Featured image of post Kali

Kali

kali是很多渗透测试人员都会使用的系统,本文是kali终极配置教程,完成后便可直接在网络安全的海洋驰骋

Kali

系统配置

换源

1
sudo vim /etc/apt/sources.list

中科大源

1
2
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

清华源

1
2
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

阿里源

1
2
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

官方源

1
2
deb http://http.kali.org/kali kali-rolling main no-free contrib
deb-src http://http.kali.org/kali kali-rolling main non-free contrib

完成之后按esc 再输入 :wq即保存退出

再进行更新

1
2
3
4
sudo apt update
sudo apt upgrade -y
sudo apt dist-upgrade -y
sudo reboot now

Root登陆

  1. 先修改默认root密码
1
sudo passwd root
  1. apt-get install kali-root-login命令安装软件包。

安装完成后,输入命令passwd修改root密码。

init 6重启后使用root登录。

装网卡驱动

1
2
3
4
5
6
sudo apt install realtek-rtl88xxau-dkms -y
sudo apt install dkms -y
git clone https://github.com/aircrack-ng/rtl8812au
cd rtl8812au/
make
sudo make install

检查一下

1
2
lsusb
iwconfig

完成之后测试一下

1
sudo wifite

显卡驱动

部分使用nvidia显卡的计算机在安装kali后会产生缺少驱动不兼容的情况。解决这一问题可参考如下步骤:

apt-cache search linux-image

apt-get install linux-image-xxx linux-header-xxx

init 6

echo -e “blacklist nouveau\noptions nouveau modeset=0\nalias nouveau off” > /etc/modprobe.d/blacklist-nouveau.conf

update-initramfs -u && reboot

apt-get install dkms

下载nvidia相应的驱动程序后,用以下命令执行安装。

./NVIDIA-Linux-x86_64-470.74.run #全部选是即可

安装驱动后需要编辑一些配置文件

vi /etc/X11/xorg.conf

 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
Section "ServerLayout"
 Identifier "layout"
 Screen 0 "nvidia"
 Inactive "intel"
EndSection

Section "Device"
 Identifier "nvidia"
 Driver "nvidia"
 BusID "PCI:1:0:0"
EndSection

Section "Screen"
 Identifier "nvidia"
 Device "nvidia"
 Option "AllowEmptyInitialConfiguration"
EndSection

Section "Device"
 Identifier "intel"
 Driver "modesetting"
EndSection

Section "Screen"
 Identifier "intel"
 Device "intel"
EndSection

vi /usr/share/gdm/greeter/autostart/optimus.desktop

1
2
3
4
5
6
[Desktop Entry]
Type=Application
Name=Optimus
Exec=sh -c "xrandr --setprovideroutputsource modesetting NVIDIA-0; xrandr --auto"
NoDisplay=true
X-GNOME-Autostart-Phase=DisplayServer

vi /etc/xdg/autostart/optimus.desktop

1
2
3
4
5
6
[Desktop Entry]
Type=Application
Name=Optimus
Exec=sh -c "xrandr --setprovideroutputsource modesetting NVIDIA-0; xrandr --auto"
NoDisplay=true
X-GNOME-Autostart-Phase=DisplayServer

init 6

以上命令中,执行apt-cache search linux-image命令可检索kali系统最新版本内核。系统内核是操作系统最基本的部分。在linux环境中,某些软件和驱动在安装过程中需要调用最新的内核版本。因此我们需要找到最新版本系统内核并安装升级。

执行apt-get install linux-image-xxx linux-header-xxx命令以安装kali最新版本内核,其中xxx代表内核版本。如下图:

image-20211117210607325

安装新的内核之后需要重启电脑,其余命令按上文顺次执行即可。

ssh

可使用systemctl命令查看和设置openssh服务的状态。

1
2
3
4
systemctl status sshd.service    #查看ssh状态
systemctl enable sshd.service    #开启ssh自启动
systemctl start sshd.service     #启动ssh服务
systemctl stop sshd.service      #停止ssh服务

配置免密码(公私钥认证)登录

ssh-keygen命令生成公钥/私钥对

进入根目录文件夹内可以看到如下密钥文件

1
2
  id_rsa        #私钥
  id_rsa.pub    #公钥

vi /etc/ssh/sshd_config,将文本中有关PubkeyAuthenticationAuthorizedKeysFile的条目修改为如下内容:

1
2
PubkeyAuthentication yes
AuthorizedKeysFile      .ssh/authorized_keys

重启服务

A机器(客户机)使用ssh-copy-id [user]@[host]命令拷贝密钥文件到B机器(服务器)。

随后客户机访问服务器,我们会发现直接无密码登录。

