add tool to distinguish china from overseas
This commit is contained in:
parent
4dabf635a8
commit
3f5199f3a3
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,13 @@
|
|||
10.0.0.0|10.255.255.255|0|0|0|内网IP|内网IP
|
||||
100.64.0.0|100.127.255.255|0|0|0|内网IP|内网IP
|
||||
127.0.0.0|127.255.255.255|0|0|0|内网IP|内网IP
|
||||
169.254.0.0|169.254.255.255|0|0|0|内网IP|内网IP
|
||||
172.16.0.0|172.31.255.255|0|0|0|内网IP|内网IP
|
||||
192.0.0.0|192.0.0.255|0|0|0|内网IP|内网IP
|
||||
192.0.2.0|192.0.2.255|0|0|0|内网IP|内网IP
|
||||
192.88.99.0|192.88.99.255|0|0|0|内网IP|内网IP
|
||||
192.168.0.0|192.168.255.255|0|0|0|内网IP|内网IP
|
||||
198.18.0.0|198.19.255.255|0|0|0|内网IP|内网IP
|
||||
198.51.100.0|198.51.100.255|0|0|0|内网IP|内网IP
|
||||
203.0.113.0|203.0.113.255|0|0|0|内网IP|内网IP
|
||||
224.0.0.0|255.255.255.255|0|0|0|内网IP|内网IP
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding: UTF-8 -*-
|
||||
|
||||
filepath = '../data/ip.merge.txt'
|
||||
opath = "overseas.txt"
|
||||
cnpath = "cn.txt"
|
||||
inpath = "inner.txt"
|
||||
fo = open(opath,"w")
|
||||
fcn = open(cnpath,"w")
|
||||
fin = open(inpath, "w")
|
||||
with open(filepath) as fp:
|
||||
line = fp.readline()
|
||||
cnt = 1
|
||||
while line:
|
||||
#print("Line {}: {}".format(cnt, line))
|
||||
line = fp.readline()
|
||||
cnt += 1
|
||||
if "内网" in line:
|
||||
print("Line {}: {}".format(cnt, line))
|
||||
fin.write(line)
|
||||
elif "中国" in line:
|
||||
fcn.write(line)
|
||||
else:
|
||||
fo.write(line)
|
||||
fp.close()
|
||||
fo.close()
|
||||
fcn.close()
|
||||
fin.close()
|
||||
Loading…
Reference in New Issue