forked from p4-team/ctf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdecode.py
67 lines (63 loc) · 1.52 KB
/
decode.py
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
import os
from subprocess import check_output, call
while(True):
fileType = check_output(["file", "f100"])
fileType = fileType[6:9]
print(fileType)
if(fileType=='ARC'):
print('ARC')
os.system("nomarch -p f100 > out")
os.system("mv out f100")
elif(fileType=='PPM'):
print('PPMD')
os.system("ppmd d f100")
os.system("mv secret f100")
elif(fileType=='Mic'):
print('Cabinet')
os.system("cabextract f100")
os.system("mv secret f100")
elif(fileType=='bzi'):
print('Bzip2')
os.system("bzip2 -d f100")
os.system("mv f100.out f100")
elif(fileType=='XZ'):
print('XZ')
os.system("unxz < f100 > out")
os.system("mv out f100")
elif(fileType=='7-z'):
print('7-Z')
os.system("7z e f100")
os.system("mv secret f100")
elif(fileType=='gzi'):
print('gzip')
os.system("mv f100 f100.gz")
os.system("gzip -d f100.gz")
elif(fileType=='POS'):
print('POSIX')
os.system("tar -xvf f100")
os.system("mv secret f100")
elif(fileType=='Zip'):
print('ZIP')
os.system("unzip f100")
os.system("mv secret f100")
elif(fileType=='ARJ'):
print('ARJ')
os.system("mv f100 f100.arj")
os.system("arj e f100")
os.system("mv secret f100")
elif(fileType=='rzi'):
print('fzip')
os.system("mv f100 f100.rz")
os.system("rzip -d f100.rz")
os.system("mv secret f100")
elif(fileType=='Zoo'):
print('zoo')
os.system("mv f100 f100.zoo")
os.system("zoo -extract f100")
os.system("mv secret f100")
elif(fileType=='RAR'):
print('RAR')
os.system("unrar e f100")
os.system("mv secret f100")
else :
exit();