-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_captcha.py
executable file
·47 lines (41 loc) · 1.26 KB
/
test_captcha.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
#!/usr/bin/python
import sys
import pygvoicelib
try:
input = raw_input
except NameError:
input = input
def handle_captcha(voice):
voice.passwd = passwd
print 'Captcha URL is: %s\n' % (voice.captcha_url)
print 'Enter captcha value: '
voice.captcha_entry = input()
def run_test(user, passwd)
print 'We will try random wrong passwords to get a captcha lock ...'
voice = pygvoicelib.GoogleVoice(user, passwd)
voice.handle_captcha_entry = handle_captcha
for i in range(50):
print 'Wrong password - try %d' % (i)
voice.passwd = str(i+111111)
try:
voice.validate_credentials()
except pygvoicelib.LoginError, e:
if e.reason != 'failed':
raise
if voice.auth_token:
break
try:
ret = voice.get_numbers()
ret1 = voice.call('1222333444', '15556667777')
ret2 = voice.cancel()
print 'Test OK - We succeeded to login'
except:
print 'Test FAILED - We failed to login'
if __name__ == '__main__':
print 'Please enter your Google Username:',
user = input()
print 'Please enter your Password:',
passwd = input()
print 'Please enter a number to call:',
call_number = input()
run_test(user, passwd)