Skip to content

Commit

Permalink
暂时屏蔽216开头的IP
Browse files Browse the repository at this point in the history
  • Loading branch information
moonshawdo committed Apr 26, 2015
1 parent 1a61cfa commit a25066d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ ssl subject: ((('countryName', u'US'),), (('stateOrProvinceName', u'California'
,), (('commonName', u'google.com'),))
Exception KeyError: KeyError(41875536,) in <module 'threading' from 'D:\Python27
\lib\threading.pyc'> ignored
````
````
* 增加IP黑名单配置,暂时把216开头的IP屏蔽
`g_blackiplist = ("216.",)`


使用方法
Expand Down
11 changes: 10 additions & 1 deletion checkip.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
g_excludessdomain=()
#检查组织是否为google,如果有其他名称,需要添加,暂时只发现一个
g_organizationName = ("Google Inc",)
g_blackiplist = ("216.",)


"是否自动删除记录查询成功的非google的IP文件,方便下次跳过连接,0为不删除,1为删除"
Expand Down Expand Up @@ -146,7 +147,7 @@ def new_sslwrap(sock, server_side=False, keyfile=None, certfile=None, cert_reqs=
210.153.73.20-210.153.73.123|106.162.192.148-106.162.192.187|106.162.198.84-106.162.198.123|106.162.216.20-106.162.216.123
210.139.253.20-210.139.253.251|111.168.255.20-111.168.255.187|203.165.13.210-203.165.13.251
61.19.1.30-61.19.1.109|74.125.31.33-74.125.31.60|210.242.125.20-210.242.125.59|203.165.14.210-203.165.14.251
216.239.32.0/19
#216.239.32.0/19
64.233.160.0/19
66.249.80.0/20
72.14.192.0/18
Expand Down Expand Up @@ -646,6 +647,14 @@ def runJob(self):
ipaddr = to_string(addrint)
self.queue.task_done()
self.addIPCount()
matchblack = False
for blackitem in g_blackiplist:
if ipaddr.startswith(blackitem):
matchblack = True
break
if matchblack:
PRINT("ip: %s in blacklist,skip it" % (ipaddr))
continue
ssl_obj = my_ssl_wrap()
(ssldomain, costtime,timeout,gwsname,ssl_orgname) = ssl_obj.getssldomain(self.getName(), ipaddr)
if ssldomain is not None:
Expand Down

0 comments on commit a25066d

Please sign in to comment.