Last active
September 26, 2023 05:18
-
-
Save deadYokai/4311c7ca0851a415574df6c94ecd30d2 to your computer and use it in GitHub Desktop.
Adobe Installer Unpacker written on Python, place with products folder
This file contains 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/env python3 | |
# -*- coding: utf-8 -*- | |
import json | |
import re | |
import os | |
import shutil | |
from bs4 import BeautifulSoup | |
from zipfile import ZipFile | |
selectedlangs = ["en_US", "uk_UA"] | |
upath = "./_tmpfiles/" | |
opath = "./out/" | |
with open('products/driver.xml') as f: | |
xdriver = f.read() | |
data = BeautifulSoup(xdriver, "xml") | |
pinfo = data.find("ProductInfo") | |
pname = pinfo.find("Name").text | |
pdir = pinfo.find("EsdDirectory").text | |
deplistraw = pinfo.find_all("Dependency") | |
deplist = [x.find("EsdDirectory").text for x in deplistraw] | |
installdir = pname | |
commonDir = f"{installdir}/_CommonFiles" | |
def charcount(input_string): | |
letter_count = 0 | |
for char in input_string: | |
if char.isalpha(): | |
letter_count += 1 | |
return letter_count | |
def readpimx(path, pak): | |
pacname = pak["PackageName"] | |
with open(path+pacname+".pimx") as f: | |
pdata = BeautifulSoup(f.read(), "xml") | |
assets = pdata.find("Assets").find_all("Asset") | |
for asset in assets: | |
asrc = asset.get("source").replace("\\", "/").replace("[StagingFolder]", pak["AliasPackageName"]) | |
atar = asset.get("target").replace("\\", "/").replace("[AdobeCommon]", commonDir).replace("[InstallDir]", installdir).replace("[INSTALLDIR]", installdir) | |
sd = f"{path}/{asrc}" | |
dd = opath+atar | |
for sdir, dirs, files in os.walk(sd): | |
ddir = sdir.replace(sd, dd) | |
if not os.path.exists(ddir): | |
os.makedirs(ddir) | |
for f in files: | |
sf = sdir+"/"+f | |
df = ddir+"/"+f | |
if os.path.exists(df): | |
os.remove(df) | |
# print(f"Moving: {sf} - {df}") | |
shutil.move(sf, df) | |
def appjson(product): | |
with open(f"./products/{product}/application.json") as f: | |
ajs = json.loads(f.read()) | |
a = ajs["Packages"]["Package"] | |
print(f"\n == {product}") | |
avalangs = [] | |
selprods = [] | |
for x in a: | |
if 'Condition' not in x: | |
selprods.append(x) | |
for sl in selectedlangs: | |
s = re.search(sl, x["PackageName"]) | |
if s is not None: | |
selprods.append(x) | |
for prod in selprods: | |
path = f"products/{product}/{prod['PackageName']}" | |
os.makedirs(f"{upath}/{path}", exist_ok=True) | |
aformat = os.path.splitext(prod["Path"])[1] | |
print(f"Unpacking: {path}...") | |
try: | |
# ZipFile(f"{path}{aformat}").extractall(f"{upath}/{path}/") | |
with ZipFile(f"{path}{aformat}", 'r') as ofile: | |
for item in ofile.infolist(): | |
fp = item.filename.replace("\\", "/") | |
os.makedirs(os.path.dirname(f"{upath}/{path}/{fp}"), exist_ok=True) | |
if not os.path.isdir(f"{upath}/{path}/{fp}"): | |
with open(f"{upath}/{path}/{fp}", "wb") as ef: | |
ef.write(ofile.read(item.filename)) | |
except FileNotFoundError: | |
pass | |
aformat = aformat.upper() | |
with ZipFile(f"{path}{aformat}", 'r') as ofile: | |
for item in ofile.infolist(): | |
fp = item.filename.replace("\\", "/") | |
os.makedirs(os.path.dirname(f"{upath}/{path}/{fp}"), exist_ok=True) | |
if not os.path.isdir(f"{upath}/{path}/{fp}"): | |
with open(f"{upath}/{path}/{fp}", "wb") as ef: | |
ef.write(ofile.read(item.filename)) | |
readpimx(f"{upath}/{path}/", prod) | |
if os.path.exists(upath): | |
shutil.rmtree(upath) | |
dc = "" | |
chars = "Adobe Unpacker by deadYokai" | |
if charcount(pname) > charcount(chars): | |
chars = pname | |
for i in range(charcount(chars)): | |
dc += "--" | |
print(f''' | |
.-. _ _, | |
.---""""``"-, : `"-.__.\' \`-. _..-"/_,-""\\ | |
/_.,- \ / , _, \_.--. _.-" `. | |
.\'.\' \'. / .\'\/.-\ ; ""-; .\' `, | |
\':" \ .\' /" `-; \ \ .\' __ `. | |
/ .-" \ .\' .\' :-"""``"-: : ; / ","\' \\ | |
.\' .\' \'.\' ; : / ` \' ; ; .\' .--.._ `-, : | |
/ ; / ; /; :\' ; ; ` \ : ; / / , \_=\' | | |
/ `\ _; : ; /| | ; ; \ ; ; __i-, /.-,-, : .\' \ | | |
; ; / \ `,; :_; / ; ; ;\ \ \ : _T-" .-\' / : _.\',\' / ; : | |
| / ; ; ;| ; ; __; ;\ ;\ J_ \ :-" .\' : I. : : : ; | |
: : ; | `, `|T |`,(()\ `" T;());/=" : .\'\ : / : / /` : / \\ | |
|| | ; \ ;; | ,"=-\' `.,=\' ; F\' : ; __"`/ ;_/ / \ / : | |
|| ; ^ : `; ;. \ < / ; ; : :`; i`,; : / , : / : | |
|| \ ; : | , ; \ `, <= .\'_.\' ;: ;-\' ;/ : | / , : | |
:| : ; \' `, | \ _.\' \ `,""`-, ,"/ / / / | |/ ; / | |
!: | ;: `, :`-,\/,/ /\ \ Y==` / /; ; / .\'| ;/; / .\' | |
\ ; \ `! ,\'.\' : `. \ ; />`/ .\'_,; \ ,\' .\'1" | ,\' ` ; .\' | |
\ ; \' ` .\' / | _`"-, ;"`._.\'_ -\'" | ; F :/ ` :.\' ; / | |
`, : : ,\' / ; .\' ,-\' `i _//; `, /| ; ; \ :/ ; / | |
:\ : ; : /.\'.-\' /\ ; \ ( ; | | : / / ; ; / | |
\: : \ : ;.\' / :/| \ \ ;| : \ : / / |/ | |
:| \ \ \ | ;/ / T | \ :`: ; \ | : : ;\' | |
!; \ \ \ | ; / : : `. |; ; \ | : ; | | |
; `. \ \ | /\ .\' ; : : \ ;. `; ; ; /| ; ; | |
, `, \, \: : `.:" ; .\'^ | `J ; \`, / .\' : / ;/ | |
\ \ ;`. \\ ; `@__.^-\'" `. ; `, / /| ,`-, ; ;.\' .\' / /` | |
\ `! `.:\ ; "+,_.a._,-\' ; ^ ;\ : ` / .\' ; | |
`. `,`,_` `; `"` `"-,; / ) : \| :.\'/ / | |
`-, \ `-,_`-.__ `-, / :.\' : / ; / | |
\ `, `,`" `""--..__.....-----.._ `""\"` | /: | / | |
`, ; \ `. "-, `. ;\' ; ; / | |
\ :`, : `-,__ \',`. \ ` / .\' / | |
\ : `,! `",`,`,J .\'+\' .\' | |
`,! `J" `"/_.\' | |
''') | |
print(f""" | |
| ^ Adobe Unpacker by deadYokai (up to CC 2021) | |
| ^ | |
| ^ Unpacking {pname} | |
-"-"-------------{dc}""") | |
appjson(pdir) | |
for a in deplist: | |
appjson(a) | |
if os.path.exists(upath): | |
shutil.rmtree(upath) | |
print("\n--DONE--") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment