Browse Source

Create #make_fast_nops for huge NOP chunks

This creates a new method called #make_fast_nops for exploits that
actually need large chunks of NOPs.
wchen-r7 3 years ago
parent
commit
337e48dc07
1 changed files with 24 additions and 0 deletions
  1. 24
    0
      lib/msf/core/exploit.rb

+ 24
- 0
lib/msf/core/exploit.rb View File

@@ -1002,6 +1002,30 @@ class Exploit < Msf::Module
1002 1002
     }
1003 1003
   end
1004 1004
 
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
+
1005 1029
   #
1006 1030
   # Generates a nop sled of a supplied length and returns it to the caller.
1007 1031
   #

Loading…
Cancel
Save