bash

2017-2018-2 20179204《网络攻防实践》第十周学习总结 缓冲区溢出漏洞实验

不打扰是莪最后的温柔 提交于 2021-02-17 17:09:31
第1节 实验简介 缓冲区溢出是指程序试图向缓冲区写入超出预分配固定长度数据的情况。这一漏洞可以被恶意用户利用来改变程序的流控制,甚至执行代码的任意片段。这一漏洞的出现是由于数据缓冲器和返回地址的暂时关闭,溢出会引起返回地址被重写。 第2节 实验准备 系统用户名shiyanlou,实验楼提供的是64位Ubuntu linux,而本次实验为了方便观察汇编语句,我们需要在32位环境下作操作,因此实验之前需要做一些准备。 ###2.1 输入命令安装一些用于编译32位C程序的东西: ###2.2 输入命令“linux32”进入32位linux环境。此时你会发现,命令行用起来没那么爽了,比如不能tab补全了,所以输入“/bin/bash”使用bash: 第3节 练习1实验步骤 ###3.1 初始设置 Ubuntu和其他一些Linux系统中,使用地址空间随机化来随机堆(heap)和栈(stack)的初始地址,这使得猜测准确的内存地址变得十分困难,而猜测内存地址是缓冲区溢出攻击的关键。因此本次实验中,我们使用以下命令关闭这一功能: sudo sysctl -w kernel.randomize_va_space=0 此外,为了进一步防范缓冲区溢出攻击及其它利用shell程序的攻击,许多shell程序在被调用时自动放弃它们的特权。因此,即使你能欺骗一个Set-UID程序调用一个shell

How to execute a python script in a different directory?

懵懂的女人 提交于 2021-02-17 15:21:49
问题 Solved see my answer below for anyone who might find this helpful. I have two scripts a.py and b.py. In my current directory "C:\Users\MyName\Desktop\MAIN", I run > python a.py. The first script, a.py runs in my current directory, does something to a bunch of files and creates a new directory (testA) with the edited versions of those files which are simultaneously moved into that new directory. Then I need to run b.py for the files in testA. As a beginner, I would just copy and paste my b.py

CentOS7部署OpenStack

岁酱吖の 提交于 2021-02-17 13:06:10
一、Openstack概述 1.云计算简介 1.1 什么是云计算:本质是 按需使用,按使用付费 基于互联网的相关服务的增加、使用和交付模式 这种模式提供可用的、便捷的、按需的网络访问,进入可配置的计算机资源共享池(资源包括网络,服务,服务器,存储,应用软件) 这些资源能够被快速提供,只需投入很少的管理工作,或与服务供应商进行很少的交互 通常涉及通过互联网来提供动态易扩展且经常是虚拟化的资源 1.2 IaaS Infrastructure as a Service,基础设施即服务,最终提供云主机 提供给消费者的服务是对所有计算机基础设施的利用,包括: - 处理CPU、内存、存储、网络和其他基本的计算机资源, - 用户能够部署和运行任意软件,包括:操作系统和应用程序。 消费者不管理或控制任何云计算基础设施,但能控制操作系统的选择、存储空间、部署的应用; Iaas通常分为三种用法:公有云的、私有云、混合云、社区云 云产品:阿里云、亚马逊(Elastic Compute Cloud) 1.3 PaaS Platform as a Service,平台即服务,提供组件 云计算时代相应的服务器平台 或 开发环境作为服务进行提供 就成为了PaaS PaaS运营商所需提供的服务,不仅仅是单纯的基础平台,而是包括针对该平台的技术支持服务,甚至针对该平台而进行的应用系统开发、优化等服务 简单说

How can I disable Bash sessions in OS X El Capitan

