Advertisement
Guest User

Untitled

a guest
Jun 15th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. #!/usr/bin/env ruby
  2. require 'msfrpc-client'
  3.  
  4. @keyword = 'MS08-067'
  5. @matches = []
  6.  
  7. begin
  8. @rpc = Msf::RPC::Client.new( :host => "127.0.0.1",
  9. :port => 55552,
  10. :user => 'msf',
  11. :pass => 'abc123',
  12. :ssl => true )
  13. rescue => e
  14. puts "(-) Error: connection failed: #{e}"
  15. end
  16.  
  17. if @rpc.token.nil?
  18. puts '(-) Error: authentication failed'
  19. exit 1
  20. end
  21.  
  22. version = @rpc.call('core.version')
  23. puts "(*) Version: #{version}"
  24. puts
  25.  
  26. @token = @rpc.token
  27. puts "(*) Temporary Token: #{@token}"
  28. puts
  29.  
  30. exploits = @rpc.call('module.exploits')['modules']
  31.  
  32. puts "(*) Searching #{exploits.length} modules..."
  33. puts
  34.  
  35. exploits.each do |name|
  36. mod = @rpc.call('module.info', 'exploit', name)
  37. if mod['name'] =~ /#{@keyword}/i || mod['description'] =~ /#{@keyword}/i || mod['references'] =~ /#{@keyword}/i
  38. @matches << [mod['name'], name]
  39. end
  40. end
  41.  
  42. if @matches.empty?
  43. puts "(-) Found no matches for #{@keyword}"
  44. exit 1
  45. end
  46.  
  47. puts "(+) Found (#{@matches.length}) matches:"
  48. @matches.each do |match|
  49. puts match.join ' :: '
  50. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement