mirror of
https://github.com/DrKLO/Telegram.git
synced 2024-12-22 06:25:14 +01:00
update apkdiff.py apkfrombundle.py
This commit is contained in:
parent
17283cea01
commit
2628a58147
2 changed files with 24 additions and 24 deletions
|
@ -3,12 +3,12 @@ from zipfile import ZipFile
|
||||||
|
|
||||||
def compareFiles(first, second):
|
def compareFiles(first, second):
|
||||||
while True:
|
while True:
|
||||||
firstBytes = first.read(4096);
|
firstBytes = first.read(4096)
|
||||||
secondBytes = second.read(4096);
|
secondBytes = second.read(4096)
|
||||||
if firstBytes != secondBytes:
|
if firstBytes != secondBytes:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if firstBytes == b"":
|
if firstBytes == b"" and secondBytes == b"":
|
||||||
break
|
break
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
|
@ -3,12 +3,12 @@ from zipfile import ZipFile
|
||||||
|
|
||||||
def compareFiles(first, second):
|
def compareFiles(first, second):
|
||||||
while True:
|
while True:
|
||||||
firstBytes = first.read(4096);
|
firstBytes = first.read(4096)
|
||||||
secondBytes = second.read(4096);
|
secondBytes = second.read(4096)
|
||||||
if firstBytes != secondBytes:
|
if firstBytes != secondBytes:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if firstBytes != b"" or secondBytes != b"":
|
if firstBytes == b"" and secondBytes == b"":
|
||||||
break
|
break
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
@ -19,7 +19,7 @@ def remove_prefix(text, prefix):
|
||||||
return text
|
return text
|
||||||
|
|
||||||
def compareApkFromBundle(bundle, apk):
|
def compareApkFromBundle(bundle, apk):
|
||||||
FILES_TO_IGNORE = ["META-INF/MANIFEST.MF", "META-INF/CERT.RSA", "META-INF/CERT.SF", "resources.arsc"]
|
FILES_TO_IGNORE = ["resources.arsc", "stamp-cert-sha256"]
|
||||||
|
|
||||||
apkZip = ZipFile(apk, 'r')
|
apkZip = ZipFile(apk, 'r')
|
||||||
bundleZip = ZipFile(bundle, 'r')
|
bundleZip = ZipFile(bundle, 'r')
|
||||||
|
@ -66,6 +66,6 @@ if __name__ == '__main__':
|
||||||
|
|
||||||
|
|
||||||
if sys.argv[1] == sys.argv[2] or compareApkFromBundle(sys.argv[1], sys.argv[2]) == True:
|
if sys.argv[1] == sys.argv[2] or compareApkFromBundle(sys.argv[1], sys.argv[2]) == True:
|
||||||
print("APKs are from bundle!")
|
print("APK from bundle!")
|
||||||
else:
|
else:
|
||||||
print("APKs are different!")
|
print("APK has difference!")
|
||||||
|
|
Loading…
Reference in a new issue