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 methods to retrieve paused scans #196

Merged
merged 4 commits into from
Dec 11, 2015

Conversation

gschneider-r7
Copy link
Contributor

Two separate methods for site scans and all scans using two different data table endpoints. This may or may not allow for some more efficiency when checking specific sites.

Added new class ActiveScan based on CompletedScan to handle parsing the data differently.

Testing required:

  • Get paused scans for specific sites
  • Get all paused scans
  • Get paused scans when there are also running scans
  • Get paused scans when there are also integrating scans
  • Scheduled scans paused by schedule
  • Scheduled scans paused by user
  • Manual scans paused by user

A pre-built gem can be downloaded at http://gavinws.com/nexpose-2.3.0.pre.gem otherwise set your gemfile to use my fork and branch.

Resolves #193

@site_id = json['Site ID']
@status = CompletedScan._parse_status(json['Status Code'])
@start_time = Time.at(json['Started'].to_i / 1000)
@end_time = Time.at(json['Progress'].to_i / 1000)

Choose a reason for hiding this comment

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

Do not use Time.at without zone. Use one of Time.zone.at, Time.at.current, Time.at.in_time_zone, Time.at.utc, Time.at.getlocal, Time.at.iso8601, Time.at.jisx0301, Time.at.rfc3339, Time.at.to_i, Time.at.to_f instead.

Two separate methods for site scans and all scans using two different
data table endpoints.

Added new class ActiveScan based on CompletedScan to handle parsing the
data differently.
Forgot to map the global paused scans to ActiveScan objects. Cleaned up
doc a bit. Make site_id not default to nil since it is required for the
method.
@gschneider-r7 gschneider-r7 added this to the 3.0 milestone Dec 10, 2015
end
else
uri = '/data/site/scans/dyntable.xml?printDocType=0&tableID=siteScansTable&activeOnly=true'
data = DataTable._get_dyn_table(self, uri).select { |scan| (scan['Status'].include? 'Paused')}

Choose a reason for hiding this comment

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

Space missing inside }.

gschneider-r7 added a commit that referenced this pull request Dec 11, 2015
@gschneider-r7 gschneider-r7 merged commit 7e37ecf into rapid7:master Dec 11, 2015
@gschneider-r7 gschneider-r7 deleted the paused_scans_listing branch December 11, 2015 00:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants