[Solved] Hide Scapy Warning Message IPv6

I tried multiple times to hide, but no success. Any help?

I already tried –

from scapy.all import *
import logging
logging.getLogger("scapy.runtime").setLevel(logging.ERROR)

Still get the same warning on console.

WARNING: No route found for IPv6 destination :: (no default route?)

FYI, I’m using Scapy with Python 2.7 on OS Mavericks.

Solution #1:

You need to import logging and adjust the settings for the logging message first.

What’s happening is you import scapy into your namespace, trigger the error – and then change the logging settings.

import logging
logging.getLogger("scapy.runtime").setLevel(logging.ERROR)
from scapy.all import *
Respondent: RyPeck
Solution #2:

If you want to disable IPv6 in scapy but leave warnings (which is a good thing), use the following code:

from scapy.config import conf
conf.ipv6_enabled = False
from scapy.all import *

The source code of scapy.all reveals this little secret.

Respondent: famzah
Solution #3:

I know that this question is old, but I might have found an elegant answer. Are you building IPv6 packets? If not, then what you could do is, instead of:

from scapy.all import *

Use:

from scapy.layers.inet import IP

The problem is there are two IP classes, one in the package from scapy.layers.inet and one in from scapy.layers.inet6. Should you use the former import statement, you will import both even though you are only building version 4 packets.

All of this is assuming you are intending to use IPv4 only, which I reckon is the case.

Respondent: Paul
The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .

Leave a Reply

Your email address will not be published.