Skip to content

Commit

Permalink
refact flow.py
Browse files Browse the repository at this point in the history
  • Loading branch information
winsphinx committed Feb 23, 2024
1 parent 37b9072 commit 04bd401
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/modules/flows.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@

def calculate_network(df):
try:
if not df["起始IP"].startswith("2408"): # for ipv4
if df["起始IP"].startswith("2408"): # for ipv6
return ipaddress.ip_network(df["起始IP"])
else: # for ipv4
for host in ipaddress.summarize_address_range(ipaddress.ip_address(df["起始IP"]), ipaddress.ip_address(df["终止IP"])):
return host
else: # for ipv6
return ipaddress.ip_network(df["起始IP"])
except ValueError:
pass

Expand Down

0 comments on commit 04bd401

Please sign in to comment.