Add key length check and remove mixin

Also add a reference to the original honeyscore website
bug/bundler_fix
Carter 2017-03-24 22:33:09 -04:00 committed by GitHub
parent 2a96190dac
commit 3e2173d4f9
1 changed files with 14 additions and 5 deletions

View File

@ -7,8 +7,6 @@ require 'msf/core'
class MetasploitModule < Msf::Auxiliary
include Msf::Exploit::Remote::HttpClient
def initialize(info = {})
super(update_info(info,
'Name' => 'Shodan Honeyscore Client',
@ -24,8 +22,12 @@ class MetasploitModule < Msf::Auxiliary
https://honeyscore.shodan.io/
},
'Author' =>
[ 'thecarterb' ],
'License' => MSF_LICENSE
[ 'thecarterb' ], # Thanks to @rwhitcroft, @h00die and @wvu-r7 for the improvements and review!
'License' => MSF_LICENSE,
'References' =>
[
[ 'URL', 'https://honeyscore.shodan.io/']
]
)
)
@ -47,6 +49,13 @@ class MetasploitModule < Msf::Auxiliary
def run
key = datastore['SHODAN_APIKEY']
# Check the length of the key (should be 32 chars)
if key.length != 32
print_error('Invalid API key (Not long enough)')
return
end
tgt = datastore['TARGET']
print_status("Scanning #{tgt}")
cli = Rex::Proto::Http::Client.new('api.shodan.io', 443, {}, true)
@ -78,7 +87,7 @@ class MetasploitModule < Msf::Auxiliary
print_good("#{tgt} is probably a honeypot")
elsif score == 1.0
print_good("#{tgt} is definitely a honeypot")
else # We shouldn't ever get here as the previous check should catch an unexpected response
else # We shouldn't ever get here as the previous checks should catch an unexpected response
print_error('An unexpected error occured.')
return
end