1. 查找 Kali 镜像
[root@yongz ~]# docker search kali
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
kalilinux/kali-rolling Official Kali Linux Docker image (weekly sna… 327
kalilinux/kali Image built from the last snapshot of the of… 90
2. 下载 Kali 镜像
[root@yongz ~]# docker pull kalilinux/kali-rolling
Using default tag: latest
latest: Pulling from kalilinux/kali-rolling
1fe1750efb0e: Pull complete
Digest: sha256:373697d3e7f445c8008d8d8667d0d19bcc2fa482c1539114ff78e8aea9fed239
Status: Downloaded newer image for kalilinux/kali-rolling:latest
docker.io/kalilinux/kali-rolling:latest
3. 运行 Kali 镜像
[root@yongz ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
kalilinux/kali-rolling latest 5ec1c728df05 7 days ago 126MB
[root@yongz ~]# docker run -it --name kali2021 -p 3389:3389 5ec1c728df05 /bin/bash
┌──(root💀f9cab1f38b2f)-[/] └─#
4. 切换更新源
由于是最基础的镜像没有 vi、vim 使用 echo 写入文件内容
4.1 阿里云
在直接切换为 aliyun 时会报错 ``` ┌──(root💀f9cab1f38b2f)-[/] └─# echo “deb https://mirrors.aliyun.com/kali kali-rolling main non-free contrib” > /etc/apt/sources.list
┌──(root💀f9cab1f38b2f)-[/] └─# echo “deb-src https://mirrors.aliyun.com/kali kali-rolling main non-free contrib” >> /etc/apt/sources.list
┌──(root💀f9cab1f38b2f)-[/] └─# apt-get update
Ign:1 https://mirrors.aliyun.com/kali kali-rolling InRelease
Ign:1 https://mirrors.aliyun.com/kali kali-rolling InRelease
Ign:1 https://mirrors.aliyun.com/kali kali-rolling InRelease
Err:1 https://mirrors.aliyun.com/kali kali-rolling InRelease
…….
<a name="QX4Fp"></a>
## 4.2 中科大
┌──(root💀f9cab1f38b2f)-[/] └─# echo “deb http://mirrors.ustc.edu.cn/kali kali-rolling main non-free contrib” > /etc/apt/sources.list
┌──(root💀f9cab1f38b2f)-[/] └─# echo “deb-src http://mirrors.ustc.edu.cn/kali kali-rolling main non-free contrib” >> /etc/apt/sources.list
┌──(root💀f9cab1f38b2f)-[/] └─# apt-get update
Get:1 http://mirrors.ustc.edu.cn/kali kali-rolling InRelease [30.5 kB]
Get:2 http://mirrors.ustc.edu.cn/kali kali-rolling/contrib Sources [66.1 kB]
Get:3 http://mirrors.ustc.edu.cn/kali kali-rolling/main Sources [14.2 MB]
Get:4 http://mirrors.ustc.edu.cn/kali kali-rolling/non-free Sources [128 kB]
Get:5 http://mirrors.ustc.edu.cn/kali kali-rolling/main amd64 Packages [17.9 MB]
Get:6 http://mirrors.ustc.edu.cn/kali kali-rolling/non-free amd64 Packages [209 kB]
Get:7 http://mirrors.ustc.edu.cn/kali kali-rolling/contrib amd64 Packages [108 kB]
Fetched 32.7 MB in 8s (4354 kB/s)
Reading package lists… Done
<a name="rmFhX"></a>
# 5. 安装工具
apt-get -y update && apt-get -y upgrade && \ DEBIAN_FRONTEND=noninteractive apt-get install -y \ kali-tools-top10 \ pciutils \ vim \ net-tools \ kali-desktop-xfce \ xorg \ xrdp \ iputils-ping \ bash-completion && \ apt-get autoremove -y && \ apt-get clean
<a name="ZcbAr"></a>
# 6. 配置远程桌面
sed -i ‘s/port=3399/port=3389/g’ /etc/xrdp/xrdp.ini service xrdp restart
<a name="QWczI"></a>
# 7. 使用 mstsc 进行连接
- 第一次连接需要修改 root 密码
┌──(root💀925c9f1c4bdc)-[/] └─# passwd root New password: Retype new password: passwd: password updated successfully ```
- 但不建议开启远程,因为比较卡,而且字体不能放大,在 XShell 中使用 bash 操作就好