Skip to content

Commit

Permalink
Merge pull request #2108 from blacklanternsecurity/misc-bugfixes
Browse files Browse the repository at this point in the history
Small bugfixes in cloudcheck, wpscan, and filedownload
  • Loading branch information
TheTechromancer authored Dec 21, 2024
2 parents f6fdd79 + bdce64c commit 6d2ae67
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 18 deletions.
29 changes: 16 additions & 13 deletions bbot/core/event/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1578,19 +1578,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

0 comments on commit 6d2ae67

Please sign in to comment.