Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修改检测有效性为闪光注册页面 #145

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion config.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,8 @@ def get_header():
#因此在这个地方用户可以自己添加检测函数,我以百度为访问网址尝试一下
#大家可以看一下Validator.py文件中的baidu_check函数和detect_proxy函数就会明白

CHECK_PROXY={'function':'checkProxy'}#{'function':'baidu_check'}
#CHECK_PROXY={'function':'checkProxy'}#{'function':'baidu_check'}
CHECK_PROXY={'function':'bloodwow_check'}

#下面配置squid,现在还没实现
#SQUID={'path':None,'confpath':'C:/squid/etc/squid.conf'}
Expand Down
7 changes: 6 additions & 1 deletion db/DataStore.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# coding:utf-8
import sys
import sys,os

BASE_DIR = os.path.dirname(os.path.dirname((os.path.abspath(__file__))))
if BASE_DIR not in sys.path:
sys.path.append(BASE_DIR)

from config import DB_CONFIG
from util.exception import Con_DB_Fail

Expand Down
2 changes: 1 addition & 1 deletion db/SqlHelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def close(self):
if __name__ == '__main__':
sqlhelper = SqlHelper()
sqlhelper.init_db()
proxy = {'ip': '192.168.1.1', 'port': 80, 'type': 0, 'protocol': 0, 'country': '中国', 'area': '广州', 'speed': 11.123, 'types': ''}
proxy = {'ip': '192.168.1.1', 'port': 80, 'type': 0, 'protocol': 0, 'country': 'cn', 'area': 'gz', 'speed': 11.123, 'types': ''}
sqlhelper.insert(proxy)
sqlhelper.update({'ip': '192.168.1.1', 'port': 80}, {'score': 10})
print(sqlhelper.select(1))
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@ greenlet==0.4.11
lxml==3.7.1
requests==2.12.4
SQLAlchemy==1.1.4
web.py==0.38
redis==2.10.5
psutil
2 changes: 1 addition & 1 deletion start.bat
Original file line number Diff line number Diff line change
@@ -1 +1 @@
py -2 IPProxy.py
python IPProxy.py
21 changes: 20 additions & 1 deletion validator/Validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,27 @@ def getMyIP():
except Exception as e:
raise Test_URL_Fail

def bloodwow_check(selfip,proxies):
try:
start = time.time()
r = requests.get(url='http://dx.blood-wow.com:85/', headers=config.get_header(), timeout=config.TIMEOUT, proxies=proxies)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Chrome打开显示”您要访问的网站包含恶意软件“,你这pr什么鬼。。。

r.encoding = chardet.detect(r.content)['encoding']
if r.ok:
speed = round(time.time() - start, 2)
protocol= 0
types=0

else:
speed = -1
protocol= -1
types=-1
except Exception as e:
speed = -1
protocol = -1
types = -1
return protocol, types, speed

if __name__ == '__main__':
if __name__ == '__main__':
ip = '222.186.161.132'
port = 3128
proxies = {"http": "http://%s:%s" % (ip, port), "https": "http://%s:%s" % (ip, port)}
Expand Down