Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2017
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. #! /bin/bash
  2. int_ip=$(ifconfig | grep -E -o "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)" | sed '3,3!d')
  3. echo "Internal IP is:"$int_ip
  4. subnet=$(ifconfig | grep -E -o "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)" | sed '4,4!d')
  5. echo "Internal Subnet is:"$subnet
  6. ext_ip=$(curl -s http://whatismyip.org | grep -E -o "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)")
  7. echo "External IP is:"$ext_ip
  8. subnet_cut=$(ifconfig | grep -E -o "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)" | sed '4,4!d' | cut -d '.' -f 1-3)
  9. echo "Alive hosts on the network: "
  10. (prefix=$subnet_cut && for i in `seq 254`; do (sleep 0.5 && ping -c1 -w1 $prefix.$i &> /dev/null && arp -n | awk ' /'$prefix'.'$i' / { print $1 " " $3 } ') & done; wait)
  11. echo "Arp scan: "
  12. arp-scan --localnet
  13. nmap -O $subnet_cut.0/24 -vv --open | grep -v 'Nmap' | grep -v 'SYN' | grep -v 'OS detection' | grep -v 'Increasing' | grep -v 'OS:'
  14. mac_vendors=$(nmap -sP -n $subnet_cut.0/24)
  15. echo -e "'List of Vendors:' $mac_vendors"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement