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

Misc tweaks + improvements #991

Merged
merged 2 commits into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion bbot/core/helpers/web.py
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ async def _acatch(self, url, raise_error):
if raise_error:
raise
except httpx.ConnectError:
log.verbose(f"HTTP connect failed to URL: {url}")
log.debug(f"HTTP connect failed to URL: {url}")
if raise_error:
raise
except httpx.RequestError as e:
Expand Down
9 changes: 8 additions & 1 deletion bbot/modules/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1152,7 +1152,14 @@ def log_table(self, *args, **kwargs):
return table

def _is_graph_important(self, event):
return self._preserve_graph and getattr(event, "_graph_important", False)
return self.preserve_graph and getattr(event, "_graph_important", False)

@property
def preserve_graph(self):
preserve_graph = self.config.get("preserve_graph", None)
if preserve_graph is None:
preserve_graph = self._preserve_graph
return preserve_graph

def stdout(self, *args, **kwargs):
"""Writes log messages directly to standard output.
Expand Down
9 changes: 6 additions & 3 deletions bbot/modules/output/websocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@
class Websocket(BaseOutputModule):
watched_events = ["*"]
meta = {"description": "Output to websockets"}
options = {"url": "", "token": ""}
options_desc = {"url": "Web URL", "token": "Authorization Bearer token"}
_preserve_graph = True
options = {"url": "", "token": "", "preserve_graph": True}
options_desc = {
"url": "Web URL",
"token": "Authorization Bearer token",
"preserve_graph": "Preserve full chains of events in the graph (prevents orphans)",
}

async def setup(self):
self.url = self.config.get("url", "")
Expand Down
4 changes: 1 addition & 3 deletions bbot/modules/sslcert.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,8 @@ async def handle_event(self, event):

if event.scope_distance == 0:
abort_threshold = self.in_scope_abort_threshold
log_fn = self.info
else:
abort_threshold = self.out_of_scope_abort_threshold
log_fn = self.verbose

tasks = [self.visit_host(host, port) for host in hosts]
async for task in self.helpers.as_completed(tasks):
Expand All @@ -70,7 +68,7 @@ async def handle_event(self, event):
dns_names, emails, (host, port) = result
if len(dns_names) > abort_threshold:
netloc = self.helpers.make_netloc(host, port)
log_fn(
self.verbose(
f"Skipping Subject Alternate Names (SANs) on {netloc} because number of hostnames ({len(dns_names):,}) exceeds threshold ({abort_threshold})"
)
dns_names = dns_names[:1] + [n for n in dns_names[1:] if self.scan.in_scope(n)]
Expand Down
2 changes: 1 addition & 1 deletion bbot/scanner/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ async def distribute_event(self, event):
for mod in self.scan.modules.values():
acceptable_dup = (not is_outgoing_duplicate) or mod.accept_dupes
# graph_important = mod._type == "output" and event._graph_important == True
graph_important = mod._preserve_graph and event._graph_important
graph_important = mod._is_graph_important(event)
if acceptable_dup or graph_important:
await mod.queue_event(event)

Expand Down
Loading