fix: building process; add: web UI JavaScript code

This commit both fixes the building process to include the webroot folder and adds the web UI JS code to allow it to fetch the values.
This commit is contained in:
ThePedroo
2024-06-22 04:54:58 -03:00
parent 10bdf6f080
commit bdf12dcf44
4 changed files with 115 additions and 29 deletions

View File

@@ -86,6 +86,9 @@ androidComponents.onVariants { variant ->
into("lib") {
from(project(":loader").layout.buildDirectory.file("intermediates/stripped_native_libs/$variantLowered/out/lib"))
}
into("webroot") {
from("${rootProject.projectDir}/webroot")
}
val root = moduleDir.get()
@@ -159,6 +162,12 @@ androidComponents.onVariants { variant ->
root.file("bin/$abi64/zygiskd").asFile
)
)
set.add(
Pair(
root.file("webroot/index.html").asFile,
null
)
)
sig.initSign(privKey)
set.forEach { it.first.sha(it.second) }
val signFile = root.file(name).asFile

View File

@@ -110,6 +110,14 @@ mv "$TMPDIR/sepolicy.rule" "$MODPATH"
mkdir "$MODPATH/bin"
mkdir "$MODPATH/lib"
mkdir "$MODPATH/lib64"
mkdir "$MODPATH/webroot"
ui_print "- Extracting webroot"
extract "$ZIPFILE" 'webroot/index.html' "$MODPATH/webroot" true
extract "$ZIPFILE" 'webroot/assets/tick.svg' "$MODPATH/webroot/assets" true
extract "$ZIPFILE" 'webroot/css/index.css' "$MODPATH/webroot/css" true
extract "$ZIPFILE" 'webroot/js/main.js' "$MODPATH/webroot/js" true
extract "$ZIPFILE" 'webroot/js/kernelsu.js' "$MODPATH/webroot/js" true
if [ "$ARCH" = "x86" ] || [ "$ARCH" = "x64" ]; then
ui_print "- Extracting x86 libraries"

View File

@@ -1,58 +1,46 @@
<!doctype html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="initial-scale=1, width=device-width" />
<meta name="viewport" content="viewport-fit=cover" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="css/index.css">
<script src="js/main.js" type="module"></script>
</head>
<body>
<div class="header">ReZygisk</div>
<div name="ghost" style="padding: 40px 0px;"></div>
<div name="version" class="bright card">
<div class="brightc content" style="display: flex; align-items: center;">
<div name="rezygisk-status" class="brightc">
<div name="rezygisk-state" class="brightc">
<img class="brightc" src="assets/tick.svg">
</div>
<div name="rezygisk-status" class="brightc content" style="font-size: 1.2em; padding-bottom: 6.5px; padding-left: 5px;">
Zygote is running!
<div name="rezygisk-state" class="brightc content" id="rezygisk_state" style="font-size: 1.2em; padding-bottom: 6.5px; padding-left: 5px;">
ReZygisk is at an unknown state!
</div>
</div>
<div class="brightc content">
<div class="brightc" style="font-size: 1.1em">Version</div>
<div class="brightc" style="color: #c9c9c9">1.0.0</div>
<div class="brightc" id="version_code" style="color: #c9c9c9">Unknown</div>
</div>
<div class="brightc content">
<div class="brightc" style="font-size: 1.1em">Root Implementation</div>
<div class="brightc" style="color: #c9c9c9">KernelSU</div>
</div>
<div class="brightc content">
<div class="brightc" style="font-size: 1.1em">Zygote32</div>
<div class="brightc" style="color: #c9c9c9">Injected</div>
<div class="brightc" id="root_impl" style="color: #c9c9c9">Unknown</div>
</div>
<div class="brightc content">
<div class="brightc" style="font-size: 1.1em">Zygote64</div>
<div class="brightc" style="color: #c9c9c9">Injected</div>
<div class="brightc" id="is_zygote64_injected" style="color: #c9c9c9">Unknown</div>
</div>
<div class="brightc content">
<div class="brightc" style="font-size: 1.1em">Zygote32</div>
<div class="brightc" id="is_zygote32_injected" style="color: #c9c9c9">Unknown</div>
</div>
</div>
<div name="version" class="dim card">
<div class="dimc content" style="font-size: 1.2em;">
Modules (3)
</div>
<div class="dimc content spliter liste" style="padding-top: 3px; padding-bottom: 13px;">
<div class="dimc">Play Integrity Fix (STRONG)</div>
<div class="dimc">32/64</div>
</div>
<div class="dimc content spliter liste" style="padding-top: 10px; padding-bottom: 13px;">
<div class="dimc">Shamiko</div>
<div class="dimc">32/64</div>
</div>
<div class="dimc content spliter liste" style="padding-top: 10px; padding-bottom: 13px;">
<div class="dimc">Zygisk - LSposed</div>
<div class="dimc">32/64</div>
</div>
<div name="version" class="dim card" id="modules_list">
<!-- N/A -->
</div>
<div name="version" class="dim card">

View File

@@ -1,2 +1,83 @@
import { toast } from './kernelsu';
toast('Hello, world!');
import { exec, toast, fullScreen } from './kernelsu.js';
(async () => {
fullScreen(true)
const rezygisk_state = document.getElementById('rezygisk_state')
/* TODO: Implement rezygisk state */
rezygisk_state.innerHTML = 'ReZygisk is functioning!'
const code_version = document.getElementById('version_code')
const root_impl = document.getElementById('root_impl')
const is_zygote32_injected = document.getElementById('is_zygote32_injected')
const is_zygote64_injected = document.getElementById('is_zygote64_injected')
const { errno, stdout, stderr } = await exec('/data/adb/modules/zygisksu/bin/zygisk-ptrace64 info')
if (errno === 0) {
const lines = stdout.split('\n')
code_version.innerHTML = lines[0].split('Tracer ')[1].split('-')[0]
root_impl.innerHTML = lines[4].split(': ')[1]
is_zygote64_injected.innerHTML = lines[5].split(': ')[1] === 'yes' ? 'Injected' : 'Not Injected'
} else {
toast(`Failed to get zygisk-ptrace64 info: ${stderr}`)
}
const { errno: errno32, stdout: stdout32, stderr: stderr32 } = await exec('/data/adb/modules/zygisksu/bin/zygisk-ptrace32 info')
if (errno32 === 0) {
const lines32 = stdout32.split('\n')
is_zygote32_injected.innerHTML = lines32[5].split(': ')[1] === 'yes' ? 'Injected' : 'Not Injected'
} else {
toast(`Failed to get zygisk-ptrace32 info: ${stderr32}`)
}
const modules_list = document.getElementById('modules_list')
const { errno: errnoModules, stdout: stdoutModules, stderr: stderrModules } = await exec('find /data/adb/modules -type d -name zygisk -exec dirname {} \\;')
if (errnoModules === 0) {
const modules = stdoutModules.split('\n')
modules_list.innerHTML +=
`<div class="dimc content" style="font-size: 1.2em;">
Modules (${modules.length})
</div>
<br/>`
for (const module of modules) {
const { errno: errnoZygisk, stdout: stdoutZygisk, stderr: stderrZygisk } = await exec(`ls ${module}/zygisk`)
if (errnoZygisk !== 0) continue
const bitsUsed = []
if (stdoutZygisk.split('\n').find(line => [ 'arm64-v8a.so', 'x86_64.so' ].includes(line))) bitsUsed.push('64 bit')
if (stdoutZygisk.split('\n').find(line => [ 'armeabi-v7a.so', 'x86.so' ].includes(line))) bitsUsed.push('32 bit')
if (bitsUsed.length === 0) bitsUsed.push('N/A')
const { errno: errnoModule, stdout: stdoutModule, stderr: stderrModule } = await exec(`cat ${module}/module.prop`)
if (errnoModule === 0) {
const lines = stdoutModule.split('\n')
const name = lines.find(line => line.includes('name=')).split('=')[1]
modules_list.innerHTML +=
`<div class="dimc content spliter liste" style="padding-top: 3px; padding-bottom: 13px;">
<div class="dimc">${name}</div>
<div class="dimc">${bitsUsed.join(' / ')}</div>
</div>`
} else {
toast(`Failed to get module ${module} info: ${stderrModule}`)
}
}
modules_list.innerHTML += '</div>'
} else {
toast(`Failed to get modules list: ${stderrModules}`)
}
})()