Last active
February 22, 2023 20:01
-
-
Save obfusk/c7dcee1ac28bc494323b6ce78ea8ac3c to your computer and use it in GitHub Desktop.
use zipflinger to add files to an APK w/ a groovy script
This file contains hidden or 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
import java.util.zip.ZipInputStream | |
def zis = new ZipInputStream(new FileInputStream(args[0])) | |
def entryCounter = 0 | |
while (temp = zis.getNextEntry()) { | |
entryCounter++ | |
if (!temp.name && !temp.size) { | |
println "Found virtual entry #${entryCounter}" | |
} | |
} |
This file contains hidden or 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
import com.android.zipflinger.BytesSource | |
import com.android.zipflinger.ZipArchive | |
import java.util.zip.Deflater | |
def archive = new ZipArchive(new File("foo.apk")) | |
def file = new File("LICENSE.GPLv3") | |
def source = new BytesSource(file, file.name, Deflater.BEST_COMPRESSION) | |
archive.add(source) | |
archive.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment