我正在尝试从原始 .img 中解压 android 11 图像/获取信息以获取 selinux 信息、符号链接等。
我正在使用这个很棒的工具:https : //github.com/cubinator/ext4/blob/master/ext4.py35.py
我的代码如下所示:
#!/usr/bin/env python3
import argparse
import sys
import os
import ext4
parser = argparse.ArgumentParser(description='Read <modes, symlinks, contexts and capabilities> from an ext4 image')
parser.add_argument('ext4_image', help='Path to ext4 image to process')
args = parser.parse_args()
exists = os.path.isfile(args.ext4_image)
if not exists:
print("Error: input file " f"[{args.ext4_image}]" " was not found")
sys.exit(1)
file = open(args.ext4_image, "rb")
volume = ext4.Volume(file)
def scan_dir (root_inode, root_path = ""):
for entry_name, entry_inode_idx, entry_type in root_inode.open_dir(): …Run Code Online (Sandbox Code Playgroud)