Ubuntu18.0下的pwn环境配置01

Ubuntu环境配置篇

Ubuntu 18.0环境下的pwn环境配置01

初学Linux和pwn时,配置各种环境总是最为烦人,在这整理了一些基础的环境配置。

一:下载太慢?换源解决!

在Ubuntu上apt安装软件时,总是使用官方网站下载,速度非常慢,其实,只要换源就能解决。

1.1 进入/etc/apt/

cd /etc/apt

1.2 修改sources.list文件(需要root)

sudo vi sources.list

1.3 备份(以防出错)

sudo cp sources.list sources.list.bak

1.4 复制一种源文件进去(并删去之前内容)

Ubuntu18.0下的pwn环境配置01_第1张图片

1.4.1 阿里源

deb-src http://archive.ubuntu.com/ubuntu xenial main restricted #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse #Added by software-properties
deb http://archive.canonical.com/ubuntu xenial partner
deb-src http://archive.canonical.com/ubuntu xenial partner
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse

1.4.2 清华大学源

deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted

deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted

deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial universe

deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates universe

deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial multiverse

deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates multiverse

deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse

deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted

deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security universe deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security multiverse

1.4.3 网易源

eb http://mirrors.163.com/ubuntu/ trusty main restricted universe multiverse

deb http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse

deb http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse

deb http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiverse

deb http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse

deb-src http://mirrors.163.com/ubuntu/ trusty main restricted universe multiverse

deb-src http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse

deb-src http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse

deb-src http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiverse

deb-src http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse

二:gdb的三种插件安装

gdb常用的三种插件,peda,gef,gdbinit。

2.1 安装git

apt-get install git

2.2 插件安装

git clone https://github.com/gatieme/GdbPlugins.git ~/GdbPlugins

2.3 换用不同的插件

由于三种各有各的优点,所以经常需要切换,下面是切换的指令,更改安装的位置则指令需要对应修改。

2.3.1 切换为 peda

echo "source ~/GdbPlugins/peda/peda.py" > ~/.gdbinit 

Ubuntu18.0下的pwn环境配置01_第2张图片

2.3.2 切换为 gef

echo "source ~/GdbPlugins/gef/gef.py" > ~/.gdbinit 

Ubuntu18.0下的pwn环境配置01_第3张图片

2.3.3 切换为 gdbinit

echo "source ~/GdbPlugins/gdbinit/gdbinit" > ~/.gdbinit

Ubuntu18.0下的pwn环境配置01_第4张图片

2.4 技巧! 将切换脚本的指令写进bashrc

因为这些插件经常需要切换,不可能每次都去找这些指令或者记忆这些指令,所以我们可以把这些指令写入bashrc,用一个快捷指令来代替!

2.4.1 进入bashrc

vi ~/.bashrc

进去之后找到如图所示的地方,那里有一些alias开头的字符。
Ubuntu18.0下的pwn环境配置01_第5张图片

2.4.2 写入快捷指令

alias peda='echo "source ~/GdbPlugins/peda/peda.py" > ~/.gdbinit '
alias gef='echo "source ~/GdbPlugins/gef/gef.py" > ~/.gdbinit '
alias gdbinit='echo "source ~/GdbPlugins/gdbinit/gdbinit" > ~/.gdbinit  '

Ubuntu18.0下的pwn环境配置01_第6张图片

2.4.3 保存退出并更新bashrc文件

更新完后大功告成,这样以后就只要输入这三个简单的指令就可以在三种插件中自由切换!
Ubuntu18.0下的pwn环境配置01_第7张图片

你可能感兴趣的:(Linux)