diff --git a/files/initrd/opt/arc/arc-functions.sh b/files/initrd/opt/arc/arc-functions.sh index d2e4a3b1..89b3afde 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,58 @@ 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 + writeConfigKey "arc.hwid" "" "${USER_CONFIG_FILE}" + writeConfigKey "arc.userid" "" "${USER_CONFIG_FILE}" + [ $? -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 + writeConfigKey "arc.hwid" "" "${USER_CONFIG_FILE}" + writeConfigKey "arc.userid" "" "${USER_CONFIG_FILE}" + 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}" + 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 + writeConfigKey "arc.hwid" "" "${USER_CONFIG_FILE}" + writeConfigKey "arc.userid" "" "${USER_CONFIG_FILE}" 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 + 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..87690691 100755 --- a/files/initrd/opt/arc/arc.sh +++ b/files/initrd/opt/arc/arc.sh @@ -32,8 +32,8 @@ if [ -n "${MODEL}" ]; then fi # Get Arc Data from Config -ARCKEY="$(readConfigKey "arc.key" "${USER_CONFIG_FILE}")" 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}")" @@ -91,7 +91,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 +409,9 @@ function arcPatch() { ARCCONF="$(readConfigKey "${MODEL}.serial" "${S_FILE}")" # Check for Custom Build if [ "${ARCMODE}" == "automated" ]; then + [ -z "${ARCCONF}" ] && checkHardwareID || true + 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}" elif [ "${ARCMODE}" == "config" ]; then @@ -422,7 +425,9 @@ function arcPatch() { resp=$(cat ${TMP_PATH}/resp) [ -z "${resp}" ] && return 1 if [ ${resp} -eq 1 ]; then - [ -z "${ARCCONF}" ] && decryptMenu || true + [ -z "${ARCCONF}" ] && checkHardwareID || true + 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}" elif [ ${resp} -eq 2 ]; then @@ -820,8 +825,8 @@ else [ "${BUILDDONE}" == "true" ] && NEXT="3" || NEXT="1" while true; do echo "= \"\Z4========== Main ==========\Zn \" " >"${TMP_PATH}/menu" - if [ -z "${ARCCONF}" ] && [ "${ARCOFFLINE}" != "true" ]; then - echo "0 \"Enable Arc Patch\" " >>"${TMP_PATH}/menu" + if [ -z "${USERID}" ] && [ "${ARCOFFLINE}" != "true" ]; then + echo "0 \"HardwareID for Arc Patch\" " >>"${TMP_PATH}/menu" fi echo "1 \"Choose Model \" " >>"${TMP_PATH}/menu" if [ "${CONFDONE}" == "true" ]; then @@ -939,7 +944,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/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 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"