Portforwarding and tunneling

Commands to enumerate internal networks

PS C:\> Get-NetNeighbor -AddressFamily IPv4
PS C:\> Test-NetConnection -ComputerName 192.168.210.13 -Port 443
PS C:\> Test-WSMan -ComputerName 192.168.1.10
PS C:\> arp -a
PS C:\> route print
Intrusionz3r0X@htb[/htb]$ arp -n
Intrusionz3r0X@htb[/htb]$ route -4

Ping Sweep

Intrusionz3r0X@htb[/htb]$ for i in {1..254} ;do (ping -c 1 172.16.5.$i | grep "bytes from" &) ;done
C:\\>  for /L %i in (1 1 254) do ping 172.16.5.%i -n 1 -w 100 | find "Reply"
PS C:\\> 1..254 | % { $ip="192.168.210.$_"; if (Test-Connection -Count 1 -ComputerName $ip -Quiet) { "$ip`: True" } }
meterpreter > run post/multi/gather/ping_sweep RHOSTS=172.16.5.0/23

Port Scanning if ICMP is blocked

for i in {1..65535}; do (echo > /dev/tcp/192.168.1.1/$i) >/dev/null 2>&1 && echo $i is open; done

Ligolo NG

Configure double pivoting

You have to create for each pivot a new interface and specify the subnet to reach either /24 to access the entire subnet or /32 for specific host.

Note: --addr parameter port has to increase on one to facilitate the manage of all tunnels

For unstable Sessions:

Chisel

Chisel double pivoting

Kali Linux:

Modify the /etc/proxychains

Pivot Host:

Pivot Host 2:

Scan the entire IP list one line

Local Port Forwarding over SSH

Remote/Reverse Port Forwarding with SSH

Meterpreter Tunneling & Port Forwarding

Socat

https://github.com/tech128/socat-1.7.3.0-windows

SSH Pivoting with Sshuttle

RPivot

Port Forwarding with Windows Netsh

DNS Tunneling with Dnscat2

DNS Tunneling with Dnscat2: Dnscat2 is a tool that allows data to be tunneled through the DNS protocol, using an encrypted command-and-control (C2) channel. By embedding data within DNS TXT records, it enables stealthy communication between an attacker's server and a compromised host. This method can bypass traditional network defenses like firewalls and intrusion detection systems, making it a potent tool for exfiltrating data and maintaining remote control over compromised systems in a covert manner.

ICMP Tunneling

Last updated