源
#官方源
deb http://http.kali.org/kali kali-rolling main non-free contrib
deb-src http://http.kali.org/kali kali-rolling main non-free contrib
#中科大
deb http://mirrors.ustc.edu.cn/kali kali-rolling main non-free contrib
deb-src http://mirrors.ustc.edu.cn/kali kali-rolling main non-free contrib
#阿里云
deb http://mirrors.aliyun.com/kali kali-rolling main non-free contrib
deb-src http://mirrors.aliyun.com/kali kali-rolling main non-free contrib
#清华大学
deb http://mirrors.tuna.tsinghua.edu.cn/kali kali-rolling main contrib non-free
deb-src https://mirrors.tuna.tsinghua.edu.cn/kali kali-rolling main contrib non-free
#浙大
deb http://mirrors.zju.edu.cn/kali kali-rolling main contrib non-free
deb-src http://mirrors.zju.edu.cn/kali kali-rolling main contrib non-free
#东软大学
deb http://mirrors.neusoft.edu.cn/kali kali-rolling/main non-free contrib
deb-src http://mirrors.neusoft.edu.cn/kali kali-rolling/main non-free contrib
deb http://mirrors.163.com/debian/ jessie main non-free contrib
deb http://mirrors.163.com/debian/ jessie-updates main non-free contrib
deb http://mirrors.163.com/debian/ jessie-backports main non-free contrib
deb-src http://mirrors.163.com/debian/ jessie main non-free contrib
deb-src http://mirrors.163.com/debian/ jessie-updates main non-free contrib
deb-src http://mirrors.163.com/debian/ jessie-backports main non-free contrib
deb http://mirrors.163.com/debian-security/ jessie/updates main non-free contrib
deb-src http://mirrors.163.com/debian-security/ jessie/updates main non-free contrib
常用命令
df | 磁盘使用情况
df -h
apt | 软件包管理器
自动安装但不再使用的过期安装包 | 清除所有已下载的安装包
apt-get autoremove && apt-get clean
更新
apt-get update && apt-get upgrade && apt-get dist-upgrade
apt-get update = 更新源
apt-get install package = 安装包
apt-get remove package = 删除包
apt-cache search package = 搜索软件包
apt-cache show package = 获取包的相关信息,如说明、大小、版本等
apt-get install package --reinstall = 重新安装包
apt-get -f install = 修复安装
apt-get remove package --purge = 删除包,包括配置文件等
apt-get build-dep package = 安装相关的编译环境
apt-get upgrade = 更新已安装的包
apt-get dist-upgrade = 升级系统
apt-cache depends package = 了解使用该包依赖那些包
apt-cache rdepends package = 查看该包被哪些包依赖
apt-get source package = 下载该包的源代码
apt-get clean && sudo apt-get autoclean = 清理无用的包
apt-get check = 检查是否有损坏的依赖
ln | 软链接
ln -s -b -v [源文件或目录] [目标文件或目录]
下列签名无效,无法安全地用该源进行更新,所以默认禁用该源。
下列签名无效: EXPKEYSIG 1397BC53640DB551 Google Inc. (Linux Packages Signing Authority) <linux-packages-keymaster@google.com>
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 1397BC53640DB551
chsh切换命令工具
更改Shell
#兼容性好
chsh -s /bin/bash && reboot
#显示好看(我选择的原因,而不是真实的区别
chsh -s /bin/zsh && reboot
网络
修改IP配置
vim /etc/network/interfaces
#将网卡eth0设置为静态IP
auto eth0
iface eth0 inet static
#设置ip地址
address 192.168.33.3
#设置子网掩码
netmask 255.255.255.0
#设置网关
gateway 192.168.33.1
重启networking
systemctl restart networking && /etc/init.d/networking restart
SSH
安装
#检查系统服务是否有ssh
chkconfig --list | grep ssh
#没有则安装
install -y openssl openssh-server
拒绝root用户ssh远程登录
查看PermitRootLogin配置
cat /etc/ssh/sshd_config | grep PermitRootLogin
修改/etc/ssh/sshd_config
vim /etc/ssh/sshd_config
注释“PermitRootLogin prohibit-password”,改为“PermitRootLogin yes”
启用并启动SSH
service ssh start && systemctl enable ssh.service
检查状态
/etc/init.d/ssh status
端口开放
netstat -lnt
查找
尝试查看最近3分钟包含指定字符串的文件:
查找某时间内的文件,按时间排序,输出包含“flag”和“CTF”字符串的文件
find / -type f -ctime -3 | xargs ls -lt | grep -i 'flag\|CTF' > Out.txt
安装GDB
apt-get update && apt install gdb && apt install gdb-minimal
ln –snf /var/cache/apt/archives
mkdir /home/var/
ln -s /var/ /home/
mv /var/ /home/
mkdir /home/var/cache/apt/archives/partial/ && ln -s /var/cache/apt/archives/partial /home/var/cache/apt/download/
tar zxvf g[tab]
改名为GDB(/home/Software/GDB)
cd GDB
./configure --target=arm-linux --prefix=/home/Software/GDB/arm-gdb
make && make install
cd gdbserver(/home/Software/GDB/gdbserver)
CC=arm-linux-gcc ./configure --host=arm-linux --prefix=/home/Software/GDB/gdbserver
make && make install
arm-linux-strip gdbserver
cp gdbserver /tftpboot
修改history命令保存数量
echo查询系统变量
echo $HISTSIZE
locate定位文件
updatedb && locate .bashrc
sed替换
sed -i 's/原字符串/新字符串/g' /root/.bashrc
sed -i 's/HISTSIZE=1000/HISTSIZE=333333/g' /root/.bashrc && sed -i 's/HISTFILESIZE=2000/HISTFILESIZE=666666/g' /root/.bashrc && cat /root/.bashrc | grep HIST
source /root/.bashrc