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/armle/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 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
end
30
31
32
def generate_sled(length, opts)
33
34
badchars = opts['BadChars'] || ''
35
random = opts['Random'] || datastore['RandomNops']
36
37
nops = [
38
0xe1a01001,
39
0xe1a02002,
40
0xe1a03003,
41
0xe1a04004,
42
0xe1a05005,
43
0xe1a06006,
44
0xe1a07007,
45
0xe1a08008,
46
0xe1a09009,
47
0xe1a0a00a,
48
0xe1a0b00b
49
]
50
51
if random
52
return ([nops[rand(nops.length)]].pack("V*") * (length/4))
53
end
54
55
return ([nops[0]].pack("V*") * (length/4))
56
end
57
end
58
59