Posh-Nessus icon indicating copy to clipboard operation
Posh-Nessus copied to clipboard

Added API Token authentication support

Open ConnorGriffin opened this issue 6 years ago • 2 comments

Made changes to Session.ps1 and Posh-Nessus.psm1 to support the use of API Secretkey/Accesskey authentication in addition to username/password authentication.

Example (using invalid/discarded API key):

> New-NessusSession -ComputerName 'scanner1.local' -Port 8834 -AccessKey '0472a87ffa7e3acc01e5c864bbf008a6bdc84de2af
27dd343a513187ce423093' -SecretKey 'aa7762a5b13ef6cb90ef852755f884ab8cd959944e9dbebdc51bfc8483927d4d'


SessionId : 1
URI       : https://scanner1.local:8834
Token     : {SecretKey, AccessKey}

Listing my Credential session and my API session. Both can be used by specifying the respective SessionID. No changes have been made to the way existing functions are used. Technically the API session is not a 'session', but it was the simplest way to add API support without completely rewriting the existing authentication framework:

> Get-NessusSession


SessionId : 0
URI       : https://scanner1.local:8834
Token     : 42bde0e16fa5638413d12840813aef72f7abede094e1a6c0

SessionId : 1
URI       : https://scanner1.local:8834
Token     : {SecretKey, AccessKey}

ConnorGriffin avatar Mar 13 '18 21:03 ConnorGriffin

Woot!! Hope one of my ex-coworkers at Tenable will merge these soon

Sent from my iPhone

On Mar 13, 2018, at 5:11 PM, Connor Griffin [email protected] wrote:

Made changes to Session.ps1 and Posh-Nessus.psm1 to support the use of API Secretkey/Accesskey authentication in addition to username/password authentication.

Example (using invalid/discarded API key):

New-NessusSession -ComputerName 'scanner1.local' -Port 8834 -AccessKey '0472a87ffa7e3acc01e5c864bbf008a6bdc84de2af 27dd343a513187ce423093' -SecretKey 'aa7762a5b13ef6cb90ef852755f884ab8cd959944e9dbebdc51bfc8483927d4d'

SessionId : 1 URI : https://scanner1.local:8834 Token : {SecretKey, AccessKey} Listing my Credential session and my API session. Both can be used by specifying the respective SessionID. No changes have been made to the way existing functions are used. Technically the API session is not a 'session', but it was the simplest way to add API support without completely rewriting the existing authentication framework:

Get-NessusSession

SessionId : 0 URI : https://adsprscan02.az.int:8834 Token : 42bde0e16fa5638413d12840813aef72f7abede094e1a6c0

SessionId : 1 URI : https://adsprscan02.az.int:8834 Token : {SecretKey, AccessKey} You can view, comment on, or merge this pull request online at:

https://github.com/tenable/Posh-Nessus/pull/23

Commit Summary

Added support for API key authentication Matched previous formatting File Changes

M Posh-Nessus.psm1 (21) M Session.ps1 (111) Patch Links:

https://github.com/tenable/Posh-Nessus/pull/23.patch https://github.com/tenable/Posh-Nessus/pull/23.diff — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

darkoperator avatar Mar 14 '18 01:03 darkoperator

Merge please :D

nicpenning avatar May 26 '20 23:05 nicpenning