From 98cef1bcd8e1e100bf70e5d77e54b2d1e0897095 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 21 Apr 2026 15:26:42 +0000 Subject: [PATCH] Add url-encode-password.sh helper MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Prompts for a password without echoing, URL-encodes it via Python's urllib.parse.quote, and prints the result with a ready-to-paste .env snippet. Password is passed via environment variable to avoid any shell quoting or injection issues — never written to disk or network. https://claude.ai/code/session_01C4jbd3waXG3eKZYbGUjLUQ --- url-encode-password.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 url-encode-password.sh diff --git a/url-encode-password.sh b/url-encode-password.sh new file mode 100755 index 0000000..d8714ea --- /dev/null +++ b/url-encode-password.sh @@ -0,0 +1,24 @@ +#!/bin/bash +# url-encode-password.sh — URL-encode a password for use in an RTSP (or any) URL. +# +# Runs entirely locally. The password is read without echoing, never written +# to disk, never sent anywhere. The encoded result is printed to stdout so +# you can copy it straight into your .env file. +# +# Usage: +# ./url-encode-password.sh + +printf 'Password (not echoed): ' +read -rs password +echo # newline after silent input + +# Pass via environment variable — avoids any shell quoting / injection issues. +encoded=$(PASSWORD="$password" python3 -c " +import os, urllib.parse +print(urllib.parse.quote(os.environ['PASSWORD'], safe='')) +") + +echo "URL-encoded: $encoded" +echo "" +echo "Paste into .env like:" +echo " CAM_RTSP_='rtsp://admin:${encoded}@192.168.1.XXX:554/stream1'"