FORUMS
Remove All Ads from XDA

[8/3/2019]Updated Android IMG Tools[Upto Android 9.0]

5,154 posts
Thanks Meter: 7,562
 
By Ricky Divjakovski, Recognized Developer / Recognized Contributor on 20th January 2019, 03:23 PM
Post Reply Email Thread
1st May 2019, 12:38 PM |#31  
Ricky Divjakovski's Avatar
OP Recognized Developer / Recognized Contributor
Flag Sydney
Thanks Meter: 7,562
 
Donate to Me
More
Quote:
Originally Posted by JamFlux

Hi friend.
i found the .py code:
https://github.com/cubinator/ext4/is...ment-438177556

#!/usr/bin/env python3

import ext4
import argparse
import os
import sys

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():
if entry_name == "." or entry_name == "..":
continue
entry_inode = root_inode.volume.get_inode(entry_inode_idx, entry_type)
entry_inode_path = root_path + "/" + entry_name
if entry_inode.is_dir:
scan_dir(entry_inode, entry_inode_path)
if entry_inode_path[-1] == '/':
continue
xattrs_perms = list(entry_inode.xattrs())
found_cap = False
found_con = False
if "security.capability" in f"{xattrs_perms}": found_cap = True
if "security.selinux" in f"{xattrs_perms}": found_con = True
contexts = ""
capability = ""
if found_cap:
if found_con:
if "security.five" in f"{xattrs_perms}":
capability = f"{xattrs_perms[2:3]}"
else:
capability = f"{xattrs_perms[1:2]}"
else:
capability = f"{xattrs_perms[0:1]}"
capability = capability.split(" ")[1][:-3][+2:].encode('utf-8').decode('unicode-escape').encode('ISO-8859-1')
capability = str(hex(int.from_bytes(capability[4:8] + capability[14:18], "little")))
capability = "capabilities="f"{capability}"
capability = " "f"{capability}"
if found_con:
contexts = f"{xattrs_perms[0:1]}"
contexts = f"{contexts.split( )[1].split('x00')[0][:-1][+2:]}"
contexts = " "f"{contexts}"
print(f"{entry_inode.mode_str:s}" " " f"{entry_inode_path}"f"{contexts}"f"{capability }")

scan_dir(volume.root)
file.close()

i found this but couldnt get a proper compilation of the code in the form of an executable, ill dig deeper soon, thanks for linking
 
 
1st May 2019, 10:54 PM |#32  
Senior Member
Thanks Meter: 143
 
More
Can you pack it and post it?

通过我的 Redmi Note 5 上的 Tapatalk发言
5th May 2019, 06:08 AM |#33  
Senior Member
Thanks Meter: 17
 
More
Repack android 8 and android 9 .
https://github.com/rkhat2/android-rom-repacker/releases
The Following User Says Thank You to I1V1A1N For This Useful Post: [ View ] Gift I1V1A1N Ad-Free
15th May 2019, 06:57 AM |#34  
Junior Member
Thanks Meter: 0
 
More
futuretricks
useful
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes