Skip to content

Commit

Permalink
[Update] Fix ROM Unpack
Browse files Browse the repository at this point in the history
  • Loading branch information
ColdWindScholar committed Feb 6, 2024
1 parent ff2704a commit 56dca17
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
24 changes: 12 additions & 12 deletions ApkParse/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def get_main_activity(self) -> str:
category.__next__() # ElementDepthFirstIterator为啥没有一个判空的方法??
except:
continue
for i in category:
for _ in category:
# print(item.get("{http://schemas.android.com/apk/res/android}name"))
if item.get(
"{http://schemas.android.com/apk/res/android}name") != "android.intent.category.LAUNCHER":
Expand Down Expand Up @@ -182,29 +182,29 @@ def get_version(self) -> str:
return self.common_k_v.get('versionName', '')

def get_file(self, fname: bytes) -> bytes:
'''
"""
通过文件名获取文件,文件名需要转换为bytes
'''
"""
return self.zip.get_file(fname)

def get_manifest(self) -> str:
'''
"""
获取xml格式的manifest文件
'''
"""
return self.manifest.get_xml_str()

def get_resources(self, res_id: int) -> list:
'''
"""
输入资源id, 如 0x7f100010
return:
return:
[(key,value), (key,value)...]
'''
"""
return self.resources.get_resources(res_id)

def unzip(self, out_path):
'''
"""
解压apk中的全部文件
'''
"""
zip_file = self.zip
for fname in zip_file.cds.keys():
out_fname = os.path.join(out_path.encode('utf-8'), fname)
Expand All @@ -219,15 +219,15 @@ def unzip(self, out_path):
pass

def re_zip(self, tmp_path: str, out_path: str, quiet: bool = True):
'''
"""
解压apk文件,再重新zip打包,某些apk可能有较复杂对抗,
无法直接用jeb等工具打开,可以用此方法重打包后再用jeb等其他分析工具分析
**此功能调用系统的zip命令进行打包,没有重签名**
params:
tmp_path: 解压用的临时文件夹
out_path: 最终输出的文件名
'''
"""

self.unzip(tmp_path)
if quiet:
Expand Down
2 changes: 1 addition & 1 deletion ApkParse/utils/public_res_ids.py
Original file line number Diff line number Diff line change
Expand Up @@ -2648,4 +2648,4 @@
0x01020055: "id_accessibilityActionDragStart",
0x01020056: "id_accessibilityActionDragDrop",
0x01020057: "id_accessibilityActionDragCancel",
}
}

0 comments on commit 56dca17

Please sign in to comment.