2. Active Gathering

DNS Enumeration

#Vanlig lookup
host www.test.com

#MX lookup
host -t mx test.com

#TXT lookup
host -t txt test.com

Pasted image 20230628132745.png|625

One-line command directory look-up med wordlist:

for ip in $(cat list.txt); do host $ip.site.com; done

Reverse-lookup one-liner:

for ip in $(seq 200 254); do host 51.222.169.$ip; done | grep -v "not found"

Automatiserade verktyg:

dnsrecon
dnsenum

Windows:
nslookup
ex. nslookup -type=TXT megacorptwo.com


Host enumeration

Nmap:

Syn-scan (-sS)

Connect-scan (TCP) (-sT)

UDP-scan (-sU)

--top-ports=NN
--osscan-guess

Good nmap scan:

sudo nmap -A -Pn -n 172.16.248.10

-sV

Windows:
Test-NetConnection
eg.

Test-NetConnection -Port 445 192.168.X.X
1..1024 | % {echo ((New-Object Net.Sockets.TcpClient).Connect("192.168.50.151", $_)) "TCP port $_ is open"} 2>$null

Nmap med sudo skickar ICMPs

Nmap scripting engine:
/usr/share/nmap/scripts

-oG flagga: output som greppable format

-n flagga: skippar DNS resolution

Netcat:

Portskanna med netcat:

TCP:

nc -nvv -w 1 -z ip port

UDP:

nc -nv -u -w 1 -z ip port