Tmux

1
nano ~/.tmux.conf
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
#tmux attach 如果无分离终端则新建
new-session
# split panes using | and -
bind | split-window -h
bind - split-window -v
unbind ' " '
unbind %
# switch panes using Alt-arrow without prefix
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
# reload config file (change file location to your the tmux.conf you want to use)
bind r source-file ~/.tmux.conf; display-message "Config reloaded.."
set -g mouse on
bind V source-file ~/.tmux/layout1         #ctrl b + shift v => change
1
2
mkdir ~/.tmux
nano ~/.tmux/layout1
1
2
3
4
5
6
7
selectp -t 0 # select the first (0) pane
splitw -v -p 50 # split it into two halves


selectp -t 1 # select the new, second (1) pane
splitw -h -p 50 # split it into two halves
selectp -t 0 # go back to the first pane

常用软件

sublime-text

通过apt 工具在线下载安装Sublime Text,包括x86_64 版本和ARM 64版本。

安装 GPG 密钥:

1
wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | sudo apt-key add -

确定apt 可用https:

1
sudo apt-get install apt-transport-https

选择一个可用版本:

稳定版本

1
echo "deb https://download.sublimetext.com/ apt/stable/" | sudo tee /etc/apt/sources.list.d/sublime-text.list

开发版本:

1
echo "deb https://download.sublimetext.com/ apt/dev/" | sudo tee /etc/apt/sources.list.d/sublime-text.list

更新apt 软件列表并安装sublime-text:

1
2
sudo apt-get update
sudo apt-get install sublime-text

中文输入法

1
2
3
sudo apt install fcitx
sudo apt-get install fcitx-googlepinyin
reboot

点击桌面右上角输入法图标,点击Configure

去掉Only Show Current Language,选中Google Pinyin,OK

ctrl+空格切换

Firefox 浏览器调优

MozillaFirefox,中文俗称“火狐”,是一个由Mozilla开发的自由及开放源代码的网页浏览器。它自带于kali系统中,在使用之前我们需要对部分功能进行调整。

firefox 关闭 success.txt 及开启插件安装

打开浏览器,在地址栏输入about:config

在search那一行输入network.captive,将network.captive-portal-service.enadbled那一行双击改为false

在search那一行输入xpinstall.signatures,将xpinstall.signatures.required那一行双击改为false

更新 Firefox 浏览器

在命令终端执行apt-get install firefox-esr命令可将Firefox浏览器升级到最新版本。

安装 Chrome 浏览器

双浏览器更符合信息安全工作的需要,因此我们再加装一款谷歌浏览器。

1
2
3
apt-get install chromium
vim /usr/share/applications/chromium.desktop
Exec=/usr/bin/chromium --no-sandbox %U

执行vi /usr/share/applications/chromium.desktop命令后,将文本中Exec一行改为如下内容:

typora需要执行如下命令:

1
2
3
4
5
6
wget -qO - https://typora.io/linux/public-key.asc | sudo apt-key add -
add-apt-repository 'deb https://typora.io/linux ./'
apt-get update
apt-get install typora
vim /usr/share/applications/typora.desktop
修改exec为:/usr/bin/typora --no-sandbox

flameshot 截图工具安装

截图功能是编写学习笔记和渗透测试报告时所必须的,在kali中我们可以安装一款名为flameshot的截图工具。

安装:

1
apt-get install flameshot

设置快捷键:

设置完成后,按Ctrl+Alt+A即可截图。

常用工具

信息收集工具

Rustscan

Rustscan是一个快速的端口扫描工具

去下载deb包 👉 https://github.com/RustScan/RustScan/releases

1
wget https://github.com/RustScan/RustScan/releases/download/2.0.1/rustscan_2.0.1_amd64.deb

在下载文件夹中打开终端输入dpkg -i

1
2
chmod +x rustscan_2.0.1_amd64.deb
sudo dpkg -i rustscan_2.0.1_amd64.deb

安装完成

使用方式

1
rustscan -b 30 -a 目标  -q

feroxbuster

1
sudo apt install feroxbuster -y

xray

https://github.com/chaitin/xray

提权工具

pspy

在目标主机下载

  • 32 bit big, static version: pspy32 download
  • 64 bit big, static version: pspy64 download
  • 32 bit small version: pspy32s download
  • 64 bit small version: pspy64s download
1
chmod 777 pspy64
1
./pspy64

linpeas

https://github.com/carlospolop/PEASS-ng/releases/latest

fscan

https://github.com/shadow1ng/fscan

Licensed under CC BY-NC-SA 4.0
最后更新于 May 23, 2023 21:49 CST