当前位置:   article > 正文

ctf实战第一节:kali环境的熟悉:最新ZSH,初始化root密码,环境配置_kali ctf命令

kali ctf命令

最近国家要求各个部分重视网络安全生产

1、下载《Kali-Linux-2020.3-vmware-i386》最新版,自带ZSH

2、导入vmware15,之前版本报错,估计镜像是基于15做的

3、开机

4、默认只有kali用户密码kali

我想开root

kali@kali:~/Desktop$ sudo su
[sudo] password for kali: 
root@kali:/home/kali/Desktop# passwd
New password: 
Retype new password: 
passwd: password updated successfully
root@kali:/home/kali/Desktop# exit
exit

允许超级用户登录,可以修改 /etc/ssh/sshd_config 配置文件,需将参数 PermitRootLogin 设为 yes


5、默认的是bash,切换zsh和sh看看效果

ali@kali:~/Desktop$ ls -al
total 8
drwxr-xr-x  2 kali kali 4096 Jul 27 13:31 .
drwxr-xr-x 14 kali kali 4096 Oct  1 05:14 ..
kali@kali:~/Desktop$ zsh
┌──(kali㉿kali)-[~/Desktop]
└─$ ls
                                                                           
┌──(kali㉿kali)-[~/Desktop]
└─$ bash
kali@kali:~/Desktop$ sh

如果您喜欢所看到的内容,可以通过执行将ZSH设置为默认值 (替换bash)chsh -s /bin/zsh


6、默认ssh关闭着呢

查看状态没打开

