You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.8 KiB
Python

import gzip
import os
import shutil
from stuff.general import General
from tools.logger import Logger
from tools import container
3 years ago
class Nodataperm(General):
3 years ago
id = "nodataperm"
dl_links = {
"11": ["https://github.com/ayasa520/hack_full_data_permission/archive/refs/heads/main.zip",
"8f067ef796c3f6849f9767a85496156f"],
"13": ["", ""]
}
dl_file_name = "nodataperm.zip"
extract_to = "/tmp/nodataperm"
3 years ago
dl_link = ...
act_md5 = ...
partition = "system"
files = [
3 years ago
"etc/nodataperm.sh",
"etc/init/nodataperm.rc",
"framework/services.jar"
]
def __init__(self, android_version="11") -> None:
super().__init__()
self.dl_link = self.dl_links[android_version][0]
self.act_md5 = self.dl_links[android_version][1]
def copy(self):
3 years ago
extract_path = os.path.join(
self.extract_to, "hack_full_data_permission-main")
if not container.use_overlayfs():
3 years ago
services_jar = os.path.join(
self.copy_dir, self.partition, "framework", "services.jar")
gz_filename = services_jar+".gz"
3 years ago
with gzip.open(gz_filename, 'wb') as f_gz:
with open(services_jar, "rb") as f:
f_gz.write(f.read())
Logger.info("Copying widevine library files ...")
3 years ago
shutil.copytree(extract_path, os.path.join(
self.copy_dir, self.partition), dirs_exist_ok=True)
3 years ago
def extra2(self):
if not container.use_overlayfs():
services_jar = os.path.join(
self.copy_dir, self.partition, "framework", "services.jar")
gz_filename = services_jar+".gz"
with gzip.GzipFile(gz_filename) as f_gz:
with open(services_jar, "wb") as f:
f.writelines(f_gz)