CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/nops/aarch64/simple.rb
Views: 1904
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
end
29
30
def generate_sled(length, opts)
31
random = opts['Random'] || datastore['RandomNops']
32
nops = [
33
0xd503201f, # nop
34
0xaa0103e1, # mov x1, x1
35
0xaa0203e2, # mov x2, x2
36
0x2a0303e3, # mov w3, w3
37
0x2a0403e4, # mov w4, w4
38
]
39
if random
40
return ([nops[rand(nops.length)]].pack("V*") * (length/4))
41
end
42
return ([nops[0]].pack("V*") * (length/4))
43
end
44
end
45
46