Skip to content

Commit b8a847d

Browse files
Merge pull request #2352 from blacklanternsecurity/bump-httpx-0-28
Bumping httpx / pytest-httpx versions
2 parents 6272a59 + 35604fb commit b8a847d

File tree

14 files changed

+144
-207
lines changed

14 files changed

+144
-207
lines changed

bbot/core/helpers/misc.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def is_domain(d):
5050
if is_ip(d):
5151
return False
5252
extracted = tldextract(d)
53-
if extracted.registered_domain:
53+
if extracted.top_domain_under_public_suffix:
5454
if not extracted.subdomain:
5555
return True
5656
else:
@@ -85,7 +85,7 @@ def is_subdomain(d):
8585
if is_ip(d):
8686
return False
8787
extracted = tldextract(d)
88-
if extracted.registered_domain:
88+
if extracted.top_domain_under_public_suffix:
8989
if extracted.subdomain:
9090
return True
9191
else:
@@ -486,7 +486,7 @@ def split_domain(hostname):
486486
return ("", hostname)
487487
parsed = tldextract(hostname)
488488
subdomain = parsed.subdomain
489-
domain = parsed.registered_domain
489+
domain = parsed.top_domain_under_public_suffix
490490
if not domain:
491491
split = hostname.split(".")
492492
subdomain = ".".join(split[:-2])

bbot/core/helpers/web/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def __init__(self, *args, **kwargs):
7070
kwargs["headers"] = headers
7171
# proxy
7272
proxies = self._web_config.get("http_proxy", None)
73-
kwargs["proxies"] = proxies
73+
kwargs["proxy"] = proxies
7474

7575
log.verbose(f"Creating httpx.AsyncClient({args}, {kwargs})")
7676
super().__init__(*args, **kwargs)

bbot/core/helpers/web/web.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ async def request(self, *args, **kwargs):
9595
files (dict, optional): Dictionary of 'name': file-like-objects for multipart encoding upload.
9696
auth (tuple, optional): Auth tuple to enable Basic/Digest/Custom HTTP auth.
9797
timeout (float, optional): The maximum time to wait for the request to complete.
98-
proxies (dict, optional): Dictionary mapping protocol schemes to proxy URLs.
98+
proxy (str, optional): HTTP proxy URL.
9999
allow_redirects (bool, optional): Enables or disables redirection. Defaults to None.
100100
stream (bool, optional): Enables or disables response streaming.
101101
raise_error (bool, optional): Whether to raise exceptions for HTTP connect, timeout errors. Defaults to False.

bbot/modules/baddns.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class baddns(BaseModule):
2222
"enabled_submodules": "A list of submodules to enable. Empty list (default) enables CNAME, TXT and MX Only",
2323
}
2424
module_threads = 8
25-
deps_pip = ["baddns~=1.4.13"]
25+
deps_pip = ["baddns~=1.9.130"]
2626

2727
def select_modules(self):
2828
selected_submodules = []

bbot/modules/baddns_direct.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class baddns_direct(BaseModule):
1919
"custom_nameservers": "Force BadDNS to use a list of custom nameservers",
2020
}
2121
module_threads = 8
22-
deps_pip = ["baddns~=1.4.13"]
22+
deps_pip = ["baddns~=1.9.130"]
2323

2424
scope_distance_modifier = 1
2525

bbot/modules/baddns_zone.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class baddns_zone(baddns_module):
1616
"only_high_confidence": "Do not emit low-confidence or generic detections",
1717
}
1818
module_threads = 8
19-
deps_pip = ["baddns~=1.4.13"]
19+
deps_pip = ["baddns~=1.9.130"]
2020

2121
def set_modules(self):
2222
self.enabled_submodules = ["NSEC", "zonetransfer"]

bbot/modules/internal/speculate.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,8 @@ async def handle_event(self, event):
176176
org_stubs = set()
177177
if event.type == "DNS_NAME" and event.scope_distance == 0:
178178
tldextracted = self.helpers.tldextract(event.data)
179-
registered_domain = getattr(tldextracted, "registered_domain", "")
180-
if registered_domain:
179+
top_domain_under_public_suffix = getattr(tldextracted, "top_domain_under_public_suffix", "")
180+
if top_domain_under_public_suffix:
181181
tld_stub = getattr(tldextracted, "domain", "")
182182
if tld_stub:
183183
decoded_tld_stub = self.helpers.smart_decode_punycode(tld_stub)

bbot/test/test_step_2/module_tests/test_module_censys.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class TestCensys(ModuleTestBase):
77
async def setup_before_prep(self, module_test):
88
module_test.httpx_mock.add_response(
99
url="https://search.censys.io/api/v1/account",
10-
# match_headers={"Authorization": "Basic YXBpX2lkOmFwaV9zZWNyZXQ="},
10+
match_headers={"Authorization": "Basic YXBpX2lkOmFwaV9zZWNyZXQ="},
1111
json={
1212
"email": "[email protected]",
1313
"login": "nope",
@@ -18,8 +18,9 @@ async def setup_before_prep(self, module_test):
1818
)
1919
module_test.httpx_mock.add_response(
2020
url="https://search.censys.io/api/v2/certificates/search",
21-
# match_headers={"Authorization": "Basic YXBpX2lkOmFwaV9zZWNyZXQ="},
22-
match_content=b'{"q": "names: blacklanternsecurity.com", "per_page": 100}',
21+
match_headers={"Authorization": "Basic YXBpX2lkOmFwaV9zZWNyZXQ="},
22+
method="POST",
23+
match_json={"q": "names: blacklanternsecurity.com", "per_page": 100},
2324
json={
2425
"code": 200,
2526
"status": "OK",
@@ -47,8 +48,9 @@ async def setup_before_prep(self, module_test):
4748
)
4849
module_test.httpx_mock.add_response(
4950
url="https://search.censys.io/api/v2/certificates/search",
50-
# match_headers={"Authorization": "Basic YXBpX2lkOmFwaV9zZWNyZXQ="},
51-
match_content=b'{"q": "names: blacklanternsecurity.com", "per_page": 100, "cursor": "NextToken"}',
51+
match_headers={"Authorization": "Basic YXBpX2lkOmFwaV9zZWNyZXQ="},
52+
method="POST",
53+
match_json={"q": "names: blacklanternsecurity.com", "per_page": 100, "cursor": "NextToken"},
5254
json={
5355
"code": 200,
5456
"status": "OK",

bbot/test/test_step_2/module_tests/test_module_ipstack.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ async def setup_before_prep(self, module_test):
2626
"capital": "Washington D.C.",
2727
"languages": [{"code": "en", "name": "English", "native": "English"}],
2828
"country_flag": "https://assets.ipstack.com/flags/us.svg",
29-
"country_flag_emoji": "\ud83c\uddfa\ud83c\uddf8",
29+
"country_flag_emoji": "🇺🇸",
3030
"country_flag_emoji_unicode": "U+1F1FA U+1F1F8",
3131
"calling_code": "1",
3232
"is_eu": False,
@@ -53,7 +53,7 @@ async def setup_before_prep(self, module_test):
5353
"capital": "Washington D.C.",
5454
"languages": [{"code": "en", "name": "English", "native": "English"}],
5555
"country_flag": "https://assets.ipstack.com/flags/us.svg",
56-
"country_flag_emoji": "\ud83c\uddfa\ud83c\uddf8",
56+
"country_flag_emoji": "🇺🇸",
5757
"country_flag_emoji_unicode": "U+1F1FA U+1F1F8",
5858
"calling_code": "1",
5959
"is_eu": False,

bbot/test/test_step_2/module_tests/test_module_postman.py

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,22 @@ async def setup_after_prep(self, module_test):
4545
)
4646
module_test.httpx_mock.add_response(
4747
url="https://www.postman.com/_api/ws/proxy",
48-
match_content=b'{"service": "search", "method": "POST", "path": "/search-all", "body": {"queryIndices": ["collaboration.workspace"], "queryText": "blacklanternsecurity", "size": 25, "from": 0, "clientTraceId": "", "requestOrigin": "srp", "mergeEntities": "true", "nonNestedRequests": "true", "domain": "public"}}',
48+
match_json={
49+
"service": "search",
50+
"method": "POST",
51+
"path": "/search-all",
52+
"body": {
53+
"queryIndices": ["collaboration.workspace"],
54+
"queryText": "blacklanternsecurity",
55+
"size": 25,
56+
"from": 0,
57+
"clientTraceId": "",
58+
"requestOrigin": "srp",
59+
"mergeEntities": "true",
60+
"nonNestedRequests": "true",
61+
"domain": "public",
62+
},
63+
},
4964
json={
5065
"data": [
5166
{
@@ -177,7 +192,11 @@ async def setup_after_prep(self, module_test):
177192
)
178193
module_test.httpx_mock.add_response(
179194
url="https://www.postman.com/_api/ws/proxy",
180-
match_content=b'{"service": "workspaces", "method": "GET", "path": "/workspaces?handle=blacklanternsecurity&slug=bbot-public"}',
195+
match_json={
196+
"service": "workspaces",
197+
"method": "GET",
198+
"path": "/workspaces?handle=blacklanternsecurity&slug=bbot-public",
199+
},
181200
json={
182201
"meta": {"model": "workspace", "action": "find", "nextCursor": ""},
183202
"data": [
@@ -207,7 +226,11 @@ async def setup_after_prep(self, module_test):
207226
)
208227
module_test.httpx_mock.add_response(
209228
url="https://www.postman.com/_api/ws/proxy",
210-
match_content=b'{"service": "workspaces", "method": "GET", "path": "/workspaces?handle=testteam&slug=testing-bbot-api"}',
229+
match_json={
230+
"service": "workspaces",
231+
"method": "GET",
232+
"path": "/workspaces?handle=testteam&slug=testing-bbot-api",
233+
},
211234
json={
212235
"meta": {"model": "workspace", "action": "find", "nextCursor": ""},
213236
"data": [

0 commit comments

Comments
 (0)