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

Add sterr to output list #3649

merged 8 commits into from
Oct 23, 2024

Conversation

noamblitz
Copy link
Contributor

Changes

Also save sterr to bytes for docker boefjes

Issue link

Closes #3559

Demo

Please add some proof in the form of screenshots or screen recordings to show (off) new functionality, if there are interesting new features for end-users.

QA notes

Please add some information for QA on how to test the newly created code.


Code Checklist

  • All the commits in this PR are properly PGP-signed and verified.
  • This PR only contains functionality relevant to the issue.
  • I have written unit tests for the changes or fixes I made.
  • I have checked the documentation and made changes where necessary.
  • I have performed a self-review of my code and refactored it to the best of my abilities.
  • Tickets have been created for newly discovered issues.
  • For any non-trivial functionality, I have added integration and/or end-to-end tests.
  • I have informed others of any required .env changes files if required and changed the .env-dist accordingly.
  • I have included comments in the code to elaborate on what is not self-evident from the code itself, including references to issues and discussions online, or implicit behavior of an interface.

Checklist for code reviewers:

Copy-paste the checklist from the docs/source/templates folder into your comment.


Checklist for QA:

Copy-paste the checklist from the docs/source/templates folder into your comment.

@noamblitz noamblitz requested a review from a team as a code owner October 8, 2024 14:23
@noamblitz noamblitz marked this pull request as draft October 8, 2024 14:28
@noamblitz noamblitz marked this pull request as ready for review October 8, 2024 14:28
@noamblitz
Copy link
Contributor Author

#3559 (comment)

Important to think about.

results = [({"openkat/nmap-output"}, output.stdout.decode())]

if output.stderr:
return results.append(({"error/boefje"}, output.stderr.decode()))
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.

ammar92
ammar92 previously approved these changes Oct 8, 2024
Copy link
Contributor

@ammar92 ammar92 left a comment

Choose a reason for hiding this comment

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

No remarks

Copy link

@dekkers
Copy link
Contributor

dekkers commented Oct 23, 2024

I tested it and verified that the boefje still works. If I introduce an error the boefje will get failed status.

The stderr of the command is not saved as is mentioned in the description because the exception is not catched. But this part is already useful, so I am merging the PR and creating a new issue.

@dekkers dekkers merged commit 64461ad into main Oct 23, 2024
23 checks passed
@dekkers dekkers deleted the feature/save-sterr branch October 23, 2024 17:01
jpbruinsslot added a commit that referenced this pull request Oct 24, 2024
* main:
  Add sterr to output list (#3649)
  feat: ✨ add Shodan InternetDB boefje (#2615)
  Add search endpoint for schedules for scheduler (#3695)
jpbruinsslot added a commit that referenced this pull request Oct 24, 2024
* main: (25 commits)
  Add sterr to output list (#3649)
  feat: ✨ add Shodan InternetDB boefje (#2615)
  Add search endpoint for schedules for scheduler (#3695)
  Fix/report naming (#3666)
  Add delete schedule functionality for schedules in the scheduler (#3678)
  Fix javascript and component template in prod environments (#3672)
  Fix first order dangling affirmation delete (#3682)
  Do not run dh_strip_nondeterminism in Debian packaging (#3674)
  Github action should trigger if workflow definition changes (#3680)
  Updated packages (#3694)
  Silence KATFindingType not found error in JobHandler (#3686)
  Add docs for xtdb analyze bits. (#3688)
  Fix empty vulnerability reports (#3662)
  Fix jsonb 'contained by' query (#3643)
  Add plugins to findings report (#3657)
  Translations update from Hosted Weblate (#3673)
  Update upload_raw.py (#3645)
  Add rocky worker service to debian packages (#3619)
  Fix/yielded objects (#3669)
  make some things look better (#3661)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New boefje containerized setup ignores stderr
4 participants