-
Notifications
You must be signed in to change notification settings - Fork 1
/
py_exec_js.py
144 lines (110 loc) · 4.06 KB
/
py_exec_js.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
import threading
from selenium.webdriver.common.by import By
__author__ = 'chenwei'
from selenium.webdriver import Proxy, DesiredCapabilities
from selenium.webdriver.common.proxy import ProxyType
import time
__author__ = 'chenwei'
from selenium import webdriver
base_url = 'http://127.0.0.1:8888'
def test():
pass
base_url = 'http://www.baidu.com'
driver = webdriver.PhantomJS()
driver.get(base_url)
print(driver.current_url)
data = driver.find_element_by_id('cp').text
print(data)
# print(driver.current_url)
driver.quit()
def test_1():
from ghost import Ghost
ghost = Ghost()
page, extra_res = ghost.open('http://www.baidu.com')
print(page.http_status)
print(ghost.content)
def test_3():
driver = webdriver.Firefox()
driver.get("http://m.mail.10086.cn")
driver.implicitly_wait(30)
driver.find_element_by_id("ur").send_keys("手机号")
driver.find_element_by_id("pw").send_keys("密码")
driver.find_element_by_class_name("loading_btn").click()
driver.quit()
def test_6():
from ghost import Ghost
base_url = 'http://127.0.0.1:8888'
ghost = Ghost()
ghost.open(base_url)
# page, extra_res = ghost.open(base_url)
# print(page.http_status)
# print(ghost.content)
def test_2():
driver = webdriver.PhantomJS()
# driver.set_window_size(1120, 550)
driver.get(base_url)
driver.find_element_by_id('username').send_keys('username')
driver.find_element_by_id('password').send_keys('123456')
driver.find_element_by_id('test_ajax').click()
print(driver.current_url)
driver.quit()
def test_3():
driver = webdriver.Firefox()
# driver = webdriver.PhantomJS()
# driver.set_window_size(1120, 550)
driver.get("https://ssl.ptlogin2.qq.com/check?pt_tea=1&uin=2081374195&appid=501004106&js_ver=10124&js_type=0&login_sig=&u1=http://w.qq.com/proxy.html&r=0.5679909912869334")
# driver.find_element_by_id('username').send_keys('username')
# driver.find_element_by_id('password').send_keys('123456')
# driver.find_element_by_id('test_ajax').click()
print(driver.current_url)
print(driver.page_source)
# driver.quit()
def get_encrypt_pwd():
'''获取加密密码'''
print('get_encrypt_pwd()')
base_url = "http://127.0.0.1:8888/encrypt"
driver = webdriver.PhantomJS()
driver.get(base_url)
print(base_url)
driver.find_element_by_id('salt').send_keys('\x00\x00\x00\x00\x7c\x0f\x3f\xf3')
driver.find_element_by_id('pwd').send_keys('gguuss')
driver.find_element_by_id('vcode').send_keys('')
driver.find_element_by_id('bt_01').click()
print(driver.current_url)
driver.quit()
print('quit()')
def worker(str):
print(str)
print (threading.currentThread().getName(), 'Starting')
time.sleep(3)
print (threading.currentThread().getName(), 'Exiting')
def test_thread():
w = threading.Thread(name='get_encrypt_pwd', target=get_encrypt_pwd)
w.start()
if __name__ == '__main__':
s = "ptuiCB('0','0','http://ptlogin4.web2.qq.com/check_sig?pttype=1&uin=2081374195&service=login&nodirect=0&ptsigx=26ec0347eb5084a199eaf9f7dad05afccdaf4e86055b2c37dcbb1a90aeb234038afc5bb272e734768ac7a0c9184d6bef3a9fec1f9fcb83c0231adc0760a0c8a0&s_url=http%3A%2F%2Fw.qq.com%2Fproxy.html%3Flogin2qq%3D1%26webqq_type%3D10&f_url=&ptlang=2052&ptredirect=100&aid=501004106&daid=164&j_later=0&low_login_hour=0®master=0&pt_login_type=1&pt_aid=0&pt_aaid=0&pt_light=0&pt_3rd_aid=0','0','\xe7\x99\xbb\xe5\xbd\x95\xe6\x88\x90\xe5\x8a\x9f\xef\xbc\x81', 'rtokie')"
s = s[7:-1]
print(s)
# w = threading.Thread(name='worker', target=worker('3'))
# w2 = threading.Thread(target=worker) # use default name
#
# w.start()
# w2.start()
# print('hello world')
#
# action = [0, 0];
# import time
# print(int(time.time()))
# salt = '\x00\x00\x00\x00\x7c\x0f\x3f\xf3';
# print(bytes(salt,encoding='utf8'))
# pass
#
# get_encrypt_pwd();
# test_6()
# test()
# test_1()
# test_3()
# test_3()
# test_4()
# import os
# print(os.environ['HTTP_PROXY'])