whatsrunning 0.0.0-stage → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,3 +1,44 @@
1
- # Temporary Holding Version
1
+ # whatsrunning
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ See what every device on **your own** home network is talking to — from your
4
+ laptop, with no router changes and no extra hardware.
5
+
6
+ ```bash
7
+ npx whatsrunning detect # show the network you're on
8
+ sudo npx whatsrunning discover # list the devices on it
9
+ sudo npx whatsrunning spoof # monitor it live in your terminal
10
+ ```
11
+
12
+ Or install it so `whatsrunning` is always on your PATH:
13
+
14
+ ```bash
15
+ npm install -g whatsrunning
16
+ ```
17
+
18
+ ## Requires Python 3.9+
19
+
20
+ whatsrunning's engine is Python — packet capture needs raw sockets and
21
+ `libpcap`, which Node can't do cleanly. **This npm package is a launcher.** On
22
+ the first run it finds Python 3, creates a private virtual environment under
23
+ `~/.cache/whatsrunning`, installs the bundled engine into it (needs internet
24
+ once), and from then on just runs it. You need:
25
+
26
+ - **Python 3.9+** on your PATH (`brew install python`, or
27
+ `sudo apt install python3 python3-venv`)
28
+ - **macOS or Linux** (Windows isn't supported yet — it needs Npcap)
29
+
30
+ Root is required for capture (`sudo`), the same as Wireshark/tcpdump. The first
31
+ `sudo` run does its own one-time setup under root's home.
32
+
33
+ ## What it does
34
+
35
+ - Inventories every device on the network (IP, MAC, maker, name)
36
+ - With your explicit confirmation, observes per-device traffic **metadata**:
37
+ DNS lookups, the site name in HTTPS connections (TLS SNI), bytes up/down, and
38
+ timing — then labels each connection (ads, tracking, telemetry, video, ...)
39
+ - A live terminal view and a local web dashboard (`whatsrunning ui`)
40
+
41
+ It reports **names and volumes, not contents** — HTTPS stays encrypted. Use it
42
+ only on a network you own and administer.
43
+
44
+ Full docs and source: https://github.com/dmoney25632/whatsrunning
@@ -0,0 +1,109 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ /*
5
+ * npm launcher for whatsrunning.
6
+ *
7
+ * whatsrunning's engine is Python (packet capture needs raw sockets + libpcap,
8
+ * which Node can't do cleanly). This launcher makes `npx whatsrunning` work
9
+ * anyway: it finds Python 3, sets up a private virtual environment on first
10
+ * run, installs the bundled engine wheel into it, then runs the real CLI and
11
+ * passes your arguments straight through.
12
+ *
13
+ * Requires: Python 3.9+ on PATH. macOS / Linux only (Windows needs Npcap).
14
+ */
15
+
16
+ const { spawnSync } = require("child_process");
17
+ const fs = require("fs");
18
+ const os = require("os");
19
+ const path = require("path");
20
+
21
+ function log(msg) {
22
+ process.stderr.write(`[whatsrunning] ${msg}\n`);
23
+ }
24
+
25
+ function findPython() {
26
+ for (const cand of ["python3", "python"]) {
27
+ const r = spawnSync(cand, ["-c", "import sys;print('%d.%d'%sys.version_info[:2])"],
28
+ { encoding: "utf8" });
29
+ if (r.status === 0 && r.stdout) {
30
+ const [maj, min] = r.stdout.trim().split(".").map(Number);
31
+ if (maj === 3 && min >= 9) return cand;
32
+ }
33
+ }
34
+ return null;
35
+ }
36
+
37
+ function venvPython(venvDir) {
38
+ return process.platform === "win32"
39
+ ? path.join(venvDir, "Scripts", "python.exe")
40
+ : path.join(venvDir, "bin", "python");
41
+ }
42
+
43
+ function bundledWheel() {
44
+ const vendor = path.join(__dirname, "..", "vendor");
45
+ let whls = [];
46
+ try {
47
+ whls = fs.readdirSync(vendor).filter((f) => f.endsWith(".whl"));
48
+ } catch (e) {
49
+ return null;
50
+ }
51
+ if (!whls.length) return null;
52
+ whls.sort();
53
+ return path.join(vendor, whls[whls.length - 1]);
54
+ }
55
+
56
+ function ensureEngine(py) {
57
+ const cacheRoot = process.env.XDG_CACHE_HOME || path.join(os.homedir(), ".cache");
58
+ const venvDir = path.join(cacheRoot, "whatsrunning", "venv");
59
+ const vpy = venvPython(venvDir);
60
+ const wheel = bundledWheel();
61
+ if (!wheel) {
62
+ log("internal error: bundled engine wheel is missing.");
63
+ process.exit(1);
64
+ }
65
+ const marker = path.join(venvDir, ".installed");
66
+ const want = path.basename(wheel);
67
+ const upToDate = fs.existsSync(vpy) && fs.existsSync(marker) &&
68
+ fs.readFileSync(marker, "utf8").trim() === want;
69
+
70
+ if (!upToDate) {
71
+ log("first run: setting up the Python engine (one time, needs internet)...");
72
+ fs.mkdirSync(path.dirname(venvDir), { recursive: true });
73
+ let r = spawnSync(py, ["-m", "venv", venvDir], { stdio: "inherit" });
74
+ if (r.status !== 0) {
75
+ log("could not create a Python virtual environment.");
76
+ log("make sure the venv module is available (Debian/Ubuntu: sudo apt install python3-venv).");
77
+ process.exit(1);
78
+ }
79
+ spawnSync(vpy, ["-m", "pip", "install", "--quiet", "--upgrade", "pip"], { stdio: "inherit" });
80
+ r = spawnSync(vpy, ["-m", "pip", "install", "--quiet", wheel], { stdio: "inherit" });
81
+ if (r.status !== 0) {
82
+ log("could not install the engine.");
83
+ process.exit(1);
84
+ }
85
+ fs.writeFileSync(marker, want);
86
+ log("setup complete.");
87
+ }
88
+ return vpy;
89
+ }
90
+
91
+ function main() {
92
+ if (process.platform === "win32") {
93
+ log("Windows is not supported yet (packet capture needs Npcap).");
94
+ process.exit(1);
95
+ }
96
+ const py = findPython();
97
+ if (!py) {
98
+ log("needs Python 3.9+ on your PATH.");
99
+ log(" macOS: brew install python");
100
+ log(" Debian/Ubuntu: sudo apt install python3 python3-venv");
101
+ process.exit(1);
102
+ }
103
+ const vpy = ensureEngine(py);
104
+ const args = process.argv.slice(2);
105
+ const r = spawnSync(vpy, ["-m", "whatsrunning", ...args], { stdio: "inherit" });
106
+ process.exit(r.status === null ? 1 : r.status);
107
+ }
108
+
109
+ main();
package/package.json CHANGED
@@ -1,6 +1,39 @@
1
1
  {
2
2
  "name": "whatsrunning",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.4.0",
4
+ "description": "See what every device on your own home network is talking to. (npm launcher for the Python engine.)",
5
+ "bin": {
6
+ "whatsrunning": "bin/whatsrunning.js"
7
+ },
8
+ "files": [
9
+ "bin/",
10
+ "vendor/",
11
+ "README.md"
12
+ ],
13
+ "keywords": [
14
+ "network",
15
+ "monitoring",
16
+ "privacy",
17
+ "dns",
18
+ "security",
19
+ "home-network",
20
+ "packets"
21
+ ],
22
+ "homepage": "https://github.com/dmoney25632/whatsrunning",
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "git+https://github.com/dmoney25632/whatsrunning.git"
26
+ },
27
+ "bugs": {
28
+ "url": "https://github.com/dmoney25632/whatsrunning/issues"
29
+ },
30
+ "license": "MIT",
31
+ "engines": {
32
+ "node": ">=14"
33
+ },
34
+ "os": [
35
+ "darwin",
36
+ "linux"
37
+ ],
38
+ "preferGlobal": true
39
+ }