diff options
| author | Li Zhineng <[email protected]> | 2024-07-05 12:06:27 +0800 |
|---|---|---|
| committer | Li Zhineng <[email protected]> | 2024-07-05 12:06:27 +0800 |
| commit | e30c0ea7c7a128f4f0579f7e254a95105e2b48b9 (patch) | |
| tree | 21926e9c97086c5a3867ba8ba1ee0d624de09906 | |
| parent | 9aec9bfbd4d6370423927fdd7b8bc0bb0f8aa811 (diff) | |
| download | china-unicom-iptv-gd-e30c0ea7c7a128f4f0579f7e254a95105e2b48b9.tar.gz china-unicom-iptv-gd-e30c0ea7c7a128f4f0579f7e254a95105e2b48b9.zip | |
decrypt:authinfo command
| -rwxr-xr-x | iptv.sh | 49 |
1 files changed, 49 insertions, 0 deletions
@@ -226,6 +226,54 @@ make_playlist () { exit 0 } +decrypt_authinfo () { + local authinfo="$1" + + if [[ -z "$authinfo" ]]; then + fatal "Requires authinfo data from /EPG/oauth/v2/token" + fi + + authinfo=$(echo -n "$authinfo" | xxd -r -p) + + local loading=("Still working." "Still working.." "Still working...") + + local key + for ((i=0; i<1000000; i++)); do + key=$(printf "%06d" "$i") + + if (( i % 100 == 0 )); then + echo -ne "\r\033[K${loading[i % 3]} $((i / 1000000 * 100))%" + fi + + local result=$(echo -n "$authinfo" | \ + openssl enc -d -des-ede3 -K "$(echo -n "${key}000000000000000000" | xxd -p -c 0)" 2>/dev/null | \ + tr -d '\0') + + if echo -n "$result" | grep -q OTT; then + IFS='$' read -ra components <<< "$result" + + echo -e "\n" + echo "========================================" + echo "Found key: $key" + echo "========================================" + echo "$result" + echo "========================================" + echo " random: ${components[0]}" + echo " encry token: ${components[1]}" + echo " user id: ${components[2]}" + echo " device id: ${components[3]}" + echo " ip address: ${components[4]}" + echo " mac address: ${components[5]}" + echo " reserved: ${components[6]}" + echo " ott: ${components[7]}" + + exit 0 + fi + done + + fatal "Could not find a possible key." +} + ## ## Main ## @@ -234,6 +282,7 @@ while [ $# -gt 0 ]; do case "$1" in make:playlist) shift 1; make_playlist "$@";; make:epg) shift 1; make_epg "$@";; + decrypt:authinfo) shift 1; decrypt_authinfo "$@";; *) echo "Unknown command: $1"; exit 1;; esac done |
