From 3a0346b164494babef6a3621e156d373f631d234 Mon Sep 17 00:00:00 2001 From: Stefan Midjich Date: Tue, 7 Mar 2017 17:07:08 +0100 Subject: [PATCH] error handling --- tools/client.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tools/client.py b/tools/client.py index ab8b50b..210534e 100644 --- a/tools/client.py +++ b/tools/client.py @@ -90,8 +90,14 @@ class Client(object): for rule in self.chain.rules: src_ip = rule.src - _ip = str(ip_address.ip) - if src_ip.startswith(str(ip_address.ip)) and rule.protocol == protocol: + + try: + _ip = str(ip_address.ip) + except: + # If we can't understand the argument just return None + return None + + if src_ip.startswith(_ip) and rule.protocol == protocol: return rule else: return None