# Linuxarp -a
cat /etc/hosts
ifconfig
ip a
nmcli dev show
ip r
# Windowsarp -a
type c:\Windows\System32\drivers\etc\hosts
ipconfig /all
netstat -r
Access Domain Names
For a box that is not joined to the domain, but has domain access, add the DC (or DNS server) to resolve DNS names.
Split DNS Resolution (w/ VPN)
# 1. Enable dnsmasq plugin (Global Config)sudo cp /etc/NetworkManager/NetworkManager.conf /etc/NetworkManager/NetworkManager.conf.bak
sudo sed -i '/\[main\]/a dns=dnsmasq' /etc/NetworkManager/NetworkManager.conf
# 2. Create the Domain Rule (Persistent)# Syntax: server=/domain.com/10.10.10.10echo "server=/<FQDN>/<DNS_SERVER>" | sudo tee /etc/NetworkManager/dnsmasq.d/split_dns.conf
# 3. Restart NetworkManager to apply the plugin changesudo systemctl restart NetworkManager
# 4. Configure the VPN Connection# Replace <CONNECTION_NAME> with your VPN profile name (e.g., 'tun0' or 'lab_vpn')sudo nmcli connection modify "<CONNECTION_NAME>" ipv4.dns ""sudo nmcli connection modify "<CONNECTION_NAME>" ipv4.ignore-auto-dns yes
sudo nmcli connection modify "<CONNECTION_NAME>" ipv4.never-default yes
# 5. Reconnect VPNsudo nmcli connection down "<CONNECTION_NAME>"sudo nmcli connection up "<CONNECTION_NAME>"
All DNS Resolution (no Internet access)
# Configure the VPN connection to strictly use the Target DNSsudo nmcli connection modify "<CONNECTION_NAME>" ipv4.dns "<DNS_SERVER>"sudo nmcli connection modify "<CONNECTION_NAME>" ipv4.ignore-auto-dns yes
# Reconnect to applysudo nmcli connection down "<CONNECTION_NAME>"sudo nmcli connection up "<CONNECTION_NAME>"
# ATTACKER => REDIR => TARGET# NOTE: add "-L 0.0.0.0" to make the local port accessible from other machines next to ATTACKER (like a Windows box)portfwd add -l <ATTACKER_PORT> -r <TARGET_IP> -p <TARGET_PORT>
Remember that only proper TCP traffic works with SOCKS (e.g. NOT certain scans like nmap -sS sends malformed packets or ICMP ping), use nmap -sT --proxy
# Set global proxy for Metasploitsetg PROXIES socks5:127.0.0.1:1080 # SOCKS5setg PROXIES HTTP:127.0.0.1:8080 # HTTP# Clear proxy for current module onlyset Proxies ""# Accept reverse connections directly (don't let it thru the SOCKS proxy)setg ReverseAllowProxy true
via SSH
# Step 1: create proxy via SSHssh -D 9050 <USER>@<TARGET>
# Step 1: Run MSF SOCKS proxyuse auxiliary/server/socks_proxy
set SRVPORT 9050set SRVHOST 0.0.0.0
set version 4a
#set version 5run -j
jobs
# Step 2a: in MSFuse post/multi/manage/autoroute
set SESSION <SESSION>
set SUBNET <TARGET_SUBNET>
run -j
jobs
route print
# OR Step 2b: in MSF sessionrun autoroute -s <TARGET_SUBNET>
run autoroute -p
Sshuttle
“Transparent proxy server that works as a poor man’s VPN. Forwards over ssh. Doesn’t require admin… Supports DNS tunneling.”