Skip to content Skip to sidebar Skip to footer

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) Stil

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.allimport *

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 = Falsefrom scapy.allimport *

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

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.allimport *

Use:

from scapy.layers.inetimportIP

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.

Post a Comment for "Hide Scapy Warning Message Ipv6"