arc: next step

Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
AuxXxilium 2024-11-10 17:16:46 +01:00
parent 73ec652bd0
commit 81d72a0800
3 changed files with 45 additions and 73 deletions

View File

@ -729,8 +729,6 @@ function backupMenu() {
PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")"
DT="$(readConfigKey "platforms.${PLATFORM}.dt" "${P_FILE}")"
CONFDONE="$(readConfigKey "arc.confdone" "${USER_CONFIG_FILE}")"
writeConfigKey "arc.key" "" "${USER_CONFIG_FILE}"
ARCKEY="$(readConfigKey "arc.key" "${USER_CONFIG_FILE}")"
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
break
@ -857,7 +855,7 @@ function updateMenu() {
updateDependencies
;;
3)
decryptMenu
checkHardwareID
;;
4)
dialog --backtitle "$(backtitle)" --title "Switch Arc Branch" \
@ -912,8 +910,6 @@ function networkMenu() {
function sysinfo() {
# Get System Informations
[ -d /sys/firmware/efi ] && BOOTSYS="UEFI" || BOOTSYS="BIOS"
HWID="$(readConfigKey "arc.hwid" "${USER_CONFIG_FILE}")"
USERID="$(readConfigKey "arc.userid" "${USER_CONFIG_FILE}")"
CPU="$(cat /proc/cpuinfo 2>/dev/null | grep 'model name' | uniq | awk -F':' '{print $2}')"
SECURE=$(dmesg 2>/dev/null | grep -i "Secure Boot" | awk -F'] ' '{print $2}')
VENDOR=$(dmesg 2>/dev/null | grep -i "DMI:" | head -1 | sed 's/\[.*\] DMI: //i')
@ -962,9 +958,6 @@ function sysinfo() {
TIMEOUT=5
TEXT=""
# Print System Informations
if [ -n ${HWID} ] && [ -n "${USERID}" ]; then
TEXT+="\n\Z4> HWID | UserID: ${HWID} | ${USERID}\Zn"
fi
TEXT+="\n\n\Z4> System: ${MACHINE} | ${BOOTSYS} | ${BUS}\Zn"
TEXT+="\n Vendor: \Zb${VENDOR}\Zn"
TEXT+="\n CPU: \Zb${CPU}\Zn"
@ -1925,52 +1918,6 @@ function satadomMenu() {
return
}
###############################################################################
# Decrypt Menu
function decryptMenu() {
ARCKEY="$(readConfigKey "arc.key" "${USER_CONFIG_FILE}")"
ARCOFFLINE="$(readConfigKey "arc.offline" "${USER_CONFIG_FILE}")"
if [ "${ARCOFFLINE}" == "false" ]; then
updateConfigs
fi
if openssl enc -in "${S_FILE_ENC}" -out "${S_FILE_ARC}" -d -aes-256-cbc -k "${ARCKEY}" 2>/dev/null; then
dialog --backtitle "$(backtitle)" --colors --title "Arc Decrypt" \
--msgbox "Decrypt successful: You can select Arc Patch." 5 50
mv -f "${S_FILE_ARC}" "${S_FILE}"
else
while true; do
CONFIGSVERSION="$(cat "${MODEL_CONFIG_PATH}/VERSION" 2>/dev/null)"
cp -f "${S_FILE}" "${S_FILE}.bak"
dialog --backtitle "$(backtitle)" --colors --title "Arc Decrypt" \
--inputbox "Enter Decryption Key for ${CONFIGSVERSION}!\nKey is available in my Discord:\nhttps://discord.auxxxilium.tech" 9 50 2>"${TMP_PATH}/resp"
[ $? -ne 0 ] && break
ARCKEY=$(cat "${TMP_PATH}/resp")
if openssl enc -in "${S_FILE_ENC}" -out "${S_FILE_ARC}" -d -aes-256-cbc -k "${ARCKEY}" 2>/dev/null; then
dialog --backtitle "$(backtitle)" --colors --title "Arc Decrypt" \
--msgbox "Decrypt successful: You can select Arc Patch." 5 50
mv -f "${S_FILE_ARC}" "${S_FILE}"
writeConfigKey "arc.key" "${ARCKEY}" "${USER_CONFIG_FILE}"
ARCKEY="$(readConfigKey "arc.key" "${USER_CONFIG_FILE}")"
else
dialog --backtitle "$(backtitle)" --colors --title "Arc Decrypt" \
--msgbox "Decrypt failed: Wrong Key!" 5 50
mv -f "${S_FILE}.bak" "${S_FILE}"
writeConfigKey "arc.key" "" "${USER_CONFIG_FILE}"
ARCKEY="$(readConfigKey "arc.key" "${USER_CONFIG_FILE}")"
fi
if [ -n "${ARCKEY}" ]; then
break
fi
done
fi
ARCCONF="$(readConfigKey "${MODEL:-SA6400}.serial" "${S_FILE}")"
writeConfigKey "arc.confdone" "false" "${USER_CONFIG_FILE}"
CONFDONE="$(readConfigKey "arc.confdone" "${USER_CONFIG_FILE}")"
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
return 0
}
###############################################################################
# Reboot Menu
function rebootMenu() {
@ -2250,27 +2197,54 @@ function getpatfiles() {
###############################################################################
# Generate HardwareID
function genHardwareID() {
while true; do
HWID="$(echo $(ifconfig | grep eth0 | awk '{print $NF}' | sed 's/://g') | sha256sum | awk '{print $1}' | cut -c1-16)" 2>/dev/null
writeConfigKey arc.hwid "${HWID}" "${USER_CONFIG_FILE}"
if [ -n "${HWID}" ]; then
HWDB="$(curl -skL "https://auxxxilium.tech/hwid.yml")"
if grep -q "${HWID}" "${HWDB}"; then
USERID="$(curl -skL "https://arc.auxxxilium.tech?hwid=${HWID}")"
if echo "${USERID}" | grep -vq "Hardware ID"; then
dialog --backtitle "$(backtitle)" --title "HardwareID" \
--msgbox "HardwareID: ${HWID}\n\nYour HardwareID is registered!" 0 0
USERID="$(grep -q "${HWID}" "${HWDB}" | awk '{print $1}')"
--msgbox "HardwareID: ${HWID}\nYour HardwareID is registered to UserID: ${USERID}!" 6 70
writeConfigKey "arc.hwid" "${HWID}" "${USER_CONFIG_FILE}"
writeConfigKey "arc.userid" "${USERID}" "${USER_CONFIG_FILE}"
break
else
dialog --backtitle "$(backtitle)" --title "HardwareID" \
--msgbox "HardwareID: ${HWID}\n\nYour HardwareID is not registered!" 0 0
--yes-label "Retry" --no-label "Cancel" --yesno "HardwareID: ${HWID}\nRegister your HardwareID on\nhttps://arc.auxxxilium.tech (Discord Account needed)." 8 60
[ $? -ne 0 ] && break
fi
else
dialog --backtitle "$(backtitle)" --title "HardwareID" \
--msgbox "HardwareID: Verification failed!" 0 0
exit 1
--msgbox "HardwareID: Verification failed!" 6 50
break
fi
done
return
}
###############################################################################
# Check HardwareID
function checkHardwareID() {
HWID="$(echo $(ifconfig | grep eth0 | awk '{print $NF}' | sed 's/://g') | sha256sum | awk '{print $1}' | cut -c1-16)" 2>/dev/null
USERID="$(curl -skL "https://arc.auxxxilium.tech?hwid=${HWID}")"
if echo "${USERID}" | grep -vq "Hardware ID"; then
writeConfigKey "arc.hwid" "${HWID}" "${USER_CONFIG_FILE}"
writeConfigKey "arc.userid" "${USERID}" "${USER_CONFIG_FILE}"
writeConfigKey "arc.patch" "true" "${USER_CONFIG_FILE}"
if [ -n "${USERID}" ] && [ -n "${HWID}" ]; then
cp -f "${S_FILE}" "${S_FILE}.bak"
curl -skL "https://arc.auxxxilium.tech?hwid=${HWID}&userid=${USERID}" > "${S_FILE}"
fi
else
dialog --backtitle "$(backtitle)" --title "HardwareID" \
--infobox "Couldn't verify your HardwareID!\nArc Patch not enabled!" 6 40
writeConfigKey "arc.patch" "false" "${USER_CONFIG_FILE}"
cp -f "${S_FILE}.bak" "${S_FILE}"
sleep 3
fi
return
}
###############################################################################
# Bootsreen Menu
function bootScreen () {

View File

@ -32,7 +32,6 @@ if [ -n "${MODEL}" ]; then
fi
# Get Arc Data from Config
ARCKEY="$(readConfigKey "arc.key" "${USER_CONFIG_FILE}")"
ARCPATCH="$(readConfigKey "arc.patch" "${USER_CONFIG_FILE}")"
ARCCONF="$(readConfigKey "${MODEL:-SA6400}.serial" "${S_FILE}")"
BOOTIPWAIT="$(readConfigKey "bootipwait" "${USER_CONFIG_FILE}")"
@ -91,7 +90,7 @@ function arcModel() {
STEP="model"
dialog --backtitle "$(backtitlep)" --title "Model" \
--infobox "Reading Models..." 3 25
if [ ! -f "${S_FILE}" ]; then
if [ ! -f "${S_FILE}" ] || [ ! -f "${P_FILE}" ]; then
updateConfigs
fi
# Loop menu
@ -409,6 +408,7 @@ function arcPatch() {
ARCCONF="$(readConfigKey "${MODEL}.serial" "${S_FILE}")"
# Check for Custom Build
if [ "${ARCMODE}" == "automated" ]; then
[ -z "${ARCCONF}" ] && checkHardwareID || true
[ -n "${ARCCONF}" ] && SN="$(generateSerial "${MODEL}" "true")" || SN="$(generateSerial "${MODEL}" "false")"
[ -n "${ARCCONF}" ] && writeConfigKey "arc.patch" "true" "${USER_CONFIG_FILE}" || writeConfigKey "arc.patch" "false" "${USER_CONFIG_FILE}"
elif [ "${ARCMODE}" == "config" ]; then
@ -422,7 +422,7 @@ function arcPatch() {
resp=$(cat ${TMP_PATH}/resp)
[ -z "${resp}" ] && return 1
if [ ${resp} -eq 1 ]; then
[ -z "${ARCCONF}" ] && decryptMenu || true
[ -z "${ARCCONF}" ] && checkHardwareID || true
[ -n "${ARCCONF}" ] && SN="$(generateSerial "${MODEL}" "true")" || SN="$(generateSerial "${MODEL}" "false")"
[ -n "${ARCCONF}" ] && writeConfigKey "arc.patch" "true" "${USER_CONFIG_FILE}" || writeConfigKey "arc.patch" "false" "${USER_CONFIG_FILE}"
elif [ ${resp} -eq 2 ]; then
@ -821,7 +821,7 @@ else
while true; do
echo "= \"\Z4========== Main ==========\Zn \" " >"${TMP_PATH}/menu"
if [ -z "${ARCCONF}" ] && [ "${ARCOFFLINE}" != "true" ]; then
echo "0 \"Enable Arc Patch\" " >>"${TMP_PATH}/menu"
echo "0 \"HardwareID for Arc Patch\" " >>"${TMP_PATH}/menu"
fi
echo "1 \"Choose Model \" " >>"${TMP_PATH}/menu"
if [ "${CONFDONE}" == "true" ]; then
@ -939,7 +939,7 @@ else
[ $? -ne 0 ] && break
case "$(cat ${TMP_PATH}/resp)" in
# Main Section
0) decryptMenu; NEXT="0" ;;
0) genHardwareID; NEXT="0" ;;
1) arcModel; NEXT="2" ;;
2) arcSummary; NEXT="3" ;;
3) boot; NEXT="3" ;;

View File

@ -36,8 +36,6 @@ USER_UP_PATH="${PART3_PATH}/users"
UNTAR_PAT_PATH="${PART3_PATH}/DSM"
S_FILE="${MODEL_CONFIG_PATH}/serials.yml"
S_FILE_ARC="${MODEL_CONFIG_PATH}/arc_serials.yml"
S_FILE_ENC="${MODEL_CONFIG_PATH}/arc_serials.enc"
P_FILE="${MODEL_CONFIG_PATH}/platforms.yml"
D_FILE="${MODEL_CONFIG_PATH}/data.yml"