Using Two Factor Authentication - rapid7/nexpose-client GitHub Wiki
Before attempting to use Two Factor Authentication, be sure to follow the guide on Rapid7's Community forum to successfully setup and enable the feature.
Login with a User setup to use Two Factor Authentication:
nsc = Connection.new('10.99.0.1', 'tfa_username', 'tfa_password', port, silo_id, 'tfa_access_code')
nsc.login
When logging in with a user that has two factor authentication enabled, you will need to pass in the port and the silo_id for the Nexpose console. The default port for Nexpose is 3780, and unless the silo_id is known the default should be nil.
With that information, our default Connectionwould look something like this:
nsc = Connection.new('10.99.0.1', 'tfa_username', 'tfa_password', 3780, nil, 'tfa_access_code')
nsc.login
Keep an eye on this page, as we will add more functionality around the two factor authentication feature in this gem.