From 3c7e0d2946874c9e5ea178f5e350947d4f5f40f0 Mon Sep 17 00:00:00 2001 From: gpotter2 <gabriel@potter.fr> Date: Tue, 16 May 2017 18:37:31 +0200 Subject: [PATCH] Better error logs --- scapy/arch/windows/__init__.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/scapy/arch/windows/__init__.py b/scapy/arch/windows/__init__.py index 4d8303f1..2bd7ec20 100755 --- a/scapy/arch/windows/__init__.py +++ b/scapy/arch/windows/__init__.py @@ -461,6 +461,7 @@ class NetworkInterfaceDict(UserDict): elif _confir in ["no", "n"]: return False return False + _error_msg = "No match between your pcap and windows network interfaces found. " if _detect[0] and not _detect[2] and ((hasattr(self, "restarted_adapter") and not self.restarted_adapter) or not hasattr(self, "restarted_adapter")): warning("Scapy has detected that your pcap service is not running !") @@ -471,15 +472,11 @@ class NetworkInterfaceDict(UserDict): log_loading.info("Pcap service started !") self.load_from_powershell() return - warning("Could not start the pcap service ! " - "You probably won't be able to send packets. " - "Deactivating unneeded interfaces and restarting Scapy might help. " - "Check your winpcap and powershell installation, and access rights.") - else: - warning("No match between your pcap and windows network interfaces found. " - "You probably won't be able to send packets. " - "Deactivating unneeded interfaces and restarting Scapy might help. " - "Check your winpcap and powershell installation, and access rights.", True) + _error_msg = "Could not start the pcap service ! " + warning(_error_msg + + "You probably won't be able to send packets. " + "Deactivating unneeded interfaces and restarting Scapy might help. " + "Check your winpcap and powershell installation, and access rights.", True) else: # Loading state: remove invalid interfaces self.remove_invalid_ifaces() -- GitLab