Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #exec(open('script.py').read())
- import urllib, urllib.parse, urllib.request
- from pprint import pprint
- import hashlib
- import json
- host = "localhost"
- port = 65665
- usr = "admin"
- pwd = "changeme"
- salt = "salt"
- print("Call method: ")
- method = input()
- methodToCall = urllib.parse.quote(method)
- print("Called "+method)
- arg = ""
- args = []
- while not arg == "q":
- print('Arg (q for quit): ')
- arg = input()
- if not arg == "q":
- args.append(arg)
- args = urllib.parse.quote(json.dumps(args))
- print("Final args: ")
- print(args)
- key = hashlib.sha256()
- key.update(usr.encode('utf-8'))
- key.update(method.encode('utf-8'))
- key.update(pwd.encode('utf-8'))
- key.update(salt.encode('utf-8'))
- key = key.hexdigest()
- print(key)
- url = "http://{}:{}/api/call?method={}&args={}&key={}".format(host, port, methodToCall, args, key)
- print('Tried to access '+url)
- f = urllib.request.urlopen(url)
- response = json.loads(f.read())
- pprint(response)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement