Skip to content

Commit

Permalink
better handling of isgraphql()
Browse files Browse the repository at this point in the history
  • Loading branch information
halfluke committed Sep 3, 2022
1 parent fb93e25 commit 1ecf45b
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions graphql-cop.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,22 +85,18 @@
json_output = []

for path in paths:
if not is_graphql(path, proxy, HEADERS):
print(path, 'does not seem to be running GraphQL.')
continue
for test in tests:
json_output.append(test(path, proxy, HEADERS))

json_output = sorted(json_output, key=lambda d: d['title'])

isgraphql=0
if options.format == 'json':
for i in range(len(json_output)):
print(json_output[i], end='\n\n')
if json_output[i]['result']:
isgraphql += 1
else:
for i in json_output:
if i['result']:
print('[{}] {} - {} ({})'.format(i['severity'], i['title'], i['description'], i['impact']))
isgraphql += 1

if isgraphql == 0:
print(url, 'does not seem to be running GraphQL.')

0 comments on commit 1ecf45b

Please sign in to comment.