Changes to asset extractor + ...

* Set System session HOME to / ( nonroot + root )
* Let startup_assets reset assets fully on startup
This commit is contained in:
Martin Valba 2022-12-28 15:41:03 +02:00
parent f783a39f31
commit 98dd587547
3 changed files with 8 additions and 6 deletions

View File

@ -2,7 +2,7 @@
# Version: 1.0.2
# export path for android bins/tools
export PATH=/data/data/com.offsec.nhterm/files/home/.pwnterm/script:/data/data/com.offsec.nhterm/files/usr/bin:/data/data/com.offsec.nhterm/files/usr/sbin:/sbin:/system/bin:/system/xbin:/apex/com.android.runtime/bin:/apex/com.android.art/bin:/odm/bin:/vendor/bin:.
export PATH=/data/data/com.offsec.nhterm/files/home/.nhterm/script:/data/data/com.offsec.nhterm/files/usr/bin:/data/data/com.offsec.nhterm/files/usr/sbin:/sbin:/system/bin:/system/xbin:/apex/com.android.runtime/bin:/apex/com.android.art/bin:/odm/bin:/vendor/bin:.
SU1=$(which su)
SU2="$SU1 -c $@"

View File

@ -27,7 +27,7 @@ object NeoTermPath {
@SuppressLint("SdCardPath")
const val ROOT_PATH = "/data/data/com.offsec.nhterm/files"
const val USR_PATH = "$ROOT_PATH/usr"
const val HOME_PATH = "$ROOT_PATH/home"
const val HOME_PATH = "/"
const val APT_BIN_PATH = "$USR_PATH/bin/apt"
const val LIB_PATH = "$USR_PATH/lib"

View File

@ -351,14 +351,16 @@ class NeoTermActivity : AppCompatActivity(), ServiceConnection, SharedPreference
}
fun startup_assets() {
// Always update the file on the opening of this app
// Always update the files on the startup of this app
// Great for noobies who delete stuff and ask why its broken
Runtime.getRuntime().exec("mkdir -p "+" "+"/data/data/com.offsec.nhterm/files/usr/").waitFor()
Executer("/system/bin/rm -f /data/data/com.offsec.nhterm/files/usr/bin/*")
Executer("/system/bin/rm -rf /data/data/com.offsec.nhterm/files/usr/bin")
Thread.sleep(400)
extractAssetsDir("bin", "/data/data/com.offsec.nhterm/files/usr/bin/")
Thread.sleep(400)
Executer("/system/bin/chmod +x /data/data/com.offsec.nhterm/files/usr/bin/bash")
Executer("/system/bin/chmod +x /data/data/com.offsec.nhterm/files/usr/bin/kali")
Executer("/system/bin/chmod +x /data/data/com.offsec.nhterm/files/usr/bin/bash") // Static bash for arm ( works for *64 too )
Executer("/system/bin/chmod +x /data/data/com.offsec.nhterm/files/usr/bin/kali") // Kali chroot scriptlet
Executer("/system/bin/chmod +x /data/data/com.offsec.nhterm/files/usr/bin/android-su") // Android su scriptlet
}
fun Executer(command: String?): String? {