mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-05 15:00:30 +03:00
parent
6a4b7ba4c1
commit
4197455436
1 changed files with 2 additions and 2 deletions
|
|
@ -136,7 +136,7 @@ def get_embedded_classes(apkfile, depth=0):
|
||||||
if depth > 10: # zipbomb protection
|
if depth > 10: # zipbomb protection
|
||||||
return {_('Max recursion depth in ZIP file reached: %s') % apkfile}
|
return {_('Max recursion depth in ZIP file reached: %s') % apkfile}
|
||||||
|
|
||||||
apk_regex = re.compile(r'.*\.apk')
|
archive_regex = re.compile(r'.*\.(aab|aar|apk|apks|jar|war|xapk|zip)$')
|
||||||
class_regex = re.compile(r'classes.*\.dex')
|
class_regex = re.compile(r'classes.*\.dex')
|
||||||
classes = set()
|
classes = set()
|
||||||
|
|
||||||
|
|
@ -144,7 +144,7 @@ def get_embedded_classes(apkfile, depth=0):
|
||||||
with TemporaryDirectory() as tmp_dir, zipfile.ZipFile(apkfile, 'r') as apk_zip:
|
with TemporaryDirectory() as tmp_dir, zipfile.ZipFile(apkfile, 'r') as apk_zip:
|
||||||
for info in apk_zip.infolist():
|
for info in apk_zip.infolist():
|
||||||
# apk files can contain apk files, again
|
# apk files can contain apk files, again
|
||||||
if apk_regex.search(info.filename):
|
if archive_regex.search(info.filename):
|
||||||
with apk_zip.open(info) as apk_fp:
|
with apk_zip.open(info) as apk_fp:
|
||||||
classes = classes.union(get_embedded_classes(apk_fp, depth + 1))
|
classes = classes.union(get_embedded_classes(apk_fp, depth + 1))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue