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