换源 找到系统中保存源网址的文件 在Linux系统中,apt源的网址保存在
linux系统中/代表根目录 注意:/etc这个文件夹几乎放置了系统的所有配置文件 通过/etc/apt/sources.list的路径名称,我们也可以推测出该文件的用处。
(2) 在该文件修改源网址 我们已经知道了,目标文件夹的位置,相当然的想法是直接去该文件中修改它。 可是直接修改系统默认配置是一件有风险的事情。所以修改的第一步是将该文件备份。
2.1 备份文件 输入第1个指令:
1 sudo cp /etc/apt/sources.list sources_backup.list
注意:操作/etc这个文件夹,需要超级用户su的权限,所以使用了sudo这个指令,作用是请求su的权限来进行操作。 注意:cp是复制copy的指令,第一个参数为源文件,第二个参数为目标文件,当第二个参数不存在时自动创建。当第二个参数本来就存在时,就会覆盖该文件。 所以我建议使用
1 sudo cp -i /etc/apt/sources.list sources_backup.list
如果有覆盖,则会提醒用户。
界面如下,要求我们输入用户密码。
输入第2个指令:
我们可以看到sources_backup.list已经在当前文件夹里面了。
2.2 修改文件 以下是两个国内的ubuntu16.04源,可选一个复制。
#阿里云源
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 deb-src http://archive.ubuntu.com/ubuntu xenial main restricted deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted multiverse universe deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted multiverse universe 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 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 deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse
#清华大学源
1 2 3 4 5 6 7 8 9 10 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
输入第3个指令:
以下三选一就行 ,(建议第一条)
1 sudo gedit /etc/apt/sources.list
或者这个:
1 sudo vim /etc/apt/sources.list
或者这个:
1 sudo nano /etc/apt/sources.list
以上三条指令分别是使用三种文本编辑方法来修改/etc/apt/sources.list 输入该指令之后,将文件清空,复制上面的一个国内源,然后保存退出就行。至于gedit、vim和 nano 的使用方法,篇幅有限,请自行研究。
输入第4个指令: 更新
1 2 3 sudo apt-get update sudo apt-get -f install sudo apt-get upgrade
———————————————–换源完毕————————————————————————— pip源: Linux下,修改 ~/.pip/pip.conf
1 2 3 mkdir .pip cd .pip gedit pip.conf
里面的内容:
1 2 3 4 5 6 7 [global] index-url = https://pypi.tuna.tsinghua.edu.cn/simple [install] trusted-host=mirrors.aliyun.com
git clone(加速) https://www.jianshu.com/p/3f6477049ece git clone(加速) https://www.cnblogs.com/rxbook/p/11869835.html(推荐这个) 打开/etc/hosts文件
把以下两行代码加入文件末尾就可以,保存退出
1 2 github.com 13.229.188.59 github.global.ssl.fastly.Net 151.101.229.194
更新设置
1 sudo /etc/init.d/networking restart
—————————-ROPgadget——————————————————- ROPgadget:
sudo apt-get install python-capstone
git clone https://github.com/JonathanSalwan/ROPgadget.git
cd ROPgadget
sudo python setup.py install —————————-ROPgadget结束——————————————————-
sublime —————————————sublime——————————————————-
官网下载源码包https://www.sublimetext.com/3
1 sudo mv sublime_text_3 /opt 将安装包移动到/opt目录下
1 2 sudo ln -s /opt/sublime_text_3/sublime_text/usr/bin/sublime 创建快捷方式,终端输入subl就可以启动
https://www.jianshu.com/p/5cbdb42f348b —————————————sublime结束————————————————-
—————————————pwntools—————————————————— 我以uabantu16.04为例,然而其自带的python2版本已经停止维护了。相应版本的包管理器pip也受到影响 pwntools安装指令: 【1】
1 sudo apt-get install software-properties-common
【2】
1 sudo apt-add-repository ppa:pwntools/binutils
【3】
【4】
1 sudo apt-get install python2.7 python-pip python-dev git libssl-dev libffi-dev build-essential
【5】
1 sudo pip install --upgrade pip
【6】
1 sudo pip install --upgrade pwntools
执行第5条指令时,如果是ubantu16.04的机器可能会报错如下:
1 2 3 4 5 6 7 8 $ pip3 --version Traceback (most recent call last): File "/usr/local/bin/pip3", line 7, in <module> from pip._internal.cli.main import main File "/usr/local/lib/python3.5/dist-packages/pip/_internal/cli/main.py", line 60 sys.stderr.write(f"ERROR: {exc}") ^ SyntaxError: invalid syntax
如果报错,就先补上:
1 curl -fsSL -o- https://bootstrap.pypa.io/pip/2.7/get-pip.py | python2.7
——————————————-pwntools完毕——————————————-
ropper ———————————————ropper————————————————— ropper安装:
1 2 3 4 5 6 7 8 9 git clone https://github.com/sashs/ropper.git cd ropper git submodule init git submodule update ./Ropper.py git clone https://github.com/sashs/filebytes.git cd filebytes sudo python setup.py install sudo ln -s ~/ropper/Ropper.py /usr/local/bin/ropper
——————————————–ropper结束——————————————————
——————————————-seccomp-tools&one_gadget———————————
1 2 3 4 5 6 sudo add-apt-repository ppa:brightbox/ruby-ng sudo apt-get update sudo apt-get purge --auto-remove ruby sudo apt-get install ruby2.6 ruby2.6-dev gem install seccomp-tools sudo gem install one_gadget
如果ruby报错请看这两篇https://www.jianshu.com/writer#/notebooks/48773032/notes/80815381 https://blog.csdn.net/qq_43058911/article/details/104715023 ——————————————-one_gadget——————————————————————————
LibcSearcher
————-LibcSearcher————————————————
1 2 3 git clone https://github.com/lieanu/LibcSearcher.git cd LibcSearcher python setup.py develop
https://www.it610.com/article/1295247433932021760.htm
——————————————LibcSearcher结束—————————————— 32位程序支持
必备,装它。
1 apt-get install libc6-dev-i386
中文输入法
https://www.dazhuanlan.com/2019/11/04/5dbf21e3a96fa/
patchelf 的安装与使用https://blog.csdn.net/juluwangriyue/article/details/108617283u
记一下,查看给定libc文件的方法.
libc文件是链接文件,里面也有字符段注明该文件的一些信息
chemo师傅教了一个,直接用IDA打开头部信息
cntlrt师傅教了一个:
1 strings ***.so | grep "GNU C Library"
这里贴一个cntlrt师傅写的bash脚本
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 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 filename=$1 libcname=$2 LIBC_DIR=/home/blacktea/glibc-all-in-one SOURCE="https://mirror.tuna.tsinghua.edu.cn/ubuntu/pool/main/g/glibc" OLD_SOURCE="http://old-releases.ubuntu.com/ubuntu/pool/main/g/glibc" if [ "$filename " = "" ];then printf "Usage <%s> : xclibc <file> <libcfile>\n" printf "Please input the file\n" exit fi if [ "$libcname " = "" ];then printf "Usage <%s> : xclibc <file> <libcfile>\n" printf "Please input libcfile\n" exit fi die () { echo >&2 $1 exit 1 } usage () { echo >&2 "Usage: $0 id" exit 2 } usage1 () { echo -e >&2 "Usage: $0 deb output" exit 2 } get_arch () { local x86="X86-64" local x32="80386" local data=$(readelf -h $1 ) if [[ $data =~ $x86 ]];then arch ='amd64' elif [[ $data =~ $x32 ]];then arch ='i386' else echo "no" exit 1 fi } get_ver () { local buf=$(strings $libcname |grep "GNU C Library" |awk '{print $6}' ) libcversion=${buf%*)} buf=$(strings $libcname |grep "GNU C Library" |awk '{print $6}' ) version=${buf%-*} } clibc () { FILE_NAME=$1 LIBC_VERSION=$2 if [ "$FILE_NAME " = "" ];then printf "Usage <%s> : clibc <file> <version> <dir>\n" printf "Please input the file\n" exit fi if [ "$LIBC_VERSION " = "" ];then printf "Usage <%s> : clibc <file> <version> <dir>\n" printf "Please input libc version\n" exit fi LIBC_DIR=/home/blacktea/glibc-all-in-one/libs libc_dir=$(find $LIBC_DIR -name "$LIBC_VERSION *" ) if [ "$libc_dir " = "" ];then echo "Not support version or your $LIBC_DIR don't have libc" exit fi if [ "$3 " ] then patchelf --set-interpreter $3 /ld-$LIBC_VERSION .so --set-rpath $3 / $1 else printf '%s\n' "$libc_dir " echo -e '\033[32mPlease specify the directory \033[0m' fi } extract () { if [[ $# -ne 2 ]]; then usage1 fi local deb=$1 local out=$2 if [ ! -d "$out " ]; then mkdir $out fi local tmp=`mktemp -d` cp $deb $tmp /pkg.deb pushd $tmp 1>/dev/null ar x pkg.deb || die "ar failed" tar xf data.tar.* || die "tar failed" popd 1>/dev/null cp $tmp /lib/*/* $out 2>/dev/null || cp $tmp /lib32/* $out 2>/dev/null \ || cp $tmp /usr/lib/debug/lib/*/* $out 2>/dev/null || cp $tmp /usr/lib/debug/lib32/* $out 2>/dev/null \ || die "Failed to save. Check it manually $tmp " rm -rf $tmp } download_single () { id =$libcversion '_' $arch local LIBC_PREFIX="libc6_" local LIBC_DBG_PREFIX="libc6-dbg_" local deb_name=$LIBC_PREFIX$id .deb local dbg_name=$LIBC_DBG_PREFIX$id .deb echo "Getting $id " if [ -d "$LIBC_DIR /libs/$id " ]; then clibc $filename $version $LIBC_DIR /libs/$id die "success" fi url="$SOURCE /$deb_name " echo " -> Location: $url " echo " -> Downloading libc binary package" sudo wget "$url " 2>/dev/null -O $LIBC_DIR /debs/$deb_name || download_old_single echo " -> Extracting libc binary package" mkdir $LIBC_DIR /libs/$id extract $LIBC_DIR /debs/$deb_name $LIBC_DIR /libs/$id echo " -> Package saved to $LIBC_DIR /$libs /$id " url="$SOURCE /$dbg_name " echo " -> Location: $url " echo " -> Downloading libc debug package" sudo wget "$url " 2>/dev/null -O $LIBC_DIR /debs/$dbg_name || download_old_single echo " -> Extracting libc debug package" mkdir $LIBC_DIR /libs/$id /.debug extract $LIBC_DIR /debs/$dbg_name $LIBC_DIR /libs/$id /.debug echo " -> Package saved to $LIBC_DIR /libs/$id /.debug" clibc $filename $version $LIBC_DIR /libs/$id die "success" } download_old_single (){ id =$libcversion '_' $arch local LIBC_PREFIX="libc6_" local LIBC_DBG_PREFIX="libc6-dbg_" local deb_name=$LIBC_PREFIX$id .deb local dbg_name=$LIBC_DBG_PREFIX$id .deb echo "Getting $id " if [ -d "$LIBC_DIR /libs/$id " ]; then clibc $filename $version $LIBC_DIR /libs/$id die "success" fi url="$OLD_SOURCE /$deb_name " echo " -> Location: $url " echo " -> Downloading libc binary package" sudo wget "$url " 2>/dev/null -O $LIBC_DIR /debs/$deb_name || die "Failed to download package from $url " echo " -> Extracting libc binary package" mkdir $LIBC_DIR /libs/$id extract $LIBC_DIR /debs/$deb_name $LIBC_DIR /libs/$id echo " -> Package saved to $LIBC_DIR /$libs /$id " url="$OLD_SOURCE /$dbg_name " echo " -> Location: $url " echo " -> Downloading libc debug package" sudo wget "$url " 2>/dev/null -O $LIBC_DIR /debs/$dbg_name || die "Failed to download package from $url " echo " -> Extracting libc debug package" mkdir $LIBC_DIR /libs/$id /.debug extract $LIBC_DIR /debs/$dbg_name $LIBC_DIR /libs/$id /.debug echo " -> Package saved to $LIBC_DIR /libs/$id /.debug" clibc $filename $version $LIBC_DIR /libs/$id die "success" } get_arch "$2 " get_ver download_single
使用感受:真他妈的好……
补充初始版本,同一作者
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 #!/bin/bash FILE_NAME=$1 LIBC_VERSION=$2 if [ "$FILE_NAME " = "" ];then printf "Usage <%s> : clibc <file> <version> <dir>\n" printf "Please input the file\n" exit fi if [ "$LIBC_VERSION " = "" ];then printf "Usage <%s> : clibc <file> <version> <dir>\n" printf "Please input libc version\n" exit fi LIBC_DIR=~/glibc-all-in-one/libs libc_dir=$(find $LIBC_DIR -name "$LIBC_VERSION *" ) if [ "$libc_dir " = "" ];then echo "Not support version or your $LIBC_DIR don't have libc" exit fi if [ "$3 " ] then patchelf --set-interpreter $3 /ld-$LIBC_VERSION .so --set-rpath $3 / $1 echo "success!!!" else printf '%s\n' "$libc_dir " echo -e '\033[32mPlease specify the directory \033[0m' fi