bbot 2.0.1.4654rc0__py3-none-any.whl → 2.3.0.5397rc0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of bbot might be problematic. Click here for more details.
- bbot/__init__.py +1 -1
- bbot/cli.py +3 -7
- bbot/core/config/files.py +0 -1
- bbot/core/config/logger.py +34 -4
- bbot/core/core.py +21 -6
- bbot/core/engine.py +9 -8
- bbot/core/event/base.py +162 -63
- bbot/core/helpers/bloom.py +10 -3
- bbot/core/helpers/command.py +9 -8
- bbot/core/helpers/depsinstaller/installer.py +89 -32
- bbot/core/helpers/depsinstaller/sudo_askpass.py +38 -2
- bbot/core/helpers/diff.py +10 -10
- bbot/core/helpers/dns/brute.py +18 -14
- bbot/core/helpers/dns/dns.py +16 -15
- bbot/core/helpers/dns/engine.py +159 -132
- bbot/core/helpers/dns/helpers.py +2 -2
- bbot/core/helpers/dns/mock.py +26 -8
- bbot/core/helpers/files.py +1 -1
- bbot/core/helpers/helper.py +7 -4
- bbot/core/helpers/interactsh.py +3 -3
- bbot/core/helpers/libmagic.py +65 -0
- bbot/core/helpers/misc.py +65 -22
- bbot/core/helpers/names_generator.py +17 -3
- bbot/core/helpers/process.py +0 -20
- bbot/core/helpers/regex.py +1 -1
- bbot/core/helpers/regexes.py +12 -6
- bbot/core/helpers/validators.py +1 -2
- bbot/core/helpers/web/client.py +1 -1
- bbot/core/helpers/web/engine.py +18 -13
- bbot/core/helpers/web/web.py +25 -116
- bbot/core/helpers/wordcloud.py +5 -5
- bbot/core/modules.py +36 -27
- bbot/core/multiprocess.py +58 -0
- bbot/core/shared_deps.py +46 -3
- bbot/db/sql/models.py +147 -0
- bbot/defaults.yml +15 -10
- bbot/errors.py +0 -8
- bbot/modules/anubisdb.py +2 -2
- bbot/modules/apkpure.py +63 -0
- bbot/modules/azure_tenant.py +2 -2
- bbot/modules/baddns.py +35 -19
- bbot/modules/baddns_direct.py +92 -0
- bbot/modules/baddns_zone.py +3 -8
- bbot/modules/badsecrets.py +4 -3
- bbot/modules/base.py +195 -51
- bbot/modules/bevigil.py +7 -7
- bbot/modules/binaryedge.py +7 -4
- bbot/modules/bufferoverrun.py +47 -0
- bbot/modules/builtwith.py +6 -10
- bbot/modules/bypass403.py +5 -5
- bbot/modules/c99.py +10 -7
- bbot/modules/censys.py +9 -13
- bbot/modules/certspotter.py +5 -3
- bbot/modules/chaos.py +9 -7
- bbot/modules/code_repository.py +1 -0
- bbot/modules/columbus.py +3 -3
- bbot/modules/crt.py +5 -3
- bbot/modules/deadly/dastardly.py +1 -1
- bbot/modules/deadly/ffuf.py +9 -9
- bbot/modules/deadly/nuclei.py +3 -3
- bbot/modules/deadly/vhost.py +4 -3
- bbot/modules/dehashed.py +1 -1
- bbot/modules/digitorus.py +1 -1
- bbot/modules/dnsbimi.py +145 -0
- bbot/modules/dnscaa.py +3 -3
- bbot/modules/dnsdumpster.py +4 -4
- bbot/modules/dnstlsrpt.py +144 -0
- bbot/modules/docker_pull.py +7 -5
- bbot/modules/dockerhub.py +2 -2
- bbot/modules/dotnetnuke.py +18 -19
- bbot/modules/emailformat.py +1 -1
- bbot/modules/extractous.py +122 -0
- bbot/modules/filedownload.py +9 -7
- bbot/modules/fullhunt.py +7 -4
- bbot/modules/generic_ssrf.py +5 -5
- bbot/modules/github_codesearch.py +3 -2
- bbot/modules/github_org.py +4 -4
- bbot/modules/github_workflows.py +4 -4
- bbot/modules/gitlab.py +2 -5
- bbot/modules/google_playstore.py +93 -0
- bbot/modules/gowitness.py +48 -50
- bbot/modules/hackertarget.py +5 -3
- bbot/modules/host_header.py +5 -5
- bbot/modules/httpx.py +1 -4
- bbot/modules/hunterio.py +3 -9
- bbot/modules/iis_shortnames.py +19 -30
- bbot/modules/internal/cloudcheck.py +27 -12
- bbot/modules/internal/dnsresolve.py +250 -276
- bbot/modules/internal/excavate.py +100 -64
- bbot/modules/internal/speculate.py +42 -33
- bbot/modules/internetdb.py +4 -2
- bbot/modules/ip2location.py +3 -5
- bbot/modules/ipneighbor.py +1 -1
- bbot/modules/ipstack.py +3 -8
- bbot/modules/jadx.py +87 -0
- bbot/modules/leakix.py +11 -10
- bbot/modules/myssl.py +2 -2
- bbot/modules/newsletters.py +2 -2
- bbot/modules/otx.py +5 -3
- bbot/modules/output/asset_inventory.py +7 -7
- bbot/modules/output/base.py +1 -1
- bbot/modules/output/csv.py +1 -2
- bbot/modules/output/http.py +20 -14
- bbot/modules/output/mysql.py +51 -0
- bbot/modules/output/neo4j.py +7 -2
- bbot/modules/output/postgres.py +49 -0
- bbot/modules/output/slack.py +0 -1
- bbot/modules/output/sqlite.py +29 -0
- bbot/modules/output/stdout.py +2 -2
- bbot/modules/output/teams.py +107 -6
- bbot/modules/paramminer_headers.py +5 -8
- bbot/modules/passivetotal.py +13 -13
- bbot/modules/portscan.py +32 -6
- bbot/modules/postman.py +50 -126
- bbot/modules/postman_download.py +220 -0
- bbot/modules/rapiddns.py +3 -8
- bbot/modules/report/asn.py +11 -11
- bbot/modules/robots.py +3 -3
- bbot/modules/securitytrails.py +7 -10
- bbot/modules/securitytxt.py +128 -0
- bbot/modules/shodan_dns.py +7 -9
- bbot/modules/sitedossier.py +1 -1
- bbot/modules/skymem.py +2 -2
- bbot/modules/social.py +2 -1
- bbot/modules/subdomaincenter.py +1 -1
- bbot/modules/subdomainradar.py +160 -0
- bbot/modules/telerik.py +8 -8
- bbot/modules/templates/bucket.py +1 -1
- bbot/modules/templates/github.py +22 -14
- bbot/modules/templates/postman.py +21 -0
- bbot/modules/templates/shodan.py +14 -13
- bbot/modules/templates/sql.py +95 -0
- bbot/modules/templates/subdomain_enum.py +53 -17
- bbot/modules/templates/webhook.py +2 -4
- bbot/modules/trickest.py +8 -37
- bbot/modules/trufflehog.py +18 -3
- bbot/modules/url_manipulation.py +3 -3
- bbot/modules/urlscan.py +1 -1
- bbot/modules/viewdns.py +1 -1
- bbot/modules/virustotal.py +8 -30
- bbot/modules/wafw00f.py +1 -1
- bbot/modules/wayback.py +1 -1
- bbot/modules/wpscan.py +17 -11
- bbot/modules/zoomeye.py +11 -6
- bbot/presets/baddns-thorough.yml +12 -0
- bbot/presets/fast.yml +16 -0
- bbot/presets/kitchen-sink.yml +1 -0
- bbot/presets/spider.yml +4 -0
- bbot/presets/subdomain-enum.yml +7 -7
- bbot/scanner/manager.py +5 -16
- bbot/scanner/preset/args.py +44 -26
- bbot/scanner/preset/environ.py +7 -2
- bbot/scanner/preset/path.py +7 -4
- bbot/scanner/preset/preset.py +36 -23
- bbot/scanner/scanner.py +176 -63
- bbot/scanner/target.py +236 -434
- bbot/scripts/docs.py +1 -1
- bbot/test/bbot_fixtures.py +22 -3
- bbot/test/conftest.py +132 -100
- bbot/test/fastapi_test.py +17 -0
- bbot/test/owasp_mastg.apk +0 -0
- bbot/test/run_tests.sh +4 -4
- bbot/test/test.conf +2 -0
- bbot/test/test_step_1/test_bbot_fastapi.py +82 -0
- bbot/test/test_step_1/test_bloom_filter.py +2 -0
- bbot/test/test_step_1/test_cli.py +138 -64
- bbot/test/test_step_1/test_dns.py +392 -70
- bbot/test/test_step_1/test_engine.py +17 -17
- bbot/test/test_step_1/test_events.py +203 -37
- bbot/test/test_step_1/test_helpers.py +64 -28
- bbot/test/test_step_1/test_manager_deduplication.py +1 -1
- bbot/test/test_step_1/test_manager_scope_accuracy.py +336 -338
- bbot/test/test_step_1/test_modules_basic.py +69 -71
- bbot/test/test_step_1/test_presets.py +184 -96
- bbot/test/test_step_1/test_python_api.py +7 -2
- bbot/test/test_step_1/test_regexes.py +35 -5
- bbot/test/test_step_1/test_scan.py +39 -5
- bbot/test/test_step_1/test_scope.py +5 -4
- bbot/test/test_step_1/test_target.py +243 -145
- bbot/test/test_step_1/test_web.py +48 -10
- bbot/test/test_step_2/module_tests/base.py +17 -20
- bbot/test/test_step_2/module_tests/test_module_anubisdb.py +1 -1
- bbot/test/test_step_2/module_tests/test_module_apkpure.py +71 -0
- bbot/test/test_step_2/module_tests/test_module_asset_inventory.py +0 -1
- bbot/test/test_step_2/module_tests/test_module_azure_realm.py +1 -1
- bbot/test/test_step_2/module_tests/test_module_baddns.py +6 -6
- bbot/test/test_step_2/module_tests/test_module_baddns_direct.py +62 -0
- bbot/test/test_step_2/module_tests/test_module_bevigil.py +29 -2
- bbot/test/test_step_2/module_tests/test_module_binaryedge.py +4 -2
- bbot/test/test_step_2/module_tests/test_module_bucket_amazon.py +2 -2
- bbot/test/test_step_2/module_tests/test_module_bucket_azure.py +1 -1
- bbot/test/test_step_2/module_tests/test_module_bufferoverrun.py +35 -0
- bbot/test/test_step_2/module_tests/test_module_builtwith.py +2 -2
- bbot/test/test_step_2/module_tests/test_module_bypass403.py +1 -1
- bbot/test/test_step_2/module_tests/test_module_c99.py +126 -0
- bbot/test/test_step_2/module_tests/test_module_censys.py +4 -1
- bbot/test/test_step_2/module_tests/test_module_cloudcheck.py +4 -0
- bbot/test/test_step_2/module_tests/test_module_code_repository.py +11 -1
- bbot/test/test_step_2/module_tests/test_module_columbus.py +1 -1
- bbot/test/test_step_2/module_tests/test_module_credshed.py +3 -3
- bbot/test/test_step_2/module_tests/test_module_dastardly.py +2 -1
- bbot/test/test_step_2/module_tests/test_module_dehashed.py +2 -2
- bbot/test/test_step_2/module_tests/test_module_digitorus.py +1 -1
- bbot/test/test_step_2/module_tests/test_module_discord.py +1 -1
- bbot/test/test_step_2/module_tests/test_module_dnsbimi.py +103 -0
- bbot/test/test_step_2/module_tests/test_module_dnsbrute.py +9 -10
- bbot/test/test_step_2/module_tests/test_module_dnsbrute_mutations.py +1 -2
- bbot/test/test_step_2/module_tests/test_module_dnscommonsrv.py +1 -2
- bbot/test/test_step_2/module_tests/test_module_dnsdumpster.py +4 -4
- bbot/test/test_step_2/module_tests/test_module_dnstlsrpt.py +64 -0
- bbot/test/test_step_2/module_tests/test_module_dotnetnuke.py +0 -8
- bbot/test/test_step_2/module_tests/test_module_excavate.py +17 -37
- bbot/test/test_step_2/module_tests/test_module_extractous.py +54 -0
- bbot/test/test_step_2/module_tests/test_module_ffuf_shortnames.py +1 -1
- bbot/test/test_step_2/module_tests/test_module_filedownload.py +14 -14
- bbot/test/test_step_2/module_tests/test_module_git_clone.py +2 -2
- bbot/test/test_step_2/module_tests/test_module_github_org.py +19 -8
- bbot/test/test_step_2/module_tests/test_module_github_workflows.py +1 -1
- bbot/test/test_step_2/module_tests/test_module_gitlab.py +9 -4
- bbot/test/test_step_2/module_tests/test_module_google_playstore.py +83 -0
- bbot/test/test_step_2/module_tests/test_module_gowitness.py +4 -4
- bbot/test/test_step_2/module_tests/test_module_host_header.py +1 -1
- bbot/test/test_step_2/module_tests/test_module_http.py +4 -4
- bbot/test/test_step_2/module_tests/test_module_httpx.py +10 -8
- bbot/test/test_step_2/module_tests/test_module_hunterio.py +68 -4
- bbot/test/test_step_2/module_tests/test_module_jadx.py +55 -0
- bbot/test/test_step_2/module_tests/test_module_json.py +24 -11
- bbot/test/test_step_2/module_tests/test_module_leakix.py +7 -3
- bbot/test/test_step_2/module_tests/test_module_mysql.py +76 -0
- bbot/test/test_step_2/module_tests/test_module_myssl.py +1 -1
- bbot/test/test_step_2/module_tests/test_module_neo4j.py +1 -1
- bbot/test/test_step_2/module_tests/test_module_newsletters.py +6 -6
- bbot/test/test_step_2/module_tests/test_module_ntlm.py +7 -7
- bbot/test/test_step_2/module_tests/test_module_oauth.py +1 -1
- bbot/test/test_step_2/module_tests/test_module_otx.py +1 -1
- bbot/test/test_step_2/module_tests/test_module_paramminer_cookies.py +1 -2
- bbot/test/test_step_2/module_tests/test_module_paramminer_getparams.py +0 -6
- bbot/test/test_step_2/module_tests/test_module_paramminer_headers.py +2 -9
- bbot/test/test_step_2/module_tests/test_module_passivetotal.py +3 -1
- bbot/test/test_step_2/module_tests/test_module_portscan.py +9 -8
- bbot/test/test_step_2/module_tests/test_module_postgres.py +74 -0
- bbot/test/test_step_2/module_tests/test_module_postman.py +84 -253
- bbot/test/test_step_2/module_tests/test_module_postman_download.py +439 -0
- bbot/test/test_step_2/module_tests/test_module_rapiddns.py +93 -1
- bbot/test/test_step_2/module_tests/test_module_securitytxt.py +50 -0
- bbot/test/test_step_2/module_tests/test_module_shodan_dns.py +20 -1
- bbot/test/test_step_2/module_tests/test_module_sitedossier.py +2 -2
- bbot/test/test_step_2/module_tests/test_module_smuggler.py +1 -1
- bbot/test/test_step_2/module_tests/test_module_social.py +11 -1
- bbot/test/test_step_2/module_tests/test_module_speculate.py +2 -6
- bbot/test/test_step_2/module_tests/test_module_splunk.py +4 -4
- bbot/test/test_step_2/module_tests/test_module_sqlite.py +18 -0
- bbot/test/test_step_2/module_tests/test_module_sslcert.py +1 -1
- bbot/test/test_step_2/module_tests/test_module_stdout.py +5 -3
- bbot/test/test_step_2/module_tests/test_module_subdomaincenter.py +1 -1
- bbot/test/test_step_2/module_tests/test_module_subdomainradar.py +208 -0
- bbot/test/test_step_2/module_tests/test_module_subdomains.py +1 -1
- bbot/test/test_step_2/module_tests/test_module_teams.py +8 -6
- bbot/test/test_step_2/module_tests/test_module_telerik.py +1 -1
- bbot/test/test_step_2/module_tests/test_module_trufflehog.py +317 -11
- bbot/test/test_step_2/module_tests/test_module_wayback.py +1 -1
- bbot/test/test_step_2/template_tests/test_template_subdomain_enum.py +135 -0
- {bbot-2.0.1.4654rc0.dist-info → bbot-2.3.0.5397rc0.dist-info}/METADATA +48 -18
- bbot-2.3.0.5397rc0.dist-info/RECORD +421 -0
- {bbot-2.0.1.4654rc0.dist-info → bbot-2.3.0.5397rc0.dist-info}/WHEEL +1 -1
- bbot/modules/unstructured.py +0 -163
- bbot/test/test_step_2/module_tests/test_module_unstructured.py +0 -102
- bbot-2.0.1.4654rc0.dist-info/RECORD +0 -385
- {bbot-2.0.1.4654rc0.dist-info → bbot-2.3.0.5397rc0.dist-info}/LICENSE +0 -0
- {bbot-2.0.1.4654rc0.dist-info → bbot-2.3.0.5397rc0.dist-info}/entry_points.txt +0 -0
|
@@ -49,6 +49,8 @@ async def test_helpers_misc(helpers, scan, bbot_scanner, bbot_httpserver):
|
|
|
49
49
|
assert helpers.url_depth("http://evilcorp.com/") == 0
|
|
50
50
|
assert helpers.url_depth("http://evilcorp.com") == 0
|
|
51
51
|
|
|
52
|
+
assert helpers.parent_url("http://evilcorp.com/subdir1/subdir2?foo=bar") == "http://evilcorp.com/subdir1"
|
|
53
|
+
|
|
52
54
|
### MISC ###
|
|
53
55
|
assert helpers.is_domain("evilcorp.co.uk")
|
|
54
56
|
assert not helpers.is_domain("www.evilcorp.co.uk")
|
|
@@ -62,8 +64,8 @@ async def test_helpers_misc(helpers, scan, bbot_scanner, bbot_httpserver):
|
|
|
62
64
|
assert not helpers.is_subdomain("notreal")
|
|
63
65
|
assert helpers.is_url("http://evilcorp.co.uk/asdf?a=b&c=d#asdf")
|
|
64
66
|
assert helpers.is_url("https://evilcorp.co.uk/asdf?a=b&c=d#asdf")
|
|
65
|
-
assert helpers.is_uri("ftp://evilcorp.co.uk")
|
|
66
|
-
assert helpers.is_uri("http://evilcorp.co.uk")
|
|
67
|
+
assert helpers.is_uri("ftp://evilcorp.co.uk") is True
|
|
68
|
+
assert helpers.is_uri("http://evilcorp.co.uk") is True
|
|
67
69
|
assert helpers.is_uri("evilcorp.co.uk", return_scheme=True) == ""
|
|
68
70
|
assert helpers.is_uri("ftp://evilcorp.co.uk", return_scheme=True) == "ftp"
|
|
69
71
|
assert helpers.is_uri("FTP://evilcorp.co.uk", return_scheme=True) == "ftp"
|
|
@@ -91,8 +93,34 @@ async def test_helpers_misc(helpers, scan, bbot_scanner, bbot_httpserver):
|
|
|
91
93
|
ipaddress.ip_network("0.0.0.0/0"),
|
|
92
94
|
]
|
|
93
95
|
assert helpers.is_ip("127.0.0.1")
|
|
96
|
+
assert helpers.is_ip("127.0.0.1", include_network=True)
|
|
97
|
+
assert helpers.is_ip("127.0.0.1", version=4)
|
|
98
|
+
assert not helpers.is_ip("127.0.0.1", version=6)
|
|
94
99
|
assert not helpers.is_ip("127.0.0.0.1")
|
|
100
|
+
|
|
101
|
+
assert helpers.is_ip("dead::beef")
|
|
102
|
+
assert helpers.is_ip("dead::beef", include_network=True)
|
|
103
|
+
assert not helpers.is_ip("dead::beef", version=4)
|
|
104
|
+
assert helpers.is_ip("dead::beef", version=6)
|
|
105
|
+
assert not helpers.is_ip("dead:::beef")
|
|
106
|
+
|
|
107
|
+
assert not helpers.is_ip("1.2.3.4/24")
|
|
108
|
+
assert helpers.is_ip("1.2.3.4/24", include_network=True)
|
|
109
|
+
assert not helpers.is_ip("1.2.3.4/24", version=4)
|
|
110
|
+
assert helpers.is_ip("1.2.3.4/24", include_network=True, version=4)
|
|
111
|
+
assert not helpers.is_ip("1.2.3.4/24", include_network=True, version=6)
|
|
112
|
+
|
|
113
|
+
assert not helpers.is_ip_type("127.0.0.1")
|
|
114
|
+
assert helpers.is_ip_type(ipaddress.ip_address("127.0.0.1"))
|
|
115
|
+
assert not helpers.is_ip_type(ipaddress.ip_address("127.0.0.1"), network=True)
|
|
116
|
+
assert helpers.is_ip_type(ipaddress.ip_address("127.0.0.1"), network=False)
|
|
117
|
+
assert helpers.is_ip_type(ipaddress.ip_network("127.0.0.0/8"))
|
|
118
|
+
assert helpers.is_ip_type(ipaddress.ip_network("127.0.0.0/8"), network=True)
|
|
119
|
+
assert not helpers.is_ip_type(ipaddress.ip_network("127.0.0.0/8"), network=False)
|
|
120
|
+
|
|
95
121
|
assert helpers.is_dns_name("evilcorp.com")
|
|
122
|
+
assert not helpers.is_dns_name("evilcorp.com:80")
|
|
123
|
+
assert not helpers.is_dns_name("http://evilcorp.com:80")
|
|
96
124
|
assert helpers.is_dns_name("evilcorp")
|
|
97
125
|
assert not helpers.is_dns_name("evilcorp", include_local=False)
|
|
98
126
|
assert helpers.is_dns_name("ドメイン.テスト")
|
|
@@ -210,8 +238,12 @@ async def test_helpers_misc(helpers, scan, bbot_scanner, bbot_httpserver):
|
|
|
210
238
|
|
|
211
239
|
ipv4_netloc = helpers.make_netloc("192.168.1.1", 80)
|
|
212
240
|
assert ipv4_netloc == "192.168.1.1:80"
|
|
213
|
-
|
|
214
|
-
assert
|
|
241
|
+
assert helpers.make_netloc("192.168.1.1") == "192.168.1.1"
|
|
242
|
+
assert helpers.make_netloc(ipaddress.ip_address("192.168.1.1"), None) == "192.168.1.1"
|
|
243
|
+
assert helpers.make_netloc("dead::beef", "443") == "[dead::beef]:443"
|
|
244
|
+
assert helpers.make_netloc(ipaddress.ip_address("dead::beef"), 443) == "[dead::beef]:443"
|
|
245
|
+
assert helpers.make_netloc("dead::beef", None) == "[dead::beef]"
|
|
246
|
+
assert helpers.make_netloc(ipaddress.ip_address("dead::beef"), None) == "[dead::beef]"
|
|
215
247
|
|
|
216
248
|
assert helpers.get_file_extension("https://evilcorp.com/evilcorp.com/test/asdf.TXT") == "txt"
|
|
217
249
|
assert helpers.get_file_extension("/etc/conf/test.tar.gz") == "gz"
|
|
@@ -251,7 +283,7 @@ async def test_helpers_misc(helpers, scan, bbot_scanner, bbot_httpserver):
|
|
|
251
283
|
replaced = helpers.search_format_dict(
|
|
252
284
|
{"asdf": [{"wat": {"here": "#{replaceme}!"}}, {500: True}]}, replaceme="asdf"
|
|
253
285
|
)
|
|
254
|
-
assert replaced["asdf"][1][500]
|
|
286
|
+
assert replaced["asdf"][1][500] is True
|
|
255
287
|
assert replaced["asdf"][0]["wat"]["here"] == "asdf!"
|
|
256
288
|
|
|
257
289
|
filtered_dict = helpers.filter_dict(
|
|
@@ -283,7 +315,7 @@ async def test_helpers_misc(helpers, scan, bbot_scanner, bbot_httpserver):
|
|
|
283
315
|
fuzzy=True,
|
|
284
316
|
exclude_keys="modules",
|
|
285
317
|
)
|
|
286
|
-
assert
|
|
318
|
+
assert "secrets_db" not in filtered_dict4["modules"]
|
|
287
319
|
assert "ipneighbor" in filtered_dict4["modules"]
|
|
288
320
|
assert "secret" in filtered_dict4["modules"]["ipneighbor"]
|
|
289
321
|
assert "asdf" not in filtered_dict4["modules"]["ipneighbor"]
|
|
@@ -376,15 +408,15 @@ async def test_helpers_misc(helpers, scan, bbot_scanner, bbot_httpserver):
|
|
|
376
408
|
assert helpers.validators.validate_host("LOCALHOST ") == "localhost"
|
|
377
409
|
assert helpers.validators.validate_host(" 192.168.1.1") == "192.168.1.1"
|
|
378
410
|
assert helpers.validators.validate_host(" Dead::c0dE ") == "dead::c0de"
|
|
379
|
-
assert helpers.validators.soft_validate(" evilCorp.COM", "host")
|
|
380
|
-
assert helpers.validators.soft_validate("!@#$", "host")
|
|
411
|
+
assert helpers.validators.soft_validate(" evilCorp.COM", "host") is True
|
|
412
|
+
assert helpers.validators.soft_validate("!@#$", "host") is False
|
|
381
413
|
with pytest.raises(ValueError):
|
|
382
414
|
assert helpers.validators.validate_host("!@#$")
|
|
383
415
|
# ports
|
|
384
416
|
assert helpers.validators.validate_port(666) == 666
|
|
385
417
|
assert helpers.validators.validate_port(666666) == 65535
|
|
386
|
-
assert helpers.validators.soft_validate(666, "port")
|
|
387
|
-
assert helpers.validators.soft_validate("!@#$", "port")
|
|
418
|
+
assert helpers.validators.soft_validate(666, "port") is True
|
|
419
|
+
assert helpers.validators.soft_validate("!@#$", "port") is False
|
|
388
420
|
with pytest.raises(ValueError):
|
|
389
421
|
helpers.validators.validate_port("asdf")
|
|
390
422
|
# top tcp ports
|
|
@@ -396,7 +428,7 @@ async def test_helpers_misc(helpers, scan, bbot_scanner, bbot_httpserver):
|
|
|
396
428
|
assert top_tcp_ports[-10:] == [65526, 65527, 65528, 65529, 65530, 65531, 65532, 65533, 65534, 65535]
|
|
397
429
|
assert len(top_tcp_ports) == 65535
|
|
398
430
|
assert len(set(top_tcp_ports)) == 65535
|
|
399
|
-
assert all(
|
|
431
|
+
assert all(isinstance(i, int) for i in top_tcp_ports)
|
|
400
432
|
top_tcp_ports = helpers.top_tcp_ports(10, as_string=True)
|
|
401
433
|
assert top_tcp_ports == "80,23,443,21,22,25,3389,110,445,139"
|
|
402
434
|
# urls
|
|
@@ -405,25 +437,29 @@ async def test_helpers_misc(helpers, scan, bbot_scanner, bbot_httpserver):
|
|
|
405
437
|
helpers.validators.validate_url_parsed(" httP://evilcorP.com/asdf?a=b&c=d#e").geturl()
|
|
406
438
|
== "http://evilcorp.com/asdf"
|
|
407
439
|
)
|
|
408
|
-
assert helpers.validators.soft_validate(" httP://evilcorP.com/asdf?a=b&c=d#e", "url")
|
|
409
|
-
assert helpers.validators.soft_validate("!@#$", "url")
|
|
440
|
+
assert helpers.validators.soft_validate(" httP://evilcorP.com/asdf?a=b&c=d#e", "url") is True
|
|
441
|
+
assert helpers.validators.soft_validate("!@#$", "url") is False
|
|
410
442
|
with pytest.raises(ValueError):
|
|
411
443
|
helpers.validators.validate_url("!@#$")
|
|
412
444
|
# severities
|
|
413
445
|
assert helpers.validators.validate_severity(" iNfo") == "INFO"
|
|
414
|
-
assert helpers.validators.soft_validate(" iNfo", "severity")
|
|
415
|
-
assert helpers.validators.soft_validate("NOPE", "severity")
|
|
446
|
+
assert helpers.validators.soft_validate(" iNfo", "severity") is True
|
|
447
|
+
assert helpers.validators.soft_validate("NOPE", "severity") is False
|
|
416
448
|
with pytest.raises(ValueError):
|
|
417
449
|
helpers.validators.validate_severity("NOPE")
|
|
418
450
|
# emails
|
|
419
451
|
assert helpers.validators.validate_email(" bOb@eViLcorp.COM") == "bob@evilcorp.com"
|
|
420
|
-
assert helpers.validators.soft_validate(" bOb@eViLcorp.COM", "email")
|
|
421
|
-
assert helpers.validators.soft_validate("!@#$", "email")
|
|
452
|
+
assert helpers.validators.soft_validate(" bOb@eViLcorp.COM", "email") is True
|
|
453
|
+
assert helpers.validators.soft_validate("!@#$", "email") is False
|
|
422
454
|
with pytest.raises(ValueError):
|
|
423
455
|
helpers.validators.validate_email("!@#$")
|
|
424
456
|
|
|
425
457
|
assert type(helpers.make_date()) == str
|
|
426
458
|
|
|
459
|
+
# string formatter
|
|
460
|
+
s = "asdf {unused} {used}"
|
|
461
|
+
assert helpers.safe_format(s, used="fdsa") == "asdf {unused} fdsa"
|
|
462
|
+
|
|
427
463
|
# punycode
|
|
428
464
|
assert helpers.smart_encode_punycode("ドメイン.テスト") == "xn--eckwd4c7c.xn--zckzah"
|
|
429
465
|
assert helpers.smart_decode_punycode("xn--eckwd4c7c.xn--zckzah") == "ドメイン.テスト"
|
|
@@ -497,9 +533,9 @@ async def test_helpers_misc(helpers, scan, bbot_scanner, bbot_httpserver):
|
|
|
497
533
|
truncated_filename.unlink()
|
|
498
534
|
|
|
499
535
|
# misc DNS helpers
|
|
500
|
-
assert helpers.is_ptr("wsc-11-22-33-44-wat.evilcorp.com")
|
|
501
|
-
assert helpers.is_ptr("wsc-11-22-33-wat.evilcorp.com")
|
|
502
|
-
assert helpers.is_ptr("11wat.evilcorp.com")
|
|
536
|
+
assert helpers.is_ptr("wsc-11-22-33-44-wat.evilcorp.com") is True
|
|
537
|
+
assert helpers.is_ptr("wsc-11-22-33-wat.evilcorp.com") is False
|
|
538
|
+
assert helpers.is_ptr("11wat.evilcorp.com") is False
|
|
503
539
|
|
|
504
540
|
## NTLM
|
|
505
541
|
testheader = "TlRMTVNTUAACAAAAHgAeADgAAAAVgorilwL+bvnVipUAAAAAAAAAAJgAmABWAAAACgBjRQAAAA9XAEkATgAtAFMANAAyAE4ATwBCAEQAVgBUAEsAOAACAB4AVwBJAE4ALQBTADQAMgBOAE8AQgBEAFYAVABLADgAAQAeAFcASQBOAC0AUwA0ADIATgBPAEIARABWAFQASwA4AAQAHgBXAEkATgAtAFMANAAyAE4ATwBCAEQAVgBUAEsAOAADAB4AVwBJAE4ALQBTADQAMgBOAE8AQgBEAFYAVABLADgABwAIAHUwOZlfoNgBAAAAAA=="
|
|
@@ -577,8 +613,8 @@ async def test_helpers_misc(helpers, scan, bbot_scanner, bbot_httpserver):
|
|
|
577
613
|
assert len(helpers.get_exception_chain(e)) == 2
|
|
578
614
|
assert len([_ for _ in helpers.get_exception_chain(e) if isinstance(_, KeyboardInterrupt)]) == 1
|
|
579
615
|
assert len([_ for _ in helpers.get_exception_chain(e) if isinstance(_, ValueError)]) == 1
|
|
580
|
-
assert helpers.in_exception_chain(e, (KeyboardInterrupt, asyncio.CancelledError))
|
|
581
|
-
assert helpers.in_exception_chain(e, (TypeError, OSError))
|
|
616
|
+
assert helpers.in_exception_chain(e, (KeyboardInterrupt, asyncio.CancelledError)) is True
|
|
617
|
+
assert helpers.in_exception_chain(e, (TypeError, OSError)) is False
|
|
582
618
|
test_ran = True
|
|
583
619
|
assert test_ran
|
|
584
620
|
test_ran = False
|
|
@@ -591,9 +627,9 @@ async def test_helpers_misc(helpers, scan, bbot_scanner, bbot_httpserver):
|
|
|
591
627
|
assert len(helpers.get_exception_chain(e)) == 2
|
|
592
628
|
assert len([_ for _ in helpers.get_exception_chain(e) if isinstance(_, AttributeError)]) == 1
|
|
593
629
|
assert len([_ for _ in helpers.get_exception_chain(e) if isinstance(_, ValueError)]) == 1
|
|
594
|
-
assert helpers.in_exception_chain(e, (KeyboardInterrupt, asyncio.CancelledError))
|
|
595
|
-
assert helpers.in_exception_chain(e, (KeyboardInterrupt, AttributeError))
|
|
596
|
-
assert helpers.in_exception_chain(e, (AttributeError,))
|
|
630
|
+
assert helpers.in_exception_chain(e, (KeyboardInterrupt, asyncio.CancelledError)) is False
|
|
631
|
+
assert helpers.in_exception_chain(e, (KeyboardInterrupt, AttributeError)) is True
|
|
632
|
+
assert helpers.in_exception_chain(e, (AttributeError,)) is True
|
|
597
633
|
test_ran = True
|
|
598
634
|
assert test_ran
|
|
599
635
|
|
|
@@ -850,7 +886,7 @@ async def test_parameter_validation(helpers):
|
|
|
850
886
|
if helpers.validate_parameter(p, "getparam"):
|
|
851
887
|
assert p in getparam_valid_params and p not in getparam_invalid_params
|
|
852
888
|
else:
|
|
853
|
-
assert p in getparam_invalid_params and not
|
|
889
|
+
assert p in getparam_invalid_params and p not in getparam_valid_params
|
|
854
890
|
|
|
855
891
|
header_valid_params = {
|
|
856
892
|
"name",
|
|
@@ -881,7 +917,7 @@ async def test_parameter_validation(helpers):
|
|
|
881
917
|
if helpers.validate_parameter(p, "header"):
|
|
882
918
|
assert p in header_valid_params and p not in header_invalid_params
|
|
883
919
|
else:
|
|
884
|
-
assert p in header_invalid_params and not
|
|
920
|
+
assert p in header_invalid_params and p not in header_valid_params
|
|
885
921
|
|
|
886
922
|
cookie_valid_params = {
|
|
887
923
|
"name",
|
|
@@ -911,4 +947,4 @@ async def test_parameter_validation(helpers):
|
|
|
911
947
|
if helpers.validate_parameter(p, "cookie"):
|
|
912
948
|
assert p in cookie_valid_params and p not in cookie_invalid_params
|
|
913
949
|
else:
|
|
914
|
-
assert p in cookie_invalid_params and not
|
|
950
|
+
assert p in cookie_invalid_params and p not in cookie_valid_params
|
|
@@ -91,7 +91,7 @@ async def test_manager_deduplication(bbot_scanner):
|
|
|
91
91
|
_dns_mock=dns_mock_chain,
|
|
92
92
|
)
|
|
93
93
|
|
|
94
|
-
assert len(events) ==
|
|
94
|
+
assert len(events) == 22
|
|
95
95
|
assert 1 == len([e for e in events if e.type == "DNS_NAME" and e.data == "accept_dupes.test.notreal" and str(e.module) == "accept_dupes"])
|
|
96
96
|
assert 1 == len([e for e in events if e.type == "DNS_NAME" and e.data == "default_module.test.notreal" and str(e.module) == "default_module"])
|
|
97
97
|
assert 1 == len([e for e in events if e.type == "DNS_NAME" and e.data == "no_suppress_dupes.test.notreal" and str(e.module) == "no_suppress_dupes" and e.parent.data == "accept_dupes.test.notreal"])
|