Skip to content

Instantly share code, notes, and snippets.

@obfusk
Last active February 22, 2023 20:01
Show Gist options
  • Save obfusk/c7dcee1ac28bc494323b6ce78ea8ac3c to your computer and use it in GitHub Desktop.
Save obfusk/c7dcee1ac28bc494323b6ce78ea8ac3c to your computer and use it in GitHub Desktop.
use zipflinger to add files to an APK w/ a groovy script
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}"
}
}
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