Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Account:
- def getToken(self):
- url = "https://www.darkorbit.com/"
- r = requests.get(url, verify=False)
- tree = html.fromstring(r.content)
- tokenPath = tree.xpath("//form[@name='bgcdw_login_form']/@action")
- self.token = after(tokenPath[0], "token=")
- def login(self, user, passs, file):
- self.username = user
- self.password = passs
- self.file = file
- loginData = {'username': user, 'password': passs}
- loginURL = "https://sas.bpsecure.com/Sas/Authentication/Bigpoint?authUser=22&token=" + self.token
- d = requests.post(loginURL, data=loginData, verify=False)
- self.server = between(d.url, "://", ".dark")
- if "darkorbit.com/indexInternal.es?" in d.url:
- self.cookies = d.cookies
- self.startContent = d.content
- return "success"
- else:
- print('Account ' + str(self.file) + ' failed to login.')
- def getName(self):
- tree = html.fromstring(self.startContent)
- name = tree.xpath('//*[@id="userInfoSheet"]/div[1]/text()')
- self.name = name[1].strip()
- def getLoginBonus(self):
- bonusUrl = 'https://'+self.server+'.darkorbit.com/flashAPI/dailyLogin.php?doBook=1'
- c = requests.post(bonusUrl, cookies = self.cookies, verify=False)
- if 'success' and 'true' in c.content.decode():
- print('Login bonus collected on Account' + str(self.file))
- else:
- print('Login Bonus was already collected on Account' + str(self.file))
- def getInfo(self):
- rankURL = "https://"+self.server+".darkorbit.com/indexInternal.es?action=internalHallofFame&view=dailyRank&lang=en"
- c = requests.get(rankURL, cookies = self.cookies, verify=False)
- tree = html.fromstring(c.content)
- accInfo = tree.xpath('//tr/td[@class="hof_units_amount"]/text()')
- self.xp = accInfo[0]
- self.honor = accInfo[1]
- self.level = accInfo[3]
- self.rankpoints = accInfo[-1]
- self.uid = tree.xpath('//*[@id="header_top_id"]/div/span/text()')
- self.rank = tree.xpath('//*[@id="hof_content"]/div[1]/strong/text()')[0]
- xpLevel = between(c.text, "header_ttips['exp'] =", """;
- header_ttips['hnr']""")
- rpLevel = tree.xpath('//*[@id="hof_daily_wrapper"]/p[2]/text()')
- self.xpToNextLevel = clearIntFromString(xpLevel)
- self.rpToNextRank = clearIntFromString(rpLevel)
- self.uridium = self.inventory['data']['money']['uridium']
- self.credits = self.inventory['data']['money']['credits']
- def getGateInfo(self):
- self.allGates = []
- gateUrl = 'https://'+self.server+'.darkorbit.com/flashinput/galaxyGates.php?userID='+self.uid[0]+'&action=init&sid='+self.cookies['dosid']
- b = requests.post(gateUrl, cookies=self.cookies)
- self.gateInfo = b.content.decode()
- gateInfo = untangle.parse(self.gateInfo)
- z = 0
- self.gateEnergy = gateInfo.jumpgate.samples.cdata
- while z < 20:
- try:
- total = gateInfo.jumpgate.gates.gate[z]['total']
- current = gateInfo.jumpgate.gates.gate[z]['current']
- prepared = gateInfo.jumpgate.gates.gate[z]['prepared']
- self.allGates.append(gates(gateList[z], total, current, prepared))
- z += 1
- except IndexError:
- return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement