-
-
Save parzamendi-r7/bf216a71be19025fd51d to your computer and use it in GitHub Desktop.
SSL scan resource script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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