Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clean up code duplication #18835

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
cgranleese-r7 marked this conversation as resolved.
Show resolved Hide resolved
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