-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCommands
More file actions
32 lines (23 loc) · 1.02 KB
/
Commands
File metadata and controls
32 lines (23 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#Command for socat tunnel on windows
.\socat.exe tcp-listen:2222,fork,keepalive udp-connect:<your-public-server>:53
#Open another PowerShell window and run this
[System.Console]::Title = 'SSHTunnel'
#In another window run this PowerShell code to hold the session open (this is very janky)
$wShell = New-Object -ComObject wscript.shell
While($True)
{
If(Test-path C:\Temp\ded.txt)
{
#There must be another powershell window titled "SSHTunnel" for the to work
$wShell.AppActivate('SSHTunnel')
$wShell.SendKeys('{(}ssh -D 1337 -q -C -N iamabadboy@127.0.0.1 -p 2222{)} -or {(}echo " " >> C:\temp\ded.txt{)}~')
Sleep -Milliseconds 250
$wshell.AppActivate('SSHTunnel')
$wshell.SendKeys('password~')
del C:\temp\ded.txt
}
Sleep -Milliseconds 50
}
#Create an empty text file called ded.txt in your C:\Temp folder to start it
#Command for socat tunnel on public unix server (this can be run as a background job on the remote end)
socat udp-listen:53,reuseaddr,fork tcp-connect:your-public-server:22,keepalive 2> /dev/null