$ zsh
┌──(kali㉿kali)-[~/Desktop]
└─$ systemctl status ssh
● ssh.service - OpenBSD Secure Shell server
     Loaded: loaded (/lib/systemd/system/ssh.service; disabled; vendor pre>
     Active: inactive (dead)
       Docs: man:sshd(8)
             man:sshd_config(5)
                                                                           
┌──(kali㉿kali)-[~/Desktop]
└─$ ssh                                                                3 ⨯
usage: ssh [-46AaCfGgKkMNnqsTtVvXxYy] [-B bind_interface]
           [-b bind_address] [-c cipher_spec] [-D [bind_address:]port]
           [-E log_file] [-e escape_char] [-F configfile] [-I pkcs11]
           [-i identity_file] [-J [user@]host[:port]] [-L address]
           [-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port]
           [-Q query_option] [-R address] [-S ctl_path] [-W host:port]
           [-w local_tun[:remote_tun]] destination [command]
                                                                           
┌──(kali㉿kali)-[~/Desktop]
└─$ systemctl start ssh                                              255 ⨯
                                                                           
┌──(kali㉿kali)-[~/Desktop]
└─$ systemctl status ssh
● ssh.service - OpenBSD Secure Shell server
     Loaded: loaded (/lib/systemd/system/ssh.service; disabled; vendor pre>
     Active: active (running) since Thu 2020-10-01 05:17:10 EDT; 5s ago
       Docs: man:sshd(8)
             man:sshd_config(5)
    Process: 1195 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=0/SU>
   Main PID: 1196 (sshd)
      Tasks: 1 (limit: 4713)
     Memory: 2.0M
     CGroup: /system.slice/ssh.service
             └─1196 sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups
lines 1-11/11 (END)
 

执行命令 sudo systemctl enable ssh 可以设置 SSH 服务开机自启动

或者

/etc/init.d/ssh start

update-rc.d ssh enable

7、启动Apache服务器:

service apache2 start

netstat -an |more

可以看到有80端口

可以http://localhost/试一下

 7其他附带:

添加普通用户

useradd -m -G sudo,video,audio,cdrom -s /bin/bash ssooking

把某个用户添加到组中: sudo usermod -a 用户名 -G 组名
递归更改目录/文件所属用户组: sudo chgrp 用户名 -R MyDocuments/
递归更改目录/文件拥有者:sudo chown 用户名 -R MyDocuments/

使用下列命令来停止服务:
service <servicename> stop
其中<servicename>代表我们希望停止的网络服务,例如:
service apache2 stop
使用下列命令来在开机时启用服务:
update-rc.d –f <servicename> defaults
其中<servicename>代表打算启动的网络服务,例如:
update-rc.d –f ssh defaults

MISC常用工具

    Kali中集成了MISC中常用的工具(如wireshark binwalk等,自行研究使用方法)

RE常用工具

    Kali中集成了edb,gdb等(类似windows中的ollydbg,自行研究使用方法)

PWN基本环境安装

    1.python-pip的安装

        kali集成了python2.7,但没有集成pip,需要在命令行输入 apt install python-pip -y

        如下载缓慢可以按教程换一下apt软件源 点此查看

    2.pwntools安装

        在命令行输入 pip install pwntools

        如下载缓慢可以按教程换一下pip源       点此查看

一键安装配置脚本

  1. #!/bin/bash
  2. echo ""
  3. echo "=========================================================================="
  4. echo "= Kali Auto Init Tool ="
  5. echo "= Powered by ssooking ="
  6. echo "= https://ssooking.github.io ="
  7. echo "=========================================================================="
  8. echo ""
  9. echo "[*] 即将自动对kali进行基本配置,建议你根据需要修改脚本。安装配置过程可能需要一会儿,并且由你的网速决定...."
  10. read -p "[*] 请按任意键继续...."
  11. echo "[+] 添加kali源"
  12. apt-key adv --recv ED444FF07D8D0BF6
  13. echo "deb http://http.kali.org/kali kali-rolling main non-free contrib" >> /etc/apt/sources.list
  14. echo "deb http://mirrors.ustc.edu.cn/kali kali-rolling main non-free contrib" >> /etc/apt/sources.list
  15. echo "deb http://mirrors.aliyun.com/debian stable main contrib non-free" >> /etc/apt/sources.list
  16. echo "[ok] 添加kali源成功!"
  17. echo ""
  18. echo "[+] 添加一个普通用户"
  19. read -p "请输入用户名: " username
  20. useradd -m -G sudo,video,audio,cdrom -s /bin/bash $username
  21. echo "请设置用户密码:"
  22. passwd $username
  23. echo "[ok] 添加普通用户成功!"
  24. echo ""
  25. # 安装内核头文件
  26. echo "[+] 安装内核头文件... "
  27. apt-get -y install linux-headers-$(uname -r)
  28. echo ""
  29. echo "[ok] 内核头文件安装成功!"
  30. echo ""
  31. # 解决kali启动时静音问题
  32. echo "[+] 安装 alsa-utils 解决kali启动时静音问题"
  33. apt-get -y install alsa-utils
  34. echo "[ok] 安装 alsa-utils 成功!"
  35. echo ""
  36. echo "[+] 添加PPPoE拨号连接功能"
  37. apt-get install pppoe pppoeconf
  38. echo "[ok] 安装PPPoE成功!"
  39. echo " >> 你可以使用 nm-connection-editor 命令管理pppoe连接"
  40. echo ""
  41. echo "[+] 添加VPN支持: PPTP IPsec/IKEv2 vpnc network-manager-ssh"
  42. apt-get -y install network-manager-pptp network-manager-pptp-gnome network-manager-strongswan network-manager-vpnc network-manager-vpnc-gnome network-manager-ssh
  43. echo "[ok] 成功添加vpn支持!"
  44. echo ""
  45. # Base Tool
  46. echo "[+] 安装一些必备系统工具:谷歌拼音输入法、垃圾清理工具、截图工具、快速启动工具、软件包管理工具等"
  47. apt-get -y install fcitx fcitx-googlepinyin flameshot bleachbit gdebi synaptic synapse catfish scrot vokoscreen chromium
  48. echo "[ok] 成功安装系统必备软件!"
  49. echo ""
  50. # Server Tools
  51. echo "[+] 安装服务器连接管理工具:remmina、filezilla"
  52. apt-get -y install remmina filezilla
  53. echo "[ok] 安装服务器连接管理工具成功!"
  54. echo ""
  55. # 美化
  56. echo "[+] 设置窗口按钮到左侧"
  57. gsettings set org.gnome.desktop.wm.preferences button-layout 'close,maximize,minimize:'
  58. echo "[ok] 设置窗口按钮到左侧成功!"
  59. echo ""
  60. echo "[+] 安装中文字体"
  61. apt-get -y install fonts-wqy-microhei fonts-wqy-zenhei
  62. echo "[ok] 安装中文字体成功!"
  63. echo ""
  64. echo "[+] 安装基本美化工具"
  65. apt-get -y install zsh screenfetch neofetch figlet peek
  66. #apt-get -y install cairo-dock
  67. echo "[ok] 安装成功!"
  68. echo ""
  69. echo "[+] 删除无用主题"
  70. cd /usr/share/themes/ && rm -rf Albatross Blackbird Bluebird HighContrast Greybird*
  71. echo "[ok] 删除成功!"
  72. # Security Tools
  73. echo "[+] 安装图形化十六进制编辑器bless"
  74. apt-get -y install bless
  75. echo "[ok] 安装成功!"
  76. echo ""
  77. echo "[+] 安装firewalld防火墙及iptables图形化管理工具gufw "
  78. apt-get -y install gufw firewalld firewall-applet
  79. #systemctl enable firewalld.service
  80. echo "[ok] 安装成功!"
  81. echo ""
  82. # Install sublime text 3
  83. echo "[+] 安装sublime text 3,速度可能会比较慢"
  84. wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | sudo apt-key add -
  85. sudo apt-get install apt-transport-https
  86. echo "deb https://download.sublimetext.com/ apt/stable/" | sudo tee /etc/apt/sources.list.d/sublime-text.list
  87. apt-get update
  88. apt-get install sublime-text
  89. echo "[+] 解决sublime-text 中文输入问题"
  90. git clone https://github.com/lyfeyaj/sublime-text-imfix.git
  91. cd sublime-text-imfix
  92. cp ./lib/libsublime-imfix.so /opt/sublime_text/ && cp ./src/subl /usr/bin/
  93. echo "[ok] 修复成功。输入subl命令启动sublime text即可输入中文!"
  94. echo ""
  95. # Install typora
  96. echo "[+] 安装 typora,速度可能会比较慢"
  97. sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys BA300B7755AFCFAE
  98. echo "deb http://typora.io linux/" | sudo tee /etc/apt/sources.list.d/typora.list
  99. sudo apt-get update -y
  100. sudo apt-get install typora
  101. echo ""
  102. echo "[+] 安装 node npm"
  103. wget https://npm.taobao.org/mirrors/node/v8.9.3/node-v8.9.3.tar.gz
  104. tar zxvf node-v8.9.3.tar.gz && mv node-v8.9.3-linux-x64 /opt
  105. ln -s /opt/node-v8.9.3-linux-x64/bin/node /usr/local/bin/node
  106. ln -s /opt/node-v8.9.3-linux-x64/bin/npm /usr/local/bin/npm
  107. rm ~/node-v8.9.3.tar.gz
  108. echo ""
  109. echo "[+] 清除垃圾 ......"
  110. apt-get clean && apt-get autoclean && apt-get autoremove -y 
  111. echo "[+] Cleaning OK!"
  112. # Install oh-my-zsh
  113. # 普通用户就以普通权限安装
  114. apt-get install zsh
  115. echo "[+] Install oh-my-zsh"
  116. sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
  117. echo " Setting oh-my-zsh be the default terminal"
  118. chsh -s /bin/zsh
  119. echo ""
  120. neofetch
  121. echo "[OK] 所有任务完成!"
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/酷酷是懒虫/article/detail/802889
推荐阅读
相关标签
  

闽ICP备14008679号