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

Add sterr to output list #3649

Merged
merged 8 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
6 changes: 5 additions & 1 deletion boefjes/boefjes/plugins/kat_dnssec/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,8 @@ def run(boefje_meta: dict):
cmd = ["/usr/bin/drill", "-DT", domain]
output = subprocess.run(cmd, capture_output=True)

return [({"openkat/dnssec-output"}, output.stdout)]
results = [({"openkat/dnssec-output"}, output.stdout)]
if output.stderr:
return results.append(({"error/boefje"}, output.stderr))

return results
9 changes: 8 additions & 1 deletion boefjes/boefjes/plugins/kat_nmap_tcp/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,11 @@ def run(boefje_meta: dict):
cmd.append("-6")

cmd.extend(["-oX", "-", str(ip)])
return [({"openkat/nmap-output"}, subprocess.run(cmd, capture_output=True).stdout.decode())]

output = subprocess.run(cmd, capture_output=True)
results = [({"openkat/nmap-output"}, output.stdout.decode())]

if output.stderr:
return results.append(({"error/boefje"}, output.stderr.decode()))
noamblitz marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return results.append(({"error/boefje"}, output.stderr.decode()))
if not output.stdout:
results = []
return results.append(({"error/boefje"}, output.stderr.decode()))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also made a push. That should also cover this, right?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your solution makes sure we don't Delete any previous proofs.
My suggestions allows for a situation where we still have some logical output that we'd want to ingest into the graph, but also some errors (which did not stop us from creating data). The million dollar question is: 'is there a situation where nmap throws errors, but still manages to produce valid output?'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha yeah good question. To be honest I don't think so. Im more inclined to be on the safe side and never delete old observations. If you feel like there are situations when nmap throws errors & good output, then I'm happy to rewrite it to your solution.


return results