Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rapid7
GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/nops/aarch64/simple.rb
19664 views
1
##
2
# This module requires Metasploit: https://metasploit.com/download
3
# Current source: https://github.com/rapid7/metasploit-framework
4
##
5
6
###
7
#
8
# SingleByte
9
# ----------
10
#
11
# This class implements simple NOP generator for AARCH64
12
#
13
###
14
class MetasploitModule < Msf::Nop
15
16
def initialize
17
super(
18
'Name' => 'Simple',
19
'Alias' => 'armle_simple',
20
'Description' => 'Simple NOP generator',
21
'License' => MSF_LICENSE,
22
'Author' => ['timwr'],
23
'Arch' => ARCH_AARCH64)
24
register_advanced_options(
25
[
26
OptBool.new('RandomNops', [ false, 'Generate a random NOP sled', true ])
27
]
28
)
29
end
30
31
def generate_sled(length, opts)
32
random = opts['Random'] || datastore['RandomNops']
33
nops = [
34
0xd503201f, # nop
35
0xaa0103e1, # mov x1, x1
36
0xaa0203e2, # mov x2, x2
37
0x2a0303e3, # mov w3, w3
38
0x2a0403e4, # mov w4, w4
39
]
40
if random
41
return ([nops[rand(nops.length)]].pack('V*') * (length / 4))
42
end
43
44
return ([nops[0]].pack('V*') * (length / 4))
45
end
46
end
47
48