Skip to content

Instantly share code, notes, and snippets.

@WJDigby
Last active October 26, 2015 20:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WJDigby/c1193589539b0e787166 to your computer and use it in GitHub Desktop.
Save WJDigby/c1193589539b0e787166 to your computer and use it in GitHub Desktop.
##
# This module requires Metasploit: http://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'msf/core'
class Metasploit3 < Msf::Auxiliary
def initialize
super(
'Name' => 'Launch rdesktop',
'Description' => %q{
This module uses msfconsole options to launch the external rdesktop program.
},
'Author' => 'Andy Whitmer',
'License' => MSF_LICENSE,
)
register_options(
[
OptString.new('RHOST', [true, 'Remote host IP' ]),
OptString.new('RPORT', [false, 'Remote host port', 3389]),
OptString.new('SMBUser', [false, 'Username to login with' ]),
OptString.new('SMBPass', [false, 'Password to login with' ]),
OptString.new('SMBDomain', [false, 'Domain name']),
OptString.new('LPATH', [false, 'Redirect a local disk to the client as a share named "local"'])
], self.class)
end
def run()
rdesktop = Rex::FileUtils::find_full_path('rdesktop')
unless (rdesktop)
print_error("rdesktop not installed or not detected.")
return
end
cmd = rdesktop
cmd << " -d #{datastore['SMBDomain']}" if datastore['SMBDomain'].to_s != ''
cmd << " -u #{datastore['SMBUser']}" if datastore['SMBUser'].to_s != ''
cmd << " -p #{datastore['SMBPass']}" if datastore['SMBPass'].to_s != ''
cmd << " -r disk:local=#{datastore['LPATH']}" if datastore['LPATH'].to_s != ''
cmd << " #{datastore['RHOST']}"
cmd << ":#{datastore['RPORT']}"
self.view = framework.threads.spawn("rdesktopWrapper", false) {
system(cmd)
}
end
attr_accessor :view # :nodoc:
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment