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

Unable to start scans. #21

Open
TheMetal1123 opened this issue Mar 12, 2018 · 4 comments
Open

Unable to start scans. #21

TheMetal1123 opened this issue Mar 12, 2018 · 4 comments

Comments

@TheMetal1123
Copy link

TheMetal1123 commented Mar 12, 2018

First Powershell is most assuredly not my wheelhouse. However this project has fallen in my lap and its my job to figure it out. I am attempting to automate scans, but I keep getting:

PS C:> Start-NessusScan -SessionId 0 -ScanId 1772
InvokeNessusRestRequest : {"error":"API is not available"}
At C:\Users\Documents\WindowsPowerShell\Modules\Posh-Nessus\Scan.ps1:434 char:23

  • ... $Scans = InvokeNessusRestRequest -SessionObject $Connection -Path ...
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [InvokeNessusRestRequest], WebException
    • FullyQualifiedErrorId : WebCmdletWebResponseException,InvokeNessusRestRequest
@darkoperator
Copy link
Contributor

darkoperator commented Mar 12, 2018 via email

@TheMetal1123
Copy link
Author

That would be the latest version..... Now I don't feel like such an idiot!

@TheMetal1123
Copy link
Author

Are you aware of anyway to update the target list of IPs through the API?

@ConnorGriffin
Copy link

ConnorGriffin commented Mar 12, 2018

@TheMetal1123 There doesn't appear to be a way to update the target list using the module in its current state. I have added rudimentary support for editing the scan details (most of the items on here). I have never worked with ACLs, target/agent groups, or file targets, so I can't test those features. Renaming, adding descriptions, and changing scheduling seems to work fairly well, though the syntax is iffy. Our version is Nessus Professional 6.11.3 (#104) WINDOWS.

You should be able to check the API details of your Nessus instance by going to https://nessusserver:8834/api#/overview

I added the following function to Scan.ps1 in the module folder. I may submit a pull request if i have time to test and clean up this feature, and test against the latest Nessus. I think we may be a couple major versions behind. It looks like Tenable completely dropped API support for self-hosted customers, opting to use basic features as a selling point of their cloud solution, so that's pretty disappointing.

Anyway, here's the function that I just copied into C:\Users\<username>\Documents\WindowsPowerShell\Modules\Posh-Nessus\Scan.ps1.

Updating the target list:
Edit-NessusScanDetail -SessionId 0 -ScanId 2003 -TextTargets '10.135.7.40, 10.135.7.63, 10.135.7.8, 10.251.0.1/24'

Renaming a scan, changing the description, changing the email list, and setting an every 2 weeks schedule starting on March 15th at noon:
Edit-NessusScanDetail -SessionId 0 -ScanId 2003 -Name 'EditedScanName' -Description 'TestDescription' -Frequency Weekly -Interval 2 -StartTime '2018-03-15 12:00:00' -Emails '[email protected]','[email protected]'

The scheduling syntax is weird, and I don't think I did a good job of getting it into the module, but... eh. You can check the API documentation to see what the script is asking for. For example, If you want a weekly on Monday and Friday, $ByDay should be 'MO,FR'.

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

No branches or pull requests

3 participants