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

Small bugfixes in cloudcheck, wpscan, and filedownload #2108

Merged
merged 1 commit into from
Dec 21, 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
29 changes: 16 additions & 13 deletions bbot/core/event/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1564,19 +1564,22 @@ def __init__(self, *args, **kwargs):
# detect type of file content using magic
from bbot.core.helpers.libmagic import get_magic_info, get_compression

extension, mime_type, description, confidence = get_magic_info(self.data["path"])
self.data["magic_extension"] = extension
self.data["magic_mime_type"] = mime_type
self.data["magic_description"] = description
self.data["magic_confidence"] = confidence
# detection compression
compression = get_compression(mime_type)
if compression:
self.add_tag("compressed")
self.add_tag(f"{compression}-archive")
self.data["compression"] = compression
# refresh hash
self.data = self.data
try:
extension, mime_type, description, confidence = get_magic_info(self.data["path"])
self.data["magic_extension"] = extension
self.data["magic_mime_type"] = mime_type
self.data["magic_description"] = description
self.data["magic_confidence"] = confidence
# detection compression
compression = get_compression(mime_type)
if compression:
self.add_tag("compressed")
self.add_tag(f"{compression}-archive")
self.data["compression"] = compression
# refresh hash
self.data = self.data
except Exception as e:
log.debug(f"Error detecting file type: {type(e).__name__}: {e}")


class RAW_DNS_RECORD(DictHostEvent, DnsEvent):
Expand Down
7 changes: 6 additions & 1 deletion bbot/modules/internal/cloudcheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,12 @@ async def handle_event(self, event, **kwargs):

for i, host in enumerate(hosts_to_check):
host_is_ip = self.helpers.is_ip(host)
for provider, provider_type, subnet in self.helpers.cloudcheck(host):
try:
cloudcheck_results = self.helpers.cloudcheck(host)
except Exception as e:
self.trace(f"Error running cloudcheck against {event} (host: {host}): {e}")
continue
for provider, provider_type, subnet in cloudcheck_results:
if provider:
event.add_tag(f"{provider_type}-{provider}")
if host_is_ip:
Expand Down
8 changes: 4 additions & 4 deletions bbot/modules/wpscan.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,10 @@ def construct_command(self, url):

def parse_wpscan_output(self, output, base_url, source_event):
json_output = json.loads(output)
interesting_json = json_output.get("interesting_findings", {})
version_json = json_output.get("version", {})
theme_json = json_output.get("main_theme", {})
plugins_json = json_output.get("plugins", {})
interesting_json = json_output.get("interesting_findings", {}) or {}
version_json = json_output.get("version", {}) or {}
theme_json = json_output.get("main_theme", {}) or {}
plugins_json = json_output.get("plugins", {}) or {}
if interesting_json:
yield from self.parse_wp_misc(interesting_json, base_url, source_event)
if version_json:
Expand Down
Loading