所以我正在为Kali Linux编写一个脚本,它将我的网卡置于监控模式。但是在尝试运行它时,我遇到了第八行中do命令的问题。这是代码:
#!/bin/bash
echo "Preparing to enter monitor mode."`
检查Firefox是否正在运行
ps cax | grep firefox > /dev/null
if [ $? -eq 0 ]; then
echo "Firefox is running. It needs to be closed in order to properly enter monitor mode." #If it is offers to close it
echo "Would you like me to close it for you?"
select yn in "Yes" "No"; do
case $yn in
Yes ) pkill firefox; echo "Firefox killed. Proceeding to enter monitor mode."; echo "Press any button when ready"; wait;;
No ) echo "Proceeding to enter monitor mode."; echo "Press any button when ready."; wait;;
else
echo "Proceeding to enter monitor mode."
echo "Press any button when ready"
wait
fi
询问设置变量的无线接口名称
echo "What is the name of your wireless interface?"
read interfacevar
echo Thank you. Entering $interfacevar into monitor mode.
airmon-ng start $interfacevar
airmon-ng check kill
echo "Complete! Exiting in:"
echo "5"
sleep 1s
echo "4"
sleep 1s
echo "3"
sleep 1s
echo "2"
sleep 1s
echo "1"
sleep 1s
echo "Goodbye!"
exit
但是我接到问题说第8行的做法不正确。
答案 0 :(得分:1)
问题是当您使用case
else
完成esac
阻止
您可以通过添加一行来修复它
esac
在else