-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
39 additions
and
4 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Copyright © 2024 Ennui Langeweile, All rights reserved. | ||
# | ||
# ..It ain't rocket science though, expect this to be open-sourced somewhere else | ||
|
||
from typing import IO | ||
import argparse | ||
import glob | ||
import tempfile | ||
import zipfile | ||
|
||
def hissboomify_zip(origin: IO[bytes], target: IO[bytes], is_jij: bool): | ||
zip = zipfile.ZipFile(file=origin, mode="r") | ||
new_zip = zipfile.ZipFile(file=target, mode="w", compression=zipfile.ZIP_STORED if is_jij else zipfile.ZIP_DEFLATED) | ||
for file in zip.filelist: | ||
if file.is_dir(): | ||
new_zip.mkdir(file.filename) | ||
else: | ||
data = zip.open(file.filename) | ||
if file.filename.endswith(".jar"): | ||
hissboomify_zip(data, new_zip.open(file.filename, "w"), True) | ||
else: | ||
new_zip.open(file.filename, "w").write(data.read()) | ||
zip.close() | ||
|
||
parser = argparse.ArgumentParser() | ||
parser.add_argument("path", help="The path of the files you want to detonate") | ||
args = parser.parse_args() | ||
|
||
for path in glob.glob(args.path): | ||
input = open(file=path, mode="r+b").read() | ||
input_temp = tempfile.TemporaryFile() | ||
input_temp.write(input) | ||
|
||
output = open(file=path, mode="w+b") | ||
hissboomify_zip(input_temp, output, False) |
Empty file.