Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
478
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.92 KB | None | 0 0
  1. import requests
  2. import json
  3. def for_gay_sh2_json(crapjson, *args):
  4.         args = list(args)
  5.         while args:
  6.             crapjson = crapjson[args.pop(0)]
  7.             if type(crapjson) == str:
  8.                 crapjson = json.loads(crapjson)
  9.         return crapjson
  10. class SH2(object):
  11.     """docstring for ClassName"""
  12.     def __init__(self, email, password):
  13.         super(SH2, self).__init__()
  14.         self.ses = requests.Session()
  15.         self.ses.post("https://www.slavehack2.com/pages/auth.php", data={'email': email, 'password': password}, headers={'x-requested-with':'XMLHttpRequest'})
  16.         self.ses.headers.update({"content-type":"application/x-www-form-urlencoded; charset=UTF-8", 'Server':'Slavehack2'})
  17.  
  18.     def pulse(self, ip):
  19.         payload = 'action=get&data='+json.dumps({"command":'["pulse", "'+ip+'"]'})
  20.         r = self.ses.post("https://www.slavehack2.com/theme/api/?terminal", data=payload)
  21.         return r.json()
  22.  
  23.     def rm(self, filename):
  24.         payload = 'action=get&data='+json.dumps({"command":'["rm", "'+filename+'"]'})
  25.         r = self.ses.post("https://www.slavehack2.com/theme/api/?terminal", data=payload)
  26.         return r.json()
  27.  
  28.     def finishproc(self, id):
  29.         payload = 'action=get&data={"finish":"'+id+'"}'
  30.         r = self.ses.post("https://www.slavehack2.com/theme/api/?processes", data=payload)
  31.         return r.json()
  32.     def checkproc(self, id):
  33.         payload = 'action=get&data={}'
  34.         r = self.ses.post("https://www.slavehack2.com/theme/api/?processes", data=payload)
  35.         timeleft = int(for_gay_sh2_json(r.json(), 'content', 0, 'timeleft'))    
  36.         return timeleft < 0
  37.     def resetpulse(self):
  38.         payload = 'action=get&data={"pulse":true}'
  39.         r = self.ses.post("https://www.slavehack2.com/theme/api/?reset", data=payload)
  40.         return r.json()
  41.  
  42.    
  43. bot = SH2("altayakkus1993@googlemail.com","13579altay")
  44. print(bot.checkproc('78241'))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement