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

added tor support #24

Merged
merged 1 commit into from
Jun 13, 2024
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: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,19 @@
<img src="https://github.com/dolevf/graphql-cop/blob/main/static/images/logo.png?raw=true" width="500px" alt="GraphQL Cop"/>
</p>


## About

GraphQL Cop is a small Python utility to run common security tests against GraphQL APIs. GraphQL Cop is perfect for running CI/CD checks in GraphQL. It is lightweight, and covers interesting security issues in GraphQL.

GraphQL Cop allows you to reproduce the findings by providing cURL commands upon any identified vulnerabilities.
GraphQL Cop allows you to reproduce the findings by providing cURL commands upon any identified vulnerabilities.

## Requirements

- Python3
- Requests Library

## Detections

- Alias Overloading (DoS)
- Batch Queries (DoS)
- GET based Queries (CSRF)
Expand Down Expand Up @@ -50,6 +52,7 @@ Options:
-d, --debug Append a header with the test name for debugging
-x, --proxy Sends the request through http://127.0.0.1:8080 proxy
-v, --version Print out the current version and exit.
-tor, --tor Enable Tor proxy
```

Test a website
Expand All @@ -69,6 +72,7 @@ Starting...
```

Test a website, dump to a parse-able JSON output, cURL reproduction command

```
python3 graphql-cop.py -t https://mywebsite.com/graphql -o json

Expand Down
10 changes: 10 additions & 0 deletions graphql-cop.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
help='Sends the request through http://127.0.0.1:8080 proxy')
parser.add_option('--version', '-v', dest='version', action='store_true', default=False,
help='Print out the current version and exit.')
parser.add_option('--tor','-t', dest='tor', action='store_true', default=False,
help='Sends the request through the Tor network (ensure Tor is running and properly configured)')


options, args = parser.parse_args()
Expand All @@ -55,6 +57,14 @@
'http': 'http://127.0.0.1:8080',
'https': 'http://127.0.0.1:8080',
}
elif options.tor:
import socks
import socket

socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, '127.0.0.1', 9050)
socket.socket = socks.socksocket

proxy = {}
else:
proxy = {}

Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
requests==2.25.1
simplejson==3.17.6
termcolor==2.2.0
termcolor==2.2.0
PySocks==1.7.1