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

Added function to download all JSON reports #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

qmontal
Copy link

@qmontal qmontal commented Jul 9, 2018

Every scan has its own JSON report. The objective of this function
is to download all of the JSON reports of all the scans and save
them locally, in order to be able to extract all of the findings
and send them to an aggregator.

The reason of this has been to integrate Detectify to VulnWhisperer
(see more at https://github.com/austin-taylor/VulnWhisperer)

Every scan has its own JSON report. The objective of this function
is to download all of the JSON reports of all the scans and save
them locally, in order to be able to extract all of the findings
and send them to an aggregator.

The reason of this has been to integrate Detectify to VulnWhisperer
(see more at https://github.com/austin-taylor/VulnWhisperer)
Copy link

@robertogiachetta robertogiachetta left a comment

Choose a reason for hiding this comment

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

Nice contribution in general, I only have a few minor notes. Although not sure if this the right place for the JSON download function. This is an "API examples" project, and that function seems to be more important than just laying around in this repo. We do have a community projects repo now, so maybe move it there?

if req != None:
return json.loads(req.text)

def profiles_findings(api_key, secret_key):

Choose a reason for hiding this comment

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

Could you possibly add some comments and/or update function name to be more accurate on what it does?

for files in report_files:
scan, report = (files.split(".json")[0]).split("_")
if scan in all_reports.keys():
if report in all_reports[scan]["reports"]:

Choose a reason for hiding this comment

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

I would recommend to make sure the report was completed when last downloaded, incomplete reports should be replaced. You can use the stopped timestamp to check if the report is complete.

Copy link
Author

Choose a reason for hiding this comment

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

I was checking now on this, and when downloading the reports, I was expecting that they were already finished before being stored as report; in the case of using the stopped timestamp, that value is represented as empty?

Also, at that point of the code I am working with only the filenames, not the full report data, so this check should be done at #L141 or #L142 when I am going through the reports. Will check on that.

if profiles != None:
for scan in profiles:
#print i["token"]
scan_status(scan["token"], api_key, "")
scan_status(scan["token"], api_key, secret_key)

Choose a reason for hiding this comment

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

Nice catch

@qmontal
Copy link
Author

qmontal commented Sep 20, 2018

Sure, it would be great to move it over there! I am actually working on this script in order to add it as a module to the VulnWhisperer project, although right now I am stuck with other stuff.

I will definitely do the mentioned changes as soon as I am able :)

Cheers!

@qmontal
Copy link
Author

qmontal commented Mar 13, 2019

Hey @robertogiachetta! There is an issue with the new community projects repo (https://github.com/detectify/community-projects): it doesn't have any file, so you are presented with This repository is empty. Care to check out the GitHub Channel on YouTube while you wait? and you are not allowed to fork or do PRs; could you add a README.md file in order to be able to do PR?
Thanks!

@robertogiachetta
Copy link

Hi @qmontal, sorry about that! Added a short README, so you can clone. Will add more content next week.

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