Skip to content

Instantly share code, notes, and snippets.

@parzamendi-r7
Last active February 6, 2017 15:33
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save parzamendi-r7/bf216a71be19025fd51d to your computer and use it in GitHub Desktop.
Save parzamendi-r7/bf216a71be19025fd51d to your computer and use it in GitHub Desktop.
SSL scan resource script
<ruby>
#Check for db connection
begin
framework.db.hosts
rescue ::ActiveRecord::ConnectionNotEstablished
print_error("Database connection isn't established. Try again!")
return
end
framework.db.workspace.services.each do |serv|
next if (serv.state != ServiceState::Open)
if (serv.port == 443 or serv.name =~ /https/)
print_line("Scanning SSL information on host: #{serv.host.address} on port #{serv.port}")
scanner = Rex::SSLScan::Scanner.new(serv.host.address, serv.port)
scan_data = scanner.scan
results = scan_data.to_s.scan(/Accepted.+\*.*|Accepted.+SSLv2.*/)
if results.empty?
print_good("No issues found")
else
clean_results = ""
results.each do |line|
clean_results << line.squish + "\n"
end
print_good("Found #{clean_results}")
framework.db.report_note(
:host => serv.host.address,
:name => "SSL",
:port => serv.port,
:proto => "tcp",
:type => "ssl.scanner.results",
:data => {SSLData:clean_results}
)
end
else
print_error("SSL not running on #{serv.host.address} on #{serv.port}")
end
end
</ruby>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment