如何在adb shell中跟踪路由?

发布于 2024-09-28 06:25:12 字数 118 浏览 1 评论 0原文

我有一个 root 设备,我在 adb shell 中输入“su”,然后尝试跟踪路由。 它说“traceroute:未找到”。 我在任何 bin 文件夹中都找不到 Traceroute。

感谢您的任何提示。

I have a rooted device, I type "su" in adb shell, then I try to traceroute.
It says "traceroute: not found".
I can't find traceroute in any bin folders.

Thanks for any hints.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

假装不在乎 2024-10-05 06:25:12

标准 Android 发行版不提供 Traceroute。您可能想尝试在设备上安装 BusyBox: http://www.ihackintosh.com/2009/12/how-to-install-busybox-on-a-rooted-device/

它包含许多在 UNIX 系统上可用的有用工具,并且也适用于Android。可以在这里下载:http://www.busybox.net/

Traceroute is not avaiable with standard Android distribution. You may want to try installing BusyBox on your device: http://www.ihackintosh.com/2009/12/how-to-install-busybox-on-a-rooted-device/

It contains many useful tools that are avaiable on UNIX systems and are also working for Android. It can be downloaded here: http://www.busybox.net/

香橙ぽ 2024-10-05 06:25:12

安装 busybox 后运行以下命令:

$su
# /path to folder where u have installed busybox/busybox traceroute ip 

就像我已经在 /system/xbin 文件夹中安装了 busybox 那么命令是

# /system/xbin/busybox traceroute  74.125.236.66

After installing busybox run the following command:

$su
# /path to folder where u have installed busybox/busybox traceroute ip 

like i have installed the busybox in /system/xbin folder then command is

# /system/xbin/busybox traceroute  74.125.236.66
御守 2024-10-05 06:25:12

了解 traceroute 可能会有所帮助:
它只是将数据包发送到您想要的目的地并增加生存时间 (ttl) 字段。如果 ttl 为零,每个路由器(跳)都会向发送者返回一个数据包。通过这种机制,您可以跟踪数据包通过网络的路线。

知道这一点后,您可以简单地 ping 目的地并手动增加 ttl 字段。 iE(在 adb shell 上,无需 root):

ping -t 1 -c 1 8.8.8.8
ping -t 2 -c 1 8.8.8.8
ping -t 3 -c 1 8.8.8.8
...
ping -t 255 -c 1 8.8.8.8

输出可能如下所示:

From 192.168.1.1: icmp_seq=1 Time to live exceeded

现在您可以看到沿途每一跳的 ips 地址。当您到达目的地时,您可以停止增加 ttl。

如果您愿意,可以将其包装到脚本中(非常基本的示例):

for /l %x in (1, 1, 10) do adb shell ping -t %x -c 1 8.8.8.8>>ouput.log

Understanding traceroute could be helpful:
It simply sends packets to your desired destination and increases the time-to-live (ttl) field. Every router (hop) will return a packet to the sender if the ttl is zero. With this mecanism you are able to trace the route of your packet through the network.

Knowing this, you could simply ping your destination an manually increase the ttl field. i.E (on adb shell, no root required):

ping -t 1 -c 1 8.8.8.8
ping -t 2 -c 1 8.8.8.8
ping -t 3 -c 1 8.8.8.8
...
ping -t 255 -c 1 8.8.8.8

the output could look like this:

From 192.168.1.1: icmp_seq=1 Time to live exceeded

Now you can see the ips adresses of every hop in your way. You may stop increasing the ttl when you have reached the destination.

If you like you could wrap it into a skript (very basic sample):

for /l %x in (1, 1, 10) do adb shell ping -t %x -c 1 8.8.8.8>>ouput.log
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文