· 6 years ago · Jun 06, 2019, 03:36 PM
1import requests
2import names
3import random
4import time
5
6id_livox = 931
7
8def generate_ramdom_email():
9 rand_email_type = random.randint(1,10)
10 email = ''
11 if(rand_email_type > 4 ):
12 email = '@gmail.com'
13 elif(rand_email_type == 1):
14 email = '@hotmail.com'
15 elif(rand_email_type == 2):
16 email = '@yahoo.com'
17 elif(rand_email_type == 3):
18 email = '@outlook.com'
19 elif(rand_email_type == 4):
20 email = '@hotmail.com'
21
22 rand_format_email = random.randint(1,6)
23 complement = ''
24 if(rand_format_email < 4):
25 complement = ''
26 elif(rand_format_email == 4):
27 complement = str(random.randint(30,99))
28 elif(rand_format_email > 4):
29 complement = str(random.randint(1,10))
30
31 fullname_or_firstname = random.randint(1,4)
32
33 name = ''
34 if(fullname_or_firstname < 3):
35 name = names.get_first_name()
36 else:
37 name = names.get_first_name() + names.get_last_name()
38
39 email = name + complement + email
40 final_email = email.lower()
41 return final_email
42
43
44def generate_ramdom_captcha():
45
46 captchas_start = ['api', 'soap', 'rat', 'sea', 'gi']
47 captchas_end = ['cular', 'rock', 'ten', 'let', 'gger']
48
49 return random.sample(captchas_start, 1)[0] + random.sample(captchas_end, 1)[0]
50
51def generate_ramdom_candidates():
52
53 candidates = [933, 925, 926, 927, 928, 929 ,930, 932]
54
55 choosen = random.sample(candidates, 2)
56 choosen.append(id_livox)
57 random.shuffle(choosen)
58 return choosen
59
60cookies = {
61 'tx_epaprojects_voting_projects_closed': '1',
62 'newsletter_layout': 'layout-extended',
63 'fe_typo_user': 'c7a67a3da476d81f7ec9ad66cc3455fe',
64 'newsletter_popup': 'false',
65}
66
67headers = {
68 'Connection': 'keep-alive',
69 'Cache-Control': 'max-age=0',
70 'Origin': 'https://www.empowering-people-network.siemens-stiftung.org',
71 'Upgrade-Insecure-Requests': '1',
72 'Content-Type': 'application/x-www-form-urlencoded',
73 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36',
74 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3',
75 'Referer': 'https://www.empowering-people-network.siemens-stiftung.org/en/award/shortlist2019/?tx_epaprojects_voting%5BaddProject%5D=931&tx_epaprojects_voting%5Baction%5D=index&tx_epaprojects_voting%5Bcontroller%5D=Voting&cHash=a3c43dbf652d378f5d4b5d895a8bd802',
76 'Accept-Encoding': 'gzip, deflate, br',
77 'Accept-Language': 'en-US,en;q=0.9,pt-BR;q=0.8,pt;q=0.7',
78}
79
80params = (
81 ('tx_epaprojects_voting[action]', 'index'),
82 ('tx_epaprojects_voting[controller]', 'Voting'),
83)
84
85
86while True:
87
88 candidates = generate_ramdom_candidates()
89 email = generate_ramdom_email()
90
91 data = {
92 'tx_epaprojects_voting[__referrer][@extension]': 'EpaProjects',
93 'tx_epaprojects_voting[__referrer][@vendor]': 'DIGITALPATRIOTEN',
94 'tx_epaprojects_voting[__referrer][@controller]': 'Voting',
95 'tx_epaprojects_voting[__referrer][@action]': 'index',
96 'tx_epaprojects_voting[__referrer][arguments]': 'YTozOntzOjEwOiJhZGRQcm9qZWN0IjtzOjM6IjkzMSI7czo2OiJhY3Rpb24iO3M6NToiaW5kZXgiO3M6MTA6ImNvbnRyb2xsZXIiO3M6NjoiVm90aW5nIjt909f895b400ab3e2dcf4368c23e3f4cae2fdcdce7',
97 'tx_epaprojects_voting[__trustedProperties]': 'a:1:{s:10:"voteDemand";a:4:{s:8:"projects";a:3:{i:0;i:1;i:1;i:1;i:2;i:1;}s:5:"email";i:1;s:7:"captcha";i:1;s:6:"voting";i:1;}}17b3f71e8e886e52cdc6ba89dd7d3f25198b1f66',
98 'tx_epaprojects_voting[voteDemand][projects][0]': candidates[0],
99 'tx_epaprojects_voting[voteDemand][projects][1]': candidates[1],
100 'tx_epaprojects_voting[voteDemand][projects][2]': candidates[2],
101 'tx_epaprojects_voting[voteDemand][email]': email,
102 'tx_epaprojects_voting[voteDemand][captcha]': 'tropesis',
103 'tx_epaprojects_voting[voteDemand][voting]': '1'
104 }
105
106 print(candidates)
107 print(email)
108 response = requests.post('https://www.empowering-people-network.siemens-stiftung.org/nc/en/award/shortlist2019/?tx_epaprojects_voting%5Baction%5D=index&tx_epaprojects_voting%5Bcontroller%5D=Voting', headers=headers, cookies=cookies, data=data, verify=False)
109 time.sleep(random.randint(60,100))