Advertisement
metalx1000

Port/Network Scanner for Android/ARM Devices with Busybox

Feb 13th, 2016
705
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.96 KB | None | 0 0
  1. #!/system/bin/sh
  2.  
  3. #set PORTS
  4. ports=(80 21 22 23)
  5.  
  6. #set colors
  7. bold=`echo -en "\e[1m"`
  8. red=`echo -en "\e[31m"`
  9. normal=`echo -en "\e[0m"`
  10.  
  11. dev="wlan0"
  12. myip=$(busybox ifconfig wlan0 |\
  13.     grep "inet addr"|\
  14.     busybox awk '{print $2}'|\
  15.     cut -d\: -f2)
  16.  
  17. range=$(echo $myip|cut -d\. -f1,2,3)
  18.  
  19. echo "Your IP is $myip"
  20. echo "Range is $range"
  21.  
  22. echo "Quick Ping"
  23. for i in `seq 1 254`;
  24. do
  25.   busybox arping -q -c1 -I $dev $range.$i &
  26.   echo "pinging $range.$i"
  27. done
  28.  
  29. echo "Resting for 5 seconds..."
  30. sleep 5
  31.  
  32. ips=$(busybox arp -a|grep -v incomplete|cut -d\( -f2|cut -d\) -f1)
  33.  
  34. echo "Current computers online"
  35. echo "$ips"
  36.  
  37. echo "Scanning Ports on found computers"
  38. for ip in $ips
  39. do
  40.   for p in "${ports[@]}"
  41.   do
  42.     busybox pscan $ip -p $p -P $p|\
  43.     #sed "s/$ip/${red}${bold}${ip}$normal/g"|\
  44.     #sed "s/open/${red}${bold}open$normal/g"|\
  45.     grep tcp > /dev/null &&
  46.     echo "${red}${bold}${ip}$normal Port ${red}${bold}$p$normal is OPEN"
  47.   done
  48. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement