From ac858c81a51ab11dd74bc124857fb6b24e3091a5 Mon Sep 17 00:00:00 2001 From: Tod Beardsley Date: Sun, 31 Mar 2013 23:19:28 -0500 Subject: [PATCH] Deal with other osql banners and responses Not sure where those other banners come from, but keeping them as positive responses regardless. [FixRM #7862] --- .../post/windows/manage/mssql_local_auth_bypass.rb | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/modules/post/windows/manage/mssql_local_auth_bypass.rb b/modules/post/windows/manage/mssql_local_auth_bypass.rb index f53d77482c..d105d4d462 100644 --- a/modules/post/windows/manage/mssql_local_auth_bypass.rb +++ b/modules/post/windows/manage/mssql_local_auth_bypass.rb @@ -182,12 +182,9 @@ class Metasploit3 < Msf::Post services_array1 = running_services1.split("\n") # Check for osql - services_array1.each do |service1| - if service1 =~ /SQL Server Command Line Tool/ then - print_good("OSQL client was found") - return "osql" - end - end + if services_array1.join =~ /(SQL Server Command Line Tool)|(usage: osql)/ + print_good("OSQL client was found") + return "osql" # Get Data - sqlcmd running_services = run_cmd("sqlcmd -?") @@ -252,11 +249,11 @@ class Metasploit3 < Msf::Post end # check for success/fail - if add_login_result == "" + if add_login_result.empty? or add_login_result =~ /New login created./ print_good("Successfully added login \"#{dbuser}\" with password \"#{dbpass}\"") return 1 else - print_error("Unabled to add login #{dbuser}") + print_error("Unable to add login #{dbuser}") print_error("Database Error:\n #{add_login_result}") return 0 end