Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Usernames as Targets #1665

Merged
merged 1 commit into from
Aug 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions bbot/scanner/target.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,8 @@ def __init__(self, *targets, strict_scope=False, scan=None, acl_mode=False):
self.strict_scope = strict_scope
self.acl_mode = acl_mode
self.special_event_types = {
"ORG_STUB": re.compile(r"^ORG:(.*)", re.IGNORECASE),
"ASN": re.compile(r"^ASN:(.*)", re.IGNORECASE),
"ORG_STUB": re.compile(r"^(?:ORG|ORG_STUB):(.*)", re.IGNORECASE),
"USERNAME": re.compile(r"^(?:USER|USERNAME):(.*)", re.IGNORECASE),
}
self._events = set()
self._radix = RadixTarget()
Expand Down
17 changes: 13 additions & 4 deletions bbot/test/test_step_1/test_target.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,19 @@ async def test_target(bbot_scanner):
assert list(bbottarget.whitelist) == ["evilcorp.net"]
assert list(bbottarget.blacklist) == ["evilcorp.org"]

scan = bbot_scanner("ORG:evilcorp")
events = [e async for e in scan.async_start()]
assert len(events) == 2
assert set([e.type for e in events]) == {"SCAN", "ORG_STUB"}
# test org stub as target
for org_target in ("ORG:evilcorp", "ORG_STUB:evilcorp"):
scan = bbot_scanner(org_target)
events = [e async for e in scan.async_start()]
assert len(events) == 2
assert set([e.type for e in events]) == {"SCAN", "ORG_STUB"}

# test username as target
for user_target in ("USER:vancerefrigeration", "USERNAME:vancerefrigeration"):
scan = bbot_scanner(user_target)
events = [e async for e in scan.async_start()]
assert len(events) == 2
assert set([e.type for e in events]) == {"SCAN", "USERNAME"}

# verify hash values
bbottarget = BBOTTarget(
Expand Down
Loading