防火墙会话如下:
msn-stun VPN: public --> public Remote 10.16.150.114:61721[192.160.224.209:7060] --> 112.60.24.54:3478
http VPN: public --> public Remote 10.1.32.121:58026[192.160.226.99:2603] --> 39.135.65.111:80
udp VPN: public --> public Remote 10.16.137.152:45439[192.160.227.210:48956] --> 120.229.128.134:6045
https VPN: public --> public Remote 10.16.87.237:48610[192.160.224.53:18192] --> 183.240.176.207:443
dns VPN: public --> public Remote 10.17.182.54:2348[192.160.224.234:8048] --> 192.179.38.7:53
代码如下:
"""
python
import re
import os
count_224=0
count_225=0
count_226=0
count_227=0
counts=0
with open("HWE9000EX-189-20231017-170012.txt","r",encoding='utf8') as f:
for line in f:
ip_address=re.findall(r".*?(192.\d+.\d+.\d+:\d+).*",line)
# ip_address=re.findall(r".*\[(192.\d+.\d+.\d+:\d+)\].*",line)
counts=counts+1
if ip_address == []:#不能写成if ip_address is None:
continue
elif "192.160.224." in ip_address[0]:
count_224 = count_224+1
elif "192.160.225." in ip_address[0]:
count_225 = count_225+1
elif "192.160.226." in ip_address[0]:
count_226 = count_226+1
elif "192.160.227." in ip_address[0]:
count_227 = count_227+1
print(count_224+count_225+count_226+count_227,"224段:"+str(count_224),"225段:"+str(count_225),"226段:"+str(count_226),"227段:"+str(count_227),"总条目:"+str(counts))
#
——————————————————————————————————————————————————————————————
import re
import os
count_224=0
count_225=0
count_226=0
count_227=0
counts=0
with open("HWE9000EX-189-20231017-170012.txt","r",encoding='utf8') as f:
for line in f:
if "192.160.224." in line:
count_224 = count_224+1
elif "192.160.225." in line:
count_225 = count_225+1
elif "192.160.226." in line:
count_226 = count_226+1
elif "192.160.227." in line:
count_227 = count_227+1
print(count_224,count_225,count_226,count_227)
"""