tenable / pyTenable

Python Library for interfacing into Tenable's platform APIs
https://pytenable.readthedocs.io
MIT License
354 stars 173 forks source link

SC creds parameter not passing through to sc.scans.create #128

Closed Danny-Cooke closed 5 years ago

Danny-Cooke commented 5 years ago

Describe the bug I am trying to create scans using the API but the creds parameter doesn't seem to be accepted in any format. It expects to be a list which when provided correctly complains that "cred" is in the wrong format.

TypeError: cred:id is of type str. Expected int.

any combination of formats passed through results in similar errors. i.e cred type is str but expected int. etc

here is my code:-


!/usr/bin/env python

import sys

from tenable.sc import TenableSC sc = TenableSC('MY_SC_SERVER') sc.login('winapi', 'MY_SC_SERVER_PW')

sc.scans.create('MY_NEW_HOST compliance scan', 1, policy_id=1000113, creds=['5'], targets=['10.10.10.10'])


multiple variations of "creds" have been tried creds Creds Cred cred multiple formats of the scan id have been tried ['5'] [5] '5' 5 and it just doesn't seem to like it. (tried the different formats as i saw a previous issue with creds being referenced incorrectly within documentation)

If creds is removed from the call completely then it works but i then have a new scan with now creds attached.

System Information (please complete the following information):

pytenable verion 0.3.21

SteveMcGrath commented 5 years ago

The following call seems to work:

sc.scans.create('Example', 1, creds=[1000001], targets=['127.0.0.1'], policy_id=1000001, type='policy')

On the flip side, you did highlight that the type wasn't being auto-set like it should have been