diff --git a/bin/ssh_scan b/bin/ssh_scan index 3f2e4866..5982a372 100755 --- a/bin/ssh_scan +++ b/bin/ssh_scan @@ -14,7 +14,7 @@ options = { "sockets" => [], "policy" => File.join(File.dirname(__FILE__),"../config/policies/mozilla_modern.yml"), "unit_test" => false, - "timeout" => 2, + "timeout" => 5, "threads" => 5, "verbosity" => nil, "logger" => Logger.new(STDERR), diff --git a/lib/ssh_scan/result.rb b/lib/ssh_scan/result.rb index 4b01279a..2da79939 100644 --- a/lib/ssh_scan/result.rb +++ b/lib/ssh_scan/result.rb @@ -174,7 +174,7 @@ def duplicate_host_key_ips=(duplicate_host_key_ips) end def duplicate_host_key_ips - @duplicate_host_key_ips + @duplicate_host_key_ips.to_a end def auth_methods() @@ -258,7 +258,7 @@ def to_hash } if self.error? - hashed_object.error = self.error + hashed_object["error"] = self.error end hashed_object diff --git a/lib/ssh_scan/scan_engine.rb b/lib/ssh_scan/scan_engine.rb index c39529ee..90b167a8 100644 --- a/lib/ssh_scan/scan_engine.rb +++ b/lib/ssh_scan/scan_engine.rb @@ -19,6 +19,7 @@ def scan_target(socket, opts) if port.nil? port = 22 end + timeout = opts["timeout"] result = SSHScan::Result.new() @@ -68,11 +69,14 @@ def scan_target(socket, opts) client.connect() result.set_client_attributes(client) kex_result = client.get_kex_result() - result.set_kex_result(kex_result) + + unless kex_result.nil? + result.set_kex_result(kex_result) + end # Attempt to suppliment a hostname that wasn't provided result.hostname = target.resolve_ptr - + result.error = client.error if client.error? end