diff options
| author | Kacper Sagalara <mail@kasesag.me> | 2026-06-19 19:08:11 +0200 |
|---|---|---|
| committer | Kacper Sagalara <mail@kasesag.me> | 2026-06-19 19:08:11 +0200 |
| commit | 7821c02171d77229797e3a57edd0502e942373cc (patch) | |
| tree | 2856fdb7f36144c6e539cfedacd475bf10458ce1 /utils | |
| parent | 0339c6b9e1cafffc2e37c47df4277157fc678041 (diff) | |
Diffstat (limited to 'utils')
| -rwxr-xr-x | utils/bin/fectool/fec | bin | 0 -> 1572304 bytes | |||
| -rw-r--r-- | utils/bin/fectool/ld-linux-x86-64.so.2 | bin | 0 -> 236616 bytes | |||
| -rw-r--r-- | utils/bin/fectool/libc++.so | bin | 0 -> 1306312 bytes | |||
| -rw-r--r-- | utils/bin/fectool/libdl.so.2 | bin | 0 -> 14408 bytes | |||
| -rw-r--r-- | utils/bin/fectool/libgcc_s.so.1 | bin | 0 -> 183024 bytes | |||
| -rw-r--r-- | utils/bin/fectool/libm.so.6 | bin | 0 -> 952616 bytes | |||
| -rw-r--r-- | utils/bin/fectool/libpthread.so.0 | bin | 0 -> 14408 bytes | |||
| -rw-r--r-- | utils/bin/fectool/libresolv.so.2 | bin | 0 -> 68104 bytes | |||
| -rw-r--r-- | utils/bin/fectool/librt.so.1 | bin | 0 -> 14624 bytes | |||
| -rw-r--r-- | utils/jar/apktool.jar | bin | 0 -> 25925346 bytes | |||
| -rwxr-xr-x | utils/scripts/add_to_fs.sh | 29 | ||||
| -rwxr-xr-x | utils/scripts/list_packages.sh | 7 | ||||
| -rwxr-xr-x | utils/scripts/modify_apk.sh | 50 |
13 files changed, 86 insertions, 0 deletions
diff --git a/utils/bin/fectool/fec b/utils/bin/fectool/fec Binary files differnew file mode 100755 index 0000000..b2421eb --- /dev/null +++ b/utils/bin/fectool/fec diff --git a/utils/bin/fectool/ld-linux-x86-64.so.2 b/utils/bin/fectool/ld-linux-x86-64.so.2 Binary files differnew file mode 100644 index 0000000..1100d03 --- /dev/null +++ b/utils/bin/fectool/ld-linux-x86-64.so.2 diff --git a/utils/bin/fectool/libc++.so b/utils/bin/fectool/libc++.so Binary files differnew file mode 100644 index 0000000..f1fc652 --- /dev/null +++ b/utils/bin/fectool/libc++.so diff --git a/utils/bin/fectool/libdl.so.2 b/utils/bin/fectool/libdl.so.2 Binary files differnew file mode 100644 index 0000000..81d5f23 --- /dev/null +++ b/utils/bin/fectool/libdl.so.2 diff --git a/utils/bin/fectool/libgcc_s.so.1 b/utils/bin/fectool/libgcc_s.so.1 Binary files differnew file mode 100644 index 0000000..0e7b8a5 --- /dev/null +++ b/utils/bin/fectool/libgcc_s.so.1 diff --git a/utils/bin/fectool/libm.so.6 b/utils/bin/fectool/libm.so.6 Binary files differnew file mode 100644 index 0000000..6dc6c8e --- /dev/null +++ b/utils/bin/fectool/libm.so.6 diff --git a/utils/bin/fectool/libpthread.so.0 b/utils/bin/fectool/libpthread.so.0 Binary files differnew file mode 100644 index 0000000..145787c --- /dev/null +++ b/utils/bin/fectool/libpthread.so.0 diff --git a/utils/bin/fectool/libresolv.so.2 b/utils/bin/fectool/libresolv.so.2 Binary files differnew file mode 100644 index 0000000..5b0aeed --- /dev/null +++ b/utils/bin/fectool/libresolv.so.2 diff --git a/utils/bin/fectool/librt.so.1 b/utils/bin/fectool/librt.so.1 Binary files differnew file mode 100644 index 0000000..b4db5d7 --- /dev/null +++ b/utils/bin/fectool/librt.so.1 diff --git a/utils/jar/apktool.jar b/utils/jar/apktool.jar Binary files differnew file mode 100644 index 0000000..185c2da --- /dev/null +++ b/utils/jar/apktool.jar diff --git a/utils/scripts/add_to_fs.sh b/utils/scripts/add_to_fs.sh new file mode 100755 index 0000000..037c5e6 --- /dev/null +++ b/utils/scripts/add_to_fs.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +if [ "$#" -lt 3 ]; then + echo "Incorrect arguments!" + echo " Using: $0 <PARTITION_NAME> <FILE_INPUT> <FILE_LOCATION> [FTYPE (d,f,x)] [SELINUX_DOMAIN]" + exit 1 +fi + +PARTITION_NAME=$1 +FILE_INPUT=$2 +FILE_LOCATION=$3 +FTYPE=$4 +SELINUX_DOMAIN=$5 + + +FS_CONFIG_DIR="unpacked/mnt/config/" +PERMISSION=0644 + +if [[ -z ${SELINUX_DOMAIN} ]]; then + SELINUX_DOMAIN="system_file" +fi + +echo "/${PARTITION_NAME}/${FILE_LOCATION}/${FILE_INPUT} u:object_r:$SELINUX_DOMAIN:s0" >> ${FS_CONFIG_DIR}/${PARTITION_NAME}_file_contexts + +# PART_NAME_fs_config +if [[ -d $FILE_INPUT || $FTYPE == 1 ]]; then + PERMISSION=0755 +fi +echo "${PARTITION_NAME}/${FILE_LOCATION}/${FILE_INPUT} 0 0 ${PERMISSION}" >> ${FS_CONFIG_DIR}/${PARTITION_NAME}_fs_config diff --git a/utils/scripts/list_packages.sh b/utils/scripts/list_packages.sh new file mode 100755 index 0000000..78fe462 --- /dev/null +++ b/utils/scripts/list_packages.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +MNT_DIR="unpacked/mnt/" + +for i in $(find $MNT_DIR -name "*.apk"); do + echo -e "$( aapt dump badging $i | awk '/package/{gsub("name=|'"'"'",""); print $2}' ) : $i" +done diff --git a/utils/scripts/modify_apk.sh b/utils/scripts/modify_apk.sh new file mode 100755 index 0000000..e682598 --- /dev/null +++ b/utils/scripts/modify_apk.sh @@ -0,0 +1,50 @@ +#!/bin/bash + +TMP_DIR="/tmp/driedlamu/modify_apk" + +decompile() { + local file="$1" + local file_name="$(basename "$file" .apk)" + local working_dir="$TMP_DIR/$file_name" + + mkdir -p "$working_dir" + + if ! java -Xmx2048m -jar "./utils/jar/apktool.jar" d -q -f "$file" -o "$working_dir/decompile"; then + echo "Error: Failed to decompile $file with apktool" + exit 1 + fi +} + +repack() { + local file="$1" + local file_name="$(basename "$file" .apk)" + local output_location="$2" + local working_dir="$TMP_DIR/$file_name" + local modified_apk="$working_dir/${file_name}_unsigned.apk" + + if ! java -Xmx2048m -jar "./utils/jar/apktool.jar" b -q -f "$working_dir/decompile" -o "$working_dir/${file_name}_unsigned.apk"; then + echo "Error: Failed to recompile $file with apktool" + exit 1 + fi + + apksigcopier copy "$file" "$modified_apk" "${output_location}/${file_name}.apk" +} + +mkdir -p $TMP_DIR + +apk_cli() { + case $1 in + unpack) + decompile "$2" + ;; + repack) + repack "$2" "$3" + ;; + *) + echo "Please specify a valid type of task you wish to do (unpack, repack)." + exit 1 + ;; + esac +} + +apk_cli "$1" "$2" "$3" |
