diff options
| author | Li Zhineng <[email protected]> | 2024-07-03 22:40:34 +0800 |
|---|---|---|
| committer | Li Zhineng <[email protected]> | 2024-07-03 22:40:34 +0800 |
| commit | adec7ca3ead5a3a286cba291196f69e29e2e365f (patch) | |
| tree | ce0f9c9aad5737b9b4935140a5f4706c10368550 | |
| parent | 1c00771ce009ea9f44eead6567a37f7b516338a2 (diff) | |
| download | china-unicom-iptv-gd-adec7ca3ead5a3a286cba291196f69e29e2e365f.tar.gz china-unicom-iptv-gd-adec7ca3ead5a3a286cba291196f69e29e2e365f.zip | |
accepts flags
| -rwxr-xr-x | iptv.sh | 47 |
1 files changed, 43 insertions, 4 deletions
@@ -1,15 +1,54 @@ #!/usr/bin/env bash -user_id="" -password="" -device_id="" +# Default values ip_address="127.0.0.1" -mac_address="" udpxy_endpoint="http://127.0.0.1:4022" output_file="iptv.M3U8" curl_args="" endpoint="http://eds1.unicomgd.com:8082" +while [ $# -gt 0 ]; do + case "$1" in + -u | --user) user_id="$2"; shift 2;; + -p | --password) password="$2"; shift 2;; + -d | --device) device_id="$2"; shift 2;; + --ip) ip_address="$2"; shift 2;; + --mac) mac_address="$2"; shift 2;; + --udpxy) udpxy_endpoint="$2"; shift 2;; + -o | --output) output_file="$2"; shift 2;; + --curl) curl_args="$2"; shift 2;; + *) echo "Unknown option: $1"; exit 1;; + esac +done + +## +## Validate user input +## + +if [[ -z "$user_id" ]]; then + echo "Requires an IPTV user ID with -u or --user" + exit 1 +fi + +if [[ -z "$password" ]]; then + echo "Requires an IPTV password with -p or --password" + exit 1 +fi + +if [[ -z "$device_id" ]]; then + echo "Requires a device ID with -d or --device" + exit 1 +fi + +if [[ -z "$mac_address" ]]; then + echo "Requires a device MAC address with --mac" + exit 1 +fi + +## +## Execute the main script +## + echo "[-] Authenticate" ## |
