-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathdji_ftpd_descrambler.py
69 lines (53 loc) · 2.26 KB
/
dji_ftpd_descrambler.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
#!/usr/bin/python
import sys
import os
from sys import platform
# Requires pycrypto - https://pypi.python.org/pypi/pycrypto
# You may want to use 'pip'. If on windows use the following instructions.
# https://stackoverflow.com/questions/29817447/how-to-run-pip-commands-from-cmd
# You will also need Microsoft Visual C++ Compiler for Python 2.7
# On mac, try brew, or easy_install
from Crypto.Cipher import AES
def which(program):
import os
def is_exe(fpath):
return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
fpath, fname = os.path.split(program)
if fpath:
if is_exe(program):
return program
else:
for path in os.environ["PATH"].split(os.pathsep):
path = path.strip('"')
exe_file = os.path.join(path, program)
if is_exe(exe_file):
return exe_file
return None
key = "\x74\x68\x69\x73\x2d\x61\x65\x73\x2d\x6b\x65\x79\x00\x00\x00\x00"
iv = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
daCypha = AES.new(key, AES.MODE_CBC, iv)
message = ""
wget = which("wget")
if not wget:
if platform == "linux" or platform == "linux2":
print "Linux is not supported"
elif platform == "darwin":
print "OSX assumes brew wget or other wget is in $PATH already"
elif platform == "win32":
print "Windows assumes wget.exe is in %PATH% already"
os.environ["PATH"] += os.pathsep + os.getcwd() + "/wget_bins"
wget = which("wget")
if not wget:
sys.exit( "You need wget! We can't even use the binaries we provided... something is wrong!" )
if len(sys.argv) > 1:
if sys.argv[1] == "192.168.42.2":
os.system("wget -m ftp://GPL:[email protected]/ -t 1 -T 10 -P DJI_aes_ftp_dump") # set retry to 1, because sometimes fatal.log, and others *hang*
print "\nCheck the contents of the folder DJI_aes_ftp_dump\n"
elif os.path.isfile(sys.argv[1]):
message = open(sys.argv[1], 'r').read()
gplViolation = daCypha.decrypt(message)
print gplViolation
elif os.path.isdir(sys.argv[1]):
print "You specified a directory... try a filename instead!?"
else:
system.exit( "Usage: daCypha.py <filename> (if set to 192.168.42.2 this script will mirror the DJI crafts ftpd)")