Catch exceptions from layers imports and print a warning message instead of crashing

This commit is contained in:
Phil 2010-07-06 19:30:51 +02:00
parent f3df73870c
commit c4a45a17cc
1 changed files with 6 additions and 1 deletions

View File

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