Skip to content

Commit 98ad248

Browse files
committed
Land rapid7#6970, #make_fast_nops for HUGE nop chunks
2 parents 9ea0b8f + 337e48d commit 98ad248

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

lib/msf/core/exploit.rb

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,6 +1002,30 @@ def nop_generator
10021002
}
10031003
end
10041004

1005+
1006+
#
1007+
# Generates a NOP sled using the #make_nops method.
1008+
# The difference between this and #make_nops is this method is much faster, good for exploit
1009+
# developers that actually want huge chunks of NOPs. The downside of using this is the NOP sled
1010+
# is less randomized.
1011+
#
1012+
# @param count [String] Number of NOPs to return.
1013+
# @return [String] NOPs
1014+
#
1015+
def make_fast_nops(count)
1016+
max_nop_chunk_size = 100
1017+
1018+
if count < max_nop_chunk_size
1019+
return make_nops(count)
1020+
end
1021+
1022+
nops = make_nops(max_nop_chunk_size)
1023+
nops += nops while nops.length < count
1024+
1025+
nops[0, count]
1026+
end
1027+
1028+
10051029
#
10061030
# Generates a nop sled of a supplied length and returns it to the caller.
10071031
#

0 commit comments

Comments
 (0)