抱歉,您的浏览器无法访问本站

本页面需要浏览器支持(启用)JavaScript


了解详情 >

Google验证码_打码

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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
from selenium import webdriver
from selenium.webdriver.support.select import Select
from bs4 import BeautifulSoup
import re
import time
import random
import os
import csv
from SeleniumGoogle import SeleniumTest
import requests
from datetime import datetime
# Buster: Captcha Solver for Humans

def valid_date(timestr):
nowTime_str = datetime.now().strftime('%Y-%m-%d')
# mktime参数为struc_time,将日期转化为秒,
e_time = time.mktime(time.strptime(nowTime_str, "%Y-%m-%d"))
# print(e_time)
try:
s_time = time.mktime(time.strptime(timestr, '%Y-%m-%d'))
# print(s_time)
# 日期转化为int比较
diff = int(s_time) - int(e_time)
# print(diff)
if diff >= 0:
is_true = True
# print('True')
return is_true
else:
is_true = False
# self.show_data.emit('测试版本已不能试用!!!')
# print('测试版本已不能试用!!!')
print('False')
return is_true
except Exception as e:
print(e)
return 0


# 请求方法
def get(driver,url):
data = './sss.csv'
csv_data = csv.reader(open(data, 'r'))
with open("./"+'结果.csv', "a", newline='', encoding='utf-8') as f:
print("结果" + '.csv' + " 文件已创建...")
fieldnames = ["名", "中间名", "姓", "地址", "生日", "ssn", "驾照","体重"]
f_csv = csv.DictWriter(f, fieldnames=fieldnames)
f_csv.writeheader()
for i in csv_data:
for j in range(100,170):
driver.get(url)
print("已打开首页")
driver.implicitly_wait(10)
driver.execute_script("window.scrollTo(0,document.body.scrollHeight)")
# 点击apply 应用
driver.find_element_by_xpath(
'//*[@id="main-content"]/section/section/div/div/div/div[2]/div[1]/section/div/a').click()
driver.implicitly_wait(10)

# 点击close
driver.find_element_by_xpath('//*[@id="divSystemMessage"]/div/div/div[3]/button').click()
try: # 关掉第二个close
driver.find_element_by_xpath('//*[@id="divnote"]/div/div/div[3]/button').click()
# ActionChains(driver).move_by_offset(1298, 297).click().perform() # 鼠标左键点击一律不

except:
pass
# 点击注册
driver.find_element_by_xpath('//*[@id="divRegister"]/section/div/div/div/a').click()
driver.implicitly_wait(10)

# 点击begin
driver.find_element_by_xpath('//*[@id="divStep1"]/div[2]/div/span/a').click()
driver.implicitly_wait(5)

# 下拉滚动条到底
driver.execute_script("window.scrollTo(0,document.body.scrollHeight)")
time.sleep(1)

# a = input("00000000000000:")

# 下拉滚动条到底
driver.execute_script("window.scrollTo(document.body.scrollHeight,0)")
time.sleep(1)

# 输入第一个last name
# html = driver.page_source
# soup = BeautifulSoup(html,'lxml')
# soup.select('')
lastname1 = driver.find_element_by_xpath('//*[@id="txtLastname"]')
lastname1.click()
lastname1.send_keys(i[2])

# 输入第一个生日
date1 = driver.find_element_by_xpath('//*[@id="txtDOB"]')
date1.click()
date1.send_keys(i[8])
driver.implicitly_wait(5)


# 输入第二个last name
lastname2 = driver.find_element_by_xpath('//*[@id="txtLastNameConfirm"]')
lastname2.click()
lastname2.send_keys(i[2])
driver.implicitly_wait(5)


# 输入第二个生日
date2 = driver.find_element_by_xpath('//*[@id="txtDOBConfirm"]')
date2.click()
date2.send_keys(i[8])
driver.implicitly_wait(5)


# 输入随机ID
ID = random.sample(['z', 'y', 'x', 'w', 'v', 'u', 't', 's', 'r', 'q', 'p', 'o', 'n', 'm', 'l', 'k',
'j', 'i', 'h', 'g', 'f', 'e', 'd', 'c', 'b', 'a', 'Q', 'W', 'E', 'R', 'T', 'Y',
'U', 'I', 'O', 'P', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Z', 'X', 'C', 'V',
'B', 'N', 'M'], 8)
id = ''.join(ID)
User_ID = driver.find_element_by_xpath('//*[@id="txtUserID"]')
User_ID.click()
User_ID.send_keys(id)
driver.implicitly_wait(5)


# 输入随机邮箱
Email_Address = driver.find_element_by_xpath('//*[@id="txtEmailAddress"]')
Email_Address.click()
Email_Address.send_keys(id+"@163.com")
driver.implicitly_wait(5)


# 创建密码
Password1 = driver.find_element_by_xpath('//*[@id="txtPassword"]')
Password1.click()
Password1.send_keys("ASDFasgh###555")
driver.implicitly_wait(5)


# 确认密码
Password2 = driver.find_element_by_xpath('//*[@id="txtPasswordConfirm"]')
Password2.click()
Password2.send_keys('ASDFasgh###555')

# 下拉滚动条到底
driver.execute_script("window.scrollTo(0,document.body.scrollHeight)")
time.sleep(1)

# 问题1
Question1 = driver.find_element_by_xpath('//*[@id="drpSecQuestion1"]')
Question1.click()
Select(driver.find_element_by_id('drpSecQuestion1')).select_by_value('14')
driver.implicitly_wait(10)

# 输入随机ID
ID = random.sample(['z', 'y', 'x', 'w', 'v', 'u', 't', 's', 'r', 'q', 'p', 'o', 'n', 'm', 'l', 'k',
'j', 'i', 'h', 'g', 'f', 'e', 'd', 'c', 'b', 'a', 'Q', 'W', 'E', 'R', 'T', 'Y',
'U', 'I', 'O', 'P', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Z', 'X', 'C', 'V',
'B', 'N', 'M'], 8)
id = ''.join(ID)


# 问题1答案
Answer1 = driver.find_element_by_xpath('//*[@id="txtQuestion1"]')
Answer1.click()
Answer1.send_keys(id)
driver.implicitly_wait(5)

# 问题2
Question2 = driver.find_element_by_xpath('//*[@id="drpSecQuestion2"]')
Question2.click()
Select(driver.find_element_by_id('drpSecQuestion2')).select_by_value('11')
driver.implicitly_wait(5)

# 输入随机ID
ID = random.sample(['z', 'y', 'x', 'w', 'v', 'u', 't', 's', 'r', 'q', 'p', 'o', 'n', 'm', 'l', 'k',
'j', 'i', 'h', 'g', 'f', 'e', 'd', 'c', 'b', 'a', 'Q', 'W', 'E', 'R', 'T', 'Y',
'U', 'I', 'O', 'P', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Z', 'X', 'C', 'V',
'B', 'N', 'M'], 8)
id = ''.join(ID)

# 问题2答案
Answer2 = driver.find_element_by_xpath('//*[@id="txtQuestion2"]')
Answer2.click()
Answer2.send_keys(id)
driver.implicitly_wait(5)

# 问题3
Question3 = driver.find_element_by_xpath('//*[@id="drpSecQuestion3"]')
Question3.click()
Select(driver.find_element_by_id('drpSecQuestion3')).select_by_value('10')
driver.implicitly_wait(5)

# 输入随机ID
ID = random.sample(['z', 'y', 'x', 'w', 'v', 'u', 't', 's', 'r', 'q', 'p', 'o', 'n', 'm', 'l', 'k',
'j', 'i', 'h', 'g', 'f', 'e', 'd', 'c', 'b', 'a', 'Q', 'W', 'E', 'R', 'T', 'Y',
'U', 'I', 'O', 'P', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Z', 'X', 'C', 'V',
'B', 'N', 'M'], 8)
id = ''.join(ID)

# 问题3答案
Answer3 = driver.find_element_by_xpath('//*[@id="txtQuestion3"]')
Answer3.click()
Answer3.send_keys(id)
driver.implicitly_wait(5)

