Skip to content

Commit

Permalink
add timeout, add extra paths
Browse files Browse the repository at this point in the history
  • Loading branch information
Dolev Farhi committed Sep 20, 2021
1 parent 4bed935 commit a6d83f4
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
4 changes: 3 additions & 1 deletion graphw00f/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def draw_art():

def possible_graphql_paths():
return [
'/',
'/graphql',
'/graphiql',
'/v1/graphql',
Expand All @@ -60,7 +61,8 @@ def possible_graphql_paths():
'/api/graphiql',
'/console',
'/playground',
'/gql'
'/gql',
'/index.php?graphql'
]

def get_engines():
Expand Down
7 changes: 5 additions & 2 deletions graphw00f/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ class GraphQLError(Exception):
class GRAPHW00F:
def __init__(self, headers,
cookies,
timeout,
follow_redirects=False):
self.url = 'http://example.com'
self.cookies = cookies
self.headers = headers
self.follow_redirects = follow_redirects
self.follow_redirects = follow_redirects,
self.timeout = timeout

def check(self, url):
query = '''
Expand Down Expand Up @@ -82,6 +84,7 @@ def graph_query(self, url, operation='query', payload={}):
cookies=self.cookies,
verify=False,
allow_redirects=self.follow_redirects,
timeout=self.timeout,
json={operation:payload})
return response.json()
except:
Expand Down Expand Up @@ -505,4 +508,4 @@ def engine_tartiflette(self):
if error_contains(response, 'syntax error, unexpected IDENTIFIER'):
return True

return False
return False
10 changes: 8 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def main():
parser.add_option('-t', '--target', dest='url', help='target url with the path')
parser.add_option('-f', '--fingerprint', dest='fingerprint', default=False, action='store_true', help='fingerprint mode')
parser.add_option('-d', '--detect', dest='detect', default=False, action='store_true', help='detect mode')
parser.add_option('-T', '--tim eout', dest='timeout', default=10, help='timeout')
parser.add_option('-o', '--output-file', dest='output_file',
help='Output results to a file (CSV)', default=None)
parser.add_option('-l', '--list', dest='list', action='store_true', default=False,
Expand Down Expand Up @@ -62,11 +63,16 @@ def main():
if not options.detect and not options.fingerprint:
parser.print_help()
sys.exit(1)


if not isinstance(options.timeout, int):
options.timeout = 10

g = GRAPHW00F(follow_redirects=options.followredirect,
headers=conf.HEADERS,
cookies=conf.COOKIES)
cookies=conf.COOKIES,
timeout=options.timeout)
url = options.url

url_scheme = urlparse(url).scheme
url_netloc = urlparse(url).netloc
detected = False
Expand Down
2 changes: 1 addition & 1 deletion version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION = '1.0.4'
VERSION = '1.0.5'

0 comments on commit a6d83f4

Please sign in to comment.