From 1ce934369f793973e4774cb4b8e87b630a426a52 Mon Sep 17 00:00:00 2001 From: Dirk Loss <mail@dirk-loss.de> Date: Sat, 21 Nov 2009 00:36:01 +0100 Subject: [PATCH] Catch dnet OSError exception during routing table analysis dnet throws an "OSError: No error" exception when we want to get the outgoing interface and the interface has no IP address. This uncaught exception made Scapy exit. --- scapy/arch/windows/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scapy/arch/windows/__init__.py b/scapy/arch/windows/__init__.py index 851bb9d1..05d6bfd5 100755 --- a/scapy/arch/windows/__init__.py +++ b/scapy/arch/windows/__init__.py @@ -246,7 +246,11 @@ def read_routes(): gw = match.group(3) netif = match.group(4) metric = match.group(5) - intf = pcapdnet.dnet.intf().get_dst(pcapdnet.dnet.addr(type=2, addrtxt=dest)) + try: + intf = pcapdnet.dnet.intf().get_dst(pcapdnet.dnet.addr(type=2, addrtxt=dest)) + except OSError: + log_loading.warning("Building Scapy's routing table: Couldn't get outgoing interface for destination %s" % dest) + continue if not intf.has_key("addr"): break addr = str(intf["addr"]) -- GitLab