From a8e336bcbf73748f98641fa222bfe27faedefdac Mon Sep 17 00:00:00 2001 From: Muhannad_99 <135524881+Muhax@users.noreply.github.com> Date: Tue, 28 Jul 2026 12:59:05 +0300 Subject: [PATCH 1/6] Create muhax_sniffer.js --- repositories/Muhax/App-Store-Data/Muhax Sniffer/muhax_sniffer.js | 1 + 1 file changed, 1 insertion(+) create mode 100644 repositories/Muhax/App-Store-Data/Muhax Sniffer/muhax_sniffer.js diff --git a/repositories/Muhax/App-Store-Data/Muhax Sniffer/muhax_sniffer.js b/repositories/Muhax/App-Store-Data/Muhax Sniffer/muhax_sniffer.js new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/repositories/Muhax/App-Store-Data/Muhax Sniffer/muhax_sniffer.js @@ -0,0 +1 @@ + From 57acaa6a1b70083883c37a41cbf4815c4dd6a4e4 Mon Sep 17 00:00:00 2001 From: Muhannad_99 <135524881+Muhax@users.noreply.github.com> Date: Tue, 28 Jul 2026 12:59:29 +0300 Subject: [PATCH 2/6] Create metadata.json --- repositories/Muhax/App-Store-Data/Muhax Sniffer/metadata.json | 1 + 1 file changed, 1 insertion(+) create mode 100644 repositories/Muhax/App-Store-Data/Muhax Sniffer/metadata.json diff --git a/repositories/Muhax/App-Store-Data/Muhax Sniffer/metadata.json b/repositories/Muhax/App-Store-Data/Muhax Sniffer/metadata.json new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/repositories/Muhax/App-Store-Data/Muhax Sniffer/metadata.json @@ -0,0 +1 @@ + From 17526e61116b3e95099d2f5d14a4b2c87a8a1e7e Mon Sep 17 00:00:00 2001 From: Muhannad_99 <135524881+Muhax@users.noreply.github.com> Date: Tue, 28 Jul 2026 13:18:08 +0300 Subject: [PATCH 3/6] Update metadata.json --- .../Muhax/App-Store-Data/Muhax Sniffer/metadata.json | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/repositories/Muhax/App-Store-Data/Muhax Sniffer/metadata.json b/repositories/Muhax/App-Store-Data/Muhax Sniffer/metadata.json index 8b137891..c22bec98 100644 --- a/repositories/Muhax/App-Store-Data/Muhax Sniffer/metadata.json +++ b/repositories/Muhax/App-Store-Data/Muhax Sniffer/metadata.json @@ -1 +1,11 @@ - +{ + "name": "Muhax Sniffer", + "description": "WiFi network scanner with CSV export to SD or LittleFS", + "category": "WiFi", + "version": "1.0.0", + "commit": "57acaa6a1b70083883c37a41cbf4815c4dd6a4e4", + "owner": "Muhax", + "repo": "App-Store-Data", + "path": "/repositories/your-github-username/App-Store-Data/Muhax Sniffer/", + "files": ["muhax_sniffer.js"] +} From 95a6a2bdec2b34f803cfb718f74d1ee8592574af Mon Sep 17 00:00:00 2001 From: Muhannad_99 <135524881+Muhax@users.noreply.github.com> Date: Tue, 28 Jul 2026 13:18:35 +0300 Subject: [PATCH 4/6] Update muhax_sniffer.js --- .../Muhax Sniffer/muhax_sniffer.js | 223 ++++++++++++++++++ 1 file changed, 223 insertions(+) diff --git a/repositories/Muhax/App-Store-Data/Muhax Sniffer/muhax_sniffer.js b/repositories/Muhax/App-Store-Data/Muhax Sniffer/muhax_sniffer.js index 8b137891..bec12d4a 100644 --- a/repositories/Muhax/App-Store-Data/Muhax Sniffer/muhax_sniffer.js +++ b/repositories/Muhax/App-Store-Data/Muhax Sniffer/muhax_sniffer.js @@ -1 +1,224 @@ +// ========================================== +// Muhax Sniffer v1.0 +// WiFi / BLE reconnaissance app for Bruce +// Default device theme — no custom colors +// ========================================== +// Install: copy this file to /scripts on your Bruce +// device (SD card or WebUI upload), then launch it +// from the "Scripts" menu. +var dialog = require("dialog"); +var storage = require("storage"); +var wifi = require("wifi"); +var device = require("device"); + +var APP_NAME = "Muhax Sniffer"; +var APP_VERSION = "1.0"; +var LOG_DIR = "/muhax_sniffer"; + +// ---------- generic helpers ---------- + +function padRight(str, len) { + str = to_string(str); + while (str.length < len) { + str = str + " "; + } + if (str.length > len) { + str = str.substr(0, len); + } + return str; +} + +function timestamp() { + return to_string(now()); +} + +function makePath(fsType, path) { + return { fs: fsType, path: path }; +} + +// Ask the user where results should be saved. +// Returns "sd", "littlefs", or null if cancelled. +function chooseStorage() { + var options = [ + ["SD Card", "sd"], + ["LittleFS (internal)", "littlefs"], + ]; + var selected = dialog.choice(options); + return selected; +} + +function ensureLogDir(fsType) { + var ok = storage.mkdir(makePath(fsType, LOG_DIR)); + return ok; +} + +// ---------- WiFi ---------- + +function countByEncryption(nets) { + var openCount = 0; + for (var i = 0; i < nets.length; i++) { + if (nets[i].encryptionType === "OPEN") { + openCount = openCount + 1; + } + } + return openCount; +} + +function buildWifiReport(nets) { + var openCount = countByEncryption(nets); + + var lines = []; + lines.push(APP_NAME + " v" + APP_VERSION + " - WiFi Scan"); + lines.push("Total networks : " + to_string(nets.length)); + lines.push("Open (no auth) : " + to_string(openCount)); + lines.push(""); + lines.push(padRight("SSID", 18) + padRight("ENC", 14) + "MAC"); + lines.push("--------------------------------------------"); + + for (var i = 0; i < nets.length; i++) { + var n = nets[i]; + var ssid = n.SSID.length === 0 ? "(hidden)" : n.SSID; + lines.push( + padRight(ssid, 18) + padRight(n.encryptionType, 14) + n.MAC + ); + } + + return lines.join("\n"); +} + +function saveWifiCsv(nets, fsType) { + ensureLogDir(fsType); + var filePath = LOG_DIR + "/wifi_" + timestamp() + ".csv"; + var target = makePath(fsType, filePath); + + storage.write(target, "ssid,encryption,mac,scanned_at\n", "write"); + for (var i = 0; i < nets.length; i++) { + var n = nets[i]; + var ssid = n.SSID.length === 0 ? "(hidden)" : n.SSID; + storage.write( + target, + ssid + "," + n.encryptionType + "," + n.MAC + "," + timestamp() + "\n", + "append" + ); + } + + return filePath; +} + +function runWifiScan() { + // Scan first, no intermediate "scanning..." popup — this is what + // caused the screen flicker (a quick redraw immediately followed + // by another redraw for the results screen). + var nets = wifi.scan(); + + if (nets.length === 0) { + dialog.warning("No networks found.", true); + return; + } + + var report = buildWifiReport(nets); + dialog.viewText(report, APP_NAME + " - Results"); + + var fsType = chooseStorage(); + if (fsType === null || fsType === undefined) { + dialog.info("Not saved.", true); + } else { + var savedPath = saveWifiCsv(nets, fsType); + dialog.success( + "Saved to " + (fsType === "sd" ? "SD" : "LittleFS") + ": " + savedPath, + true + ); + } +} + +// ---------- BLE ---------- + +function runBleScan() { + dialog.warning( + "BLE scanning is not yet exposed in the Bruce " + + "JS API. Use the native BLE > BLE Scan menu " + + "for now.", + true + ); +} + +// ---------- log browser ---------- + +function viewSavedLogs() { + var fsType = chooseStorage(); + if (fsType === null || fsType === undefined) { + return; + } + + var dirPath = makePath(fsType, LOG_DIR); + var files; + try { + files = storage.readdir(dirPath); + } catch (e) { + files = []; + } + + if (!files || files.length === 0) { + dialog.warning("No saved logs on this storage yet.", true); + return; + } + + var picked = dialog.choice(files); + if (!picked) return; + + var filePath = makePath(fsType, LOG_DIR + "/" + picked); + var content = storage.read(filePath); + dialog.viewText(content, picked); +} + +// ---------- about ---------- + +function showAbout() { + var msg = + APP_NAME + + " v" + + APP_VERSION + + "\n" + + "by MUHAX\n\n" + + "Device: " + + device.getName() + + "\n" + + "Board: " + + device.getBoard() + + "\n" + + "Battery: " + + to_string(device.getBatteryCharge()) + + "%"; + dialog.message(msg, true); +} + +// ---------- main ---------- + +function main() { + var running = true; + + while (running) { + var mode = dialog.choice([ + "WiFi Scan", + "BLE Scan", + "View Saved Logs", + "About", + "Exit", + ]); + + if (mode === "WiFi Scan") { + runWifiScan(); + } else if (mode === "BLE Scan") { + runBleScan(); + } else if (mode === "View Saved Logs") { + viewSavedLogs(); + } else if (mode === "About") { + showAbout(); + } else { + running = false; + } + } +} + +main(); From 165f88d148039800649a95503277c6755397df87 Mon Sep 17 00:00:00 2001 From: Muhannad_99 <135524881+Muhax@users.noreply.github.com> Date: Tue, 28 Jul 2026 13:21:45 +0300 Subject: [PATCH 5/6] add logo --- .../Muhax/App-Store-Data/Muhax Sniffer/logo.png | Bin 0 -> 548 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 repositories/Muhax/App-Store-Data/Muhax Sniffer/logo.png diff --git a/repositories/Muhax/App-Store-Data/Muhax Sniffer/logo.png b/repositories/Muhax/App-Store-Data/Muhax Sniffer/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..263e6da046be3eb3d570d299648c37526b73db68 GIT binary patch literal 548 zcmeAS@N?(olHy`uVBq!ia0vp^4Is?H1|$#LC7xzrV0`WA;uumf=k48%zRZRa4S`K7 z{1gH=u|*q%9ZTZAwxEBCnAroa~QVzE7lFu7#^_* zs5e+J9^q8*V<=?m5O$bDP{@C^xWTKcy4h8K-~O@v`fK$}bd9?9>=Jj6pTDKA8zt{OCq8q*aPd)SZHT&j2cya%EzY!x^;O+kToAFzW{(R^4_v7sTWvU)eLDygY m{W-&*vn)gfGkRpa6E9(P^nNEi^Exp089ZJ6T-G@yGywqb4b-au literal 0 HcmV?d00001 From 276f321701701e1e781791b19494e7bd3b328a98 Mon Sep 17 00:00:00 2001 From: Muhannad_99 <135524881+Muhax@users.noreply.github.com> Date: Tue, 28 Jul 2026 13:22:30 +0300 Subject: [PATCH 6/6] Update metadata.json --- repositories/Muhax/App-Store-Data/Muhax Sniffer/metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/repositories/Muhax/App-Store-Data/Muhax Sniffer/metadata.json b/repositories/Muhax/App-Store-Data/Muhax Sniffer/metadata.json index c22bec98..6b386a13 100644 --- a/repositories/Muhax/App-Store-Data/Muhax Sniffer/metadata.json +++ b/repositories/Muhax/App-Store-Data/Muhax Sniffer/metadata.json @@ -3,7 +3,7 @@ "description": "WiFi network scanner with CSV export to SD or LittleFS", "category": "WiFi", "version": "1.0.0", - "commit": "57acaa6a1b70083883c37a41cbf4815c4dd6a4e4", + "commit": "165f88d148039800649a95503277c6755397df87", "owner": "Muhax", "repo": "App-Store-Data", "path": "/repositories/your-github-username/App-Store-Data/Muhax Sniffer/",