Windows Subsystem for Linux (WSL) 出来也有一段时间了。也有不少朋友通过 Katoolin 来给 Bash on Ubuntu on Windows,添加 Kali 工具,这次来谈一谈如何用原生的 Kali 替换 Ubuntu,玩转 Bash on Kali on Windows.
前提
首先你要有 Windows 10 系统,然后可以根据 微软的说明启用并安装 WSL
使用 WSL-Distribution-Switcher
WSL-Distribution-Switcher 是 RoliSoft 贡献到 GitHub 上的一个软件。可以通过该工具中的
get-prebuilt.py
或get-source.py
从 Docker Hub 上下载各个发行版的官方镜像或 tar 包,然后用install.py
安装即可。最后,你还可以通过switch.py
在你下载安装的 WSL 中进行切换。
WSL-Distribution-Switcher 需要 Python 3 支持,请下载安装 https://www.python.org/downloads/
解压后运行cmd
进入WSL-Distribution-Switcher-master 目录后运行 python get-prebuilt.py kalilinux/kali-linux-docker
下载镜像
c:\WSL-Distribution-Switcher-master\python get-prebuilt.py kalilinux/kali-linux-docker
[*] Requesting authorization token...
[*] Fetching manifest info for kalilinux/kali-linux-docker:latest...
[*] Downloading layer sha256:a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4...
[*] Downloading layer sha256:c8f41032911eaa696afa9ed9170e3db47150b3d637fa066aed13c98bee92d289...
[*] Downloading layer sha256:cb8b228855a6efcbc1d3e941ce073e4b33c682d6badad3d8d6df8f2edb1e6994...
[*] Downloading layer sha256:261c33ef5c8393779480a6a139d0e36aeb75177bbafeeaae56c0c7d0d8f6a866...
[*] Downloading layer sha256:c680ef1373dafaff04de30921f1f481909a0766f9632f89a1c72f4210716c8e8...
[*] Downloading layer sha256:dae364b40b0da2a96af468842688c9da33b63df8ad7b6a1aa2897c4b1aa17006...
[*] Downloading layer sha256:96dd93da002c6c03c7f03deb5da58330b46a09b7c2938cde3566345581598cf3...
[*] Downloading layer sha256:6e61dde25369335dcf17965aa372c086db53c8021e885df0e09f9c4536d3231e...
[*] Downloading layer sha256:45f74187929d366242688b3d32ccb5e86c205214071b99e94c0214e7ff2bc836...
[*] Downloading layer sha256:e5b4b71338633a415ad948734490e368e69605ba508a5fa8ad64775433798fb2...
[*] Downloading layer sha256:3f96326089c0580ebbcbb68d2f49dce1d7b6fe5cd79d211e4c887b0c9cdbeb02...
[*] Downloading layer sha256:d4ecedcfaa73285da5657fd51173fa9955468bf693332c03dce58ded73615c62...
[*] Downloading layer sha256:340395ad18dbbbd79d902342eef997fbd3ecb6679ad5005e5e714e8b0bc11e77...
[*] Downloading layer sha256:b2860afd831e842446489d37f8933c71dbd4f5d5f4b13d35185c4341fcca9a84...
[*] Rootfs archive for kalilinux/kali-linux-docker:latest saved to rootfs_kalilinux_kali-linux-docker_latest.tar.gz.
下载完成后运行 python install.py rootfs_kalilinux_kali-linux-docker_latest.tar.gz
安装
c:\WSL-Distribution-Switcher-master>python install.py rootfs_kalilinux_kali-linux-docker_latest.tar.gz
[*] Probing the Linux subsystem...
[*] Default user is root at /root.
[*] Reading /etc/{passwd,shadow,group,gshadow} entries for root...
[*] Beginning extraction...
[*] Backing up current rootfs to rootfs_ubuntu_trusty...
[*] Switching to new rootfs...
[*] Writing entries of root to /etc/{passwd,shadow,group,gshadow}...
安装完成
使用 python switch.py ubuntu:trusty
可以切换回系统自带的 ubuntu
c:\WSL-Distribution-Switcher-master> python switch.py ubuntu:trusty
[*] Probing the Linux subsystem...
[*] Moving current rootfs to rootfs_kalilinux_kali-linux-docker_latest...
[*] Moving desired rootfs_ubuntu_trusty to rootfs...
c:\WSL-Distribution-Switcher-master> bash
1 package can be updated.
1 update is a security update.
root@DESKTOP-40AEC1B:/mnt/c/WSL-Distribution-Switcher-master# cat /etc/issue
Ubuntu 14.04.5 LTS \n \l