def root_request(self, method, url, args): data = json.dumps({'method':method, 'url':url, 'args': args}).encode() crypt = openssl.encrypt(data, self.root_key) res = self.post_raw('/bin/SPEKE/gateway', binascii.a2b_base64(crypt)) print(res) r = openssl.decrypt_service(res, self.root_key) return r
def vmrequest(self, method, url, args): data = json.dumps({'method':method, 'url':url, 'args': args}).encode() crypt = openssl.encrypt(data, self.vm_k) res = self.post_raw('/bin/uVM/VIOS/g4t3w4y', binascii.a2b_base64(crypt)) self.vm_res = res self.raw = openssl.decrypt_service_raw(res, self.vm_k) r = openssl.decrypt_service(res, self.vm_k) return r
def gateway(self): dico = {'method':'PUT', 'url':'/bin/echo', 'data':'VsOkaW7Dtg=='} data = openssl.encrypt(json.dumps(dico, 'debug-me').encode(), 'debug-me') retour = self.post_raw('/bin/test-gateway', binascii.a2b_base64(data)) return openssl.decrypt_service(retour, 'debug-me')
def srequest(self, method, url, args, service): data = json.dumps({'method':method, 'url':url, 'args': args}).encode() crypt = openssl.encrypt(data, self.service_key) res = self.post_raw('/service/' + service + '/request', binascii.a2b_base64(crypt)) r = openssl.decrypt_service(res, self.service_key) return r