-
Notifications
You must be signed in to change notification settings - Fork 562
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
137 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -317,6 +317,11 @@ Targets can be any of the following: | |
- `IP_RANGE` (`1.2.3.0/24`) | ||
- `OPEN_TCP_PORT` (`192.168.0.1:80`) | ||
- `URL` (`https://www.evilcorp.com`) | ||
- `EMAIL_ADDRESS` (`[email protected]`) | ||
- `ORG_STUB` (`ORG:evilcorp`) | ||
- `USER_STUB` (`USER:bobsmith`) | ||
- `FILESYSTEM` (`FILESYSTEM:/tmp/asdf`) | ||
- `MOBILE_APP` (`MOBILE_APP:https://play.google.com/store/apps/details?id=com.evilcorp.app`) | ||
|
||
For more information, see [Targets](https://www.blacklanternsecurity.com/bbot/Stable/scanning/#targets-t). To learn how BBOT handles scope, see [Scope](https://www.blacklanternsecurity.com/bbot/Stable/scanning/#scope). | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -272,13 +272,13 @@ def test_preset_scope(): | |
} | ||
assert preset_whitelist_baked.to_dict(include_target=True) == { | ||
"target": ["evilcorp.org"], | ||
"whitelist": ["1.2.3.0/24", "http://evilcorp.net/"], | ||
"whitelist": ["1.2.3.4/24", "http://evilcorp.net"], | ||
"blacklist": ["[email protected]", "evilcorp.co.uk:443"], | ||
"config": {"modules": {"secretsdb": {"api_key": "deadbeef", "otherthing": "asdf"}}}, | ||
} | ||
assert preset_whitelist_baked.to_dict(include_target=True, redact_secrets=True) == { | ||
"target": ["evilcorp.org"], | ||
"whitelist": ["1.2.3.0/24", "http://evilcorp.net/"], | ||
"whitelist": ["1.2.3.4/24", "http://evilcorp.net"], | ||
"blacklist": ["[email protected]", "evilcorp.co.uk:443"], | ||
"config": {"modules": {"secretsdb": {"otherthing": "asdf"}}}, | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,7 @@ async def setup_before_prep(self, module_test): | |
# these ones should | ||
<a href="/a_relative.txt"> | ||
<link href="/link_relative.txt"> | ||
<a href="mailto:[email protected]?subject=help">Help</a> | ||
""" | ||
expect_args = {"method": "GET", "uri": "/"} | ||
respond_args = {"response_data": response_data} | ||
|
@@ -1248,11 +1249,6 @@ def check(self, module_test, events): | |
), f"URL extracted from extractous text is incorrect, got {url_events}" | ||
|
||
|
||
from bbot.modules.base import BaseModule | ||
from .base import ModuleTestBase, tempwordlist | ||
from bbot.modules.internal.excavate import ExcavateRule | ||
|
||
|
||
class TestExcavate(ModuleTestBase): | ||
targets = ["http://127.0.0.1:8888/", "test.notreal", "http://127.0.0.1:8888/subdir/links.html"] | ||
modules_overrides = ["excavate", "httpx"] | ||
|
@@ -1380,3 +1376,29 @@ def check(self, module_test, events): | |
assert found_first_cookie is True | ||
assert found_second_cookie is False | ||
assert found_third_cookie is False | ||
|
||
class TestExcavateBadURLs(ModuleTestBase): | ||
targets = ["http://127.0.0.1:8888/"] | ||
modules_overrides = ["excavate", "httpx", "hunt"] | ||
config_overrides = {"interactsh_disable": True, "scope": {"report_distance": 10}} | ||
|
||
bad_url_data = """ | ||
<a href='mailto:[email protected]?subject=help'>Help</a> | ||
<a href='https://ssl.'>Help</a> | ||
""" | ||
|
||
async def setup_after_prep(self, module_test): | ||
module_test.set_expect_requests({"uri": "/"}, {"response_data": self.bad_url_data}) | ||
|
||
def check(self, module_test, events): | ||
log_file = module_test.scan.home / "debug.log" | ||
log_text = log_file.read_text() | ||
# make sure our logging is working | ||
assert "Setting scan status to STARTING" in log_text | ||
# make sure we don't have any URL validation errors | ||
assert "Error Parsing reconstructed URL" not in log_text | ||
assert "Error sanitizing event data" not in log_text | ||
|
||
url_events = [e for e in events if e.type == "URL_UNVERIFIED"] | ||
assert sorted([e.data for e in url_events]) == sorted(["https://ssl/", "http://127.0.0.1:8888/"]) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,11 @@ Targets declare what's in-scope, and seed a scan with initial data. BBOT accepts | |
- `IP_RANGE` (`1.2.3.0/24`) | ||
- `OPEN_TCP_PORT` (`192.168.0.1:80`) | ||
- `URL` (`https://www.evilcorp.com`) | ||
- `EMAIL_ADDRESS` (`[email protected]`) | ||
- `ORG_STUB` (`ORG:evilcorp`) | ||
- `USER_STUB` (`USER:bobsmith`) | ||
- `FILESYSTEM` (`FILESYSTEM:/tmp/asdf`) | ||
- `MOBILE_APP` (`MOBILE_APP:https://play.google.com/store/apps/details?id=com.evilcorp.app`) | ||
|
||
Note that BBOT only discriminates down to the host level. This means, for example, if you specify a URL `https://www.evilcorp.com` as the target, the scan will be *seeded* with that URL, but the scope of the scan will be the entire host, `www.evilcorp.com`. Other ports/URLs on that same host may also be scanned. | ||
|
||
|
Oops, something went wrong.