mirror of https://github.com/secdev/scapy.git
Catch exceptions from layers imports and print a warning message instead of crashing
This commit is contained in:
parent
f3df73870c
commit
c4a45a17cc
|
@ -5,6 +5,8 @@
|
|||
|
||||
from scapy.config import conf
|
||||
from scapy.error import log_loading
|
||||
import logging
|
||||
log = logging.getLogger("scapy.loading")
|
||||
|
||||
def _import_star(m):
|
||||
mod = __import__(m, globals(), locals())
|
||||
|
@ -13,7 +15,10 @@ def _import_star(m):
|
|||
|
||||
for _l in conf.load_layers:
|
||||
log_loading.debug("Loading layer %s" % _l)
|
||||
_import_star(_l)
|
||||
try:
|
||||
_import_star(_l)
|
||||
except Exception,e:
|
||||
log.warning("can't import layer %s: %s" % (_l,e))
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue