GraphQLmap/graphqlmap.py

77 lines
2.5 KiB
Python
Raw Normal View History

2019-06-21 14:42:05 +00:00
#!/usr/bin/python
import argparse
2019-06-21 14:42:05 +00:00
import json
import re
2019-06-21 14:42:05 +00:00
import readline
import requests
import sys
import time
from utils import *
from attacks import *
2020-02-05 12:05:56 +00:00
class GraphQLmap(object):
2020-02-05 12:05:56 +00:00
author = "@pentest_swissky"
version = "1.0"
endpoint = "graphql"
2020-02-05 12:05:56 +00:00
method = "POST"
args = None
2020-02-05 12:05:56 +00:00
url = None
headers = None
def __init__(self, args):
print(" _____ _ ____ _ ")
print(" / ____| | | / __ \| | ")
print(" | | __ _ __ __ _ _ __ | |__ | | | | | _ __ ___ __ _ _ __ ")
print(" | | |_ | '__/ _` | '_ \| '_ \| | | | | | '_ ` _ \ / _` | '_ \ ")
print(" | |__| | | | (_| | |_) | | | | |__| | |____| | | | | | (_| | |_) |")
print(" \_____|_| \__,_| .__/|_| |_|\___\_\______|_| |_| |_|\__,_| .__/ ")
print(" | | | | ")
print(" |_| |_| ")
2020-02-05 12:05:56 +00:00
print(" " * 30, end='')
print(f"\033[1mAuthor\033[0m: {self.author} \033[1mVersion\033[0m: {self.version} ")
self.args = args
self.url = args.url
self.method = args.method
2020-02-05 12:05:56 +00:00
self.headers = None if not args.headers else json.loads(args.headers)
while True:
query = input("GraphQLmap > ")
cmdlist.append(query)
if query == "exit" or query == "q":
exit()
elif query == "help":
display_help()
2020-02-05 12:05:56 +00:00
elif query == "debug":
display_types(self.url, self.method, self.headers)
2019-06-21 14:42:05 +00:00
elif query == "dump_new":
dump_schema(self.url, self.method, 15, self.headers)
2019-06-21 14:42:05 +00:00
elif query == "dump_old":
dump_schema(self.url, self.method, 14, self.headers)
2019-06-21 14:42:05 +00:00
elif query == "nosqli":
blind_nosql(self.url, self.method, self.headers)
2019-06-21 14:42:05 +00:00
elif query == "postgresqli":
blind_postgresql(self.url, self.method, self.headers)
2019-06-21 14:42:05 +00:00
elif query == "mysqli":
blind_mysql(self.url, self.method, self.headers)
2019-07-29 16:22:11 +00:00
elif query == "mssqli":
blind_mssql(self.url, self.method, self.headers)
2019-06-21 14:42:05 +00:00
else:
exec_advanced(args.url, self.method, query, self.headers)
2019-06-21 14:42:05 +00:00
2020-02-05 12:05:56 +00:00
2019-06-21 14:42:05 +00:00
if __name__ == "__main__":
readline.set_completer(auto_completer)
readline.parse_and_bind("tab: complete")
args = parse_args()
GraphQLmap(args)