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

Find sites that have not been scanned? #263

Open
nbirnel opened this issue Mar 16, 2017 · 2 comments
Open

Find sites that have not been scanned? #263

nbirnel opened this issue Mar 16, 2017 · 2 comments

Comments

@nbirnel
Copy link
Contributor

nbirnel commented Mar 16, 2017

Expected Behavior

I would like to be able to determine which sites have not been scanned. While the web UI shows "not scanned" for those sites, a Nexpose::SiteSummary has nothing I can see to indicate last scans. The closest I have been able to find is the idea of listing all paused and past scans, finding their sites, and removing that from the whole list of sites. Am I missing something, or is this just not supported?

Context

I have quite a few unscanned sites that I would like to delete - too many to want to do manually.

@gschneider-r7
Copy link
Contributor

Unfortunately there isn't a native API call for this, but you can work around that by using the gem to pull the same site listing details that the UI does:

sites = Nexpose::DataTable._get_dyn_table(nsc, '/data/site/dyntable?tableID=SiteSynopsis')
unscanned = sites.find_all { |site| site['Last Scan'] == '-1' }

The Last Scan field returned for the data table is a timestamp in long format (like unix time) as a string, and -1 is the placeholder value for sites that don't have a last scan date.

Note that I'm using a "private" method here, which ideally should only be consumed by the gem itself, but it is accessible to any scripts using the gem.

@peterjmcg
Copy link

Almost a year too late but if still interested I think

nsc.last_scan(site.id) == nil

should also indicate a site never scanned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants