suppress scapy warning message when importing the module

后端 未结 4 1874
無奈伤痛
無奈伤痛 2021-02-19 09:06

I\'m writing a small script, that gathers some information using scapy and then returns some xml code, that I\'ll pass on to the xmlrpc interface of metasploit. I\'d like it tha

4条回答
  •  故里飘歌
    2021-02-19 09:21

    You can get rid of warnings by scapy by adding:

    logging.getLogger("scapy.runtime").setLevel(logging.ERROR)
    

    before importing Scapy. This will suppress all messages that have a lower level of seriousness than error messages.


    for example:

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

提交回复
热议问题