1. #官方源
  2. deb http://http.kali.org/kali kali-rolling main non-free contrib
  3. deb-src http://http.kali.org/kali kali-rolling main non-free contrib
  4. #中科大
  5. deb http://mirrors.ustc.edu.cn/kali kali-rolling main non-free contrib
  6. deb-src http://mirrors.ustc.edu.cn/kali kali-rolling main non-free contrib
  7. #阿里云
  8. deb http://mirrors.aliyun.com/kali kali-rolling main non-free contrib
  9. deb-src http://mirrors.aliyun.com/kali kali-rolling main non-free contrib
  10. #清华大学
  11. deb http://mirrors.tuna.tsinghua.edu.cn/kali kali-rolling main contrib non-free
  12. deb-src https://mirrors.tuna.tsinghua.edu.cn/kali kali-rolling main contrib non-free
  13. #浙大
  14. deb http://mirrors.zju.edu.cn/kali kali-rolling main contrib non-free
  15. deb-src http://mirrors.zju.edu.cn/kali kali-rolling main contrib non-free
  16. #东软大学
  17. deb http://mirrors.neusoft.edu.cn/kali kali-rolling/main non-free contrib
  18. deb-src http://mirrors.neusoft.edu.cn/kali kali-rolling/main non-free contrib
  19. deb http://mirrors.163.com/debian/ jessie main non-free contrib
  20. deb http://mirrors.163.com/debian/ jessie-updates main non-free contrib
  21. deb http://mirrors.163.com/debian/ jessie-backports main non-free contrib
  22. deb-src http://mirrors.163.com/debian/ jessie main non-free contrib
  23. deb-src http://mirrors.163.com/debian/ jessie-updates main non-free contrib
  24. deb-src http://mirrors.163.com/debian/ jessie-backports main non-free contrib
  25. deb http://mirrors.163.com/debian-security/ jessie/updates main non-free contrib
  26. deb-src http://mirrors.163.com/debian-security/ jessie/updates main non-free contrib

常用命令

df | 磁盘使用情况

  1. df -h

apt | 软件包管理器

  1. 自动安装但不再使用的过期安装包 | 清除所有已下载的安装包
  2. apt-get autoremove && apt-get clean
  3. 更新
  4. apt-get update && apt-get upgrade && apt-get dist-upgrade
  1. apt-get update = 更新源
  2. apt-get install package = 安装包
  3. apt-get remove package = 删除包
  4. apt-cache search package = 搜索软件包
  5. apt-cache show package = 获取包的相关信息,如说明、大小、版本等
  6. apt-get install package --reinstall = 重新安装包
  7. apt-get -f install = 修复安装
  8. apt-get remove package --purge = 删除包,包括配置文件等
  9. apt-get build-dep package = 安装相关的编译环境
  10. apt-get upgrade = 更新已安装的包
  11. apt-get dist-upgrade = 升级系统
  12. apt-cache depends package = 了解使用该包依赖那些包
  13. apt-cache rdepends package = 查看该包被哪些包依赖
  14. apt-get source package = 下载该包的源代码
  15. apt-get clean && sudo apt-get autoclean = 清理无用的包
  16. apt-get check = 检查是否有损坏的依赖

ln | 软链接

  1. ln -s -b -v [源文件或目录] [目标文件或目录]

可以用来解决空间不足等问题

下列签名无效,无法安全地用该源进行更新,所以默认禁用该源。

  1. 下列签名无效: EXPKEYSIG 1397BC53640DB551 Google Inc. (Linux Packages Signing Authority) <linux-packages-keymaster@google.com>
  2. apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 1397BC53640DB551

注意签名的值就是报错提示的值↑
image.png

chsh切换命令工具

更改Shell

  1. #兼容性好
  2. chsh -s /bin/bash && reboot
  3. #显示好看(我选择的原因,而不是真实的区别
  4. chsh -s /bin/zsh && reboot

网络

修改IP配置

vim /etc/network/interfaces

  1. #将网卡eth0设置为静态IP
  2. auto eth0
  3. iface eth0 inet static
  4. #设置ip地址
  5. address 192.168.33.3
  6. #设置子网掩码
  7. netmask 255.255.255.0
  8. #设置网关
  9. gateway 192.168.33.1

重启networking

  1. systemctl restart networking && /etc/init.d/networking restart

SSH

安装

  1. #检查系统服务是否有ssh
  2. chkconfig --list | grep ssh
  3. #没有则安装
  4. install -y openssl openssh-server

拒绝root用户ssh远程登录

  1. 查看PermitRootLogin配置
  2. cat /etc/ssh/sshd_config | grep PermitRootLogin
  3. 修改/etc/ssh/sshd_config
  4. vim /etc/ssh/sshd_config
  5. 注释“PermitRootLogin prohibit-password”,改为“PermitRootLogin yes

启用并启动SSH

  1. service ssh start && systemctl enable ssh.service

检查状态

  1. /etc/init.d/ssh status

端口开放

  1. netstat -lnt

查找

尝试查看最近3分钟包含指定字符串的文件:

  1. 查找某时间内的文件,按时间排序,输出包含“flag”和“CTF”字符串的文件
  2. find / -type f -ctime -3 | xargs ls -lt | grep -i 'flag\|CTF' > Out.txt

安装GDB

  1. apt-get update && apt install gdb && apt install gdb-minimal
  2. ln snf /var/cache/apt/archives
  3. mkdir /home/var/
  4. ln -s /var/ /home/
  5. mv /var/ /home/
  6. mkdir /home/var/cache/apt/archives/partial/ && ln -s /var/cache/apt/archives/partial /home/var/cache/apt/download/
  7. tar zxvf g[tab]
  8. 改名为GDB(/home/Software/GDB)
  9. cd GDB
  10. ./configure --target=arm-linux --prefix=/home/Software/GDB/arm-gdb
  11. make && make install
  12. cd gdbserver(/home/Software/GDB/gdbserver)
  13. CC=arm-linux-gcc ./configure --host=arm-linux --prefix=/home/Software/GDB/gdbserver
  14. make && make install
  15. arm-linux-strip gdbserver
  16. cp gdbserver /tftpboot

修改history命令保存数量

echo查询系统变量

  1. echo $HISTSIZE

locate定位文件

  1. updatedb && locate .bashrc

sed替换

  1. sed -i 's/原字符串/新字符串/g' /root/.bashrc
  1. 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
  1. source /root/.bashrc

Linux就该这么学

1.1 准备您的工具