diff --git a/utils.py b/utils.py index 96d30f4..539b4da 100644 --- a/utils.py +++ b/utils.py @@ -7,7 +7,9 @@ import requests import sys import time -cmdlist = ["exit", "help", "dump_old", "dump_new", "postgresqli", "mysqli", "mssqli", "nosqli", "mutation", "edges", "node", "$regex", "$ne", "__schema"] +cmdlist = ["exit", "help", "dump_old", "dump_new", "postgresqli", "mysqli", "mssqli", "nosqli", "mutation", "edges", + "node", "$regex", "$ne", "__schema"] + def auto_completer(text, state): options = [x for x in cmdlist if x.startswith(text)] @@ -31,18 +33,20 @@ def requester(URL, method, payload, headers=None): print("\033[91m/!\ API didn't respond correctly to a POST method !\033[0m") return None else: - r = requests.get( URL+"?query={}".format(payload), verify=False) + r = requests.get(URL + "?query={}".format(payload), verify=False) return r def parse_args(): parser = argparse.ArgumentParser() - parser.add_argument('-u', action ='store', dest='url', help="URL to query : example.com/graphql?query={}") - parser.add_argument('-v', action ='store', dest='verbosity', help="Enable verbosity", nargs='?', const=True) - parser.add_argument('--method', action ='store', dest='method', help="HTTP Method to use interact with /graphql endpoint", nargs='?', const=True, default="GET") - parser.add_argument('--headers', action='store', dest='headers', help="HTTP Headers sent to /graphql endpoint", nargs='?', const=True, type=str) + parser.add_argument('-u', action='store', dest='url', help="URL to query : example.com/graphql?query={}") + parser.add_argument('-v', action='store', dest='verbosity', help="Enable verbosity", nargs='?', const=True) + parser.add_argument('--method', action='store', dest='method', + help="HTTP Method to use interact with /graphql endpoint", nargs='?', const=True, default="GET") + parser.add_argument('--headers', action='store', dest='headers', help="HTTP Headers sent to /graphql endpoint", + nargs='?', const=True, type=str) results = parser.parse_args() - if results.url == None: + if results.url is None: parser.print_help() exit() return results