Last active
August 29, 2015 14:08
-
-
Save ifnull/cd1a9410f5035583191d to your computer and use it in GitHub Desktop.
DreamUnweaver: Extracts and decrypts password and FTP info from Adobe Dreamweaver *.ste export.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
""" | |
DreamUnweaver: Extracts and decrypts password and | |
FTP info from Adobe Dreamweaver *.ste export. | |
Author: Daniel Smith (https://github.com/ifnull/) | |
Usage: | |
dreamunweaver.py decrypt --ste <argument> | |
Options: | |
-h --help Show this screen. | |
--version Show version. | |
--ste=<ste> Specify the full ste path. | |
""" | |
from docopt import docopt | |
import xml.etree.ElementTree as ET | |
import pprint | |
def main(): | |
arguments = docopt(__doc__, version='DreamUnweaver 0.1') | |
if arguments['decrypt'] is True: | |
ste = arguments['--ste'] | |
extract(ste) | |
def extract(ste): | |
""" | |
Parses STE file and grabs server data. | |
""" | |
data = [] | |
tree = ET.parse(ste) | |
site = tree.getroot() | |
pp = pprint.PrettyPrinter(indent=4) | |
for server in site.findall('serverlist/server'): | |
info = { | |
'host': server.attrib['host'], | |
'accesstype': server.attrib['accesstype'], | |
'user': server.attrib['user'], | |
'pw': decrypt(server.attrib['pw']), | |
'usepasv': server.attrib['usepasv'], | |
'useSFTP': server.attrib['useSFTP'], | |
'useFTPS': server.attrib['useFTPS'], | |
'useImplicitFTPS': server.attrib['useImplicitFTPS'], | |
'remoteroot': server.attrib['remoteroot'], | |
'weburl': server.attrib['weburl'] | |
} | |
pp.pprint(info) | |
data.append(info) | |
return data | |
def decrypt(pw): | |
""" | |
Decrypts password. | |
""" | |
pw_length = len(pw) | |
password = [] | |
if pw_length is 0: | |
return "" | |
for i in range(0, pw_length / 2): | |
chex = int(pw[(i * 2):(i * 2) + 2], 16) | |
if chex <= 0xFFFF: | |
password.append(chr(chex - i)) | |
elif chex <= 0x10FFFF: | |
chex = chex - 0x10000 | |
password.append(chr(0xD800 | (chex >> 10)) + chr(0xDC00 | | |
(chex & 0x3FF) - i)) | |
else: | |
raise Exception("Something failed.") | |
return "".join(password) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment