Dynamic patch `wslhost.exe` to listen port on any interface.

Overview

WSLHostPatcher

Dynamic patch wslhost.exe to listen port on any interfaces.

How it work

The localhost port actually forward by wslhost.exe on Windows, but it listen on localhost only.

WSLHostPatcher will scan all wslhost.exe processes, then inject into it to hook bind API listen on any IP. There is no any background processes neither cost any performance.

How to use

Download release and unzip it on Windows. Run WSLHostPatcher.exe after WSL2 started.

You can also put it in your .profile, so it will run automatically.

How to restore

wsl --shutdown or Reboot system.

Security Consideration

Listen port on any interfaces may cause some security problems. You are on your own.

Issues
  • How to put it in .profile?

    How to put it in .profile?

    Hi, thanks for this tool!

    I'm not exactly sure how to put it in .profile? Is WSLHostPatcher.exe executed in Powershell/cmd aka "outside" of WSL2 or inside of WSL2?

    opened by cvladan 4
  • Only listening on 127.0.0.1

    Only listening on 127.0.0.1

    Hi! I tried your solution as it seems the cleanest approach, but so far I haven't had any luck. Maybe you have an idea what might be happening.

    sshd is running on WSL2 instance and I tried from the windows host and I can do ssh to linux fine

    No luck from other machines on my network though, I disabled the firewall on Windows just in case but still the same

    This is the output that I get from netstat, shouldn't this be listening on 0.0.0.0:22

    netstat -an | grep :22
      TCP    127.0.0.1:22           0.0.0.0:0              LISTENING
      TCP    [::1]:22               [::]:0                 LISTENING
    

    After reading some of the issues, I wasn't sure where to run the patch, windows or wsl, but it seems that doesn't matter I get the same output, although nothing seems to work

    Dll path: C:\bin\WSLHostPatch.dll
    Found 2 WSL host
    Patched 2
    
    opened by mingue 2
  • There is no way to install. There's no `WSLHostPatcher.exe` file nor any other executable.

    There is no way to install. There's no `WSLHostPatcher.exe` file nor any other executable.

    The README says "Run WSLHostPatcher.exe after WSL2 started," but there is no such file (nor any exe) in the repo... not even in the exe folder.

    How to install?

    duplicate 
    opened by jdunk 2
  • Not sure if this is possible...

    Not sure if this is possible...

    I am trying to use WSLHostPatcher for HomeKit accessory. This utility doesn't work because I need to be able to broadcast Bonjour or CIAO packets from WSL. Is there a way to have this do that or no?

    opened by meluvalli 1
  • License Request

    License Request

    This project is awesome and could benefit from an open source license. If you have some time, could you select one that makes it easier for contributions? It's entirely possible that Win 11 won't have resolved the network bridging issue, and we'll need a straightforward app like this to continue patching instances.

    How to apply a LICENSE file to the repository

    opened by jakobo 1
  • UDP sockets

    UDP sockets

    Thanks for the great tool. It works as expected when using a nodejs express server, but when I try to setup a UDP socket in c++ it doesn't seem to work. Is UDP not supported at all with this workaround?

    opened by andreamatt 1
  • Suddenly it doesn´t work anymore...

    Suddenly it doesn´t work anymore...

    First i would like to say that this was the only thing that helped me to access wsl2 localhost:8080 from mobile... But now im not using router anymore, only hotspot from my mobile... in theory it should not matter, as outside wsl2 i can open webpack express server running on windows, but not in wsl2... im very tired of this journey!... actually im writing this issue for you to help us, but already installing git to work locally instead wsl2... Im not sure if the hotspot thing interfered or if it´s just some windows 11 update who knows...

    At first stance i´ve tried to stick using only ngrok... but for some reason ngrok doesn´t full reload, i think it reloaded in the past im not sure... (hot false, neither hot true, i use false i prefer full reload)... also the performance of acessing it direcly via localhost seems superior

    opened by VanderSP 0
  • Is there a difference between localhost and 127.0.0.1?

    Is there a difference between localhost and 127.0.0.1?

    I have a web server running in WSL2 in ubuntu. I'm using postman in windows GUI. If I try to send a GET request to http://127.0.0.1:3001 it never makes a connection.

    However if I use http://localhost:3001 it works just great. Any ideas?

    opened by GimpMaster 0
Owner
CzBiX
A Google a day.
CzBiX
About Add any Program in any language you like or add a hello world Program ❣️ if you like give us ⭐

Hello-World About Add any Program in any language you like or add a hello world Program ❣️ if you like give us ⭐ Give this Project a Star ⭐ If you lik

Lokesh Jangid 15 Aug 5, 2022
Phorklift is an HTTP server and proxy daemon, with clear, powerful and dynamic configuration.

Phorklift is an HTTP server and proxy daemon, with clear, powerful and dynamic configuration.

