I use nmap's default stealth scan as a means to determine port status on client systems. It recently came to my attention that this was causing error logging on the client side due to the reception of the RST packet during the connection.
I've modified nmap to use tcp connect() (-sT option) instead, but upon review of the packets, can confirm that the RST packet is still sent to close the connection.
Is there anyway to get nmap to do both connect() and close the connection with FIN?
For further information on the exact exchange:
Default scan:
Source - SYN
Dest - SYN-ACK
Source - RST-ACK
TCP Connect scan:
Source - SYN
Dest - SYN-ACK
Source - ACK
Source - RST
What's Needed:
Source - SYN
Dest - SYN-ACK
Source - ACK
Source - FIN
Dest - FIN-ACK
Dest - FIN
Source - FIN-ACK
Note that I only need to control what is happening on source.
nmap -sT ${ip} -p ${port} -Pn 2>/dev/null
– Nielncat
orsocat
in a suitable loop - both will do what you want. – countermode