Wednesday, March 25, 2015

nmap subnet scan with os details

this just churns and churns.
 #!/bin/bash  
   
 date=`date +%Y%M%d`;  
 OUTDIR=ip_audit_$date;  
   
 SUBNETS="8 9 10 11 16 20 24 28 32 128";  
   
 for net in $SUBNETS; do  
      for ip in `seq 1 254`; do  
          echo -n "192.168.$net.$ip: ";  
          ping -c 1 192.168.$net.$ip > /dev/null;  
          if [ $? == 0 ]; then  
              echo "up"; nmap -O 192.168.$net.$ip | grep 'OS details: ';  
          else  
              echo down;  
          fi;  
      done  
 done  
   

No comments: