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

Log formats and general improvements #47

Merged
merged 20 commits into from
Apr 2, 2022
Merged

Conversation

initstring
Copy link
Owner

@initstring initstring commented Mar 29, 2022

This PR will try to help those working with tooling output programmatically.

It gets rid of the old printc function and replaces it with fmt_output. This consumes findings as python dictionaries, giving us flexibility in how we deal with the data.

It behaves the same in terms of printing to the screen. However, when a log file is specified it can write the individual items to it either in CSV or JSON.

Still to do:

  • Add a severity value (probably based on public exposure)
  • Update the deb package manpage stuff
  • Tag a new version after merging

Ideas from: #46

UPDATE:

I'm taking the time to address some other things in this PR, too:

  • Lots of linting
  • Some additional error checks
  • Dealing with some edge-case DNS failures
  • More accurate reporting of GCP AppEngine when behind auth

cloud_enum.py Outdated
Comment on lines 70 to 71
parser.add_argument('-f', '--format', type=str, action='store', default='json',
help='Format for log file (json or csv, defaults to json)')

Choose a reason for hiding this comment

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

To avoid breaking changes (unless you don't mind), maybe it's worth making this default to None and if that's the case then save the output in the current, existing format?

Copy link
Owner Author

Choose a reason for hiding this comment

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

Hmmm, good point. I'm not so concerned about breaking what was already a hard to parse log file. But perhaps it's worth adding a "text" option as the default that logs it as plain text, without the ansi stuff. Some might be more familiar with that.

Copy link
Owner Author

Choose a reason for hiding this comment

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

Done!

@initstring initstring changed the title DRAFT: Working on formatting Log formats and general improvements Apr 2, 2022
@initstring initstring merged commit e9f4a24 into master Apr 2, 2022
@initstring initstring deleted the output-formatting branch April 19, 2022 10:54
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.

2 participants