]> Devi Nivas Git - simplescripts.git/commitdiff
Add CCTV viewer scripts (for Linux)
authorAdvaith Menon <noreply-git@bp4k.net>
Wed, 19 Nov 2025 17:41:49 +0000 (12:41 -0500)
committerAdvaith Menon <noreply-git@bp4k.net>
Wed, 19 Nov 2025 17:41:49 +0000 (12:41 -0500)
* Add linux-specific CCTV viewer scripts (require Chrome since the
  NVR interface also requires it)

unix/proxy/DvProxyCCTV.sh [new file with mode: 0755]
unix/proxy/DvProxyStart.tcl [new file with mode: 0755]
unix/proxy/askpass.py [new file with mode: 0755]

diff --git a/unix/proxy/DvProxyCCTV.sh b/unix/proxy/DvProxyCCTV.sh
new file mode 100755 (executable)
index 0000000..f986708
--- /dev/null
@@ -0,0 +1,24 @@
+#!/bin/bash
+# Devi Nivas CCTV Launcher for Linux
+# It's a TERRIBLE idea to expose any NVR server to the internet, especially if
+# it's from HikVision. (they store passwords in plaintext!)
+
+# DISH had a jerry-rigged SSH server used to access devices on the local
+# network. This is a three-part script which performs the following:
+# 1) Asks for your SSH passphrase to enter into ssh
+# 2) Starts an ssh session in the background using your SSH passphrase
+# 3) Opens Google Chrome and keeps the SSH session running until Chrome is quit
+# While the script is highly specific to this use case, it is possible to adapt
+# it into a simple proxy launcher.
+
+# That being said, it is an equally terrible idea to use a SSH server as a VPN
+# server. It's clearly not designed for that, and can cause SERIOUS security
+# loopholes if not configured correctly.
+
+set -e
+
+# connect to the SSH server
+expect -f DvProxyStart.tcl
+google-chrome --user-data-dir=$(mktemp -d) --new-window http://192.168.1.29 \
+    --incognito --proxy-server="socks5://127.0.0.1:8000"
+ssh -S /tmp/proxydevinivas -O exit server
diff --git a/unix/proxy/DvProxyStart.tcl b/unix/proxy/DvProxyStart.tcl
new file mode 100755 (executable)
index 0000000..0602b98
--- /dev/null
@@ -0,0 +1,14 @@
+#/usr/bin/expect -f
+
+set timeout -1
+
+# replase example.org with your server's IP
+spawn ssh -g -f -N -M -S /tmp/proxydevinivas -D 8000 -C madvaith1@example.org
+
+expect ": "
+
+set password [exec ./askpass.py]
+
+send "$password\r"
+
+expect eof
diff --git a/unix/proxy/askpass.py b/unix/proxy/askpass.py
new file mode 100755 (executable)
index 0000000..0fe88cd
--- /dev/null
@@ -0,0 +1,26 @@
+#!/usr/bin/python3
+
+# Password prompter for DvProxy. It's probably smarter to use Zenity instead.
+
+from tkinter import Tk
+from tkinter import Label
+from tkinter import Entry
+from tkinter import Button
+
+tk = Tk();
+
+Label(tk, text="Enter your SSH passphrase here:").pack(
+        side="top");
+
+ent = Entry(tk, show="*");
+ent.pack(side="top", expand=True);
+
+def resp(e=None, n=ent):
+    print(n.get(), end="");
+    exit();
+
+ent.bind("<Return>", resp);
+
+Button(tk, text="Submit", command=resp).pack(side="top");
+
+tk.mainloop();