· 9 years ago · Nov 18, 2016, 10:20 PM
1from string import join
2from random import choice, randrange
3from threading import Thread
4from hashlib import md5
5from time import sleep
6from uuid import uuid4
7
8import requests
9from bs4 import BeautifulSoup
10
11
12class AccountGenerator():
13 header = {
14 "User-Agent": "Mozilla/5.0 (X11; U; Linux i686) Gecko/20071127 Firefox/2.0.0.11"
15 }
16
17 def __init__(self):
18 self.email = "random"
19 self.name = "random"
20 self.pw = "RandomPass45"
21 self.color = randrange(1, 12)
22
23 self.captchas = {
24 "watermelon":"ARRB8J8KQ9t7AAAAAElFTkSuQmCC",
25 "balloon": "wuWB85cW2c5NQAAAABJRU5ErkJggg==",
26 "pizza": "XMAAAAASUVORK5CYII=",
27 "popcorn": "yat7sdCF61QAAAABJRU5ErkJggg==",
28 "igloo": "b+T94dZQb+IAAAAASUVORK5CYII=",
29 "cheese": "B0eBprJbn4wXAAAAAElFTkSuQmCC",
30 }
31
32 def getRegisterData(self):
33 response = requests.get("https://secured.clubpenguin.com/penguin/create", headers=self.header)
34
35 cookie = response.headers["Set-Cookie"]
36 htmlData = response.text
37
38 soup = BeautifulSoup(htmlData, "html.parser")
39
40 itemName = self.findBetween(htmlData, "item_name\":\"", "\",");
41 image1 = self.findBetween(htmlData, "\"images\":{\"1\":\"", "\",");
42 image1 = image1.rsplit('/',1)[-1]
43
44 image2 = self.findBetween(htmlData, image1 + "\",\"2\":\"", "\",");
45 image2 = image2.rsplit('/',1)[-1]
46
47 image3 = self.findBetween(htmlData, image2 + "\",\"3\":\"", "\"");
48 image3 = image3.rsplit('/',1)[-1]
49
50 itemImage = self.captchas[itemName]
51 if(image1 == itemImage):
52 self.captchaN = 0
53 elif(image2 == itemImage):
54 self.captchaN = 1
55 elif(image3 == itemImage):
56 self.captchaN = 2
57
58 self.anonToken = soup.find("input", {"name": "anon_token"})["value"]
59 self.formBuildId = soup.find("input", {"name": "form_build_id"})["value"]
60 self.fx_friends = self.findBetween(htmlData, "\"fx_friends\":\"", "\"}")
61
62 self.header["Cookie"] = "{0}; cpBROWSERID={1};".format(cookie, uuid4())
63 self.header["Origin"] = "https://secured.clubpenguin.com"
64 self.header["Referer"] = "https://secured.clubpenguin.com/penguin/create"
65
66
67 def registerPenguin(self):
68 self.getRegisterData()
69
70 if self.name == "random":
71 self.name = self.generateRandomString()
72
73 if self.email == "random":
74 self.email = self.generateRandomString() + "@gmail.com"
75
76 print "[{0}] Registering... with {1}".format(self.name, self.email)
77 data = {
78 "anon_token": self.anonToken,
79 "color": str(self.color),
80 "name": self.name,
81 "pass": self.pw,
82 "pass_show": "1",
83 "email": self.email,
84 "fx_friends": self.fx_friends,
85 "terms": "1",
86 "captcha": str(self.captchaN),
87 "op":"Create Your Penguin",
88 "form_build_id": self.formBuildId,
89 "form_id": "penguin_create_form"
90 }
91
92 finalResponse = requests.post("https://secured.clubpenguin.com/penguin/create", data=data, headers=self.header)
93 if "Activation Email Sent" in finalResponse.text:
94 print "[{0}] Registration successful".format(self.name)
95 # self.activatePenguin()
96 else:
97 print "[{0}] Failed registering... trying again".format(self.name)
98 self.registerPenguin()
99
100 def activatePenguin(self):
101 print "[{0}] Activating...".format(self.name)
102 attempts = 0
103 htmlData = requests.get("http://api.temp-mail.ru/request/mail/id/" + md5(self.email).hexdigest() + "/format/php").text
104 while "Activate Penguin*" not in htmlData:
105 attempts+=1
106 sleep(1)
107 htmlData = requests.get("http://api.temp-mail.ru/request/mail/id/" + md5(self.email).hexdigest() + "/format/php").text
108 if attempts > 20:
109 self.resendActivationEmail()
110 attempts = 0
111 soup = BeautifulSoup(htmlData, "html.parser")
112 for link in soup.find_all('a'):
113 if link.text == "Activate Penguin*":
114 self.activationLink = link['href']
115 break
116 htmlData = requests.get(self.activationLink, headers=self.header).text
117 soup = BeautifulSoup(htmlData, "html.parser")
118 formBuildId = soup.find("input", {"name": "form_build_id"})["value"]
119 activateData = {
120 "chat_mode": "standard",
121 "opt_in_cp": "0",
122 "opt_in_disney": "0",
123 "terms": "1",
124 "privacy": "1",
125 "op": "Activate!",
126 "form_build_id": formBuildId,
127 "form_id": "penguin_activate"
128 }
129 response = requests.post(self.activationLink, data=activateData, headers=self.header)
130 if response.url != self.activationLink:
131 print "[{0}] Activation successful".format(self.name)
132 with open("accounts.txt", "a") as file:
133 file.write("{0}:{1}\n".format(self.name, self.pw))
134
135 else:
136 print "[{0}] Activation failed".format(self.name)
137
138 def resendActivationEmail(self):
139 print "[{0}] Resending activation email...".format(self.name)
140 headers = {
141 "User-Agent": "Mozilla/5.0 (X11; U; Linux i686) Gecko/20071127 Firefox/2.0.0.11",
142 "Referer": "https://secured.clubpenguin.com/penguin/lost-code",
143 "Origin": "https://secured.clubpenguin.com"
144 }
145 response = requests.get("https://secured.clubpenguin.com/penguin/lost-code", headers=headers)
146
147 soup = BeautifulSoup(response.text, "html.parser")
148
149 form_build_id = soup.find("input", {"name":"form_build_id"})["value"]
150
151 data = {
152 "name": self.name,
153 "email": self.email,
154 "form_build_id": form_build_id,
155 "form_id":"penguin_lost_code_form"
156 }
157
158 requests.post("https://secured.clubpenguin.com/system/ajax", headers=headers, data=data)
159
160 def findBetween(self, s, first, last):
161 try:
162 start = s.index(first) + len(first)
163 end = s.index(last, start)
164 return s[start:end]
165 except ValueError:
166 return ""
167
168 def generateRandomString(self, length=8):
169 return join((choice("qwertyuiopasdfghjklzxcvbnm") for _ in range(length)), "")
170
171
172amt = input("Enter the amount of penguins you wish to generate: ")
173
174for i in range(int(amt)):
175 account_generator = AccountGenerator()
176 thread = Thread(target=account_generator.registerPenguin)
177 thread.start()