portproxy | TCP proxy , highjacks HTTP to allow CORS | Proxy library
kandi X-RAY | portproxy Summary
kandi X-RAY | portproxy Summary
A shitty TCP proxy that relays all requests to a local port to a remote server. Will proxy all TCP requests on localhost:8080 and send them to google.com.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- proxyConn is used to connect to a remote address
- Main entry point
- proxyHTTP proxies the request to the endpoint .
- isNormalTerminationError returns true if err is a normal termination error .
portproxy Key Features
portproxy Examples and Code Snippets
Community Discussions
Trending Discussions on portproxy
QUESTION
I am trying to understand why a Powershell one liner I want to use to setup a port proxy to a WSL instance seemingly does not work, but running it without the grouping/substitution does work. Steps:
Get the IP address of WSL instance:
...ANSWER
Answered 2022-Mar-21 at 02:46Abraham Zinala provided the crucial pointer:
The output from wsl hostname -I
- surprisingly - has a trailing space, which must be trimmed in order for the IP address represented by the output to be used as an argument passed to netsh
:
QUESTION
What's wrong with my settings?
Here's my docker-compose.yml
that I start with sudo docker-compose up -d
which ends up like that:
...ANSWER
Answered 2022-Jan-17 at 04:23I cannot reproduce the problem, but here are the steps I took.
- Copy your compose file into Windows filesystem.
- Open Windows Powershell, not WSL2 terminal (I think this is your problem, by the fact that you're using
sudo
) - Run
docker compose up
(which uses the newer Compose V2) - Run
netstat -ab
in the Powershell session to see0.0.0.0:27017
is indeed listening on the windows host - Successfully connect with Robo 3T with the username/password on
localhost:27017
Using Docker for Windows with WSL2 Integration enabled
QUESTION
I want to use a batch script to start Docker in Windows Subsystem for Linux at login. It works when I run the batch file as administrator. So I followed this guide: Always Run Batch file as Administrator in Windows 10
Then I placed the shortcut into the Startup
folder. The script is started, but it exits always at the first line.
Then I tried to run manually the batch file in FreeCommander. The batch script works when I run the script as administrator via right click context menu item. But there is output an error message when I run the batch script with a double click. The output error message is:
The command "wsl" is either misspelled or could not be found.
This is the batch script:
...ANSWER
Answered 2021-Nov-29 at 17:21There should be read first the following Microsoft documentation pages:
There are two system directories on 64-bit Windows with a processor with AMD64 architecture:
%SystemRoot%\System32
with 64-bit applications used by 64-bit applications by default.%SystemRoot%\SysWOW64
with 32-bit applications used by 32-bit applications by default.
The system environment variable PATH
contains by Windows default %SystemRoot%\System32
as first folder path. If a 32-bit application starts cmd.exe
to process a batch file, there is started 32-bit %SystemRoot%\SysWOW64\cmd.exe
because of the file system redirector.
cmd.exe
is searching for files specified in a batch file just with file name without or with file extension and without path by using the local environment variables PATHEXT
and PATH
as explained in full details by What is the reason for "X is not recognized as an internal or external command, operable program or batch file"?
wsl.exe
belongs to the set of executables which on AMD64 Windows exists only as 64-bit version in %SystemRoot%\System32
. There is no 32-bit version in %SystemRoot%\SysWOW64
searched by 32-bit cmd.exe
on using %SystemRoot%\System32
in expanded form in local PATH
because of file system redirector. For that reason the batch file as posted in the question does not work on being processed by 32-bit cmd.exe
on Windows x64.
The solution is taking WOW64 into account with additional code in the batch file:
QUESTION
I'm trying to mount an Azure File Share in an environment where the Proxy settings block port 445 for the global IP address.
As shown in the figure below, port forwarding is done with Azure Virtual Matchine (Linux), connecting to localhost: 1445, and 445 communication to Azure File Share is possible.
However, the mount command cannot use any port other than 445.
I have set the netsh interface portproxy to forward communication on port 445 to localhost: 1445, but the port on 445 does not listen.
...ANSWER
Answered 2021-Nov-19 at 09:25I have not tried this scenario but you might be able to accomplish this with SSH local port forwarding. The key is if your proxy is blocky localhost connections to port 445.
QUESTION
When I run
...ANSWER
Answered 2021-Oct-16 at 15:16If you take the output of your WSL command and a verbatim string of what you believe is the same value and compare the actual bytes with Format-Hex
, you will see there is a difference.
QUESTION
If I package the code as a Docker image & run it, the curl commands work from inside WSL2 and from the Windows command line, so this is a Quarkus-specific issue.
OriginalI have Ubuntu 20.04 installed on WSL2 on my Windows Home laptop.
Following the Quarkus Getting Started example (just up to step 5: Running the application), I have the code (server) running on my WSL2 bash
command line, & calling it with curl
gives the expected output:
ANSWER
Answered 2021-Jul-29 at 15:12I'm not familiar with Quarkus, but my "go to answer" for localhost forwarding not working in WSL is to try a wsl --shutdown
and, if that works, disable Windows Fast Startup.
But in this case, you also aren't able to access it on the WSL2 instance's eth0 address, so something more might be going on. That could also be explained if the Quarkus boilerplate config is just binding to localhost
or 127.0.0.1
. You'd need it to bind to 0.0.0.0
in order for both to work.
Update for others looking at this answer in the future: Quarkus automatically binding to 127.0.0.1
or localhost
did turn out to be the problem in this case. From @markvgti's research in the comments, the setting for this is to add quarkus.http.host=0.0.0.0
to the application.properties
.
QUESTION
I have an app that executes in windows and sends/receives packets to/from port 8899.
Im trying to sniff those packets from my WSL, so i installed scapy and tried to execute this command : sniff(filter="port 8899", count=1)
on my WSL 2.
The problem is that, Scapy (on WSL 2) isn't detecting any traffic on that port :/
And im pretty sure that the problem doesn't come from my windows app. Using Wireshark on Windows, i can see the packets on that port.
I tried to forward this port on windows using these commands :
...ANSWER
Answered 2021-Oct-04 at 21:49WSL2 is running on a virtual network interface (vNIC) using the Virtual Machine Platform (a subset of Hyper-V functionality). This vNIC is NAT'd behind a virtual router which is also supplied by the Virtual Machine Platform.
So sniffing traffic on the vNIC isn't going to see any traffic on the Windows host, unless it's specifically intended for the vNIC.
You have the right intentions in trying to port forward, but ultimately this isn't going to work either. Port forwarding would redirect all traffic intended for 8899 on the Windows host to a service running in WSL2. So I would expect that those port forwarding commands may be either failing (if the app was already running on that port) or preventing your Windows app from listening on that port.
I can't think of a good way to sniff Windows traffic from WSL at the moment (but it may come to me later).
While the WSL1 network actually does use the Windows NIC, the problem there is that this is done with an adaptation layer. WSL1 "translates" Linux kernel syscalls to Windows APIs. And it does a great a job of doing this, but it only goes skin-deep.
If you are using Windows Professional, you might be able to use Hyper-V to change the vNIC to bridged. Some people have had success with this. Many more have not. It's a risk vs. reward -- At best, it works. At worst, you need to reinstall Windows to recover WSL networking. It's never been worth the risk for me, personally, so I can't offer any guidance on how to do it.
QUESTION
I have a Mac running Windows 10 21H1 in Parallels. On macOS I have SQL Server running in a Docker container, exposed on port 55556.
In Windows I'm trying to forward localhost,55555 to the SQL Server in Docker.
For this I tried netsh interface portproxy add v4tov4 listenaddress=localhost listenport=55555 connectaddress=10.211.55.2 connectport=55556
, but this only works when connecting in DataGrip (in the Windows VM, using a JDBC driver); I can see all the databases, query them, etc.
SQL Management studio always gives the following error:
ANSWER
Answered 2021-Jun-29 at 08:32I figured it out: portproxy with listen address localhost doesn't work, but 127.0.0.1 does.
QUESTION
I am a developer of ROS projects. Recently I am trying using ROS(melodic) on WSL2(Windows Subsystem for Linux), and all things works just great. But I got some trouble when I want to use another PC which also in the same local area network(LAN) to communicate with. Before setting the environment variables like "ROS_MASTER_URI, ROS_IP", I know that since WSL 2 work on Hyper-V so the IP show on WSL2 is not the one in the real LAN. I have to do some command like below in order to make everyone in LAN communicate with the specific host:PORT on WSL2.
...ANSWER
Answered 2020-Dec-13 at 16:17The root problem is described in WSL issue #4150. To quote from that thread,
Option 1 - Port forwarding script on loginWSL 2 seems to NAT it's virtual network, instead of making it bridged to the host NIC.
There are a number of workarounds described in that issue, for which you've already figured out the first part (the port forwarding). The primary technique seems to be to create a PowerShell script to detect the IP address and create the port forwarding rules that runs upon Windows login. This particular comment near the top of the thread seems to be the canonical go-to answer, although many people have posted their tweaks or alternatives throughout the very long thread.
One downside - I believe the script that is mentioned there needs to be run at logon since the WSL subsystem seems to only want to run when a user is logged in. I've found that attempting to run a WSL service or instance through Windows OpenSSH results in that instance/service shutting down soon after the SSH session is closed, unless the user is already logged into Windows with a WSL instance opened.
Option 2 - WSL1I would also propose that, assuming it fits your workflow and if the ROS works on it (it may not, given the device access you need, but not sure), you can simply use WSL1 instead of WSL2 to avoid this. You can try this out by:
- Backing up your existing distro (from PowerShell or cmd, use
wsl --export
- Import the backup into a new WSL1 instance with
wsl --import --version 1
It's possible to simply change versions in place, but I tend to like to have a backup anyway before doing it, and as long as you are backing up, you may as well leave the original in place.
QUESTION
Newb here, powershell experience is a solid 1 hour but I can't seem to find the answer to this anywhere so I'm starting to think it may not be the problem. I am attempting to create a script to allow me to connect to my ubuntu machine. The ip address changes with each reboot, so I created a bash script that outputs the ip address into ip.txt and im sure that is working well (no extra spaces or undesired characters).
I have created a variable that gives me the string from the file, and although the script runs successfully, the connection doesnt work. if I execute the command and manually enter the ip, it works.
...ANSWER
Answered 2020-Nov-07 at 13:22As suggested in the comment information, the IP Address in the ip.txt
is probably preceded and/or succeeded by one or more new line (Cr/Lf) characters.
If you use the -Raw
parameter, Get-content
will return all the lines including newline characters as a single string ([String
]). At the other hand, if you do not include the -Raw
, Get-content
will return all the lines as separate strings ([String[]]
), which might cause an issue in your case as well.
To remove all possible white-space characters arround the IP Address, you might use the Trim()
method which removes all leading and trailing white-space characters from the current string by default:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install portproxy
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page