null 43 Mar 1, 2022
C++ TCP/IP and SSH stack with bounded run time and no dynamic memory allocations

Static Network Stack TCP/IP stack with all-static allocations designed for bare metal (no operating system) embedded applications with minimal footpri

Andrew Zonenberg 24 Jul 22, 2022
C++ API: http server with local dynamic or precompiled repository containers

libnavajo Framework to develop easily web interfaces in your C++ applications Libnavajo makes it easy to run an HTTP server into your own application,

null 60 Jan 29, 2022
An MQTT-based Virtual Wall for ESP8266 Devices and Gerber files to make the IR hat; this code and board can easily be adapted to be ANY infrared controller/remote!

Roomba-Virtual-Wall-ESP8266-MQTT An MQTT-based Virtual Wall for ESP8266 Devices I made this based off of the IRSend, IRremoteESP8266, and EspMQTTClien

null 8 Sep 20, 2021
OtterCastAmp is an open-source WiFi Speaker amplifier, based on a Sochip S3 SoC. Powered by any USB PD adapter for up to 100W of music.

OtterCastAmp is an open-source WiFi Speaker amplifier, based on a Sochip S3 SoC. Powered by any USB PD adapter for up to 100W of music.

Ottercast 249 Aug 7, 2022
Any type can be stored

var Any type can be stored My English is not good. there is no English introduction temporarily. 可以存储任意类型(不能存储int[]等类型,应该转换为vector存储或者vector) 使用STL时尽可

null 1 Oct 31, 2021
Run statically-compiled WebAssembly apps on any embedded platform

embedded-wasm-apps Run native, statically-compiled AssemblyScript, Rust, C/C++, TinyGo, Zig, etc. apps on any platform How it works The approach is si

Volodymyr Shymanskyy 103 Aug 3, 2022
Login and send instagram direct message to any user ;)

DM-THIS-USER Very simple instagram tool,The idea is not in the tool, but in how to deal with the C language, especially with the openssl library and c

0xDADDY 6 May 14, 2022
SixtyFPS is a toolkit to efficiently develop fluid graphical user interfaces for any display: embedded devices and desktop applications

SixtyFPS is a toolkit to efficiently develop fluid graphical user interfaces for any display: embedded devices and desktop applications. We support multiple programming languages, such as Rust, C++, and JavaScript.

SixtyFPS 4.7k Aug 6, 2022
C++ Requests: Curl for People, a spiritual port of Python Requests

C++ Requests: Curl for People Announcements The cpr project has new maintainers: Fabian Sauter and Tim Stack. TLDR C++ Requests is a simple wrapper ar

Huu Nguyen 4.9k Aug 13, 2022
Sonic the Hedgehog (1991, Sega Genesis / MegaDrive) C Port

SoniCPort Sonic the Hedgehog (1991, Sega Genesis / MegaDrive) C Port Dependencies SDL2 (if COMPILE_SDL2 is set to ON) pkg-config (for builds that requ

CuckyDev 96 Jun 28, 2022
Doom classic port to lightweight RISC‑V

Doom classic port to lightweight RISC-V This is a port to try and make adapting/running doom to simple RISC-V platform easier with the code to adapt w

Sylvain 53 Aug 10, 2022
TCP Port Redirection Utility

Overview PortBender is a TCP port redirection utility that allows a red team operator to redirect inbound traffic destined for one TCP port (e.g., 445

Praetorian 392 Jul 27, 2022
Chocolate Doom WebAssembly port with WebSockets support

Wasm Doom This is a Chocolate Doom WebAssembly port with WebSockets support. Requirements You need to install Emscripten and a few other tools first:

Cloudflare 164 Aug 6, 2022
TCP port scanner, spews SYN packets asynchronously, scanning entire Internet in under 5 minutes.

TCP port scanner, spews SYN packets asynchronously, scanning entire Internet in under 5 minutes.

Robert David Graham 19.4k Aug 16, 2022
Encapsulates the two protocols of OpenVpn and Ikev2, you only need to enter the server IP and port number to realize the connection and status display, and the specific situation of the connection can be displayed at the same time。

NewVpnCore 封装了OpenVpn和Ikev2两种协议,只需要输入服务器IP和端口号即可实现连接和状态显示,同时可以显示连接的具体情况。 UniteVpn Core(第一版) 1. 模块说明 unitevpn:封装了vpn的操作和统一不同协议信息的模块 ikev2:IKEV2协议的源码 op

ZFashion 3 Jun 8, 2022
ScummVM (UWP Port) with improvements for stability

ScummVM UWP port with few improvements for stability Source | Original Project Features Resolve crash issue when (folder removed or moved) Add loading

Bashar Astifan 4 Jul 21, 2022
Multi-protocol Port Mapping client library

libplum - Multi-protocol Port Mapping client library libplum (Port Lightweight and Universal Mapping) is a library allowing to forward ports on Networ

Paul-Louis Ageneau 14 Jun 18, 2022