Skip to content

Commit

Permalink
clean up code duplication
Browse files Browse the repository at this point in the history
  • Loading branch information
zgoldman-r7 committed Mar 11, 2024
1 parent d18520a commit 7ce91df
Showing 1 changed file with 5 additions and 15 deletions.
20 changes: 5 additions & 15 deletions modules/exploits/windows/mssql/mssql_payload.rb
Expand Up @@ -70,15 +70,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 @@ -105,14 +96,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 7ce91df

Please sign in to comment.