Skip to content

Commit

Permalink
Merge pull request #504 from blacklanternsecurity/update-httpx
Browse files Browse the repository at this point in the history
Update httpx
  • Loading branch information
liquidsec authored Oct 30, 2024
2 parents 6d246df + da0bd74 commit d4bb68c
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 26 deletions.
45 changes: 24 additions & 21 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "baddns"
version = "1.1.0"
version = "1.2.0"
description = "Check subdomains for subdomain takeovers and other DNS tomfoolery"
authors = ["liquidsec <[email protected]>"]
repository = "https://github.com/blacklanternsecurity/baddns"
Expand All @@ -15,24 +15,24 @@ python = "^3.9"
pyyaml = "^6.0.1"
dnspython = "^2.4.1"
colorama = "^0.4.6"
httpx = "^0.26.0"
python-whois = "^0.9.4"
tldextract = "^3.4.4"
python-dateutil = "2.9.0.post0"
setuptools = "^69.0.3"
httpx = "^0.27.2"


[tool.poetry.group.dev.dependencies]
pytest-httpx = "^0.28.0"
pyfakefs = "^5.2.3"
requests-mock = "^1.11.0"
pytest = "^7.4.0"
pytest-cov = "^4.0.0"
pytest-asyncio = "^0.21.1"
mock = "^5.1.0"
pytest-mock = "^3.11.1"
poetry-dynamic-versioning = {extras = ["plugin"], version = "^1.2.0"}
requests = "^2.31.0"
pytest = "^8.3.3"
pytest-httpx = "^0.33.0"


[tool.poetry.group.docs.dependencies]
Expand All @@ -57,4 +57,4 @@ build-backend = "poetry_dynamic_versioning.backend"
[tool.poetry-dynamic-versioning]
enable = true
metadata = true
format = 'v1.1.{distance}'
format = 'v1.2.{distance}'
3 changes: 3 additions & 0 deletions tests/cli_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import sys
import dns
import pytest
from mock import patch

SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
Expand Down Expand Up @@ -54,6 +55,7 @@ def test_cli_cname_nxdomain(monkeypatch, capsys, mocker, configure_mock_resolver
assert "baddns.azurewebsites.net" in captured.out


@pytest.mark.httpx_mock(assert_all_requests_were_expected=False)
def test_cli_cname_http(monkeypatch, capsys, mocker, httpx_mock, configure_mock_resolver):
monkeypatch.setattr(
"sys.argv",
Expand All @@ -80,6 +82,7 @@ def test_cli_cname_http(monkeypatch, capsys, mocker, httpx_mock, configure_mock_
assert "Bigcartel Takeover Detection" in captured.out


@pytest.mark.httpx_mock(assert_all_requests_were_expected=False)
def test_cli_direct(monkeypatch, capsys, mocker, httpx_mock, configure_mock_resolver):
monkeypatch.setattr(
"sys.argv",
Expand Down
4 changes: 4 additions & 0 deletions tests/cname_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ async def test_cname_dnsnxdomain_azure_negative(fs, mock_dispatch_whois, configu


@pytest.mark.asyncio
@pytest.mark.httpx_mock(assert_all_requests_were_expected=False)
async def test_cname_http_bigcartel_match(fs, mock_dispatch_whois, httpx_mock, configure_mock_resolver):
mock_data = {"bad.dns": {"CNAME": ["baddns.bigcartel.com"]}, "baddns.bigcartel.com": {"A": ["127.0.0.1"]}}
mock_resolver = configure_mock_resolver(mock_data)
Expand Down Expand Up @@ -268,6 +269,7 @@ async def test_cname_whois_expired(fs, mock_dispatch_whois, httpx_mock, configur


@pytest.mark.asyncio
@pytest.mark.httpx_mock(assert_all_requests_were_expected=False)
@pytest.mark.parametrize("mock_dispatch_whois", [mock_whois_unregistered], indirect=True)
async def test_cname_whois_unregistered_match(fs, mock_dispatch_whois, httpx_mock, configure_mock_resolver):
mock_data = {"bad.dns": {"CNAME": ["worse.dns."]}, "worse.dns": {"A": ["127.0.0.2"]}}
Expand Down Expand Up @@ -328,6 +330,7 @@ async def test_cname_whois_unregistered_match(fs, mock_dispatch_whois, httpx_moc


@pytest.mark.asyncio
@pytest.mark.httpx_mock(assert_all_requests_were_expected=False)
@pytest.mark.parametrize("mock_dispatch_whois", [whois_mock_expired_baddata], indirect=True)
async def test_cname_whois_unregistered_baddata(fs, mock_dispatch_whois, httpx_mock, configure_mock_resolver):
with patch("sys.exit") as exit_mock:
Expand Down Expand Up @@ -378,6 +381,7 @@ async def test_cname_whois_unregistered_baddata(fs, mock_dispatch_whois, httpx_m


@pytest.mark.asyncio
@pytest.mark.httpx_mock(assert_all_requests_were_expected=False)
@pytest.mark.parametrize("mock_dispatch_whois", [whois_mock_expired_missingdata], indirect=True)
async def test_cname_whois_unregistered_missingdata(fs, mock_dispatch_whois, httpx_mock, configure_mock_resolver):
with patch("sys.exit") as exit_mock:
Expand Down
6 changes: 6 additions & 0 deletions tests/references_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@


@pytest.mark.asyncio
@pytest.mark.httpx_mock(assert_all_requests_were_expected=False)
async def test_references_cname_css(fs, httpx_mock, configure_mock_resolver, cached_suffix_list):
with patch("sys.exit") as exit_mock:
mock_data = {"bad.dns": {"A": ["127.0.0.1"]}}
Expand Down Expand Up @@ -115,6 +116,7 @@ async def test_references_cname_css(fs, httpx_mock, configure_mock_resolver, cac


@pytest.mark.asyncio
@pytest.mark.httpx_mock(assert_all_requests_were_expected=False)
async def test_references_cname_js(fs, httpx_mock, configure_mock_resolver, cached_suffix_list):
with patch("sys.exit") as exit_mock:
mock_data = {"bad.dns": {"A": ["127.0.0.1"]}}
Expand Down Expand Up @@ -148,6 +150,7 @@ async def test_references_cname_js(fs, httpx_mock, configure_mock_resolver, cach


@pytest.mark.asyncio
@pytest.mark.httpx_mock(assert_all_requests_were_expected=False)
async def test_references_direct_js(fs, httpx_mock, configure_mock_resolver, cached_suffix_list):
with patch("sys.exit") as exit_mock:
mock_data = {"bad.dns": {"A": ["127.0.0.1"]}, "_NXDOMAIN": ["direct.azurewebsites.net"]}
Expand Down Expand Up @@ -180,6 +183,7 @@ async def test_references_direct_js(fs, httpx_mock, configure_mock_resolver, cac


@pytest.mark.asyncio
@pytest.mark.httpx_mock(assert_all_requests_were_expected=False)
async def test_references_direct_css(fs, httpx_mock, configure_mock_resolver, cached_suffix_list):
with patch("sys.exit") as exit_mock:
mock_data = {"bad.dns": {"A": ["127.0.0.1"]}, "_NXDOMAIN": ["direct.azurewebsites.net"]}
Expand Down Expand Up @@ -213,6 +217,7 @@ async def test_references_direct_css(fs, httpx_mock, configure_mock_resolver, ca


@pytest.mark.asyncio
@pytest.mark.httpx_mock(assert_all_requests_were_expected=False)
async def test_references_direct_csp(fs, httpx_mock, configure_mock_resolver, cached_suffix_list):
with patch("sys.exit") as exit_mock:
mock_data = {
Expand Down Expand Up @@ -260,6 +265,7 @@ async def test_references_direct_csp(fs, httpx_mock, configure_mock_resolver, ca


@pytest.mark.asyncio
@pytest.mark.httpx_mock(assert_all_requests_were_expected=False)
async def test_references_direct_cors(fs, httpx_mock, configure_mock_resolver, cached_suffix_list):
with patch("sys.exit") as exit_mock:
mock_data = {
Expand Down

0 comments on commit d4bb68c

Please sign in to comment.