Posts

    windows本地监听和转发

    env:

    Edition Windows 10 Pro
    Version 22H2
    Installed on    ‎5/‎7/‎2021
    OS build    19045.3324
    Experience  Windows Feature Experience Pack 1000.19041.1000.0
    

    方法1:本地和监听转发使用powershell

    powershell.exe -executionpolicy bypass -file .\Script.ps1
    https://raw.githubusercontent.com/deepzec/Win-PortFwd/master/win-portfwd.ps1

    方法2:使用netsh

    开端口,总览,重置

    netsh interface portproxy show all
    netsh interface portproxy add v4tov4 listenaddress=$Lhost listenport=$Lport connectaddress=$Rhost connectport=$Rport
    netsh interface portproxy reset

    开防火墙

    Old command:

    netsh firewall add portopening TCP 80 "Open Port 80"

    New ~~command~~:

    netsh advfirewall firewall add rule name= "Open Port 80" dir=in action=allow protocol=TCP localport=80

    总结

    两个方法本质都是netsh.