· 9 years ago · Feb 17, 2017, 11:18 PM
1import requests
2import time
3from bs4 import BeautifulSoup
4import random
5from random import choice
6from string import ascii_uppercase
7import string
8from time import sleep
9import imaplib
10import datetime
11import email
12import imaplib
13import mailbox
14global loop
15btcAddress = ''
16btcKey = ''
17global s
18s = requests.Session()
19loop = True
20x = 'true'
21def getRandomUsername():
22 u = BeautifulSoup(requests.post("http://names.pub/usernames", data=dict({"requestType":"newUsernameName"})).text, "html.parser").find("h2").getText()
23 open("alt-names.txt", "a").write("\n"+u)
24 print("Creating new alt : " + u)
25 r = requests.post("https://legacy.hackerexperience.com/ajax.php", data=dict({"username":u, "func":"check-user"})).text
26 if r == 'true':
27 return u
28 else:
29 return getRandomUsername()
30
31def randomGenerator(N):
32 return ''.join(random.choice(string.ascii_uppercase + string.digits + string.ascii_lowercase) for _ in range(N))
33
34def dot_trick(username):
35 i = 0
36 emails = list()
37 username_length = len(username)
38 combinations = pow(2, username_length - 1)
39 padding = "{0:0" + str(username_length - 1) + "b}"
40 for i in range(0, combinations):
41 bin = padding.format(i)
42 full_email = ""
43
44 for j in range(0, username_length - 1):
45 i = i + 1
46 full_email += (username[j]);
47 if bin[j] == "1":
48 full_email += "."
49 full_email += (username[j + 1])
50 emails.append(full_email + "@gmail.com")
51 return emails
52
53
54def scramble_email(address):
55 original_adress = address
56 t = tuple(address.split("@"))
57 address, host = t
58 l = len(address)-1
59 address = "".join([address[i]+random.choice(["","."]) for i in [i[0] for i in enumerate(list(address))] if i != l]+[address[l]])
60 email = address +"@"+ host
61 r = requests.post("https://legacy.hackerexperience.com/ajax.php", data=dict({"email":email, "func":"check-mail"})).text
62 if r == 'true':
63 return email
64 else:
65 return scramble_email(original_adress)
66
67def register():
68
69 username = "experiencehacker32@gmail.com"
70 emails = scramble_email(username)
71 print(emails)
72 API_KEY = ''
73 site_key = '6LceKwITAAAAAKXEDxQXYAsy5g3ikENeg7j9jKIv'
74 url = 'http://legacy.hackerexperience.com/'
75 s.get(url)
76 url = 'http://legacy.hackerexperience.com/'
77 captcha_id = s.post("http://2captcha.com/in.php?key={}&method=userrecaptcha&googlekey={}&pageurl={}".format(API_KEY, site_key, url)).text.split('|')[1]
78 print(captcha_id)
79 if(captcha_id == 'ERROR_ZERO_BALANCE'):
80 print("No balance")
81 recaptcha_answer = s.get("http://2captcha.com/res.php?key={}&action=get&id={}".format(API_KEY, captcha_id)).text
82 start = time.time()
83 print("solving ref captcha...")
84 while 'CAPCHA_NOT_READY' in recaptcha_answer:
85 sleep(5)
86 recaptcha_answer = s.get("http://2captcha.com/res.php?key={}&action=get&id={}".format(API_KEY, captcha_id)).text
87 if(recaptcha_answer == 'ERROR_CAPTCHA_UNSOLVABLE'):
88 print("Captcha failed")
89 else:
90 end = time.time()
91 print("Time Elapsed: ",end - start)
92 recaptcha_answer = recaptcha_answer.split('|')[1]
93 username = getRandomUsername()
94 with open("acc.txt", "a") as acc:
95 prep = username + "\n"
96 acc.writelines(prep)
97 password = 'test123'
98 payload = {
99 'username':username,
100 'password':password,
101 'email':emails,
102 'g-recaptcha-response':recaptcha_answer,
103 'terms':1
104 }
105 url = 'https://legacy.hackerexperience.com/register'
106 test = s.post(url,payload)
107 return True
108
109
110
111def emailAccount():
112 EMAIL_ACCOUNT = ""
113 PASSWORD = ""
114 mail = imaplib.IMAP4_SSL('imap.gmail.com')
115 mail.login(EMAIL_ACCOUNT, PASSWORD)
116 mail.list()
117 mail.select('inbox')
118 result, data = mail.uid('search', None, "UNSEEN") # (ALL/UNSEEN)
119 i = len(data[0].split())
120
121 for x in range(i):
122 latest_email_uid = data[0].split()[x]
123 result, email_data = mail.uid('fetch', latest_email_uid, '(RFC822)')
124 # result, email_data = conn.store(num,'-FLAGS','\\Seen')
125 # this might work to set flag to seen, if it doesn't already
126 raw_email = email_data[0][1]
127 raw_email_string = raw_email.decode('utf-8')
128 email_message = email.message_from_string(raw_email_string)
129
130 # Header Details
131 date_tuple = email.utils.parsedate_tz(email_message['Date'])
132 if date_tuple:
133 local_date = datetime.datetime.fromtimestamp(email.utils.mktime_tz(date_tuple))
134 local_message_date = "%s" %(str(local_date.strftime("%a, %d %b %Y %H:%M:%S")))
135 email_from = str(email.header.make_header(email.header.decode_header(email_message['From'])))
136 email_to = str(email.header.make_header(email.header.decode_header(email_message['To'])))
137 subject = str(email.header.make_header(email.header.decode_header(email_message['Subject'])))
138
139 if(subject == 'Hacker Experience email confirmation'):
140 # Body details
141 for part in email_message.walk():
142 if part.get_content_type() == "text/plain":
143 body = part.get_payload(decode=True)
144 body = body.decode('utf-8')
145 body = body.split("You can do so by clicking here or inserting manually the following URL:")
146 body = body[1].split("If you prefer, you can simply go to our welcome page and paste your activation code:")
147 body = body[0].replace("\r", "")
148 body = body.replace("\n", "")
149 response = s.get(body)
150 s.get("https://legacy.hackerexperience.com/index")
151 return True
152
153 return False
154
155
156def logClear():
157 logUrl = "https://legacy.hackerexperience.com/logEdit"
158 payload = {
159 'id':1,
160 'log':''
161 }
162 response = s.post(logUrl,payload)
163 newURL = response.url
164 time.sleep(4)
165 Log = s.get(newURL)
166 time.sleep(1)
167 Log = s.get("https://legacy.hackerexperience.com/log")
168 s.get("https://legacy.hackerexperience.com/logout")
169 print("Log cleared - Alt created - Logged out\n")
170
171def btcLogin():
172 bitcoinURL = 'https://legacy.hackerexperience.com/internet?ip=99.232.28.232'
173 url = "https://legacy.hackerexperience.com/bitcoin.php"
174 payload = {
175 'func':'btcLogin',
176 'addr':btcAddress,
177 'key':btcKey
178 }
179 s.post(url, payload)
180 test = s.get(bitcoinURL)
181 print("Successfully logged into BTC Market.")
182
183def certificate1():
184 url = 'https://legacy.hackerexperience.com/university?opt=certification&learn=1&page=3'
185 html = s.get(url)
186 html = html.text
187 soup = BeautifulSoup(html, 'html.parser')
188 href = soup.find('a', {'class': 'btn btn-success'}).get('href')
189 completeCert = 'https://legacy.hackerexperience.com/'+href
190 cert = s.get(completeCert)
191 #<a class="btn btn-success" href="university?opt=certification&complete=e2a421b7ad64cdcfa5521efe3453a5cb">Complete this certification</a>
192
193def certificate2():
194 certUrl = 'https://legacy.hackerexperience.com/university?opt=certification&learn=2&page=3'
195 url = 'https://legacy.hackerexperience.com/university'
196 payload = {
197 'act':'buy',
198 'id':2
199 }
200 s.post(url,payload)
201 html = s.get(certUrl)
202 html = html.text
203
204 soup = BeautifulSoup(html, 'html.parser')
205 href = soup.find('a', {'class': 'btn btn-success'}).get('href')
206 completeCert = 'https://legacy.hackerexperience.com/'+href
207 cert = s.get(completeCert)
208
209def bankAccount():
210 bankURL = 'https://legacy.hackerexperience.com/finances'
211 html = s.get(bankURL)
212 html = html.text
213 soup = BeautifulSoup(html, 'html.parser')
214 bank = soup.find('span', {'class': 'green'}).next_sibling
215 bank = bank.split(' at #')[1]
216 bank = bank.split('\n')
217 bankAcc = bank[0]
218 return bankAcc
219
220def sellBTC():
221 global loop
222 bankAcc = bankAccount()
223 bitcoinURL = 'https://legacy.hackerexperience.com/internet?ip=99.232.28.232'
224 html = s.get(bitcoinURL)
225 html = html.text
226 soup = BeautifulSoup(html, 'html.parser')
227 price = soup.find('span', {'class': 'green'})
228 price = price.text
229 price = price.split('$')
230 price = price[1]
231 amountOfBtc = (200000 / int(price)) + 5
232 amountOfBtc = round(amountOfBtc)
233 url = 'https://legacy.hackerexperience.com/internet?ip=99.232.28.232'
234 html = s.get(url)
235 html = html.text
236 soup = BeautifulSoup(html, 'html.parser')
237 bitcoins = soup.find('div', {'style': 'overflow: hidden;'})
238 bitcoins = bitcoins.text
239 bitcoins = bitcoins.split("Bitcoins: ")
240 bitcoins = bitcoins[1].split(" BTC")
241 if(float(bitcoins[0]) - (amountOfBtc * 2) <= 0):
242 loop = False
243 else:
244 print("BTC Balance:",bitcoins[0])
245
246 bitcoinSellURL = 'https://legacy.hackerexperience.com/bitcoin.php'
247 payload = {
248 'func':'btcSell',
249 'amount':amountOfBtc,
250 'acc':bankAcc
251 }
252 s.post(bitcoinSellURL,payload)
253 print("Sold BTC")
254
255
256def buyInternet():
257 bankAcc = bankAccount()
258 hardwareURL = 'https://legacy.hackerexperience.com/hardware'
259 payload = {
260 'acc':bankAcc,
261 'act':'net',
262 'part-id':10,
263 'price':100000
264 }
265 s.post(hardwareURL, payload)
266 print("Bought Internet")
267
268
269
270def clanCreate():
271 bankAcc = bankAccount()
272 url = 'https://legacy.hackerexperience.com/clan?action=create'
273 clanTag = randomGenerator(3)
274 clanName = getRandomUsername()
275 payload = {
276 'acc':bankAcc,
277 'ctag':clanTag,
278 'cname':clanName,
279 'act':'create'
280 }
281 response = s.post(url,payload)
282 html = response.text
283 soup = BeautifulSoup(html, 'html.parser')
284 find_error = soup.find_all('<div class="alert alert-error">')
285 if len(find_error) > 0:
286 print("Clan name/tag already in use")
287 return clanCreate()
288 else:
289 print("Clan creation successful")
290
291
292def fetchIP():
293 try:
294 clanUrl = 'https://legacy.hackerexperience.com/clan'
295 html = s.get(clanUrl)
296 html = html.text
297 soup = BeautifulSoup(html, 'html.parser')
298 test = soup.find_all('li')
299 ipSplit = test[22].a["href"]
300 ip = ipSplit.replace('internet?ip=', '')
301 return ip
302 except:
303 print("Clan failed to create... re-creating new one")
304 clanCreate()
305 fetchIP()
306
307def selfIP():
308 homeUrl = 'https://legacy.hackerexperience.com/index'
309 html = s.get(homeUrl)
310 html = html.text
311 soup = BeautifulSoup(html, 'html.parser')
312 test = soup.find_all('script')
313 calc = test[0].text
314 selfIP = calc.replace("var indexdata={ip:'", "")
315 selfIP = selfIP.split("',")
316 print(selfIP)
317 with open("accIP.txt", "a") as ip:
318 prep = str(selfIP[0])+"\n"
319 ip.writelines(prep)
320
321def clanServer():
322 selfIP()
323 clanIP = fetchIP()
324 url = 'https://legacy.hackerexperience.com/internet?ip=253.225.100.199'+str(clanIP)
325 s.get(url)
326 url = 'https://legacy.hackerexperience.com/internet?action=login&user=clan&pass=clan'
327 s.get(url)
328 url = 'https://legacy.hackerexperience.com/internet?view=clan&action=internet'
329 acc = bankAccount()
330 payload = {
331 'acc':acc,
332 'act':'net',
333 'part-id':'10',
334 'price':100000,
335 'clan':1
336 }
337 s.post(url,payload)
338 print("Clan internet bought.")
339
340def clearClanLog():
341 url = 'https://legacy.hackerexperience.com/logEdit'
342 payload = {
343 'id':0,
344 'log':''
345 }
346 s.post(url,payload)
347 print("Clan log successfuly cleared")
348
349def clanIP():
350 clanUrl = 'https://legacy.hackerexperience.com/clan'
351 html = s.get(clanUrl)
352 html = html.text
353 soup = BeautifulSoup(html, 'html.parser')
354 test = soup.find_all('li')
355 ipSplit = test[22].a["href"]
356 ip = ipSplit.replace('internet?ip=', '')
357 with open("clanIP.txt", "a") as file:
358 prep = str(ip)+"\n"
359 file.writelines(prep)
360
361while loop == True:
362 attempts = 0
363 if register() == True:
364 time.sleep(10)
365 found = False
366 while attempts < 15 and found == False:
367 found = emailAccount()
368 print(found)
369 sleep(2)
370 attempts+=1
371 print(attempts)
372 if attempts == 15:
373 print("Email not found --> Re-registering user.")
374 continue
375
376 certificate1()
377 certificate2()
378 btcLogin()
379 sellBTC()
380 buyInternet()
381 clanCreate()
382 clanServer()
383 clanIP()
384 clearClanLog()
385 logClear()
386 else:
387 print("Email in use!")