· 5 years ago · Mar 29, 2020, 09:04 PM
1import requests, re
2
3registerpage = 'https://v2.twitterhotel.fr/inscription'
4regex = 'placeholder="[0-9]{6}"'
5regex2 = '[0-9]{6}'
6header = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:74.0) Gecko/20100101 Firefox/74.0'}
7
8import random
9import string
10
11def randomString(stringLength=10):
12 """Generate a random string of fixed length """
13 letters = string.ascii_lowercase
14 return ''.join(random.choice(letters) for i in range(stringLength))
15
16def create_new_user(username : str, email : str, password : str):
17 s = requests.session()
18 r = s.get(registerpage, headers=header)
19
20 m = re.search(regex, r.text)
21 if m == None:
22 return False
23 placeholder = m.group(0)
24
25 m = re.search(regex2, placeholder)
26 if m == None:
27 return False
28 catpcha = m.group(0)
29
30 print(catpcha)
31
32 form = {'pseudo2': username,
33 'mail2': email,
34 'password1': password,
35 'password2': password,
36 'captcha': catpcha,
37 'sub2': ''}
38
39 r = s.post(registerpage, headers=header, data=form, allow_redirects=False)
40
41 print(r.status_code)
42 print(r.headers['Location'])
43 if r.status_code != 302:
44 print(r.text)
45 return r.status_code == 302
46
47
48
49
50if __name__ == '__main__':
51
52 i = 0
53 while True:
54 user = randomString()
55 if create_new_user(user, user + '@gmail.com', 'random'):
56 i += 1
57 print(user, " : ", i)
58
59 input('down')