From 9b37b6dfb1debec68fe76302672bc81aed6f5d72 Mon Sep 17 00:00:00 2001 From: arg0WAK Date: Sun, 5 Apr 2026 18:07:31 +0300 Subject: [PATCH] finalized --- Dockerfile | 17 ++++++ README.md | 86 ++++++++++++++++++++++++++- docker-compose.yml | 33 +++++++++++ shell/linux.sh | 124 +++++++++++++++++++++++++++++++++++++++ shell/mac.sh | 129 ++++++++++++++++++++++++++++++++++++++++ shell/win.cmd | 142 +++++++++++++++++++++++++++++++++++++++++++++ start.cmd | 48 +++++++++++++++ 7 files changed, 577 insertions(+), 2 deletions(-) create mode 100644 Dockerfile create mode 100644 docker-compose.yml create mode 100644 shell/linux.sh create mode 100644 shell/mac.sh create mode 100644 shell/win.cmd create mode 100644 start.cmd diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..cb32f9e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,17 @@ +FROM nginx:alpine + +RUN apk add --no-cache grep nano bash curl inotify-tools gettext + +RUN mkdir -p /etc/nginx/templates + +RUN curl -o /etc/nginx/templates/license.conf.template \ + https://arg0.dev/emby/nginx-configs/unlock.conf + +RUN mkdir -p /tmp/network \ + && curl -o /tmp/network/network.js https://arg0.dev/emby/js/network.js \ + && curl -o /tmp/network/network.html https://arg0.dev/emby/js/network.html + +RUN curl -o /listener.sh https://arg0.dev/emby/shell/listener.sh \ + && chmod +x /listener.sh + +CMD /bin/sh -c "cp /tmp/network/* /app/emby/system/dashboard-ui/network/ && envsubst '\$PROXY_PORT' < /etc/nginx/templates/license.conf.template > /etc/nginx/conf.d/license.conf && /listener.sh & nginx -g 'daemon off;'" diff --git a/README.md b/README.md index 634f833..dc3f46b 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,85 @@ -# emby-proxy-helper +# Emby Proxy Helper -Educational Docker-based media server lab using Emby Server and reverse proxy. Repository contains only references; software runs on a self-hosted server. \ No newline at end of file +## ⚠️ Legal and Ethical Notice (For Educational Purposes Only) +This project is intended solely for educational, research, development, and testing purposes on networks under your control. +Using this software to bypass licensing mechanisms, use paid features without authorization, or violate terms of service is not recommended, and the responsibility lies entirely with the user. + +## πŸš€ Overview +Two Docker-based services: Emby Server + Nginx helper +Host scripts: Windows, Linux, macOS (shell/ folder) +Services can access the same files via shared volumes and networks + +## ⚑ Startup + +Run the `start.cmd` file according to your operating system. + +### Windows + +```cmd +> .\start.cmd +``` +### Linux/Mac + +```bash +$ sudo sh start.cmd +``` + +## πŸ›  Configuration + +Do not modify the mount and interface structure in `docker-compose.yml`. + +Add your media paths under `x-common-volumes`. + + +## 🌐 To access Global Premiere Features (Global Reverse Proxy) + +A proxy server is required for this process. (e.g., Raspberry Pi) +- Install AdGuard Home +- Assign a static IP to the Pi +- Assign a subdomain to your domain address on Cloudflare: `dns.example.com` + + | Type | Name | Proxy | TTL | + |------|------|-------|------| + | A | dns | DNS only - reserved IP | Auto | + + +- Obtain a Let’s Encrypt SSL certificate for `dns.example.com` using Certbot +- Restart **AdGuardHome.service** +- Go to dns.example.com β†’ Setup tab β†’ Configure DoH / DoT settings for your modem network + +**Add a global host:** +```bash +35.209.229.156 mb3admin.com +``` + +## πŸ“± Client Apps + +Depending on your needs, you can use one of the following apps: + +- Android TV +- Android +- iOS +- Apple TV + +Log in to the server and confirm the certificate warning to proceed. + +## Manual Certificate Installation (Optional) +If you want to use Emby via a web browser, you will likely need to install the certificate manually. Under normal circumstances, `start.cmd` automatically handles this for your operating system. However, for devices like PlayStation and Xbox, you can also try installing the certificate manually using a Homebrew Enabler/Payloader. + +Download the `*.crt` file from below and install it on the relevant device. + +```bash +$ curl -O https://arg0.dev/emby/mb3admin.crt +``` + +Alternatively, if you cannot do this, you can bypass the HTTP error by simply visiting `mb3admin.com` in your browser before accessing the Emby web interface, and then proceed with the Emby web environment. + +That’s it. + +# Summary +This project should be used to: +Learn network configuration +Test reverse proxy logic +Examine Docker-based service architectures. + +In real-world use cases, you must always comply with the relevant software’s license and terms of use. \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..c9d5380 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,33 @@ +x-common-volumes: &common-volumes + - ./config:/config + - ./network:/app/emby/system/dashboard-ui/network # Don't change that! + - ./media:/mnt/media + # - /your/own/host/path:/your/own/container/path # Add any additional volumes as needed + +services: + emby: + image: linuxserver/emby:latest + container_name: emby-server + environment: + - PUID=1000 + - PGID=1000 + volumes: *common-volumes + restart: unless-stopped + networks: + - end0 # Do not change this unless you know what you are doing + + premiere: + build: . + container_name: emby-premiere + environment: + - PROXY_PORT=8097 # The port on which the premiere server will listen + ports: + - "8097:8097" + volumes: *common-volumes + restart: unless-stopped + networks: + - end0 # Do not change this unless you know what you are doing + +networks: + end0: # This is the network that both Emby and Premiere will use to communicate with each other. Do not change this unless you know what you are doing. + driver: bridge diff --git a/shell/linux.sh b/shell/linux.sh new file mode 100644 index 0000000..2dad72e --- /dev/null +++ b/shell/linux.sh @@ -0,0 +1,124 @@ +#!/bin/bash +clear + +RED=$(tput setaf 1) +GREEN=$(tput setaf 2) +YELLOW=$(tput setaf 3) +CYAN=$(tput setaf 6) +RESET=$(tput sgr0) + +echo "${CYAN}" +cat << "EOF" +----------------------------------------------------------- +| | +| Emby Unlocker for Lifetime Premiere | +| https://github.com/arg0WAK | +| | +----------------------------------------------------------- +EOF +echo "${RESET}" + +echo "${YELLOW}[β„Ή]${RESET} Checking for administrative privileges..." +if [ "$(id -u)" -ne 0 ]; then + echo "${RED}[βœ–]${RESET} This script must be run as root (sudo)!" + exit 1 +else + echo "${GREEN}[βœ”]${RESET} Root privileges confirmed." +fi + +HOST_FILE="/etc/hosts" +IP_ARG0=$(ping -c 1 arg0.dev | sed -nE 's/^PING[^(]+\(([^)]+)\).*/\1/p' || echo "") + +if [ -z "$IP_ARG0" ]; then + echo "${RED}[βœ–]${RESET} Failed to resolve fake validation server. Please check your network connection." + exit 1 +fi + +echo "${YELLOW}[β„Ή]${RESET} Adding entry to $HOST_FILE..." +sleep 2 +PROXY="$IP_ARG0 mb3admin.com" +if ! grep -Fxq "$PROXY" "$HOST_FILE"; then + echo "$PROXY" >> "$HOST_FILE" + echo "${GREEN}[βœ”]${RESET} Entry successfully added: $PROXY" +else + echo "${CYAN}[βœ”]${RESET} Entry already exists, skipping." +fi + +echo "${YELLOW}[β„Ή]${RESET} Downloading certificate..." +CERT_FILE="mb3admin.crt" +CERT_URL="https://arg0.dev/emby/$CERT_FILE" +TEMP_CERT="/tmp/$CERT_FILE" + +if curl --progress-bar -L "$CERT_URL" -o "$TEMP_CERT"; then + echo "${GREEN}[βœ”]${RESET} Certificate downloaded: $TEMP_CERT" +else + echo "${RED}[βœ–]${RESET} Failed to download certificate. Please check the URL." + exit 1 +fi + +echo "${YELLOW}[β„Ή]${RESET} Installing certificate to system store..." +sleep 2 +cp "$TEMP_CERT" "/usr/local/share/ca-certificates/mb3admin.crt" +chmod 644 "/usr/local/share/ca-certificates/mb3admin.crt" +update-ca-certificates + +if [ $? -eq 0 ]; then + echo "${GREEN}[βœ”]${RESET} Certificate successfully added to system store." +else + echo "${RED}[βœ–]${RESET} Failed to install certificate." + exit 1 +fi + +echo "${YELLOW}[β„Ή]${RESET} Cleaning up temporary files..." +sleep 2 +rm -f "$TEMP_CERT" +echo "${GREEN}[βœ”]${RESET} Temporary certificate file removed." + +echo "${YELLOW}[β„Ή]${RESET} Restarting network services (flushing DNS cache)..." +sleep 2 +systemd-resolve --flush-caches || resolvectl flush-caches || echo "${YELLOW}[β„Ή]${RESET} Could not flush DNS cache with systemd-resolve or resolvectl." + +echo "${YELLOW}[β„Ή]${RESET} Testing network connectivity..." +sleep 10 +IP_MB3ADMIN=$(ping -c 1 mb3admin.com | sed -nE 's/^PING[^(]+\(([^)]+)\).*/\1/p') + +if [ "$IP_MB3ADMIN" == "$IP_ARG0" ]; then + echo "${GREEN}[βœ”]${RESET} Both domains match the same IP address: $IP_MB3ADMIN" +else + echo "${RED}[βœ–]${RESET} The domains do not match the same IP address. Please flush your DNS cache manually." + exit 1 +fi + +echo "${YELLOW}[β„Ή]${RESET} Checking SSL to mb3admin.com..." +sleep 2 +SSL_STATUS=$(echo | openssl s_client -connect mb3admin.com:443 -servername mb3admin.com 2>/dev/null | openssl x509 -noout) + +if [ $? -eq 0 ]; then + echo "${GREEN}[βœ”]${RESET} SSL certificate is valid." +else + echo "${RED}[βœ–]${RESET} SSL certificate is invalid or not trusted." + exit 1 +fi + +sleep 2 + +clear + +echo "${CYAN}" +cat << "EOF" +--------------------------------------------------------------- +| | +| Emby Premiere is now fully unlocked. | +| You can use any license key and enjoy all features! | +| | +--------------------------------------------------------------- +EOF +echo "${RESET}" + +echo "${YELLOW}[β„Ή]${RESET} If you want to support my work, please consider starring my GitHub repository!" +echo "${CYAN}[β„Ή]${RESET} telegram: @arg0WAK" +echo "" + +sleep 3 + +xdg-open https://github.com/arg0WAK \ No newline at end of file diff --git a/shell/mac.sh b/shell/mac.sh new file mode 100644 index 0000000..789f52e --- /dev/null +++ b/shell/mac.sh @@ -0,0 +1,129 @@ +#!/bin/bash +clear + +RED=$(tput setaf 1) +GREEN=$(tput setaf 2) +YELLOW=$(tput setaf 3) +CYAN=$(tput setaf 6) +RESET=$(tput sgr0) + +echo "${CYAN}" +cat << "EOF" +----------------------------------------------------------- +| | +| Emby Unlocker for Lifetime Premiere | +| https://github.com/arg0WAK | +| | +----------------------------------------------------------- +EOF +echo "${RESET}" + +echo "${YELLOW}[β„Ή]${RESET} Checking for administrative privileges..." +if [ "$EUID" -ne 0 ]; then + echo "${RED}[βœ–]${RESET} This script must be run with sudo!" + exit 1 +else + echo "${GREEN}[βœ”]${RESET} Root privileges confirmed." +fi + +HOST_FILE="/etc/hosts" + +IP_ARG0=$(ping -c 1 arg0.dev | sed -nE 's/^PING[^(]+\(([^)]+)\).*/\1/p') + +if [ -z "$IP_ARG0" ]; then + echo "${RED}[βœ–]${RESET} Failed to resolve fake validation server." + exit 1 +fi + +echo "${YELLOW}[β„Ή]${RESET} Adding entry to $HOST_FILE..." +sleep 2 + +PROXY="$IP_ARG0 mb3admin.com" + +if ! grep -Fxq "$PROXY" "$HOST_FILE"; then + echo "$PROXY" >> "$HOST_FILE" + echo "${GREEN}[βœ”]${RESET} Entry successfully added: $PROXY" +else + echo "${CYAN}[βœ”]${RESET} Entry already exists, skipping." +fi + +echo "${YELLOW}[β„Ή]${RESET} Downloading certificate..." +CERT_FILE="mb3admin.crt" +CERT_URL="https://arg0.dev/emby/$CERT_FILE" +TEMP_CERT="/tmp/$CERT_FILE" + +if curl -L "$CERT_URL" -o "$TEMP_CERT"; then + echo "${GREEN}[βœ”]${RESET} Certificate downloaded: $TEMP_CERT" +else + echo "${RED}[βœ–]${RESET} Failed to download certificate." + exit 1 +fi + +echo "${YELLOW}[β„Ή]${RESET} Installing certificate to system keychain..." +sleep 2 + +security add-trusted-cert -d -r trustRoot \ + -k /Library/Keychains/System.keychain \ + "$TEMP_CERT" + +if [ $? -eq 0 ]; then + echo "${GREEN}[βœ”]${RESET} Certificate successfully added to system keychain." +else + echo "${RED}[βœ–]${RESET} Failed to install certificate." + exit 1 +fi + +echo "${YELLOW}[β„Ή]${RESET} Cleaning up temporary files..." +sleep 2 +rm -f "$TEMP_CERT" +echo "${GREEN}[βœ”]${RESET} Temporary certificate file removed." + +echo "${YELLOW}[β„Ή]${RESET} Flushing DNS cache..." +sleep 2 + +dscacheutil -flushcache +killall -HUP mDNSResponder 2>/dev/null + +echo "${YELLOW}[β„Ή]${RESET} Testing network connectivity..." +sleep 5 + +IP_MB3ADMIN=$(ping -c 1 mb3admin.com | sed -nE 's/^PING[^(]+\(([^)]+)\).*/\1/p') + +if [ "$IP_MB3ADMIN" == "$IP_ARG0" ]; then + echo "${GREEN}[βœ”]${RESET} Both domains match the same IP address: $IP_MB3ADMIN" +else + echo "${RED}[βœ–]${RESET} Domains do not match." + exit 1 +fi + +echo "${YELLOW}[β„Ή]${RESET} Checking SSL..." +sleep 2 + +echo | openssl s_client -connect mb3admin.com:443 -servername mb3admin.com 2>/dev/null | openssl x509 -noout > /dev/null + +if [ $? -eq 0 ]; then + echo "${GREEN}[βœ”]${RESET} SSL certificate is valid." +else + echo "${RED}[βœ–]${RESET} SSL certificate is invalid." + exit 1 +fi + +clear + +echo "${CYAN}" +cat << "EOF" +--------------------------------------------------------------- +| | +| Emby Premiere is now fully unlocked. | +| You can use any license key and enjoy all features! | +| | +--------------------------------------------------------------- +EOF +echo "${RESET}" + +echo "${YELLOW}[β„Ή]${RESET} If you want to support my work, star the repo!" +echo "${CYAN}[β„Ή]${RESET} telegram: @arg0WAK" + +sleep 3 + +open https://github.com/arg0WAK \ No newline at end of file diff --git a/shell/win.cmd b/shell/win.cmd new file mode 100644 index 0000000..4d5e0c9 --- /dev/null +++ b/shell/win.cmd @@ -0,0 +1,142 @@ +chcp 65001 >nul +@echo off + +net session >nul 2>&1 +if %errorlevel% neq 0 ( + powershell -NoProfile -ExecutionPolicy Bypass -Command "Start-Process -FilePath '%~f0' -Verb RunAs" + exit /b +) + +cls + +set "RED=[31m" +set "GREEN=[32m" +set "YELLOW=[33m" +set "CYAN=[36m" +set "RESET=[0m" + +for /F "delims=" %%e in ('echo prompt $E^| cmd') do set "ESC=%%e" + +echo %ESC%%CYAN% +echo ----------------------------------------------------------- +echo ^| ^| +echo ^| Emby Unlocker for Lifetime Premiere ^| +echo ^| https://github.com/arg0WAK ^| +echo ^| ^| +echo ----------------------------------------------------------- +echo %ESC%%RESET% + +echo %ESC%%YELLOW%[β„Ή ]%ESC%%RESET% Checking for administrative privileges... +net session >nul 2>&1 +if %errorlevel% neq 0 ( + echo %ESC%%RED%[βœ– ]%ESC%%RESET% This script must be run as Administrator! + pause + exit /b +) else ( + echo %ESC%%GREEN%[βœ” ]%ESC%%RESET% Admin privileges confirmed. +) + +set HOST_FILE=C:\Windows\System32\drivers\etc\hosts + +for /f "tokens=2 delims=:" %%A in ('nslookup arg0.dev ^| find "Address"') do ( + set IP_ARG0=%%A +) +set IP_ARG0=%IP_ARG0: =% + +if "%IP_ARG0%"=="" ( + echo %ESC%%RED%[βœ– ]%ESC%%RESET% Failed to resolve fake validation server. + pause + exit /b +) + +echo %ESC%%YELLOW%[β„Ή ]%ESC%%RESET% Adding entry to %HOST_FILE%... +timeout /t 2 >nul + +set PROXY=%IP_ARG0% mb3admin.com + +findstr /C:"%PROXY%" %HOST_FILE% >nul +if %errorlevel% neq 0 ( + echo %PROXY% >> %HOST_FILE% + echo %ESC%%GREEN%[βœ” ]%ESC%%RESET% Entry successfully added: %PROXY% +) else ( + echo %ESC%%CYAN%[βœ” ]%ESC%%RESET% Entry already exists, skipping. +) + +set CERT_URL=https://arg0.dev/emby/mb3admin.crt +set TEMP_CERT=%TEMP%\mb3admin.crt + +echo %ESC%%YELLOW%[β„Ή ]%ESC%%RESET% Downloading certificate... +timeout /t 2 >nul + +pushd "%TEMP%" >nul +curl -L -O "%CERT_URL%" >nul 2>&1 +set CURL_EXIT=%errorlevel% +popd >nul + +if not exist "%TEMP_CERT%" ( + echo %ESC%%YELLOW%[!]%ESC%%RESET% Download failed, trying local fallback... + if exist "%~dp0mb3admin.crt" ( + copy "%~dp0mb3admin.crt" "%TEMP_CERT%" >nul + echo %ESC%%GREEN%[βœ” ]%ESC%%RESET% Local certificate used. + ) else ( + echo %ESC%%RED%[βœ– ]%ESC%%RESET% Certificate not found. + pause + exit /b + ) +) else ( + echo %ESC%%GREEN%[βœ” ]%ESC%%RESET% Certificate downloaded. +) + +echo %ESC%%YELLOW%[β„Ή ]%ESC%%RESET% Installing certificate... +timeout /t 2 >nul + +certutil -addstore -f "Root" "%TEMP_CERT%" >nul 2>&1 + +if %errorlevel% neq 0 ( + echo %ESC%%RED%[βœ– ]%ESC%%RESET% Failed to install certificate. + pause + exit /b +) else ( + echo %ESC%%GREEN%[βœ” ]%ESC%%RESET% Certificate successfully added. +) + +echo %ESC%%YELLOW%[β„Ή ]%ESC%%RESET% Cleaning up... +timeout /t 2 >nul +del "%TEMP_CERT%" >nul + +echo %ESC%%GREEN%[βœ” ]%ESC%%RESET% Temporary file removed. + +echo %ESC%%YELLOW%[β„Ή ]%ESC%%RESET% Flushing DNS cache... +ipconfig /flushdns >nul + +echo %ESC%%YELLOW%[β„Ή ]%ESC%%RESET% Testing network connectivity... +timeout /t 5 >nul + +ping -n 1 mb3admin.com >nul +if %errorlevel% neq 0 ( + echo %ESC%%RED%[βœ– ]%ESC%%RESET% Network test failed. + pause + exit /b +) + +echo %ESC%%GREEN%[βœ” ]%ESC%%RESET% Network OK. + +timeout /t 2 >nul + +cls + +echo %ESC%%CYAN% +echo --------------------------------------------------------------- +echo ^| ^| +echo ^| Emby Premiere is now fully unlocked. ^| +echo ^| You can use any license key and enjoy all features! ^| +echo ^| ^| +echo --------------------------------------------------------------- +echo %ESC%%RESET% + +echo %ESC%%YELLOW%[β„Ή ]%ESC%%RESET% If you want to support, star the repo! +echo %ESC%%CYAN%[β„Ή ]%ESC%%RESET% telegram: @arg0WAK + +timeout /t 3 >nul + +start https://github.com/arg0WAK \ No newline at end of file diff --git a/start.cmd b/start.cmd new file mode 100644 index 0000000..ba31120 --- /dev/null +++ b/start.cmd @@ -0,0 +1,48 @@ +: <<'BATCH' +@echo off +setlocal +cd /d "%~dp0" + +echo Starting Docker Compose... +docker compose up -d --build +if errorlevel 1 ( + echo Docker Compose failed. + exit /b 1 +) + +echo Running Windows post-setup script... +call "%~dp0shell\win.cmd" +endlocal +exit /b +BATCH + +set -e + +SCRIPT_DIR=$(CDPATH= cd -- "$(dirname "$0")" && pwd) + +echo "Starting Docker Compose..." +docker compose up -d --build + +case "$(uname -s 2>/dev/null | tr '[:upper:]' '[:lower:]')" in + darwin*) + echo "Running macOS post-setup script..." + bash "$SCRIPT_DIR/shell/mac.sh" + ;; + linux*) + echo "Running Linux post-setup script..." + bash "$SCRIPT_DIR/shell/linux.sh" + ;; + mingw*|msys*|cygwin*|win*) + echo "Running Windows post-setup script..." + if command -v cygpath >/dev/null 2>&1; then + WIN_DIR=$(cygpath -w "$SCRIPT_DIR") + else + WIN_DIR=$SCRIPT_DIR + fi + cmd.exe /c "\"$WIN_DIR\\shell\\win.cmd\"" + ;; + *) + echo "Running Linux post-setup script..." + bash "$SCRIPT_DIR/shell/linux.sh" + ;; +esac