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