Skip to content

Commit 5169341

Browse files
committed
Land rapid7#7522, Fix psh template to avoid 100% cpu spike on CTRL+C
2 parents a7c8060 + 7895ba8 commit 5169341

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

modules/payloads/singles/cmd/windows/reverse_powershell.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
module MetasploitModule
1313

14-
CachedSize = 1204
14+
CachedSize = 1228
1515

1616
include Msf::Payload::Single
1717
include Msf::Sessions::CommandShellOptions
@@ -81,7 +81,8 @@ def command_string
8181
"while (($i -gt 0) -and ($pos -lt $nb.Length)) {"\
8282
"$r=$s.Read($nb,$pos,$nb.Length - $pos);"\
8383
"$pos+=$r;"\
84-
"if ($pos -and ($nb[0..$($pos-1)] -contains 10)) {break}};"\
84+
"if (-not $pos -or $pos -eq 0) {RSC};"\
85+
"if ($nb[0..$($pos-1)] -contains 10) {break}};"\
8586
"if ($pos -gt 0){"\
8687
"$str=$e.GetString($nb,0,$pos);"\
8788
"$is.write($str);start-sleep 1;"\

0 commit comments

Comments
 (0)