Skip to content

Commit

Permalink
Land #18835, clean up code duplication
Browse files Browse the repository at this point in the history
  • Loading branch information
cgranleese-r7 authored Mar 12, 2024
2 parents f4fedc2 + 7ce91df commit 4e0e3da
Showing 1 changed file with 5 additions and 15 deletions.
20 changes: 5 additions & 15 deletions modules/exploits/windows/mssql/mssql_payload.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,6 @@ def initialize(info = {})
end

def check
if session
set_session(session.client)
end

unless session || mssql_login_datastore
vprint_status("Invalid SQL Server credentials")
return Exploit::CheckCode::Detected
end

if session
set_session(session.client)
else
Expand All @@ -104,14 +95,13 @@ def execute_command(cmd, opts)
end

def exploit

if session
set_session(session.client)
end

unless session || mssql_login_datastore
print_status("Invalid SQL Server credentials")
return
else
unless mssql_login_datastore
print_status("Invalid SQL Server credentials")
return
end
end

method = datastore['METHOD'].downcase
Expand Down

0 comments on commit 4e0e3da

Please sign in to comment.