Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rapid7
GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/nops/armle/simple.rb
19612 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 ARM (little endian)
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
'Author' => 'hdm',
22
'License' => MSF_LICENSE,
23
'Arch' => ARCH_ARMLE)
24
25
register_advanced_options(
26
[
27
OptBool.new('RandomNops', [ false, 'Generate a random NOP sled', true ])
28
]
29
)
30
end
31
32
def generate_sled(length, opts)
33
opts['BadChars'] || ''
34
random = opts['Random'] || datastore['RandomNops']
35
36
nops = [
37
0xe1a01001,
38
0xe1a02002,
39
0xe1a03003,
40
0xe1a04004,
41
0xe1a05005,
42
0xe1a06006,
43
0xe1a07007,
44
0xe1a08008,
45
0xe1a09009,
46
0xe1a0a00a,
47
0xe1a0b00b
48
]
49
50
if random
51
return ([nops[rand(nops.length)]].pack('V*') * (length / 4))
52
end
53
54
return ([nops[0]].pack('V*') * (length / 4))
55
end
56
end
57
58