add tool to distinguish china from overseas

This commit is contained in:
root 2019-04-25 14:00:44 +08:00
parent 4dabf635a8
commit 3f5199f3a3
4 changed files with 533909 additions and 0 deletions

57030
tool/cn.txt Normal file

File diff suppressed because it is too large Load Diff

13
tool/inner.txt Normal file
View File

@ -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

476838
tool/overseas.txt Normal file

File diff suppressed because it is too large Load Diff

28
tool/readline.py Normal file
View File

@ -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()