From a56dfe9f8b0c610ca98ed44f2bc02f35f56a4607 Mon Sep 17 00:00:00 2001
From: KOWX712 <97083715+KOWX712@users.noreply.github.com>
Date: Sun, 13 Oct 2024 18:02:23 +0800
Subject: [PATCH 1/4] Add files via upload
---
module/action.sh | 11 ++
module/autopif.sh | 268 ++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 279 insertions(+)
create mode 100644 module/action.sh
create mode 100644 module/autopif.sh
diff --git a/module/action.sh b/module/action.sh
new file mode 100644
index 00000000..c43e4508
--- /dev/null
+++ b/module/action.sh
@@ -0,0 +1,11 @@
+MODPATH="${0%/*}"
+
+# ensure not running in busybox ash standalone shell
+set +o standalone
+unset ASH_STANDALONE
+
+echo -e "Staring script..."
+
+sh $MODPATH/autopif.sh || exit 1
+
+echo -e "All set!"
\ No newline at end of file
diff --git a/module/autopif.sh b/module/autopif.sh
new file mode 100644
index 00000000..36f4e2a3
--- /dev/null
+++ b/module/autopif.sh
@@ -0,0 +1,268 @@
+#!/system/bin/sh
+
+case "$0" in
+ *.sh) DIR="$0";;
+ *) DIR="$(lsof -p $$ 2>/dev/null | grep -o '/.*autopif.sh$')";;
+esac;
+DIR=$(dirname "$(readlink -f "$DIR")");
+
+item() { echo "\n- $@"; }
+die() { echo "\nError: $@!"; exit 1; }
+
+find_busybox() {
+ [ -n "$BUSYBOX" ] && return 0;
+ local path;
+ for path in /data/adb/modules/busybox-ndk/system/*/busybox /data/adb/magisk/busybox /data/adb/ksu/bin/busybox /data/adb/ap/bin/busybox; do
+ if [ -f "$path" ]; then
+ BUSYBOX="$path";
+ return 0;
+ fi;
+ done;
+ return 1;
+}
+
+if ! which wget >/dev/null || grep -q "wget-curl" $(which wget); then
+ if ! find_busybox; then
+ die "wget not found, install busybox";
+ elif $BUSYBOX ping -c1 -s2 android.com 2>&1 | grep -q "bad address"; then
+ die "wget broken, install busybox";
+ else
+ wget() { $BUSYBOX wget "$@"; }
+ fi;
+fi;
+
+rm -f pif.json
+
+if [ "$DIR" = /data/adb/modules/playintegrityfix ]; then
+ DIR=$DIR/autopif;
+ mkdir -p $DIR;
+fi;
+cd "$DIR";
+
+wget -q -O PIXEL_GSI_HTML --no-check-certificate https://developer.android.com/topic/generic-system-image/releases 2>&1 || exit 1;
+grep -m1 -o 'li>.*(Beta)' PIXEL_GSI_HTML | cut -d\> -f2;
+
+BETA_REL_DATE="$(date -D '%B %e, %Y' -d "$(grep -m1 -o 'Date:.*' PIXEL_GSI_HTML | cut -d\ -f2-4)" '+%Y-%m-%d')";
+BETA_EXP_DATE="$(date -D '%s' -d "$(($(date -D '%Y-%m-%d' -d "$BETA_REL_DATE" '+%s') + 60 * 60 * 24 * 7 * 6))" '+%Y-%m-%d')";
+echo "Beta Released: $BETA_REL_DATE \
+ \nEstimated Expiry: $BETA_EXP_DATE";
+
+RELEASE="$(grep -m1 'corresponding Google Pixel builds' PIXEL_GSI_HTML | grep -o '/versions/.*' | cut -d\/ -f3)";
+ID="$(grep -m1 -o 'Build:.*' PIXEL_GSI_HTML | cut -d\ -f2)";
+INCREMENTAL="$(grep -m1 -o "$ID-.*-" PIXEL_GSI_HTML | cut -d- -f2)";
+
+wget -q -O PIXEL_GET_HTML --no-check-certificate https://developer.android.com$(grep -m1 'corresponding Google Pixel builds' PIXEL_GSI_HTML | grep -o 'href.*' | cut -d\" -f2) 2>&1 || exit 1;
+wget -q -O PIXEL_BETA_HTML --no-check-certificate https://developer.android.com$(grep -m1 'Factory images for Google Pixel' PIXEL_GET_HTML | grep -o 'href.*' | cut -d\" -f2) 2>&1 || exit 1;
+
+MODEL_LIST="$(grep -A1 'tr id=' PIXEL_BETA_HTML | grep 'td' | sed 's;.*
\(.*\) | ;\1;')";
+PRODUCT_LIST="$(grep -o 'factory/.*_beta' PIXEL_BETA_HTML | cut -d\/ -f2)";
+
+wget -q -O PIXEL_SECBULL_HTML --no-check-certificate https://source.android.com/docs/security/bulletin/pixel 2>&1 || exit 1;
+
+SECURITY_PATCH="$(grep -A15 "$(grep -m1 -o 'Security patch level:.*' PIXEL_GSI_HTML | cut -d\ -f4-)" PIXEL_SECBULL_HTML | grep -m1 -B1 '' | grep 'td' | sed 's;.*\(.*\) | ;\1;')";
+
+case "$1" in
+ -m)
+ DEVICE="$(getprop ro.product.device)";
+ case "$PRODUCT_LIST" in
+ *${DEVICE}_beta*)
+ MODEL="$(getprop ro.product.model)";
+ PRODUCT="${DEVICE}_beta";
+ ;;
+ esac;
+ ;;
+esac;
+item "Selecting Pixel Beta device ...";
+if [ -z "$PRODUCT" ]; then
+ set_random_beta() {
+ local list_count="$(echo "$MODEL_LIST" | wc -l)";
+ local list_rand="$((RANDOM % $list_count + 1))";
+ local IFS=$'\n';
+ set -- $MODEL_LIST;
+ MODEL="$(eval echo \${$list_rand})";
+ set -- $PRODUCT_LIST;
+ PRODUCT="$(eval echo \${$list_rand})";
+ DEVICE="$(echo "$PRODUCT" | sed 's/_beta//')";
+ }
+ set_random_beta;
+fi;
+echo "$MODEL ($PRODUCT)";
+
+item "Dumping values to minimal pif.json ...";
+cat < "$OUT";
+
+[ "$INSTALL" ] || cat "$OUT";
+
+MODDIR=${0%/*}
+
+# Find and remove directories containing "xiaomi" in their name
+echo Cleaning up...
+find "$MODDIR" -type d -name '*autopif*' | while read -r dir; do
+ rm -rf "$dir"
+
+su -c killall com.google.android.gms.unstable
+done
\ No newline at end of file
From 7e41d71714353e30147eedf4aba871b2ce57ae52 Mon Sep 17 00:00:00 2001
From: KOWX712 <97083715+KOWX712@users.noreply.github.com>
Date: Sun, 13 Oct 2024 18:47:03 +0800
Subject: [PATCH 2/4] Update update.json
---
update.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/update.json b/update.json
index 552095f5..e99ac47a 100644
--- a/update.json
+++ b/update.json
@@ -1,6 +1,6 @@
{
"version": "v17.7",
"versionCode": 17700,
- "zipUrl": "https://github.com/chiteroman/PlayIntegrityFix/releases/download/v17.7/PlayIntegrityFix_v17.7.zip",
+ "zipUrl": "https://github.com/KOWX712/PlayIntegrityFixAutopif/releases/download/Publish/PIF17.7_autopif_RandomPixelBeta.zip",
"changelog": "https://raw.githubusercontent.com/chiteroman/PlayIntegrityFix/main/changelog.md"
}
From bc892ae1bad80c89dc26781c15b32b70bc9d034e Mon Sep 17 00:00:00 2001
From: KOWX712 <97083715+KOWX712@users.noreply.github.com>
Date: Sun, 13 Oct 2024 22:01:29 +0800
Subject: [PATCH 3/4] Delete update.json
---
update.json | 6 ------
1 file changed, 6 deletions(-)
delete mode 100644 update.json
diff --git a/update.json b/update.json
deleted file mode 100644
index e99ac47a..00000000
--- a/update.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "version": "v17.7",
- "versionCode": 17700,
- "zipUrl": "https://github.com/KOWX712/PlayIntegrityFixAutopif/releases/download/Publish/PIF17.7_autopif_RandomPixelBeta.zip",
- "changelog": "https://raw.githubusercontent.com/chiteroman/PlayIntegrityFix/main/changelog.md"
-}
From dad8b09837fa1c70ace5dd1be72585698b81e648 Mon Sep 17 00:00:00 2001
From: KOWX712 <97083715+KOWX712@users.noreply.github.com>
Date: Sun, 13 Oct 2024 14:50:33 +0000
Subject: [PATCH 4/4] RevertRevert "Update update.json"
This reverts commit 7e41d71714353e30147eedf4aba871b2ce57ae52.
---
update.json | 6 ++++++
1 file changed, 6 insertions(+)
create mode 100644 update.json
diff --git a/update.json b/update.json
new file mode 100644
index 00000000..552095f5
--- /dev/null
+++ b/update.json
@@ -0,0 +1,6 @@
+{
+ "version": "v17.7",
+ "versionCode": 17700,
+ "zipUrl": "https://github.com/chiteroman/PlayIntegrityFix/releases/download/v17.7/PlayIntegrityFix_v17.7.zip",
+ "changelog": "https://raw.githubusercontent.com/chiteroman/PlayIntegrityFix/main/changelog.md"
+}