Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.95 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. #Ping Sweep Script
  4. #by n1k0n
  5.  
  6. echo "What is the subnet you would like to scan?(e.g. 192.168.1.0):"
  7.  
  8. read SUBNET
  9.  
  10. echo "Please Wait..........."
  11.  
  12.  
  13. SUB=$(echo $SUBNET | cut -d "." -f 1-3)
  14.  
  15. echo "------------------------------------------------------------------" > sweep_$SUBNET.txt
  16. echo "@@        This is a ping sweep report for subnet $SUBNET      @@" >> sweep_$SUBNET.txt
  17. echo "@@             Completed on" $(echo $(date)) "       @@" >> sweep_$SUBNET.txt
  18. echo "------------------------------------------------------------------" >> sweep_$SUBNET.txt
  19.  
  20. for hosts in $(seq 254);do
  21. TEMP=$(ping -c 1 $SUB.$hosts 2> /dev/null | grep "bytes from" | cut -d " " -f 4 | cut -d ":" -f 1)
  22. echo $TEMP
  23.  
  24. echo $TEMP >> sweep_$SUBNET.txt
  25. done;
  26.  
  27. clear
  28.  
  29. echo "Ping Sweep report for $SUBNET saved to $(pwd)/sweep_$SUBNET.txt"
  30. echo "##################################################################"
  31.  
  32.  
  33. cat sweep_$SUBNET.txt
  34.  
  35. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement