Skip to content

Commit

Permalink
add feature to spoof an invalid hwid automatically
Browse files Browse the repository at this point in the history
  • Loading branch information
ading2210 committed Jun 18, 2024
1 parent 291f616 commit 645e03c
Showing 1 changed file with 26 additions and 10 deletions.
36 changes: 26 additions & 10 deletions bootloader/bin/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,24 @@ print_donor_selector() {
done
}

yes_no_prompt() {
local prompt="$1"
local var_name="$2"

while true; do
read -p "$prompt" temp_result

if [ "$temp_result" = "y" ] || [ "$temp_result" = "n" ]; then
#the busybox shell has no other way to declare a variable from a string
#the declare command and printf -v are both bashisms
eval "$var_name='$temp_result'"
return 0
else
echo "invalid selection"
fi
done
}

get_donor_selection() {
local rootfs_partitions="$1"
local target="$2"
Expand All @@ -240,16 +258,9 @@ get_donor_selection() {

if [ "$selection" = "$i" ]; then
echo "selected $part_path as the donor partition"
read -p "would you like to spoof verified mode? this is useful if you're planning on using chrome os while enrolled. (y/n): " use_crossystem

if [ "$use_crossystem" = "y" ] || [ "$use_crossystem" = "n" ]; then
boot_chromeos $target $part_path $use_crossystem
return 0
else
echo "invalid selection"
sleep 1
return 1
fi
yes_no_prompt "would you like to spoof verified mode? this is useful if you're planning on using chrome os while enrolled. (y/n): " use_crossystem
yes_no_prompt "would you like to spoof an invalid hwid? this will forcibly prevent the device from being enrolled. (y/n): " invalid_hwid
boot_chromeos $target $part_path $use_crossystem $invalid_hwid
fi

i=$((i+1))
Expand Down Expand Up @@ -278,6 +289,7 @@ boot_chromeos() {
local target="$1"
local donor="$2"
local use_crossystem="$3"
local invalid_hwid="$4"

echo "mounting target"
mkdir /newroot
Expand Down Expand Up @@ -318,6 +330,10 @@ boot_chromeos() {
if [ "$use_crossystem" = "y" ]; then
echo "patching crossystem"
cp /opt/crossystem /newroot/tmp/crossystem
if [ "$invalid_hwid" ]; then
sed -i 's/block_devmode/hwid/' /newroot/tmp/crossystem
fi

cp /newroot/usr/bin/crossystem /newroot/tmp/crossystem_old
mount -o bind /newroot/tmp/crossystem /newroot/usr/bin/crossystem
fi
Expand Down

0 comments on commit 645e03c

Please sign in to comment.