Auto Init Your Ubuntu

注意
本文最后更新于 2024-05-04,文中内容可能已过时。

Auto init your ubuntu

最近在安装 Ubuntu 22.04 的环境,顺手整了个脚本,把我常用的 Pwn 环境配置都放置于其中,方便大家配置环境使用。

init_pwn.sh

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
#!/bin/bash
set -e
cd ~
sudo apt-get -y update
sudo apt-get -y install tzdata
sudo apt-get -y install vim
sudo apt-get -y install libxml2-dev
sudo apt-get -y install libxslt-dev
sudo apt-get -y install libmysqlclient-dev
sudo apt-get -y install libsqlite3-dev
sudo apt-get -y install zlib1g-dev
sudo apt-get -y install python2-dev
sudo apt-get -y install libffi-dev
sudo apt-get -y install libssl-dev
sudo apt-get -y install wget
sudo apt-get -y install curl
sudo apt-get -y install gcc
sudo apt-get -y install clang
sudo apt-get -y install llvm
sudo apt-get -y install make
sudo apt-get -y install zip
sudo apt-get -y install build-essential
sudo apt-get -y install libncursesw5-dev libgdbm-dev libc6-dev
sudo apt-get -y install tk-dev
sudo apt-get -y install openssl
sudo apt-get -y install virtualenv
sudo apt-get -y install git
sudo apt-get -y install proxychains4
sudo apt-get -y install cmake
sudo apt-get -y install lld


#setuptools 36.6.1 -> python2
wget https://mirrors.aliyun.com/pypi/packages/56/a0/4dfcc515b1b993286a64b9ab62562f09e6ed2d09288909aee1efdb9dde16/setuptools-36.6.1.zip
unzip setuptools-36.6.1.zip
cd setuptools-36.6.1
sudo python2 setup.py install
cd ../
sudo rm -rf setuptools-36.6.1 setuptools-36.6.1.zip

#setuptools 65.4.1 -> python3
wget https://mirrors.aliyun.com/pypi/packages/03/c9/7b050ea4cc4144d0328f15e0b43c839e759c6c639370a3b932ecf4c6358f/setuptools-65.4.1.tar.gz
tar -zxvf setuptools-65.4.1.tar.gz
cd setuptools-65.4.1
sudo python3 setup.py install
cd ../
sudo rm -rf setuptools-65.4.1 setuptools-65.4.1.tar.gz

#python2 pip
wget https://mirrors.aliyun.com/pypi/packages/53/7f/55721ad0501a9076dbc354cc8c63ffc2d6f1ef360f49ad0fbcce19d68538/pip-20.3.4.tar.gz
tar -zxvf pip-20.3.4.tar.gz
cd pip-20.3.4
sudo python2 setup.py install
cd ../
sudo rm -rf pip-20.3.4 pip-20.3.4.tar.gz

#python3 pip
sudo apt-get -y install python3-pip

sudo pip2 config set global.index-url https://mirrors.aliyun.com/pypi/simple
sudo pip3 config set global.index-url https://mirrors.aliyun.com/pypi/simple

sudo python2 -m pip install --upgrade pip
sudo python3 -m pip install --upgrade pip

sudo pip2 install pathlib2

#pwntools
sudo pip2 install pwntools
sudo pip3 install pwntools

#pwndbg
git clone https://mirror.ghproxy.com/https://github.com/pwndbg/pwndbg.git
cd pwndbg
./setup.sh
cd ../

#Pwngdb
git clone https://mirror.ghproxy.com/https://github.com/scwuaptx/Pwngdb.git
cp ~/Pwngdb/.gdbinit ~/
sed -i 'N;2 i source ~/pwndbg/gdbinit.py' ~/.gdbinit
sed -i '/peda/d' ~/.gdbinit

#one_gadget
sudo apt-get -y install ruby-dev
sudo gem install one_gadget

#seccomp-tools
sudo gem install seccomp-tools

#patchelf
sudo apt-get -y install patchelf

#glibc-all-in-one
git clone https://mirror.ghproxy.com/https://github.com/matrix1001/glibc-all-in-one.git

#ln python2 -> python
sudo ln -s /usr/bin/python2 /usr/bin/python

#ropper
sudo pip3 install capstone filebytes unicorn keystone-engine ropper

#qemu
sudo apt-get -y install qemu-system qemu-user

安装和配置zsh

安装 zsh

1
sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

常用插件

zsh-autosuggestions

自动补全插件,输入命令后会自动提示相关命令,使用方向键可以实现自动补全。

1
2
3
4
5
6
7
8
proxychains git clone https://github.com/zsh-users/zsh-autosuggestions.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
vim ~/.zshrc
# 在文件里找到plugins,添加 zsh-autosuggestions
plugins=(
  git
  zsh-autosuggestions
)
source ~/.zshrc

zsh-syntax-highlighting

识别的shell命令并高亮显示

1
2
3
4
5
6
7
8
9
proxychains git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
vim ~/.zshrc
# 在文件里找到plugins,添加 zsh-syntax-highlighting
plugins=(
  git
  zsh-autosuggestions
  zsh-syntax-highlighting
)
source ~/.zshrc

zsh-completions

命令补全插件,输入命令按Tab键后会提示可以使用的命令和说明。

1
2
proxychains  git clone https://github.com/zsh-users/zsh-completions ${ZSH_CUSTOM:-${ZSH:-~/.oh-my-zsh}/custom}/plugins/zsh-completions
fpath+=${ZSH_CUSTOM:-${ZSH:-~/.oh-my-zsh}/custom}/plugins/zsh-completions/src
0%