Skip to content

Commit 54646c7

Browse files
committed
add pypy support + refactor
1 parent 145212f commit 54646c7

File tree

94 files changed

+3031
-347
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+3031
-347
lines changed

.gitignore

+8-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,11 @@ venv/
22
vulnerable*.txt
33
potential*.txt
44
*.log
5-
__pycache__/
5+
__pycache__/
6+
nordvpn_login.csv
7+
nordvpn_login_token.csv
8+
bounty_drive/outputs/reports/*.csv
9+
bounty_drive/outputs/reports/*.zip
10+
bounty_drive/outputs/html_google_todo/*.html
11+
pypy3-venv/*
12+
python3-venv/*

INSTALL.md

+46-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,54 @@
22

33
## Pre-Commit
44

5+
```bash
56
python3 -m pip install pre-commit
67
pre-commit installed at .git/hooks/pre-commit
7-
8+
```
89

910
## Classical
1011

11-
## PyPy
12+
```bash
13+
sudo apt-get install python3 python3-dev python3-venv
14+
python3 --version
15+
# Python 3.10.12
16+
```
17+
18+
```bash
19+
python3 -m venv python3-venv
20+
source python3-venv/bin/activate
21+
python3 -m pip install -U pip wheel
22+
python3 -m pip install -r requirements.txt
23+
```
24+
25+
Update `config.ini`
26+
27+
Run with `python3 bounty_drive.py`
28+
29+
## PyPy
30+
31+
Not ready - SEGFAULT in some libs (urllib3, cryptography downgraded).
32+
33+
Install PyPy from [here](https://doc.pypy.org/en/latest/install.html)
34+
35+
Package compatible with PyPy are in `requirements_pypy.txt`
36+
* http://packages.pypy.org/
37+
* https://doc.pypy.org/en/latest/cpython_differences.html
38+
39+
```bash
40+
sudo apt-get install pypy3 pypy3-dev pypy3-venv
41+
pypy3 --version
42+
# Python 3.9.19 (7.3.16+dfsg-2~ppa1~ubuntu20.04, Apr 26 2024, 13:32:24)
43+
# [PyPy 7.3.16 with GCC 9.4.0]
44+
```
45+
46+
```bash
47+
pypy3 -m venv pypy3-venv
48+
source pypy3-venv/bin/activate
49+
pypy3 -m pip install -U pip wheel
50+
pypy3 -m pip install -r requirements_pypy.txt
51+
```
52+
53+
pdate `config.ini`
54+
55+
Run with `pypy3 bounty_drive.py`

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ TODO: we should proxy proxy chains
4646

4747
# HAPPY HUNTING
4848

49+
sudo apt-get install portaudio19-dev
4950

5051
# Ressource:
5152
https://raw.githubusercontent.com/darklotuskdb/SSTI-XSS-Finder/main/Payloads.txt
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#########################################################################################
2+
# Global variables
3+
#########################################################################################
4+
5+
# GitHub Dorking
6+
GITHUB_API_URL = "https://api.github.com"
7+
TOKENS_LIST = ["your_github_token"] # Add your GitHub tokens here
8+
DORK_LIST = ["example_dork1", "example_dork2"] # Add your dorks here
9+
QUERIES_LIST = ["example_query"] # Add your queries here
10+
ORGANIZATIONS_LIST = ["example_organization"] # Add your organizations here
11+
USERS_LIST = ["example_user"] # Add your users here

bounty_drive/attacks/dorks/github_dorking.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import requests
1212
from termcolor import cprint
1313

14-
from utils.github_config import GITHUB_API_URL, TOKENS_LIST
14+
from attacks.dorks.github_config import GITHUB_API_URL, TOKENS_LIST
1515
from utils.app_config import *
1616

1717
token_index = 0

bounty_drive/attacks/dorks/google_dorking.py

+54-21
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
USER_AGENTS,
1818
)
1919

20-
from utils.web_scraper import parse_google_search_results, render_js_and_get_text
20+
from scraping.web_scraper import parse_google_search_results, render_js_and_get_text
2121

22-
from utils.proxies_manager import prepare_proxies, round_robin_proxies
23-
from utils.request_manager import param_converter, start_request
24-
from utils.results_manager import get_processed_dorks, safe_add_result
22+
from vpn_proxies.proxies_manager import prepare_proxies, round_robin_proxies
23+
from requester.request_manager import param_converter, start_request
24+
from reporting.results_manager import get_processed_dorks, safe_add_result
2525

2626
dork_id_lock = threading.Lock()
2727

@@ -32,6 +32,7 @@ def google_search_with_proxy(
3232
category,
3333
config,
3434
domain,
35+
processed_dorks,
3536
retries=1,
3637
advanced=False,
3738
dork_id=0,
@@ -46,7 +47,7 @@ def google_search_with_proxy(
4647

4748
params = prepare_params(config)
4849

49-
dork_id = perform_searches(
50+
return perform_searches(
5051
full_query,
5152
proxies,
5253
category,
@@ -55,11 +56,10 @@ def google_search_with_proxy(
5556
config,
5657
advanced,
5758
dork_id,
59+
processed_dorks,
5860
use_session=not (proxy == None),
5961
)
6062

61-
return dork_id
62-
6363

6464
def prepare_params(config):
6565
return {
@@ -79,6 +79,7 @@ def perform_searches(
7979
config,
8080
advanced,
8181
dork_id,
82+
processed_dorks,
8283
use_session,
8384
):
8485

@@ -92,6 +93,7 @@ def perform_searches(
9293
config,
9394
advanced,
9495
dork_id,
96+
processed_dorks,
9597
use_session=use_session,
9698
)
9799

@@ -107,10 +109,30 @@ def execute_search_with_retries(
107109
config,
108110
advanced,
109111
dork_id,
112+
processed_dorks,
110113
use_session=False,
111114
):
112115
base_url = "https://www.google.com/search"
113-
headers = {"User-Agent": random.choice(USER_AGENTS)}
116+
headers = {
117+
"User-Agent": random.choice(USER_AGENTS),
118+
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
119+
"Accept-Language": "en-US,en;q=0.5",
120+
"Accept-Encoding": "gzip,deflate",
121+
"Connection": "close",
122+
"DNT": "1",
123+
"accept-language": "en-US,en;q=0.9",
124+
"cache-control": "max-age=0",
125+
"Upgrade-Insecure-Requests": "1",
126+
}
127+
128+
if query in processed_dorks:
129+
cprint(
130+
f"Skipping already processed dork: {query}",
131+
"yellow",
132+
file=sys.stderr,
133+
)
134+
return dork_id
135+
114136
for retry_no in range(retries):
115137
if use_session:
116138
cprint(
@@ -127,7 +149,14 @@ def execute_search_with_retries(
127149
headers=headers,
128150
params=params,
129151
is_json=False,
130-
secured=True if "socks" in proxies["https"] else False,
152+
secured=(
153+
True
154+
if proxies
155+
and "https" in proxies
156+
and proxies["https"]
157+
and "socks" in proxies["https"]
158+
else False
159+
),
131160
session=session,
132161
cookies={
133162
"CONSENT": "PENDING+987",
@@ -148,15 +177,24 @@ def execute_search_with_retries(
148177
headers=headers,
149178
params=params,
150179
is_json=False,
151-
secured=True if "socks" in proxies["https"] else False,
180+
secured=(
181+
True
182+
if proxies
183+
and "https" in proxies
184+
and proxies["https"]
185+
and "socks" in proxies["https"]
186+
else False
187+
),
152188
cookies={
153189
"CONSENT": "PENDING+987",
154190
"SOCS": "CAESHAgBEhJnd3NfMjAyMzA4MTAtMF9SQzIaAmRlIAEaBgiAo_CmBg",
155191
},
156192
)
193+
194+
urls = []
157195
if response:
158196
urls = parse_google_search_results(proxies, advanced, query, response.text)
159-
if not urls or len(urls) == 0:
197+
if (not urls or len(urls) == 0) and config["use_selenium"]:
160198
cprint(
161199
f"Parsing for google search failed for {query} - retrying with selenium...",
162200
"red",
@@ -168,10 +206,10 @@ def execute_search_with_retries(
168206
urls = parse_google_search_results(
169207
proxies, advanced, query, html_content
170208
)
171-
result = dork_id, category, urls, query
172-
safe_add_result(result, config)
173-
with dork_id_lock:
174-
dork_id += 1
209+
result = dork_id, category, urls, query
210+
safe_add_result(result, config)
211+
# with dork_id_lock:
212+
# dork_id += 1
175213
# TODO to be faster also record non functionnal dork
176214
return dork_id
177215

@@ -282,12 +320,6 @@ def load_google_dorks_and_search(config, categories):
282320
file=sys.stderr,
283321
)
284322
processed_dorks = get_processed_dorks(config)
285-
search_tasks = filter_search_tasks(search_tasks, processed_dorks)
286-
cprint(
287-
f"Number of dorks to process: {sum([len(search_tasks[task]) for task in search_tasks])}",
288-
"yellow",
289-
file=sys.stderr,
290-
)
291323

292324
if not search_tasks:
293325
cprint(f"No dorks to process.", "red", file=sys.stderr)
@@ -328,6 +360,7 @@ def load_google_dorks_and_search(config, categories):
328360
task["category"],
329361
config,
330362
task["domain"],
363+
processed_dorks,
331364
): task
332365
for task in search_tasks_with_proxy
333366
}

bounty_drive/attacks/sqli/sqli.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from tqdm import tqdm
99
from urllib3 import Retry
1010
from requests.adapters import HTTPAdapter
11-
from utils.proxies_manager import round_robin_proxies
11+
from vpn_proxies.proxies_manager import round_robin_proxies
1212

1313

1414
def run_sqlmap(url, proxy):

0 commit comments

Comments
 (0)