2022-02-28 01:27:53 -05:00
|
|
|
#!/bin/sh
|
2024-04-22 07:48:54 -04:00
|
|
|
#DivestOS: A mobile operating system divested from the norm.
|
|
|
|
#Copyright (c) 2022-2023 Divested Computing Group
|
2022-05-01 01:13:46 -04:00
|
|
|
#
|
|
|
|
#This program is free software: you can redistribute it and/or modify
|
|
|
|
#it under the terms of the GNU General Public License as published by
|
|
|
|
#the Free Software Foundation, either version 3 of the License, or
|
|
|
|
#(at your option) any later version.
|
|
|
|
#
|
|
|
|
#This program is distributed in the hope that it will be useful,
|
|
|
|
#but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
#GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
#You should have received a copy of the GNU General Public License
|
|
|
|
#along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2022-08-15 16:37:41 -04:00
|
|
|
umask 0022;
|
|
|
|
set -uo pipefail;
|
2022-05-01 01:13:46 -04:00
|
|
|
|
2022-04-19 12:26:51 -04:00
|
|
|
#grep "verity\.mk" Build/*/device/*/*/*.mk -l
|
2023-05-08 22:28:11 -04:00
|
|
|
VERITY_DEVICES=('Amber' 'angler' 'bullhead' 'cheeseburger' 'cheryl' 'discovery' 'dragon' 'dumpling' 'flounder' 'kirin' 'marlin' 'mata' 'mermaid' 'oneplus3' 'pioneer' 'sailfish' 'shamu' 'voyager' 'z2_plus');
|
2022-04-19 12:26:51 -04:00
|
|
|
#grep "AVB_ENABLE" Build/*/device/*/*/*.mk -l
|
2024-05-04 22:18:20 -04:00
|
|
|
AVB_DEVICES=('akari' 'akatsuki' 'alioth' 'apollon' 'aura' 'aurora' 'avicii' 'barbet' 'beryllium' 'bluejay' 'blueline' 'bonito' 'bramble' 'cheetah' 'coral' 'crosshatch' 'davinci' 'dipper' 'enchilada' 'equuleus' 'fajita' 'felix' 'flame' 'FP3' 'FP4' 'guacamole' 'guacamoleb' 'hotdog' 'hotdogb' 'instantnoodle' 'instantnoodlep' 'jasmine_sprout' 'kebab' 'lavender' 'lemonade' 'lemonadep' 'lemonades' 'lmi' 'lynx' 'oriole' 'panther' 'platina' 'polaris' 'pro1' 'pro1x' 'raphael' 'raven' 'redfin' 'sargo' 'sunfish' 'taimen' 'tangorpro' 'twolip' 'ursa' 'vayu' 'walleye' 'wayne' 'whyred' 'xz2c');
|
2022-02-28 01:27:53 -05:00
|
|
|
|
|
|
|
#TODO: Make this a function?
|
|
|
|
echo "================================================================================";
|
|
|
|
echo "Verity Keys";
|
|
|
|
echo "================================================================================";
|
|
|
|
for f in */verifiedboot_relkeys.der.x509
|
|
|
|
do
|
|
|
|
device=$(dirname $f);
|
2024-05-29 12:04:44 -04:00
|
|
|
# shellcheck disable=SC2199
|
2022-02-28 01:27:53 -05:00
|
|
|
if [[ " ${VERITY_DEVICES[@]} " =~ " ${device} " ]]; then
|
|
|
|
echo "Device: $device";
|
2024-05-04 19:33:36 -04:00
|
|
|
sha1=$(cat $f | openssl dgst -sha1 -c | sed 's/SHA1(stdin)= //' | tr [a-z] [A-Z]);
|
|
|
|
sha256=$(cat $f | openssl dgst -sha256 | sed 's/SHA2-256(stdin)= //' | tr [a-z] [A-Z]);
|
2022-02-28 01:27:53 -05:00
|
|
|
#echo -e "\tSHA-1:"; #TODO: Figure out how this is actually calculated, perhaps lacks the actual certificate infomation due to mincrypt?
|
|
|
|
#echo -e "\t\t$sha1";
|
|
|
|
echo -e "\tSHA-256:";
|
|
|
|
echo -e "\t\t${sha256:0:16}";
|
|
|
|
echo -e "\t\t${sha256:16:16}";
|
|
|
|
echo -e "\t\t${sha256:32:16}";
|
|
|
|
echo -e "\t\t${sha256:48:16}";
|
|
|
|
fi;
|
|
|
|
done
|
|
|
|
echo "================================================================================";
|
|
|
|
echo "AVB Keys";
|
|
|
|
echo "================================================================================";
|
|
|
|
for f in */avb_pkmd.bin
|
|
|
|
do
|
|
|
|
device=$(dirname $f);
|
2024-05-29 12:04:44 -04:00
|
|
|
# shellcheck disable=SC2199
|
2022-02-28 01:27:53 -05:00
|
|
|
if [[ " ${AVB_DEVICES[@]} " =~ " ${device} " ]]; then
|
|
|
|
echo "Device: $device";
|
2024-05-04 19:33:36 -04:00
|
|
|
sha256=$(cat $f | openssl dgst -sha256 | sed 's/SHA2-256(stdin)= //' | tr [a-z] [A-Z]);
|
2022-02-28 01:27:53 -05:00
|
|
|
echo -e "\tSHA-256:";
|
|
|
|
echo -e "\t\t${sha256:0:16}";
|
|
|
|
echo -e "\t\t${sha256:16:16}";
|
|
|
|
echo -e "\t\t${sha256:32:16}";
|
|
|
|
echo -e "\t\t${sha256:48:16}";
|
|
|
|
fi;
|
|
|
|
done
|
|
|
|
echo "================================================================================";
|