aboutsummaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
Diffstat (limited to 'utils')
-rwxr-xr-xutils/bin/fectool/fecbin0 -> 1572304 bytes
-rw-r--r--utils/bin/fectool/ld-linux-x86-64.so.2bin0 -> 236616 bytes
-rw-r--r--utils/bin/fectool/libc++.sobin0 -> 1306312 bytes
-rw-r--r--utils/bin/fectool/libdl.so.2bin0 -> 14408 bytes
-rw-r--r--utils/bin/fectool/libgcc_s.so.1bin0 -> 183024 bytes
-rw-r--r--utils/bin/fectool/libm.so.6bin0 -> 952616 bytes
-rw-r--r--utils/bin/fectool/libpthread.so.0bin0 -> 14408 bytes
-rw-r--r--utils/bin/fectool/libresolv.so.2bin0 -> 68104 bytes
-rw-r--r--utils/bin/fectool/librt.so.1bin0 -> 14624 bytes
-rw-r--r--utils/jar/apktool.jarbin0 -> 25925346 bytes
-rwxr-xr-xutils/scripts/add_to_fs.sh29
-rwxr-xr-xutils/scripts/list_packages.sh7
-rwxr-xr-xutils/scripts/modify_apk.sh50
13 files changed, 86 insertions, 0 deletions
diff --git a/utils/bin/fectool/fec b/utils/bin/fectool/fec
new file mode 100755
index 0000000..b2421eb
--- /dev/null
+++ b/utils/bin/fectool/fec
Binary files differ
diff --git a/utils/bin/fectool/ld-linux-x86-64.so.2 b/utils/bin/fectool/ld-linux-x86-64.so.2
new file mode 100644
index 0000000..1100d03
--- /dev/null
+++ b/utils/bin/fectool/ld-linux-x86-64.so.2
Binary files differ
diff --git a/utils/bin/fectool/libc++.so b/utils/bin/fectool/libc++.so
new file mode 100644
index 0000000..f1fc652
--- /dev/null
+++ b/utils/bin/fectool/libc++.so
Binary files differ
diff --git a/utils/bin/fectool/libdl.so.2 b/utils/bin/fectool/libdl.so.2
new file mode 100644
index 0000000..81d5f23
--- /dev/null
+++ b/utils/bin/fectool/libdl.so.2
Binary files differ
diff --git a/utils/bin/fectool/libgcc_s.so.1 b/utils/bin/fectool/libgcc_s.so.1
new file mode 100644
index 0000000..0e7b8a5
--- /dev/null
+++ b/utils/bin/fectool/libgcc_s.so.1
Binary files differ
diff --git a/utils/bin/fectool/libm.so.6 b/utils/bin/fectool/libm.so.6
new file mode 100644
index 0000000..6dc6c8e
--- /dev/null
+++ b/utils/bin/fectool/libm.so.6
Binary files differ
diff --git a/utils/bin/fectool/libpthread.so.0 b/utils/bin/fectool/libpthread.so.0
new file mode 100644
index 0000000..145787c
--- /dev/null
+++ b/utils/bin/fectool/libpthread.so.0
Binary files differ
diff --git a/utils/bin/fectool/libresolv.so.2 b/utils/bin/fectool/libresolv.so.2
new file mode 100644
index 0000000..5b0aeed
--- /dev/null
+++ b/utils/bin/fectool/libresolv.so.2
Binary files differ
diff --git a/utils/bin/fectool/librt.so.1 b/utils/bin/fectool/librt.so.1
new file mode 100644
index 0000000..b4db5d7
--- /dev/null
+++ b/utils/bin/fectool/librt.so.1
Binary files differ
diff --git a/utils/jar/apktool.jar b/utils/jar/apktool.jar
new file mode 100644
index 0000000..185c2da
--- /dev/null
+++ b/utils/jar/apktool.jar
Binary files differ
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"