-
Notifications
You must be signed in to change notification settings - Fork 150
/
AAS-parser.py
executable file
·35 lines (25 loc) · 937 Bytes
/
AAS-parser.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
#!/usr/bin/env python2
# Parser for AudibleActivation.sys files
import sys
import binascii
import struct
# AudibleActivation.sys file format
#
# Each "line" is of 70 bytes
# First 4 bytes are the "activation_bytes"
# "FFFFFFFF" pattern implies that the slot is not in use
# Next two bytes are the activation slot number (0 to 7)
#
# These observations also apply to the "SWGIDMAP" registry key, and the binary
# blob that is transferred during the online activation process!
def extract_activation_bytes(filename):
with open(filename, "rb") as f:
odata = f.read(4)
mdata = struct.pack(">i", struct.unpack("<i", odata)[0])
sys.stdout.write(binascii.hexlify(mdata) + '\n')
if __name__ == "__main__":
if len(sys.argv) < 2:
sys.stderr.write("Usage: %s <path of AudibleActivation.sys>\n" %
sys.argv[0])
sys.exit(-1)
extract_activation_bytes(sys.argv[1])