-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrev_tunnel_without_proxy.ps1
More file actions
24 lines (19 loc) · 1.04 KB
/
rev_tunnel_without_proxy.ps1
File metadata and controls
24 lines (19 loc) · 1.04 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
# You need to download Renci.SshNet.dll from https://github.com/sshnet/SSH.NET first
# Then, save this Renci.SshNet.dll to the same folder of this script
# You might also need to manually right click on the DLL and unlock it before you can use it
[void][reflection.assembly]::LoadFrom((Resolve-Path ".\Renci.SshNet.dll"))
$targethost = "Remote SSH Server IP"
$targetport = 443 # Your Remote SSH Server Port
$username = "CHANGEME" # Your remote SSH server username
$password = "CHANGEME" # Your remote SSH Server password
$connInfo = New-Object Renci.SshNet.PasswordConnectionInfo($targethost, $targetport, $username, $password)
$sshClient = New-Object Renci.SshNet.SshClient -ArgumentList $connInfo
$sshClient.Connect()
$remoteForwardedPort = New-Object Renci.SshNet.ForwardedPortRemote(
"127.0.0.1",
1080, # Remote (server) forwarded port
"127.0.0.1", # Local (client) SOCKS5 Listening Address
1080 # Local (client) SOCKS5 Listening Port
)
$sshClient.AddForwardedPort($remoteForwardedPort)
$remoteForwardedPort.Start()