-
Notifications
You must be signed in to change notification settings - Fork 103
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
Allow ad-hoc scan methods to behave similar as in UI #188
Comments
We should first expose this as an official API in Nexpose, preferably. |
I've prototyped this using the UI endpoint and it seems to work okay. Going to wait for some internal feedback before I make a pull request. |
Hi. I would love to assist with this. Anything I can do to help? |
Hi @ben-git-hub99, I've created a branch on my fork with my hacky experimental method. You can either use it with a Gemfile and
Or you can download a pre-built gem file and install it with In your script you'll probably want to add Using the new method works like this: nsc = Nexpose::Connection.new(...)
# Arbitrary site id
site_id = 1
# Default scan template
template = 'full-audit-without-web-spider'
# Local scan engine is typically id 3 on newer installs, but can be 2 on older installs
engine_id = 3
# Array of strings, although passing in Nexpose::IPRange and Nexpose::HostName objects also works correctly
assets_to_scan = ['example.fqdn', '192.168.1.1', '10.1.5.0 - 10.1.5.60']
scan_id = nsc.scan_assets_with_template_engine(site_id, assets_to_scan, template, engine_id)
puts scan_id If any errors occur, they should be returned and match what you would see in the UI. |
Hi @gschneider-r7, I've tried out the branch and it works great! Can you make a second method to allow a single asset to be used instead of asset.join(,)? This would fit my needs exactly. I can get around it with something like this: site_id = 1
template = ['discovery','custom_discovery']
assets_to_scan = ['10.1.5.1, 'example.fqdn','10.1.5.2','example2.fqdn']
eng=3
template.each do |temp|
assets_to_scan.each do |asset|
asset = [asset,nil]
scan_id = nsc.scan_assets_with_template_engine(site_id, asset, temp, eng)
puts "Started scan_id: #{scan_id} for #{asset} using engine_id: #{eng} and template: #{temp}"
end
end But that seems a bit tacky. I look forward to the release of this. Thanks! |
I've updated my fork to take into account an array with only 1 address in it, which should solve that issue. |
I couldn't figure out how to clone the fork, but I saw the commit history and just added the diffs. This works great! Any idea when you can get it shipped out in a release? I would love to multi-thread my project. 👍 |
For future reference, no need to, you could've added @gschneider-r7's fork as an additional upstream. cd /path/to/your-checkout-of/nexpose-client
git remote add gschneider-r7 git@github.com:gschneider-r7/nexpose-client.git
git fetch gschneider-r7
# git cherry-pick COMMITS_YOU_CARE_FOR
# git checkout BRANCH_YOU_WANT_TO_USE --track gschneider-r7/BRANCH_YOU_WANT_TO_USE
# git pull gschneider-r7 BRANCH_YOU_WANT_TO_MERGE If you're using bundler with rubygems you can point to @gschneider-r7, or your own fork and branch, on GitHub; see http://bundler.io/git.html. Obviously that wouldn't be useful with gems you want to push to rubygems.org though (they can't have git dependencies). |
Thanks for that information. I am still a bit new to Git. |
Feedback from this community post: https://community.rapid7.com/thread/7803
Should update the gem to allow for changing scan template, and scan targets for an ad-hoc scan via the API.
The text was updated successfully, but these errors were encountered: