简体   繁体   English

Scapy Python 3 错误:警告找不到路由(没有默认路由?)

[英]Scapy Python 3 Error: WARNING No route found (no default route?)

I started to study Scapy today and I am getting a message: " WARNING No route found (no default route?) ."我今天开始学习Scapy ,收到一条消息:“ WARNING No route found (no default route?) 。” I am also a new Ubuntu user.我也是一个新的 Ubuntu 用户。

The name of my question sounds like a duplicate of the question Hide Scapy Warning Message IPv6.我的问题的名称听起来像是问题隐藏 Scapy 警告消息 IPv6 的副本。 Hide Scapy Warning Message IPv6 隐藏 Scapy 警告消息 IPv6

However, when I used that solution, I do not get the warning but the problem continues.但是,当我使用该解决方案时,我没有收到警告,但问题仍然存在。

Moreover, when I continue with other commands the problem persists.此外,当我继续使用其他命令时,问题仍然存在。

I am using the " official " Scapy tutorial that is in this link: https://scapy.readthedocs.io/en/latest/usage.html我正在使用此链接中的“官方” Scapy 教程: https ://scapy.readthedocs.io/en/latest/usage.html

I am running Scapy on Python 3 over the Ubuntu 20.04 terminal.我在 Ubuntu 20.04 终端上在 Python 3 上运行 Scapy。 I installed Ubuntu using the Microsoft store (I am NOT using Oracle Virtual Box or something similar).我使用 Microsoft 商店安装了 Ubuntu(我没有使用 Oracle Virtual Box 或类似的东西)。

These are the commands:这些是命令:

a=Ether()/IP(dst="www.slashdot.org")/TCP()/"GET /index.html HTTP/1.0 \n\n"

hexdump(a)

This is the result that I am getting:这是我得到的结果:

在此处输入图像描述

This is the result that I am supposed to get:这是我应该得到的结果:

在此处输入图像描述

I am using a laptop and a wifi connection.我正在使用笔记本电脑和 wifi 连接。 I am running this code at home.我在家里运行这段代码。

Thank you for your help!谢谢您的帮助!

PS In Ubuntu, when I use ifconfig I get the following: PS 在 Ubuntu 中,当我使用ifconfig时,我得到以下信息:

在此处输入图像描述

PS #2 I uninstalled Ubuntu 20.04 and installed Ubuntu 18.04 and I still get the same problem. PS #2 我卸载了 Ubuntu 20.04 并安装了 Ubuntu 18.04,但我仍然遇到同样的问题。

PS #3 I installed Ubuntu 20.04 in an Oracle Virtual Box Machine, and I got a different message that got me some ideas about the possible causes of the problem. PS #3 我在 Oracle Virtual Box Machine 中安装了 Ubuntu 20.04,我收到了一条不同的消息,让我对问题的可能原因有了一些想法。 I posted a solution.我发布了一个解决方案。 Please read it, and let me know what you think.请阅读它,让我知道你的想法。

It seems that the cause of the error is that as I am not using a wired connection, I am not using the network card.似乎错误的原因是因为我没有使用有线连接,所以我没有使用网卡。 For that reason, the Ether() function cannot be used.因此,无法使用Ether()函数。 As every network card has a unique Mac address, the Mac address cannot be used.由于每个网卡都有唯一的 Mac 地址,因此无法使用 Mac 地址。 That, in my opinion, is the cause of the error.在我看来,这是错误的原因。 Of course, I would love to have an opinion of somebody who knows more about the subject.当然,我很想听听对这个主题有更多了解的人的意见。 My college degree is in mathematics.我的大学学位是数学。 In my last attempt, I installed Scapy on an Oracle Virtual Box Machine, and I am getting the following message:在我最后一次尝试中,我在 Oracle Virtual Box 机器上安装了Scapy ,我收到以下消息:

WARNING: getmacbyip failed on [Errno 1] Operation not permitted WARNING: Mac address to reach destination not found. WARNING: getmacbyip failed on [Errno 1] Operation not allowed WARNING: Mac address to reach destination not found. Using broadcast.使用广播。

What do you think?你怎么看?

@Carcigenicate advised me to use the route command in Linux. @Carcigenicate 建议我在 Linux 中使用 route 命令。

Here is the info that I get when I use the command route in the Ubuntu terminal that is in my Oracle virtual box machine.这是我在 Oracle 虚拟机中的 Ubuntu 终端中使用命令路由时获得的信息。

在此处输入图像描述

When I use the command route in the Ubuntu terminal that is in my Windows 10 Pro Laptop, I get the following:当我在 Windows 10 Pro 笔记本电脑中的 Ubuntu 终端中使用命令路由时,我得到以下信息:

在此处输入图像描述

At this time, following the tip of @Carcigenicate, we find that the Gateway is 0.0.0.0这个时候,按照@Carcigenicate的提示,我们发现Gateway是0.0.0.0

What that exactly means?这究竟意味着什么? Not sure.没有把握。 Check this link: https://en.wikipedia.org/wiki/0.0.0.0检查此链接: https ://en.wikipedia.org/wiki/0.0.0.0

I forgot to mention that my machine is a corporate machine.我忘了提到我的机器是公司机器。 So, most likely my machine has some IT security software that causes that behavior.所以,我的机器很可能有一些导致这种行为的 IT 安全软件。

I too faced the same problem:我也面临同样的问题:

WARNING No route found (no default route?)

I am using kali Linux, and this is how I solved that problem.我正在使用 kali Linux,这就是我解决该问题的方法。 I installed the PyX package for my OS and it worked out.我为我的操作系统安装了 PyX 包,并且成功了。 I can't say definitely that this is the answer to your problem, but you could try it.我不能肯定地说这是您问题的答案,但您可以尝试一下。

pip install PyX

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM