From 9500038695af5eaa8ac8bdcb9b2f784d8c9a900d Mon Sep 17 00:00:00 2001 From: sinn3r Date: Sat, 11 Oct 2014 11:11:09 -0500 Subject: [PATCH] Fix #3995 - Make negative messages less verbose As an user testing against a large network, I only want to see good news, not bad news. --- modules/auxiliary/scanner/afp/afp_login.rb | 2 +- modules/auxiliary/scanner/db2/db2_auth.rb | 2 +- modules/auxiliary/scanner/ftp/ftp_login.rb | 2 +- modules/auxiliary/scanner/http/axis_login.rb | 8 ++++++-- modules/auxiliary/scanner/http/glassfish_login.rb | 8 ++++++-- modules/auxiliary/scanner/http/hp_sys_mgmt_login.rb | 8 ++++++-- modules/auxiliary/scanner/http/http_login.rb | 8 ++++++-- modules/auxiliary/scanner/http/ipboard_login.rb | 8 ++++++-- modules/auxiliary/scanner/http/jenkins_login.rb | 2 +- modules/auxiliary/scanner/http/tomcat_mgr_login.rb | 2 +- modules/auxiliary/scanner/http/wordpress_xmlrpc_login.rb | 8 ++++++-- modules/auxiliary/scanner/mssql/mssql_login.rb | 2 +- modules/auxiliary/scanner/mysql/mysql_login.rb | 6 +++--- modules/auxiliary/scanner/pop3/pop3_login.rb | 8 ++++++-- modules/auxiliary/scanner/postgres/postgres_login.rb | 2 +- modules/auxiliary/scanner/smb/smb_login.rb | 8 ++++++-- modules/auxiliary/scanner/snmp/snmp_login.rb | 2 +- modules/auxiliary/scanner/ssh/ssh_login.rb | 8 ++++++-- modules/auxiliary/scanner/ssh/ssh_login_pubkey.rb | 8 ++++++-- modules/auxiliary/scanner/telnet/telnet_login.rb | 2 +- modules/auxiliary/scanner/vmware/vmauthd_login.rb | 8 ++++++-- modules/auxiliary/scanner/vnc/vnc_login.rb | 2 +- modules/auxiliary/scanner/winrm/winrm_login.rb | 2 +- 23 files changed, 80 insertions(+), 36 deletions(-) diff --git a/modules/auxiliary/scanner/afp/afp_login.rb b/modules/auxiliary/scanner/afp/afp_login.rb index f94c8d1c91..8e57d6e852 100644 --- a/modules/auxiliary/scanner/afp/afp_login.rb +++ b/modules/auxiliary/scanner/afp/afp_login.rb @@ -79,7 +79,7 @@ class Metasploit3 < Msf::Auxiliary print_good "#{ip}:#{rport} - LOGIN SUCCESSFUL: #{result.credential}" else invalidate_login(credential_data) - print_status "#{ip}:#{rport} - LOGIN FAILED: #{result.credential} (#{result.status}: #{result.proof})" + vprint_error "#{ip}:#{rport} - LOGIN FAILED: #{result.credential} (#{result.status}: #{result.proof})" end end end diff --git a/modules/auxiliary/scanner/db2/db2_auth.rb b/modules/auxiliary/scanner/db2/db2_auth.rb index 013ee57bd7..ae366b59fa 100644 --- a/modules/auxiliary/scanner/db2/db2_auth.rb +++ b/modules/auxiliary/scanner/db2/db2_auth.rb @@ -77,7 +77,7 @@ class Metasploit3 < Msf::Auxiliary print_good "#{ip}:#{rport} - LOGIN SUCCESSFUL: #{result.credential}" else invalidate_login(credential_data) - print_status "#{ip}:#{rport} - LOGIN FAILED: #{result.credential} (#{result.status}: #{result.proof})" + vprint_error "#{ip}:#{rport} - LOGIN FAILED: #{result.credential} (#{result.status}: #{result.proof})" end end end diff --git a/modules/auxiliary/scanner/ftp/ftp_login.rb b/modules/auxiliary/scanner/ftp/ftp_login.rb index 0ab4ea0c3b..87a0fa175e 100644 --- a/modules/auxiliary/scanner/ftp/ftp_login.rb +++ b/modules/auxiliary/scanner/ftp/ftp_login.rb @@ -91,7 +91,7 @@ class Metasploit3 < Msf::Auxiliary print_good "#{ip}:#{rport} - LOGIN SUCCESSFUL: #{result.credential}" else invalidate_login(credential_data) - print_status "#{ip}:#{rport} - LOGIN FAILED: #{result.credential} (#{result.status}: #{result.proof})" + vprint_error "#{ip}:#{rport} - LOGIN FAILED: #{result.credential} (#{result.status}: #{result.proof})" end end diff --git a/modules/auxiliary/scanner/http/axis_login.rb b/modules/auxiliary/scanner/http/axis_login.rb index b7d3f8cf53..be6a1a8bd5 100644 --- a/modules/auxiliary/scanner/http/axis_login.rb +++ b/modules/auxiliary/scanner/http/axis_login.rb @@ -101,11 +101,15 @@ class Metasploit3 < Msf::Auxiliary create_credential_login(credential_data) :next_user when Metasploit::Model::Login::Status::UNABLE_TO_CONNECT - print_brute :level => :verror, :ip => ip, :msg => "Could not connect" + if datastore['VERBOSE'] + print_brute :level => :verror, :ip => ip, :msg => "Could not connect" + end invalidate_login(credential_data) :abort when Metasploit::Model::Login::Status::INCORRECT - print_brute :level => :verror, :ip => ip, :msg => "Failed: '#{result.credential}'" + if datastore['VERBOSE'] + print_brute :level => :verror, :ip => ip, :msg => "Failed: '#{result.credential}'" + end invalidate_login(credential_data) end end diff --git a/modules/auxiliary/scanner/http/glassfish_login.rb b/modules/auxiliary/scanner/http/glassfish_login.rb index 84533936b0..037bc58445 100644 --- a/modules/auxiliary/scanner/http/glassfish_login.rb +++ b/modules/auxiliary/scanner/http/glassfish_login.rb @@ -147,7 +147,9 @@ class Metasploit3 < Msf::Auxiliary do_report(ip, rport, result) :next_user when Metasploit::Model::Login::Status::UNABLE_TO_CONNECT - print_brute :level => :verror, :ip => ip, :msg => "Could not connect" + if datastore['VERBOSE'] + print_brute :level => :verror, :ip => ip, :msg => "Could not connect" + end invalidate_login( address: ip, port: rport, @@ -160,7 +162,9 @@ class Metasploit3 < Msf::Auxiliary ) :abort when Metasploit::Model::Login::Status::INCORRECT - print_brute :level => :verror, :ip => ip, :msg => "Failed: '#{result.credential}'" + if datastore['VERBOSE'] + print_brute :level => :verror, :ip => ip, :msg => "Failed: '#{result.credential}'" + end invalidate_login( address: ip, port: rport, diff --git a/modules/auxiliary/scanner/http/hp_sys_mgmt_login.rb b/modules/auxiliary/scanner/http/hp_sys_mgmt_login.rb index ac40eb19d4..1ec4b07c1c 100644 --- a/modules/auxiliary/scanner/http/hp_sys_mgmt_login.rb +++ b/modules/auxiliary/scanner/http/hp_sys_mgmt_login.rb @@ -125,7 +125,9 @@ class Metasploit3 < Msf::Auxiliary do_report(ip, rport, result) :next_user when Metasploit::Model::Login::Status::UNABLE_TO_CONNECT - print_brute :level => :verror, :ip => ip, :msg => "Could not connect" + if datastore['VERBOSE'] + print_brute :level => :verror, :ip => ip, :msg => "Could not connect" + end invalidate_login( address: ip, port: rport, @@ -138,7 +140,9 @@ class Metasploit3 < Msf::Auxiliary ) :abort when Metasploit::Model::Login::Status::INCORRECT - print_brute :level => :verror, :ip => ip, :msg => "Failed: '#{result.credential}'" + if datastore['VERBOSE'] + print_brute :level => :verror, :ip => ip, :msg => "Failed: '#{result.credential}'" + end invalidate_login( address: ip, port: rport, diff --git a/modules/auxiliary/scanner/http/http_login.rb b/modules/auxiliary/scanner/http/http_login.rb index bd8797e6c9..611aa62a7e 100644 --- a/modules/auxiliary/scanner/http/http_login.rb +++ b/modules/auxiliary/scanner/http/http_login.rb @@ -164,11 +164,15 @@ class Metasploit3 < Msf::Auxiliary create_credential_login(credential_data) :next_user when Metasploit::Model::Login::Status::UNABLE_TO_CONNECT - print_brute :level => :verror, :ip => ip, :msg => "Could not connect" + if datastore['VERBOSE'] + print_brute :level => :verror, :ip => ip, :msg => "Could not connect" + end invalidate_login(credential_data) :abort when Metasploit::Model::Login::Status::INCORRECT - print_brute :level => :verror, :ip => ip, :msg => "Failed: '#{result.credential}'" + if datastore['VERBOSE'] + print_brute :level => :verror, :ip => ip, :msg => "Failed: '#{result.credential}'" + end invalidate_login(credential_data) end end diff --git a/modules/auxiliary/scanner/http/ipboard_login.rb b/modules/auxiliary/scanner/http/ipboard_login.rb index 981177d46c..52f630c1dc 100644 --- a/modules/auxiliary/scanner/http/ipboard_login.rb +++ b/modules/auxiliary/scanner/http/ipboard_login.rb @@ -63,11 +63,15 @@ class Metasploit3 < Msf::Auxiliary create_credential_login(credential_data) :next_user when Metasploit::Model::Login::Status::UNABLE_TO_CONNECT - print_brute :level => :verror, :ip => ip, :msg => "Could not connect" + if datastore['VERBOSE'] + print_brute :level => :verror, :ip => ip, :msg => "Could not connect" + end invalidate_login(credential_data) :abort when Metasploit::Model::Login::Status::INCORRECT - print_brute :level => :verror, :ip => ip, :msg => "Failed: '#{result.credential}'" + if datastore['VERBOSE'] + print_brute :level => :verror, :ip => ip, :msg => "Failed: '#{result.credential}'" + end invalidate_login(credential_data) end end diff --git a/modules/auxiliary/scanner/http/jenkins_login.rb b/modules/auxiliary/scanner/http/jenkins_login.rb index a921eba05d..19baca6b58 100644 --- a/modules/auxiliary/scanner/http/jenkins_login.rb +++ b/modules/auxiliary/scanner/http/jenkins_login.rb @@ -67,7 +67,7 @@ class Metasploit3 < Msf::Auxiliary print_good "#{ip}:#{rport} - LOGIN SUCCESSFUL: #{result.credential}" else invalidate_login(credential_data) - print_status "#{ip}:#{rport} - LOGIN FAILED: #{result.credential} (#{result.status})" + vprint_error "#{ip}:#{rport} - LOGIN FAILED: #{result.credential} (#{result.status})" end end end diff --git a/modules/auxiliary/scanner/http/tomcat_mgr_login.rb b/modules/auxiliary/scanner/http/tomcat_mgr_login.rb index 86a6eaef2d..62afa53bce 100644 --- a/modules/auxiliary/scanner/http/tomcat_mgr_login.rb +++ b/modules/auxiliary/scanner/http/tomcat_mgr_login.rb @@ -130,7 +130,7 @@ class Metasploit3 < Msf::Auxiliary print_good "#{ip}:#{rport} - LOGIN SUCCESSFUL: #{result.credential}" else invalidate_login(credential_data) - print_status "#{ip}:#{rport} - LOGIN FAILED: #{result.credential} (#{result.status}: #{result.proof})" + vprint_error "#{ip}:#{rport} - LOGIN FAILED: #{result.credential} (#{result.status}: #{result.proof})" end end end diff --git a/modules/auxiliary/scanner/http/wordpress_xmlrpc_login.rb b/modules/auxiliary/scanner/http/wordpress_xmlrpc_login.rb index 13c82b97a1..29aebafe18 100644 --- a/modules/auxiliary/scanner/http/wordpress_xmlrpc_login.rb +++ b/modules/auxiliary/scanner/http/wordpress_xmlrpc_login.rb @@ -108,11 +108,15 @@ class Metasploit3 < Msf::Auxiliary create_credential_login(credential_data) :next_user when Metasploit::Model::Login::Status::UNABLE_TO_CONNECT - print_brute :level => :verror, :ip => ip, :msg => "Could not connect" + if datastore['VERBOSE'] + print_brute :level => :verror, :ip => ip, :msg => "Could not connect" + end invalidate_login(credential_data) :abort when Metasploit::Model::Login::Status::INCORRECT - print_brute :level => :verror, :ip => ip, :msg => "Failed: '#{result.credential}'" + if datastore['VERBOSE'] + print_brute :level => :verror, :ip => ip, :msg => "Failed: '#{result.credential}'" + end invalidate_login(credential_data) end end diff --git a/modules/auxiliary/scanner/mssql/mssql_login.rb b/modules/auxiliary/scanner/mssql/mssql_login.rb index 9fd20bda6b..7ccb01177b 100644 --- a/modules/auxiliary/scanner/mssql/mssql_login.rb +++ b/modules/auxiliary/scanner/mssql/mssql_login.rb @@ -69,7 +69,7 @@ class Metasploit3 < Msf::Auxiliary print_good "#{ip}:#{rport} - LOGIN SUCCESSFUL: #{result.credential}" else invalidate_login(credential_data) - print_status "#{ip}:#{rport} - LOGIN FAILED: #{result.credential} (#{result.status}: #{result.proof})" + vprint_error "#{ip}:#{rport} - LOGIN FAILED: #{result.credential} (#{result.status}: #{result.proof})" end end end diff --git a/modules/auxiliary/scanner/mysql/mysql_login.rb b/modules/auxiliary/scanner/mysql/mysql_login.rb index 0b3cefeec2..4ab0f18484 100644 --- a/modules/auxiliary/scanner/mysql/mysql_login.rb +++ b/modules/auxiliary/scanner/mysql/mysql_login.rb @@ -72,15 +72,15 @@ class Metasploit3 < Msf::Auxiliary print_good "#{ip}:#{rport} - LOGIN SUCCESSFUL: #{result.credential}" else invalidate_login(credential_data) - print_status "#{ip}:#{rport} - LOGIN FAILED: #{result.credential} (#{result.status}: #{result.proof})" + vprint_error "#{ip}:#{rport} - LOGIN FAILED: #{result.credential} (#{result.status}: #{result.proof})" end end else - print_error "#{target} - Unsupported target version of MySQL detected. Skipping." + vprint_error "#{target} - Unsupported target version of MySQL detected. Skipping." end rescue ::Rex::ConnectionError, ::EOFError => e - print_error "#{target} - Unable to connect: #{e.to_s}" + vprint_error "#{target} - Unable to connect: #{e.to_s}" end end diff --git a/modules/auxiliary/scanner/pop3/pop3_login.rb b/modules/auxiliary/scanner/pop3/pop3_login.rb index 3968771de7..e772d9e11a 100644 --- a/modules/auxiliary/scanner/pop3/pop3_login.rb +++ b/modules/auxiliary/scanner/pop3/pop3_login.rb @@ -87,9 +87,13 @@ class Metasploit3 < Msf::Auxiliary create_credential_login(credential_data) next when Metasploit::Model::Login::Status::UNABLE_TO_CONNECT - print_brute :level => :verror, :ip => ip, :msg => "Could not connect" + if datastore['VERBOSE'] + print_brute :level => :verror, :ip => ip, :msg => "Could not connect" + end when Metasploit::Model::Login::Status::INCORRECT - print_brute :level => :verror, :ip => ip, :msg => "Failed: '#{result.credential}', '#{result.proof.to_s.chomp}'" + if datastore['VERBOSE'] + print_brute :level => :verror, :ip => ip, :msg => "Failed: '#{result.credential}', '#{result.proof.to_s.chomp}'" + end end # If we got here, it didn't work diff --git a/modules/auxiliary/scanner/postgres/postgres_login.rb b/modules/auxiliary/scanner/postgres/postgres_login.rb index cc63a56ff3..76f951629b 100644 --- a/modules/auxiliary/scanner/postgres/postgres_login.rb +++ b/modules/auxiliary/scanner/postgres/postgres_login.rb @@ -85,7 +85,7 @@ class Metasploit3 < Msf::Auxiliary print_good "#{ip}:#{rport} - LOGIN SUCCESSFUL: #{result.credential}" else invalidate_login(credential_data) - print_status "#{ip}:#{rport} - LOGIN FAILED: #{result.credential} (#{result.status}: #{result.proof})" + vprint_error "#{ip}:#{rport} - LOGIN FAILED: #{result.credential} (#{result.status}: #{result.proof})" end end diff --git a/modules/auxiliary/scanner/smb/smb_login.rb b/modules/auxiliary/scanner/smb/smb_login.rb index 113bd3c06b..bf1bed62b0 100644 --- a/modules/auxiliary/scanner/smb/smb_login.rb +++ b/modules/auxiliary/scanner/smb/smb_login.rb @@ -112,7 +112,9 @@ class Metasploit3 < Msf::Auxiliary report_creds(ip, rport, result) :next_user when Metasploit::Model::Login::Status::UNABLE_TO_CONNECT - print_brute :level => :verror, :ip => ip, :msg => "Could not connect" + if datastore['VERBOSE'] + print_brute :level => :verror, :ip => ip, :msg => "Could not connect" + end invalidate_login( address: ip, port: rport, @@ -125,7 +127,9 @@ class Metasploit3 < Msf::Auxiliary ) :abort when Metasploit::Model::Login::Status::INCORRECT - print_brute :level => :verror, :ip => ip, :msg => "Failed: '#{result.credential}', #{result.proof}" + if datastore['VERBOSE'] + print_brute :level => :verror, :ip => ip, :msg => "Failed: '#{result.credential}', #{result.proof}" + end invalidate_login( address: ip, port: rport, diff --git a/modules/auxiliary/scanner/snmp/snmp_login.rb b/modules/auxiliary/scanner/snmp/snmp_login.rb index bd6125a0f4..317ed53168 100644 --- a/modules/auxiliary/scanner/snmp/snmp_login.rb +++ b/modules/auxiliary/scanner/snmp/snmp_login.rb @@ -77,7 +77,7 @@ class Metasploit3 < Msf::Auxiliary print_good "#{ip}:#{rport} - LOGIN SUCCESSFUL: #{result.credential}" else invalidate_login(credential_data) - print_status "#{ip}:#{rport} - LOGIN FAILED: #{result.credential} (#{result.status}: #{result.proof})" + vprint_error "#{ip}:#{rport} - LOGIN FAILED: #{result.credential} (#{result.status}: #{result.proof})" end end end diff --git a/modules/auxiliary/scanner/ssh/ssh_login.rb b/modules/auxiliary/scanner/ssh/ssh_login.rb index 8e984c7893..16f8a2ef39 100644 --- a/modules/auxiliary/scanner/ssh/ssh_login.rb +++ b/modules/auxiliary/scanner/ssh/ssh_login.rb @@ -132,12 +132,16 @@ class Metasploit3 < Msf::Auxiliary session_setup(result, scanner.ssh_socket) :next_user when Metasploit::Model::Login::Status::UNABLE_TO_CONNECT - print_brute :level => :verror, :ip => ip, :msg => "Could not connect" + if datastore['VERBOSE'] + print_brute :level => :verror, :ip => ip, :msg => "Could not connect" + end scanner.ssh_socket.close if scanner.ssh_socket && !scanner.ssh_socket.closed? invalidate_login(credential_data) :abort when Metasploit::Model::Login::Status::INCORRECT - print_brute :level => :verror, :ip => ip, :msg => "Failed: '#{result.credential}'" + if datastore['VERBOSE'] + print_brute :level => :verror, :ip => ip, :msg => "Failed: '#{result.credential}'" + end invalidate_login(credential_data) scanner.ssh_socket.close if scanner.ssh_socket && !scanner.ssh_socket.closed? else diff --git a/modules/auxiliary/scanner/ssh/ssh_login_pubkey.rb b/modules/auxiliary/scanner/ssh/ssh_login_pubkey.rb index 65aa7a0fa1..bd5053ae78 100644 --- a/modules/auxiliary/scanner/ssh/ssh_login_pubkey.rb +++ b/modules/auxiliary/scanner/ssh/ssh_login_pubkey.rb @@ -223,12 +223,16 @@ class Metasploit3 < Msf::Auxiliary session_setup(result, scanner.ssh_socket) :next_user when Metasploit::Model::Login::Status::UNABLE_TO_CONNECT - print_brute :level => :verror, :ip => ip, :msg => "Could not connect" + if datastore['VERBOSE'] + print_brute :level => :verror, :ip => ip, :msg => "Could not connect" + end scanner.ssh_socket.close if scanner.ssh_socket && !scanner.ssh_socket.closed? invalidate_login(credential_data) :abort when Metasploit::Model::Login::Status::INCORRECT - print_brute :level => :verror, :ip => ip, :msg => "Failed: '#{result.credential}'" + if datastore['VERBOSE'] + print_brute :level => :verror, :ip => ip, :msg => "Failed: '#{result.credential}'" + end invalidate_login(credential_data) scanner.ssh_socket.close if scanner.ssh_socket && !scanner.ssh_socket.closed? else diff --git a/modules/auxiliary/scanner/telnet/telnet_login.rb b/modules/auxiliary/scanner/telnet/telnet_login.rb index 206ab55be5..926c5371a2 100644 --- a/modules/auxiliary/scanner/telnet/telnet_login.rb +++ b/modules/auxiliary/scanner/telnet/telnet_login.rb @@ -84,7 +84,7 @@ class Metasploit3 < Msf::Auxiliary start_telnet_session(ip,rport,result.credential.public,result.credential.private,scanner) else invalidate_login(credential_data) - print_status "#{ip}:#{rport} - LOGIN FAILED: #{result.credential} (#{result.status}: #{result.proof})" + vprint_error "#{ip}:#{rport} - LOGIN FAILED: #{result.credential} (#{result.status}: #{result.proof})" end end end diff --git a/modules/auxiliary/scanner/vmware/vmauthd_login.rb b/modules/auxiliary/scanner/vmware/vmauthd_login.rb index b8904638d1..c363e497f3 100644 --- a/modules/auxiliary/scanner/vmware/vmauthd_login.rb +++ b/modules/auxiliary/scanner/vmware/vmauthd_login.rb @@ -89,11 +89,15 @@ class Metasploit3 < Msf::Auxiliary create_credential_login(credential_data) :next_user when Metasploit::Model::Login::Status::UNABLE_TO_CONNECT - print_brute :level => :verror, :ip => ip, :msg => 'Could not connect' + if datastore['VERBOSE'] + print_brute :level => :verror, :ip => ip, :msg => 'Could not connect' + end invalidate_login(credential_data) :abort when Metasploit::Model::Login::Status::INCORRECT - print_brute :level => :verror, :ip => ip, :msg => "Failed: '#{result.credential}' #{result.proof}" + if datastore['VERBOSE'] + print_brute :level => :verror, :ip => ip, :msg => "Failed: '#{result.credential}' #{result.proof}" + end invalidate_login(credential_data) end end diff --git a/modules/auxiliary/scanner/vnc/vnc_login.rb b/modules/auxiliary/scanner/vnc/vnc_login.rb index 31bfc44f02..4ad16a34e9 100644 --- a/modules/auxiliary/scanner/vnc/vnc_login.rb +++ b/modules/auxiliary/scanner/vnc/vnc_login.rb @@ -93,7 +93,7 @@ class Metasploit3 < Msf::Auxiliary print_good "#{ip}:#{rport} - LOGIN SUCCESSFUL: #{result.credential}" else invalidate_login(credential_data) - print_status "#{ip}:#{rport} - LOGIN FAILED: #{result.credential} (#{result.status}: #{result.proof})" + vprint_error "#{ip}:#{rport} - LOGIN FAILED: #{result.credential} (#{result.status}: #{result.proof})" end end diff --git a/modules/auxiliary/scanner/winrm/winrm_login.rb b/modules/auxiliary/scanner/winrm/winrm_login.rb index ec0a77a730..0bacc5ca9e 100644 --- a/modules/auxiliary/scanner/winrm/winrm_login.rb +++ b/modules/auxiliary/scanner/winrm/winrm_login.rb @@ -76,7 +76,7 @@ class Metasploit3 < Msf::Auxiliary print_good "#{ip}:#{rport} - LOGIN SUCCESSFUL: #{result.credential}" else invalidate_login(credential_data) - print_status "#{ip}:#{rport} - LOGIN FAILED: #{result.credential} (#{result.status}: #{result.proof})" + vprint_error "#{ip}:#{rport} - LOGIN FAILED: #{result.credential} (#{result.status}: #{result.proof})" end end