我只是一个虾纸丫 提交于 2021-02-17 07:52:42
问题 A seemingly new feature in OS X El Capitan (10.11 Beta) is Bash sessions (Terminal sessions). I now have a ~/.bash_sessions directory with history files, and my HISTFILE and HISTIGNORE envars are being overridden. How can I disable all of this functionality? 回答1: This behavior is defined in /etc/bashrc_Apple_Terminal . It contains documentation comments describing what it does and how to customize it. You can disable the per-terminal-session command history feature by setting SHELL_SESSION

How can I disable Bash sessions in OS X El Capitan

一曲冷凌霜 提交于 2021-02-17 07:52:19
问题 A seemingly new feature in OS X El Capitan (10.11 Beta) is Bash sessions (Terminal sessions). I now have a ~/.bash_sessions directory with history files, and my HISTFILE and HISTIGNORE envars are being overridden. How can I disable all of this functionality? 回答1: This behavior is defined in /etc/bashrc_Apple_Terminal . It contains documentation comments describing what it does and how to customize it. You can disable the per-terminal-session command history feature by setting SHELL_SESSION

Bash Script : what does #!/bin/bash mean? [duplicate]

北慕城南 提交于 2021-02-17 07:25:26
问题 This question already has answers here : Why do you need to put #!/bin/bash at the beginning of a script file? (9 answers) Closed 6 years ago . In bash script, what does #!/bin/bash at the 1st line mean ? UPDATE : Is there a difference between #!/bin/bash and #!/bin/sh ? 回答1: That is called a shebang, it tells the shell what program to interpret the script with, when executed. In your example, the script is to be interpreted and run by the bash shell. Some other example shebangs are: (From

Bash command to calculate average on each row and each column

爷,独闯天下 提交于 2021-02-17 07:14:48
问题 Suppose we have a log file like marks.log and the content looks something like this: Fname Lname Net Algo Jack Miller 15 20 John Compton 12 20 Susan Wilson 13 19 I want to add a new column that contains average for each person, and a new row that contains average for each course. The result has to look like this: Fname Lname Net Algo Avg Jack Miller 15 20 17.5 John Compton 12 20 16 Susan Wilson 13 19 16 Average 13.3 19.6 - 回答1: If your data is in datafile.txt , the syntax for awk could be

Bash command to calculate average on each row and each column

隐身守侯 提交于 2021-02-17 07:13:08
问题 Suppose we have a log file like marks.log and the content looks something like this: Fname Lname Net Algo Jack Miller 15 20 John Compton 12 20 Susan Wilson 13 19 I want to add a new column that contains average for each person, and a new row that contains average for each course. The result has to look like this: Fname Lname Net Algo Avg Jack Miller 15 20 17.5 John Compton 12 20 16 Susan Wilson 13 19 16 Average 13.3 19.6 - 回答1: If your data is in datafile.txt , the syntax for awk could be

sed replace with variable [duplicate]

£可爱£侵袭症+ 提交于 2021-02-17 07:10:15
问题 This question already has answers here : sed substitution with Bash variables (4 answers) Closed 5 years ago . I want to replace a line that says alpha = -pi/... with the correct calculated value in radians of the angle given ie variable n1 #!/bin/bash read -p "Angle in degrees : " n1 ## Convert angle to radians printf -v "n2" "%.0f" $(echo | bc | awk "BEGIN {print 180/$n1}") echo "$n1 Degrees = pi/$n2" printf -v "n3" "alpha = -pi/$n2;" echo "${n3}" cd /home/src/octave_scripts/makemesh_rot

How to filter the running nodes

拜拜、爱过 提交于 2021-02-17 07:08:12
问题 I want to filter the running nodes list . I tried below command but its only showing running status.I need to filter with it name..Any help ? [root@techsl]# kubectl get nodes -o jsonpath='{range .items[ ]}{@.metadata.name}:{range @.status. enter code here conditions[ ]}{@.type}={@.status};{end}{end}'| tr ';' "\n" | grep "Ready=True" 回答1: Something like this is easier: kubectl get nodes | grep -v NotReady | awk '{print $1}' | tail -n2 server1 server3 kubectl get nodes NAME STATUS ROLES AGE