Skip to content

Commit d29a84a

Browse files
committed
autopif: add fallbacks for potential missing info
ref: osm0sis/PlayIntegrityFork@818f2a6
1 parent 438d3fb commit d29a84a

2 files changed

Lines changed: 18 additions & 6 deletions

File tree

.github/workflows/autopif.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ jobs:
2828
download "https://developer.android.com$(grep -o 'href=".*download.*"' PIXEL_LATEST_HTML | grep 'qpr' | cut -d\" -f2 | head -n1)" PIXEL_FI_HTML
2929
3030
# Extract device information
31-
grep -A1 'tr id=' PIXEL_FI_HTML | grep 'td' | sed 's;.*<td>\(.*\)</td>;\1;' | sed 's/^[[:space:]]*//g;s/[[:space:]]*$//g' > MODEL_LIST
32-
grep -o 'tr id="[^\"]*"' PIXEL_FI_HTML | awk -F\" '{print $2 "_beta"}' | sed 's/^[[:space:]]*//g;s/[[:space:]]*$//g' > PRODUCT_LIST
31+
grep -A1 'tr id=' PIXEL_FI_HTML | grep 'td' | sed 's;.*<td>\(.*\)</td>.*;\1;' > MODEL_LIST
32+
grep 'tr id=' PIXEL_FI_HTML | sed 's;.*<tr id="\(.*\)">.*;\1_beta;' > PRODUCT_LIST
3333
3434
matrix_json=$(paste MODEL_LIST PRODUCT_LIST | jq -R 'split("\t") | {model: .[0], product: .[1]}' | jq -s '{include: .}' | jq -c .)
3535
echo "matrix=$matrix_json" >> $GITHUB_OUTPUT
@@ -72,11 +72,17 @@ jobs:
7272
CANARY_ID="$(grep '"id"' PIXEL_CANARY_JSON | sed -e 's;.*canary-\(.*\)".*;\1;' -e 's;^\(.\{4\}\);\1-;')"
7373
SECURITY_PATCH="$(grep "<td>$CANARY_ID" PIXEL_SECBULL_HTML | sed 's;.*<td>\(.*\)</td>;\1;')"
7474
75-
if [ -z "$ID" ] || [ -z "$INCREMENTAL" ] || [ -z "$SECURITY_PATCH" ]; then
75+
if [ -z "$ID" ] || [ -z "$INCREMENTAL" ]; then
7676
echo "! Failed to get pif.prop for $product"
7777
exit 1
7878
fi
7979
80+
if [ -z "$SECURITY_PATCH" ]; then
81+
echo "! Failed to determine exact security patch level"
82+
echo "- Assuming probable security patch level from Canary build info"
83+
SECURITY_PATCH="${CANARY_ID}-05"
84+
fi
85+
8086
cat <<EOF > ../${product}.prop
8187
FINGERPRINT=$FINGERPRINT
8288
MANUFACTURER=Google

module/autopif.sh

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ FI_URL="https://developer.android.com$(grep -o 'href=".*download.*"' PIXEL_LATES
6464
download "$FI_URL" PIXEL_FI_HTML
6565

6666
# Extract device information
67-
MODEL_LIST="$(grep -A1 'tr id=' PIXEL_FI_HTML | grep 'td' | sed 's;.*<td>\(.*\)</td>;\1;')"
68-
PRODUCT_LIST="$(grep -o 'tr id="[^"]*"' PIXEL_FI_HTML | awk -F\" '{print $2 "_beta"}')"
67+
MODEL_LIST="$(grep -A1 'tr id=' PIXEL_FI_HTML | grep 'td' | sed 's;.*<td>\(.*\)</td>.*;\1;')";
68+
PRODUCT_LIST="$(grep 'tr id=' PIXEL_FI_HTML | sed 's;.*<tr id="\(.*\)">.*;\1_beta;')";
6969

7070
# List available devices
7171
if [ "$1" = "--list" ] || [ "$1" = "-l" ]; then
@@ -97,11 +97,17 @@ CANARY_ID="$(grep '"id"' PIXEL_CANARY_JSON | sed -e 's;.*canary-\(.*\)".*;\1;' -
9797
SECURITY_PATCH="$(grep "<td>$CANARY_ID" PIXEL_SECBULL_HTML | sed 's;.*<td>\(.*\)</td>;\1;')"
9898

9999
# Validate required field to prevent empty pif.prop
100-
if [ -z "$ID" ] || [ -z "$INCREMENTAL" ] || [ -z "$SECURITY_PATCH" ]; then
100+
if [ -z "$ID" ] || [ -z "$INCREMENTAL" ]; then
101101
echo "! Failed to get pif.prop"
102102
exit 1
103103
fi
104104

105+
if [ -z "$SECURITY_PATCH" ]; then
106+
echo "! Failed to determine exact security patch level"
107+
echo "- Assuming probable security patch level from Canary build info"
108+
SECURITY_PATCH="${CANARY_ID}-05"
109+
fi
110+
105111
# Preserve previous setting
106112
spoofConfig="spoofBuild spoofProps spoofProvider spoofSignature spoofVendingBuild spoofVendingSdk DEBUG"
107113
for config in $spoofConfig; do

0 commit comments

Comments
 (0)