# LibcSearcher git clone https://github.com/lieanu/LibcSearcher.git cd LibcSearcher python3 setup.py develop cd ..
# patchelf apt-get install autoconf automake libtool git clone https://github.com/NixOS/patchelf.git cd patchelf ./bootstrap.sh ./configure make make check make install cd ..
# 更新apt源 for (( i=1; i<=$MAX_RETRY; i++ )); do if sudo apt update; then break fi if [ $i -eq $MAX_RETRY ]; then echo"更新apt源时出现错误" exit 1 fi echo"更新apt源失败,正在进行第$i次重试..." sleep 1 done
# 安装常用工具 for (( i=1; i<=$MAX_RETRY; i++ )); do if xxxxxxxxxxx; then break fi if [ $i -eq $MAX_RETRY ]; then echo"安装常用工具时出现错误" exit 1 fi echo"安装常用工具失败,正在进行第$i次重试..." sleep 1 done
定好模版
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#!/bin/bash
# 定义变量 MAX_RETRY=3
# 安装常用工具 for (( i=1; i<=$MAX_RETRY; i++ )); do if xxxxxxxxxxx; then break fi if [ $i -eq $MAX_RETRY ]; then echo"安装常用工具时出现错误" exit 1 fi echo"安装常用工具失败,正在进行第$i次重试..." sleep 1 done
# 必要的更新、安装常用工具 for (( i=1; i<=$MAX_RETRY; i++ )); do if (apt-get update;apt-get -y install python3 python3-pip python3-dev git libssl-dev libffi-dev build-essential git vim gdb strace ltrace socat netcat); then break fi if [ $i -eq $MAX_RETRY ]; then echo"更新、安装常用工具时出现错误" exit 1 fi echo"更新、安装常用工具失败,正在进行第$i次重试..." sleep 1 done
# 安装pwntools for (( i=1; i<=$MAX_RETRY; i++ )); do if (python3 -m pip install --upgrade pip;python3 -m pip install --upgrade pwntools); then break fi if [ $i -eq $MAX_RETRY ]; then echo"安装pwntools时出现错误" exit 1 fi echo"安装pwntools失败,正在进行第$i次重试..." sleep 1 done
# 安装pwndbg
for (( i=1; i<=$MAX_RETRY; i++ )); do if (git clone https://github.com/pwndbg/pwndbg;cd pwndbg;./setup.sh;echo"source /ctfpwntools/pwndbg/gdbinit.py" >> ~/.gdbinit;cd ..); then break fi if [ $i -eq $MAX_RETRY ]; then echo"安装pwndbg时出现错误" exit 1 fi echo"安装pwndbg失败,正在进行第$i次重试..." sleep 1 done
# 安装glibc-all-in-one for (( i=1; i<=$MAX_RETRY; i++ )); do if (git clone https://github.com/matrix1001/glibc-all-in-one.git;cd glibc-all-in-one/;python3 update_list;cd ..); then break fi if [ $i -eq $MAX_RETRY ]; then echo"安装glibc-all-in-one时出现错误" exit 1 fi echo"安装glibc-all-in-one失败,正在进行第$i次重试..." sleep 1 done
# 安装ROPgadget for (( i=1; i<=$MAX_RETRY; i++ )); do if (pip install capstone;git clone https://github.com/JonathanSalwan/ROPgadget.git;cd ROPgadget;sudo python3 setup.py install;cd ..); then break fi if [ $i -eq $MAX_RETRY ]; then echo"安装ROPgadget时出现错误" exit 1 fi echo"安装ROPgadget失败,正在进行第$i次重试..." sleep 1 done
# one_gadget # 32位libc
for (( i=1; i<=$MAX_RETRY; i++ )); do if (apt -y install ruby;gem install one_gadget;dpkg --add-architecture i386;apt-get -y install libc6:i386 libgtk2.0-0:i386); then break fi if [ $i -eq $MAX_RETRY ]; then echo"安装one_gadget时出现错误" exit 1 fi echo"安装one_gadget失败,正在进行第$i次重试..." sleep 1 done
# LibcSearcher for (( i=1; i<=$MAX_RETRY; i++ )); do if (git clone https://github.com/lieanu/LibcSearcher.git;cd LibcSearcher;python3 setup.py develop;cd ..); then break fi if [ $i -eq $MAX_RETRY ]; then echo"安装LibcSearcher时出现错误" exit 1 fi echo"安装LibcSearcher失败,正在进行第$i次重试..." sleep 1 done
# patchelf for (( i=1; i<=$MAX_RETRY; i++ )); do if (apt-get install autoconf automake libtool;git clone https://github.com/NixOS/patchelf.git;cd patchelf;./bootstrap.sh;./configure;make;make check;make install;cd ..); then break fi if [ $i -eq $MAX_RETRY ]; then echo"安装patchelf时出现错误" exit 1 fi echo"安装patchelf失败,正在进行第$i次重试..." sleep 1 done
## seccomp //安装失败 ## ruby版本会和上面那个onegadget冲突吗??
for (( i=1; i<=$MAX_RETRY; i++ )); do if (add-apt-repository ppa:brightbox/ruby-ng;apt-get install ruby2.6 ruby2.6-dev ;gem install seccomp-tools); then break fi if [ $i -eq $MAX_RETRY ]; then echo"安装seccomp时出现错误" exit 1 fi echo"安装seccomp失败,正在进行第$i次重试..." sleep 1 done