-
Notifications
You must be signed in to change notification settings - Fork 6
/
alienspy-decrypt.py
65 lines (47 loc) · 1.7 KB
/
alienspy-decrypt.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
__description__ = 'AlienSpy Decoder'
__author__ = 'Sean Wilson'
__version__ = '0.0.1'
__date__ = '2015/03/18'
import hashlib
from StringIO import StringIO
import zipfile
import argparse
from Crypto.Cipher import ARC4
import os
def getpassandconfig(jfname):
jar = zipfile.ZipFile(open(jfname, 'rb'))
pw = StringIO(jar.read('password.ini')).read()
config = StringIO(jar.read('config.ini')).read()
ratdata = (pw, config)
return ratdata
def decrypt_payload(ratdata):
static_key = 'ALSKEOPQLFKJDUSIKSJAUIE'
rcobj = ARC4.new(hashlib.sha256(ratdata[0]+static_key).hexdigest())
data = rcobj.decrypt(ratdata[1])
return data
def extract_props(data):
jtmp = StringIO()
jtmp.write(data)
jar = zipfile.ZipFile(jtmp)
return StringIO(jar.read('config.xml')).read()
def main():
parser = argparse.ArgumentParser(description="Decrypt adwind jar.")
parser.add_argument("jarfile", help="Adwind Jar file")
parser.add_argument('-p', '--props', dest='props', action='store_true', help="Extract properties config.xml file.")
parser.add_argument('-e', '--extract', dest='extract', action='store_true', help="Extract enctypted jar to out.jar.")
args = parser.parse_args()
rdata = getpassandconfig(args.jarfile)
if not os.path.isfile(args.jarfile):
raise Exception('File does not exist')
if args.props:
print 'Extracting Properties...'
propdata = extract_props(decrypt_payload(rdata))
out = open('config.xml', 'wb')
out.write(propdata)
out.close()
if args.extract:
outfile = open('out.jar', 'wb')
outfile.write(decrypt_payload(rdata))
outfile.close()
if __name__ == '__main__':
main()