wsl2+kali-rolling+win kex+Connection refused 10061

wsl2+kali,可以在win10下运行一个效率高于virtualbox等虚拟机的linux,kali-win-kex基于VNC(In computing, Virtual Network Computing (VNC) is a graphical desktop-sharing system that uses the Remote Frame Buffer protocol (RFB) to remotely control another computer. It transmits the keyboard and mouse events from one computer to another, relaying the graphical-screen updates back in the other direction, over a network.),可以提供一套GUI系统,虽然不如原生的好看,但是还是可以用的。
我使用的是win10版本为20H2,默认启动kex会报10061的错,后面需要特殊处理一下,

winver

kali国内源

以下源,根据自己网络速度任选一个即可。

#中科大
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

#阿里云
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

#清华大学
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

#浙大
deb http://mirrors.zju.edu.cn/kali kali-rolling main contrib non-free
deb-src http://mirrors.zju.edu.cn/kali kali-rolling main contrib non-free

#东软大学
deb http://mirrors.neusoft.edu.cn/kali kali-rolling/main non-free contrib
deb-src http://mirrors.neusoft.edu.cn/kali kali-rolling/main non-free contrib

#官方源
deb http://http.kali.org/kali kali-rolling main non-free contrib
deb-src http://http.kali.org/kali kali-rolling main non-free contrib

kali win kex

sudo apt install -y kali-win-kex
└─$ kex --help

        Win-Kex 2.7 provides a GUI desktop experience for Kali Linux
        in Windows Subsystem for Linux 2 (WSL 2)

        Usage:
                kex <mode> <command> <parameters>

                Mode:
                --esm            : Launch KeX desktop in a dedicated window using Windows native RDP
                --sl             : Seemlessly integrate KeX into the Windows desktop
                --win            : Launch KeX desktop in a dedicated window

                Command:
                [none]           : start KeX server and launch KeX client
                --start          : start kex server
                --start-client   : start kex client
                --stop           : stop kex server
                --status         : show kex server status
                --kill           : stop kex server and kill all related processes
                --passwd         : set kex server password
                --wtstart        : start kex server and launch win-kex client
                                   in Windows Terminal session
                --start-sound    : start Windows sound server
                --stop-sound     : stop Windows sound server
                --help           : display help
                --version        : display version

                Parameters:
                -i               : Use container IP address instead of "localhost"
                -m               : Optimized for Multiscreen (Win mode only)
                -s               : Sound support

        Examples:
                kex -s           : Start KeX server in window mode and launch KeX client with sound support
                kex --sl -s      : Start KeX in seemless mode and launch KeX client with sound support
                kex --esm -i -s  : Start KeX in ESM mode with arm workaround and launch KeX client with sound support
                sudo kex         : Start KeX server as root in window mode and launch KeX client

直接执行

kex -s

报如下的错误,
wsl2+kali-rolling+win kex+Connection refused 10061

此时需要执行以下命令,不让VNC只接收本机的数据包(wsl2和win10 ip是两个网段),

# [-localhost [yes|no]]    if enabled, VNC will only accept connections from localhost.
vncserver -localhost no
kex -s

wsl2+kali-rolling+win kex+Connection refused 10061

再次执行后,一切正常!

wsl2+kali-rolling+win kex+Connection refused 10061

如果需要从GUI退出,可以按F8,然后Exit Viewer,否则再次进入的时候又会报错。如果报错,可以再次执行vncserver的命令。

猜你喜欢

转载自blog.51cto.com/15147256/2673134