-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathns_arc_unpack.py
More file actions
33 lines (24 loc) · 897 Bytes
/
ns_arc_unpack.py
File metadata and controls
33 lines (24 loc) · 897 Bytes
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
#!/usr/bin/python3
import sys
import json
import os
dumpPath = "dump"
if not os.path.exists(dumpPath):
os.mkdir(dumpPath)
arcpack = open(sys.argv[2],'rb')
with open(sys.argv[1], 'r') as arcjson:
data = json.load(arcjson)
for group in data["Groups"]:
groupPath = dumpPath + "/" + group["Name"]
if not os.path.exists(groupPath):
os.mkdir(groupPath)
for OrderedEntrie in group["OrderedEntries"]:
filePath = groupPath + "/" + OrderedEntrie["OriginalFilename"]
if not os.path.exists(filePath[0:filePath.rfind("/")]):
os.makedirs(filePath[0:filePath.rfind("/")])
arcpack.seek(OrderedEntrie["Offset"])
with open(filePath, 'wb') as dumpFile:
dumpFile.write(arcpack.read(OrderedEntrie["Length"]))
dumpFile.close()
arcjson.close()
arcpack.close()