Skip to content

Msf::Auxiliary::Report provides APIs for saving data to the Metasploit database. Its implementation is lib/msf/core/auxiliary/report.rb. HttpClient includes it too.

MethodPurpose
report_hostRegister a host
report_serviceRegister a service
report_noteSave a free-form note
report_vulnRecord a vulnerability
report_lootRecord loot metadata
store_lootSave the file and index it as loot
create_credentialSave a credential
create_credential_loginRecord a successful login
create_credential_and_loginDo both together
invalidate_loginRecord a failed login
myworkspace / myworkspace_idCurrent workspace
report_service(
host: rhost,
port: rport,
proto: 'tcp',
name: 'http',
info: 'ExampleApp 1.2'
)
report_note(
host: rhost,
type: 'example.version',
data: { version: '1.2' },
update: :unique_data
)
report_vuln(
host: rhost,
port: rport,
name: 'Example RCE',
refs: references
)
path = store_loot(
'example.config', # ltype
'text/plain', # ctype
rhost, # host or session
res.body, # data
'config.php', # filename
'Application config' # info
)
print_good("Loot: #{path}")
create_credential_and_login(
address: rhost,
port: rport,
service_name: 'ssh',
protocol: 'tcp',
workspace_id: myworkspace_id,
origin_type: :service,
module_fullname: fullname,
username: user,
private_data: pass,
private_type: :password,
status: Metasploit::Model::Login::Status::SUCCESSFUL
)

Modules still run without a database, but these calls become effectively no-ops or produce warnings. In a test environment, prepare msfdb first as described in Basics and the Database.

For helper examples, also see Reporting Helpers.