1
0
mirror of https://github.com/takeshixx/redstar-tools synced 2025-07-17 20:43:21 +00:00

Added all ioctl commands

This commit is contained in:
takeshix
2015-11-28 19:26:35 +01:00
parent b316a7bb57
commit 65c3b2584d
2 changed files with 97 additions and 9 deletions

View File

@ -1,11 +1,60 @@
#!/usr/bin/env python2
from fcntl import ioctl
# This needs to run under Python2.6
import sys
import fcntl
filename = '/dev/res'
fd = open(filename, 'wb')
ret = ioctl(fd, 29187, 0)
DEV = '/dev/res'
SCAN_ENABLE = 29188
SCAN_DISABLE = 29187
ADD_PID = 29189
DEL_PID = 29193
RECV_FILES = 29191
PROTECT_FILE = 29192
UNPROTECT_FILE = 29194
HIDE_FILE = 29195
UNHIDE_FILE = 29196
SET_SIGN_EXTS = 29197
GET_SIGN_EXTS = 29198
if ret is not 0:
print('Error')
if __name__ == '__main__':
if len(sys.argv) < 2:
print('usage: {s} [CMD] [ARG]'.format(s=sys.argv[0]))
sys.exit(1)
fd.close()
CMD = sys.argv[1]
if len(sys.argv) is 3:
ARG = sys.argv[2]
else:
ARG = 0
if CMD == 'enable':
CMD = SCAN_ENABLE
elif CMD == 'disable':
CMD = SCAN_DISABLE
elif CMD == 'pid':
CMD = ADD_PID
elif CMD == 'unpid':
CMD = DEL_PID
elif CMD == 'recv':
CMD = RECV_FILES
elif CMD == 'protect':
CMD = PROTECT_FILE
elif CMD == 'unprotect':
CMD = UNPROTECT_FILE
elif CMD == 'hide':
CMD = HIDE_FILE
elif CMD == 'unhide':
CMD = UNHIDE_FILE
elif CMD == 'setsign':
CMD = SET_SIGN_EXTS
elif CMD == 'getsign':
CMD = GET_SIGN_EXTS
else:
print('unknown command: {c}'.format(c=CMD))
sys.exit(1)
fd = open(DEV, 'wb')
ret = fcntl.ioctl(fd, CMD, ARG)
print(ret)
fd.close()