From bbfb8482177011aa20aa50742bb0b81237987ab6 Mon Sep 17 00:00:00 2001 From: "jp.av.dev" Date: Sun, 16 Oct 2022 02:14:24 -0300 Subject: [PATCH] ed: iplocate.py lazy regex local ip filter --- iplocate.py | 3 ++- maps/map_thumb.svg | 63 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 1 deletion(-) diff --git a/iplocate.py b/iplocate.py index a9a9d02..0c06361 100755 --- a/iplocate.py +++ b/iplocate.py @@ -25,9 +25,10 @@ console = Console() # IP validate https://stackoverflow.com/questions/319279/how-to-validate-ip-address-in-python ip_regx = "^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])$" +ip_local_regx = "^192\.168\.0\.([0-9]|[0-9][0-9]|[0-9][0-9][0-9])$" def filtro_ip_propia(ip): - return True if ip != ownip else False + return True if ip != ownip and not re.search(ip_local_regx, ip) else False def print_ipinfo(ip, tkn=True): diff --git a/maps/map_thumb.svg b/maps/map_thumb.svg index a89e572..89b4d15 100644 --- a/maps/map_thumb.svg +++ b/maps/map_thumb.svg @@ -12024,6 +12024,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -13905,6 +13959,15 @@ + + + + + + + + + Maps & Data (C) OpenStreetMap.org contributors