Session¶
The following methods allow for interaction into the Tenable Vulnerability Management session API endpoints.
Methods available on tio.session
:
- class SessionAPI(api: APISession)[source]¶
Tenable Vulnerability Management session API is deprecated. it is recommended to use
users
endpoint instead- change_password(old_password, new_password)[source]¶
Change the password of the current user.
- Parameters:
- Returns:
The password has been successfully changed.
- Return type:
Examples
>>> tio.session.change_password('old_pass', 'new_pass')
- details()[source]¶
Retrieve the current users resource record.
- Returns:
The user’s session resource record.
- Return type:
Examples
>>> user = tio.session.details() >>> pprint(user)
- edit(name, email)[source]¶
Modify the currently logged-in user.
- Parameters:
- Returns:
The session data for the current user.
- Return type:
Examples
>>> tio.session.edit('John Doe', 'joe@company.com')
- enable_two_factor(phone)[source]¶
Initiate the phone-based two-factor authorization verification process.
- Parameters:
phone (str) – The phone number to use for two-factor auth.
- Returns:
One-time activation code sent to the provided phone number.
- Return type:
Examples
>>> tio.session.enable_two_factor('9998887766')
- gen_api_keys()[source]¶
Generate new API keys for the current user.
- Returns:
A dictionary containing the new API Keypair.
- Return type:
Examples
>>> keys = tio.session.gen_api_keys()
- restore()[source]¶
Restore the session to the logged-in user. This will remove any user impersonation setting that have been set.
- Returns:
The session has properly been restored to the original user.
- Return type:
Example
>>> tio.session.restore()
- two_factor(email, sms, phone=None)[source]¶
Configure two-factor authorization.
- Parameters:
- Returns:
Setting changes were successfully updated.
- Return type:
Example
Configure email multi-factor auth:
>>> tio.session.two_factor(True, False)
Configure SMS multi-factor auth:
>>> tio.session.two_factor(False, True, '9998887766')