# 问题4
Question4 = driver.find_element_by_xpath('//*[@id="drpSecQuestion4"]')
Question4.click()
Select(driver.find_element_by_id('drpSecQuestion4')).select_by_value('13')
driver.implicitly_wait(5)

# 输入随机ID
ID = random.sample(['z', 'y', 'x', 'w', 'v', 'u', 't', 's', 'r', 'q', 'p', 'o', 'n', 'm', 'l', 'k',
'j', 'i', 'h', 'g', 'f', 'e', 'd', 'c', 'b', 'a', 'Q', 'W', 'E', 'R', 'T', 'Y',
'U', 'I', 'O', 'P', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Z', 'X', 'C', 'V',
'B', 'N', 'M'], 8)
id = ''.join(ID)

# 问题4答案
Answer4 = driver.find_element_by_xpath('//*[@id="txtQuestion4"]')
Answer4.click()
Answer4.send_keys(id)
driver.implicitly_wait(5)
# print("准备2秒后验证.............")
#
# time.sleep(2)

html = driver.page_source
# print(html)



# driver.find_element_by_css_selector('#recaptcha-anchor > div.recaptcha-checkbox-border').click()




# 点击人机验证 打码平台

# input("信息填完后按回车:")
print("开始打码.......................................................")
task_id = create_task()
task_id = polling_task(task_id)
print("task_id:", task_id)
js_code = 'document.getElementById("g-recaptcha-response").innerHTML="{}";'.format(task_id)
print(js_code)
driver.execute_script(js_code)







# a = input('人工智能验证中:')
# time.sleep(2)
#
# # 点击验证码
# ActionChains(driver).move_by_offset(392, 820).click().perform() # 鼠标左键点击
# time.sleep(2)
# # 点击人头
# ActionChains(driver).move_by_offset(444, 1006).click().perform() # 鼠标左键点击
# # 等待5秒 通过验证
# time.sleep(5)


# 点击Next
driver.find_element_by_xpath('//*[@id="btnNext"]').click()
driver.implicitly_wait(10)


# *****************************************************************************************************************************
# 第二页

# ActionChains(driver).move_by_offset(1765, 266).click().perform() # 鼠标左键点击一律不


# last name
last1 = driver.find_element_by_xpath('//*[@id="txtLast"]')
last1.click()
last1.clear()
last1.send_keys(i[2])

# first name
first = driver.find_element_by_xpath('//*[@id="txtFirst"]')
first.click()
first.send_keys(i[0])

# Middle
Middle = driver.find_element_by_xpath('//*[@id="txtMiddle"]')
Middle.click()
Middle.send_keys(i[1])

# 出生日期
bir = driver.find_element_by_xpath('//*[@id="txtDOB"]')
bir.click()
bir.send_keys(i[-1])

# Eye Color
Eye_Color = driver.find_element_by_xpath('//*[@id="drpEyeColor"]')
Eye_Color.click()
Select(driver.find_element_by_id('drpEyeColor')).select_by_value('BLU')

# 随机10位数电话号码
# nums = random.sample(['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'], 4)
num = "2562131565"

# 下拉滚动条到底
driver.execute_script("window.scrollTo(0,document.body.scrollHeight)")
time.sleep(1)

# Primary Phone
Primary_Phone = driver.find_element_by_xpath('//*[@id="txtPhone"]')
Primary_Phone.click()
Primary_Phone.send_keys(num)

# ID State
ID_State = driver.find_element_by_xpath('//*[@id="drpIDStateDisplay"]')
ID_State.click()
Select(driver.find_element_by_id('drpIDStateDisplay')).select_by_value('IL')

# ID Type
ID_Type = driver.find_element_by_xpath('//*[@id="drpIDType"]')
ID_Type.click()
Select(driver.find_element_by_id('drpIDType')).select_by_value('OL')

# ID Number
ID_Number = driver.find_element_by_xpath('//*[@id="txtIDNumber"]')
ID_Number.click()
ID_Number.send_keys(i[-3])

# 隐式等待
driver.implicitly_wait(5)

# Weight as displayed on your Drivers License
tizhong = driver.find_element_by_xpath('//*[@id="txtWeight"]')
tizhong.click()
tizhong.clear()
tizhong.send_keys(j+10)
print(j)

# over
driver.find_element_by_xpath('//*[@id="btnNext"]').click()

html = driver.page_source
soup = BeautifulSoup(html,'lxml')
hahas = soup.select('#phTitle')
haha_re = 'i> (.*?) <i'
haha_geshi = re.compile(haha_re, re.S)
haha = re.findall(haha_geshi, str(hahas))[0]
print(haha)
print(type(haha))
if haha == "hahah": # "名", "中间名", "姓", "地址", "生日", "ssn", "驾照","体重"
f_csv.writerow(
{
'名': i[0],
'中间名': i[1],
'姓': i[2],
'地址': i[3],
'生日': i[4],
'ssn': i[5],
'驾照': i[6],
'体重':j
}
)
print('名:'+i[0]+'\n'+'中间名'+i[1]+'\n'+'姓:'+ i[2]+'\n'+'地址:'+i[3]+'\n'+'生日:'+i[4]+'\n'+'ssn:'+i[5]+'\n'+'驾照:'+i[6]+'\n'+'体重:'+j)
print("已写入...")
driver.find_element_by_xpath('//*[@id="btnHome"]').click()
driver.implicitly_wait(20)
time.sleep(2)

# Learn More
driver.find_element_by_xpath('//*[@id="home1"]/section/div/div[2]/div/a[2]').click()
break
else:
driver.find_element_by_xpath('//*[@id="btnHome"]').click()
continue


# 递归
# get(driver)



def verify(response):
url = "https://www.ispfsb.com/Reg/signup.aspx"
data = {"g-recaptcha-response": response}
response = requests.post(url, data=data)
if response.status_code == 200:
return response.text

def create_task():
url = 'http://api.recaptcha.press/task/create?siteKey=6LdAHv8UAAAAAC-KuK02qHMG7nLPZ3WpxZs7eG6K&siteReferer=https://www.ispfsb.com/&authorization=0a389ac1-ab1a-4d60-a089-1f182bd12461'

try:
response = requests.get(url)
if response.status_code == 200:
data = response.json()
print('response data:', data)
return data.get('data', {}).get('taskId')
except requests.RequestException as e:
print('create task failed', e)



def polling_task(task_id):
url2 = 'https://api.recaptcha.press/task/status?taskId=%s' % task_id
count = 0
while count < 60:
try:
response = requests.get(url2)
if response.status_code == 200:
data = response.json()
print('polling result', data)
status = data.get('data', {}).get('status')
print('status of task', status)
if status == 'Success':
return data.get('data', {}).get('response')
except requests.RequestException as e:
print('polling task failed', e)
finally:
count += 1
time.sleep(3)





def csv_read():
data = './sss.csv'
csv_data = csv.reader(open(data, 'r'))
for i in csv_data:
print(i[1])
print(csv_data)
print(type(csv_data))




# 程序入口
if __name__ == '__main__':
# 标识 当前目录
path = os.getcwd()
url = "https://www.ispfsb.com/Public/FOID.aspx"
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36"}

# 文件验证是否存在
# if os.path.exists('./' + id + '.csv'):
# try:
# os.remove('./' + id + '.csv')
# except:
# print("请删除" + id + '.csv' + "原文件后重新运行!")
#
# print(id + '.csv' + "已删除....")

# 去除浏览器被控 字样
options = webdriver.ChromeOptions()
options.add_experimental_option("excludeSwitches", ['enable-automation'])
options.add_experimental_option('useAutomationExtension', False)
# 浏览器扩展程序
# 语音识别程序
extension_path1 = './1.2.2_0.crx'
# xpath程序
extension_path2 = './2.0.2_0.crx'

options.add_extension(extension_path1)
options.add_extension(extension_path2)
driver = webdriver.Chrome(options=options) #driver = webdriver.Chrome(executable_path=r'D:PATHchromedriver.exe')?
driver.maximize_window()
# a = input("人工智障打码操作:")


get(driver,url)
# csv_read()

评论

测试阶段