using ipadress module,

using ipadress module to find all private address ranges instead of '192.168.0.0/8'.
main
z-alami 2022-07-26 23:44:46 +00:00 committed by GitHub
parent 275d4890af
commit f7d76c8ca1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -3,6 +3,7 @@ import requests
import csv import csv
from colorama import Fore from colorama import Fore
from datetime import date from datetime import date
import ipaddress
def read_pcap(pcap_file): def read_pcap(pcap_file):
ips = [] ips = []
@ -24,7 +25,7 @@ def ips_list(ips):
ips_lists = [] ips_lists = []
aborted_ips = [] aborted_ips = []
for ip in ips : for ip in ips :
if ip not in ips_lists and '192.168.' not in ip: if ip not in ips_lists and ipaddress.ip_address(ip).is_global:
ips_lists.append(ip) ips_lists.append(ip)
elif ip not in aborted_ips and '192.168.' in ip: elif ip not in aborted_ips and '192.168.' in ip:
aborted_ips.append(ip) aborted_ips.append(ip)