I'm dealing with a large private /8 network and need to enumerate all webservers which are listening on port 443 and have a specific version stated in their HTTP HEADER response.
First I was thinking to run nmap
with connect scans and grep myself through the output files, but this turned out to throw many false-positives where nmap
stated a port to be "filtered" while it actually was "open" (used connect scans: nmap -sT -sV -Pn -n -oA foo 10.0.0.0/8 -p 443
).
So now I was thinking to script something with bash and curl
- pseudo code would be like:
for each IP in 10.0.0.0/8
do:
curl --head https://{IP}:443 | grep -iE "(Server\:\ Target)" > {IP}_info.txt;
done
As I'm not that familiar with bash I'm not sure how to script this properly - I would have to:
- loop through all IPs
- make sure that only X threats run in parallel
- ideally cut the output to only note down the IP of the matching host in one single file
- ideally make sure that only matching server versions are noted down
Any suggestion or pointing into a direction is highly appreciated.