Skip to content

Commit ac858c8

Browse files
committed
Deal with other osql banners and responses
Not sure where those other banners come from, but keeping them as positive responses regardless. [FixRM rapid7#7862]
1 parent bafb50a commit ac858c8

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

modules/post/windows/manage/mssql_local_auth_bypass.rb

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -182,12 +182,9 @@ def get_sql_client
182182
services_array1 = running_services1.split("\n")
183183

184184
# Check for osql
185-
services_array1.each do |service1|
186-
if service1 =~ /SQL Server Command Line Tool/ then
187-
print_good("OSQL client was found")
188-
return "osql"
189-
end
190-
end
185+
if services_array1.join =~ /(SQL Server Command Line Tool)|(usage: osql)/
186+
print_good("OSQL client was found")
187+
return "osql"
191188

192189
# Get Data - sqlcmd
193190
running_services = run_cmd("sqlcmd -?")
@@ -252,11 +249,11 @@ def add_sql_login(sqlclient,dbuser,dbpass,instance,service_instance,verbose)
252249
end
253250

254251
# check for success/fail
255-
if add_login_result == ""
252+
if add_login_result.empty? or add_login_result =~ /New login created./
256253
print_good("Successfully added login \"#{dbuser}\" with password \"#{dbpass}\"")
257254
return 1
258255
else
259-
print_error("Unabled to add login #{dbuser}")
256+
print_error("Unable to add login #{dbuser}")
260257
print_error("Database Error:\n #{add_login_result}")
261258
return 0
262259
end

0 commit comments

Comments
 (0)