Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env ruby
- require 'msfrpc-client'
- @keyword = 'MS08-067'
- @matches = []
- begin
- @rpc = Msf::RPC::Client.new( :host => "127.0.0.1",
- :port => 55552,
- :user => 'msf',
- :pass => 'abc123',
- :ssl => true )
- rescue => e
- puts "(-) Error: connection failed: #{e}"
- end
- if @rpc.token.nil?
- puts '(-) Error: authentication failed'
- exit 1
- end
- version = @rpc.call('core.version')
- puts "(*) Version: #{version}"
- puts
- @token = @rpc.token
- puts "(*) Temporary Token: #{@token}"
- puts
- exploits = @rpc.call('module.exploits')['modules']
- puts "(*) Searching #{exploits.length} modules..."
- puts
- exploits.each do |name|
- mod = @rpc.call('module.info', 'exploit', name)
- if mod['name'] =~ /#{@keyword}/i || mod['description'] =~ /#{@keyword}/i || mod['references'] =~ /#{@keyword}/i
- @matches << [mod['name'], name]
- end
- end
- if @matches.empty?
- puts "(-) Found no matches for #{@keyword}"
- exit 1
- end
- puts "(+) Found (#{@matches.length}) matches:"
- @matches.each do |match|
- puts match.join ' :: '
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement