From 73ec652bd0b0b4a99be7c61e22cc6e2a9c1e1b3b Mon Sep 17 00:00:00 2001 From: AuxXxilium Date: Sun, 10 Nov 2024 12:28:23 +0100 Subject: [PATCH 1/4] boot: fix boot message Signed-off-by: AuxXxilium --- files/initrd/opt/arc/boot.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/initrd/opt/arc/boot.sh b/files/initrd/opt/arc/boot.sh index 4928d42c..76ac9ff8 100755 --- a/files/initrd/opt/arc/boot.sh +++ b/files/initrd/opt/arc/boot.sh @@ -309,7 +309,7 @@ elif [ "${DIRECTBOOT}" == "false" ]; then [ -f "${TMP_PATH}/qrcode_boot.png" ] && echo | fbv -acufi "${TMP_PATH}/qrcode_boot.png" >/dev/null 2>/dev/null || true fi - for T in $(busybox w 2>/dev/null | grep -v 'TTY' | awk '{print $2}'); do + for T in $(w 2>/dev/null | grep -v 'TTY' | awk '{print $2}'); do if [ -w "/dev/${T}" ]; then [ -n "${IPCON}" ] && echo -e "Use \033[1;34mhttp://${IPCON}:5000\033[0m or try \033[1;34mhttp://find.synology.com/ \033[0mto find DSM and proceed.\n\n\033[1;37mThis interface will not be operational. Wait a few minutes.\033[0m\n" >"/dev/${T}" 2>/dev/null || echo -e "Try \033[1;34mhttp://find.synology.com/ \033[0mto find DSM and proceed.\n\n\033[1;37mThis interface will not be operational. Wait a few minutes.\nNo IP found.\033[0m\n" >"/dev/${T}" 2>/dev/null fi From 81d72a080090983ee70a735be9d2a0e31f5915bf Mon Sep 17 00:00:00 2001 From: AuxXxilium Date: Sun, 10 Nov 2024 17:16:46 +0100 Subject: [PATCH 2/4] arc: next step Signed-off-by: AuxXxilium --- files/initrd/opt/arc/arc-functions.sh | 106 ++++++++++--------------- files/initrd/opt/arc/arc.sh | 10 +-- files/initrd/opt/arc/include/consts.sh | 2 - 3 files changed, 45 insertions(+), 73 deletions(-) diff --git a/files/initrd/opt/arc/arc-functions.sh b/files/initrd/opt/arc/arc-functions.sh index d2e4a3b1..693a19d9 100755 --- a/files/initrd/opt/arc/arc-functions.sh +++ b/files/initrd/opt/arc/arc-functions.sh @@ -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() { - 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 - dialog --backtitle "$(backtitle)" --title "HardwareID" \ - --msgbox "HardwareID: ${HWID}\n\nYour HardwareID is registered!" 0 0 - USERID="$(grep -q "${HWID}" "${HWDB}" | awk '{print $1}')" - writeConfigKey "arc.userid" "${USERID}" "${USER_CONFIG_FILE}" + while true; do + HWID="$(echo $(ifconfig | grep eth0 | awk '{print $NF}' | sed 's/://g') | sha256sum | awk '{print $1}' | cut -c1-16)" 2>/dev/null + if [ -n "${HWID}" ]; 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}\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" \ + --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: ${HWID}\n\nYour HardwareID is not registered!" 0 0 + --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" \ - --msgbox "HardwareID: Verification failed!" 0 0 - exit 1 + --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 () { diff --git a/files/initrd/opt/arc/arc.sh b/files/initrd/opt/arc/arc.sh index 1c700d0e..154a7688 100755 --- a/files/initrd/opt/arc/arc.sh +++ b/files/initrd/opt/arc/arc.sh @@ -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" ;; diff --git a/files/initrd/opt/arc/include/consts.sh b/files/initrd/opt/arc/include/consts.sh index 5cc35abd..3fb3048e 100755 --- a/files/initrd/opt/arc/include/consts.sh +++ b/files/initrd/opt/arc/include/consts.sh @@ -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" From 78f5455b69bb1fa9ce5086920a94cf72a20689e8 Mon Sep 17 00:00:00 2001 From: AuxXxilium Date: Sun, 10 Nov 2024 17:39:26 +0100 Subject: [PATCH 3/4] arc: more ... Signed-off-by: AuxXxilium --- files/initrd/opt/arc/arc-functions.sh | 2 -- files/initrd/opt/arc/arc.sh | 4 ++++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/files/initrd/opt/arc/arc-functions.sh b/files/initrd/opt/arc/arc-functions.sh index 693a19d9..77ad8ccc 100755 --- a/files/initrd/opt/arc/arc-functions.sh +++ b/files/initrd/opt/arc/arc-functions.sh @@ -2229,7 +2229,6 @@ function checkHardwareID() { 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}" @@ -2237,7 +2236,6 @@ function checkHardwareID() { 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 diff --git a/files/initrd/opt/arc/arc.sh b/files/initrd/opt/arc/arc.sh index 154a7688..94f9171a 100755 --- a/files/initrd/opt/arc/arc.sh +++ b/files/initrd/opt/arc/arc.sh @@ -409,6 +409,8 @@ function arcPatch() { # Check for Custom Build if [ "${ARCMODE}" == "automated" ]; then [ -z "${ARCCONF}" ] && checkHardwareID || true + sleep 2 + ARCCONF="$(readConfigKey "${MODEL}.serial" "${S_FILE}")" [ -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 @@ -423,6 +425,8 @@ function arcPatch() { [ -z "${resp}" ] && return 1 if [ ${resp} -eq 1 ]; then [ -z "${ARCCONF}" ] && checkHardwareID || true + sleep 2 + ARCCONF="$(readConfigKey "${MODEL}.serial" "${S_FILE}")" [ -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 From 1d04d3f59fc989b3f5dfb623383298e6e27551ad Mon Sep 17 00:00:00 2001 From: AuxXxilium Date: Sun, 10 Nov 2024 18:15:54 +0100 Subject: [PATCH 4/4] arc: more logic rewrite Signed-off-by: AuxXxilium --- files/initrd/opt/arc/arc-functions.sh | 6 ++++++ files/initrd/opt/arc/arc.sh | 7 ++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/files/initrd/opt/arc/arc-functions.sh b/files/initrd/opt/arc/arc-functions.sh index 77ad8ccc..89b3afde 100755 --- a/files/initrd/opt/arc/arc-functions.sh +++ b/files/initrd/opt/arc/arc-functions.sh @@ -2210,11 +2210,15 @@ function genHardwareID() { else dialog --backtitle "$(backtitle)" --title "HardwareID" \ --yes-label "Retry" --no-label "Cancel" --yesno "HardwareID: ${HWID}\nRegister your HardwareID on\nhttps://arc.auxxxilium.tech (Discord Account needed)." 8 60 + writeConfigKey "arc.hwid" "" "${USER_CONFIG_FILE}" + writeConfigKey "arc.userid" "" "${USER_CONFIG_FILE}" [ $? -ne 0 ] && break fi else dialog --backtitle "$(backtitle)" --title "HardwareID" \ --msgbox "HardwareID: Verification failed!" 6 50 + writeConfigKey "arc.hwid" "" "${USER_CONFIG_FILE}" + writeConfigKey "arc.userid" "" "${USER_CONFIG_FILE}" break fi done @@ -2234,6 +2238,8 @@ function checkHardwareID() { curl -skL "https://arc.auxxxilium.tech?hwid=${HWID}&userid=${USERID}" > "${S_FILE}" fi else + writeConfigKey "arc.hwid" "" "${USER_CONFIG_FILE}" + writeConfigKey "arc.userid" "" "${USER_CONFIG_FILE}" dialog --backtitle "$(backtitle)" --title "HardwareID" \ --infobox "Couldn't verify your HardwareID!\nArc Patch not enabled!" 6 40 cp -f "${S_FILE}.bak" "${S_FILE}" diff --git a/files/initrd/opt/arc/arc.sh b/files/initrd/opt/arc/arc.sh index 94f9171a..87690691 100755 --- a/files/initrd/opt/arc/arc.sh +++ b/files/initrd/opt/arc/arc.sh @@ -33,6 +33,7 @@ fi # Get Arc Data from Config ARCPATCH="$(readConfigKey "arc.patch" "${USER_CONFIG_FILE}")" +USERID="$(readConfigKey "arc.userid" "${USER_CONFIG_FILE}")" ARCCONF="$(readConfigKey "${MODEL:-SA6400}.serial" "${S_FILE}")" BOOTIPWAIT="$(readConfigKey "bootipwait" "${USER_CONFIG_FILE}")" DIRECTBOOT="$(readConfigKey "directboot" "${USER_CONFIG_FILE}")" @@ -409,7 +410,7 @@ function arcPatch() { # Check for Custom Build if [ "${ARCMODE}" == "automated" ]; then [ -z "${ARCCONF}" ] && checkHardwareID || true - sleep 2 + sleep 1 ARCCONF="$(readConfigKey "${MODEL}.serial" "${S_FILE}")" [ -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}" @@ -425,7 +426,7 @@ function arcPatch() { [ -z "${resp}" ] && return 1 if [ ${resp} -eq 1 ]; then [ -z "${ARCCONF}" ] && checkHardwareID || true - sleep 2 + sleep 1 ARCCONF="$(readConfigKey "${MODEL}.serial" "${S_FILE}")" [ -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}" @@ -824,7 +825,7 @@ else [ "${BUILDDONE}" == "true" ] && NEXT="3" || NEXT="1" while true; do echo "= \"\Z4========== Main ==========\Zn \" " >"${TMP_PATH}/menu" - if [ -z "${ARCCONF}" ] && [ "${ARCOFFLINE}" != "true" ]; then + if [ -z "${USERID}" ] && [ "${ARCOFFLINE}" != "true" ]; then echo "0 \"HardwareID for Arc Patch\" " >>"${TMP_PATH}/menu" fi echo "1 \"Choose Model \" " >>"${TMP_PATH}/menu"