Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add variable proxy support #26

Merged
merged 2 commits into from
Oct 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ Options:
json
-f, --force Forces a scan when GraphQL cannot be detected
-d, --debug Append a header with the test name for debugging
-x, --proxy Sends the request through http://127.0.0.1:8080 proxy
-x PROXY, --proxy=PROXY
HTTP(S) proxy URL in the form
http://user:pass@host:port
-v, --version Print out the current version and exit.
```

Expand Down Expand Up @@ -97,10 +99,10 @@ python3 graphql-cop.py -t https://mywebsite.com/graphql -o json
'title': 'Directive Overloading'}]
```

Test a website using `graphql-cop` through a proxy (e.g. Burp Suite) with custom headers (e.g. Authorization):
Test a website using `graphql-cop` through a proxy (e.g. Burp Suite listening on 127.0.0.1:8080) with custom headers (e.g. Authorization):

```
$ python3 graphql-cop.py -t https://mywebsite.com/graphql --proxy --header '{"Authorization": "Bearer token_here"}'
$ python3 graphql-cop.py -t https://mywebsite.com/graphql --proxy=http://127.0.0.1:8080 --header '{"Authorization": "Bearer token_here"}'

GraphQL Cop 1.2
Security Auditor for GraphQL
Expand Down
12 changes: 6 additions & 6 deletions graphql-cop.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
parser.add_option('-f', '--force', dest='forced_scan', action='store_true',
help='Forces a scan when GraphQL cannot be detected', default=False)
parser.add_option('-d', '--debug', dest='debug_mode', action='store_true',
help='Append a header with the test name for debugging', default=False)
parser.add_option('-x', '--proxy', dest='proxy', action='store_true', default=False,
help='Sends the request through http://127.0.0.1:8080 proxy')
help='Append a header with the test name for debugging', default=False)
parser.add_option('-x', '--proxy', dest='proxy', default=None,
help='HTTP(S) proxy URL in the form http://user:pass@host:port')
parser.add_option('--version', '-v', dest='version', action='store_true', default=False,
help='Print out the current version and exit.')

Expand All @@ -50,10 +50,10 @@
parser.print_help()
sys.exit(1)

if options.proxy == True:
if options.proxy:
proxy = {
'http': 'http://127.0.0.1:8080',
'https': 'http://127.0.0.1:8080',
'http': options.proxy,
'https': options.proxy
}
else:
proxy = {}
Expand Down