Add nosleep to cracker interface

This commit is contained in:
Jack Kingsman
2026-01-06 21:16:05 -08:00
parent 1eba08ce88
commit e33275a2fc
7 changed files with 576 additions and 539 deletions
+14
View File
@@ -76,6 +76,20 @@ MESHCORE_SERIAL_PORT=/dev/ttyUSB0 uv run uvicorn app.main:app --host 0.0.0.0 --p
Access the app at http://localhost:8000 (or your server's IP/hostname).
### HTTPS (Required for WebGPU Cracking)
WebGPU requires a secure context. To use the channel key cracker, serve over HTTPS:
```bash
# Generate self-signed cert
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes -subj '/CN=localhost'
# Run with SSL
uv run uvicorn app.main:app --host 0.0.0.0 --port 8000 --ssl-keyfile=key.pem --ssl-certfile=cert.pem
```
Accept the browser security warning on first visit. For locally-trusted certs without warnings, use [mkcert](https://github.com/FiloSottile/mkcert).
### Systemd Service (Linux)
To run as a system service:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -4,7 +4,7 @@
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>RemoteTerm for MeshCore</title>
<script type="module" crossorigin src="/assets/index-DeS_VBWV.js"></script>
<script type="module" crossorigin src="/assets/index-B-xot-vl.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-DlaqriQ9.css">
</head>
<body>
+7
View File
@@ -18,6 +18,7 @@
"clsx": "^2.1.1",
"lucide-react": "^0.562.0",
"meshcore-cracker": "file:../references/standalone_cracker",
"nosleep.js": "^0.12.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"sonner": "^2.0.7",
@@ -3616,6 +3617,12 @@
"node": ">=0.10.0"
}
},
"node_modules/nosleep.js": {
"version": "0.12.0",
"resolved": "https://registry.npmjs.org/nosleep.js/-/nosleep.js-0.12.0.tgz",
"integrity": "sha512-9d1HbpKLh3sdWlhXMhU6MMH+wQzKkrgfRkYV0EBdvt99YJfj0ilCJrWRDYG2130Tm4GXbEoTCx5b34JSaP+HhA==",
"license": "MIT"
},
"node_modules/nwsapi": {
"version": "2.2.23",
"resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.23.tgz",
+2 -1
View File
@@ -11,7 +11,6 @@
"test:run": "vitest run"
},
"dependencies": {
"meshcore-cracker": "file:../references/standalone_cracker",
"@radix-ui/react-checkbox": "^1.3.3",
"@radix-ui/react-dialog": "^1.1.15",
"@radix-ui/react-label": "^2.1.8",
@@ -21,6 +20,8 @@
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"lucide-react": "^0.562.0",
"meshcore-cracker": "file:../references/standalone_cracker",
"nosleep.js": "^0.12.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"sonner": "^2.0.7",
+10 -1
View File
@@ -1,5 +1,6 @@
import { useState, useEffect, useRef, useCallback } from 'react';
import { GroupTextCracker, type ProgressReport } from 'meshcore-cracker';
import NoSleep from 'nosleep.js';
import type { RawPacket, Channel } from '../types';
import { cn } from '@/lib/utils';
@@ -35,6 +36,7 @@ export function CrackerPanel({ packets, channels, onChannelCreate }: CrackerPane
const [gpuAvailable, setGpuAvailable] = useState<boolean | null>(null);
const crackerRef = useRef<GroupTextCracker | null>(null);
const noSleepRef = useRef<NoSleep | null>(null);
const isRunningRef = useRef(false);
const abortedRef = useRef(false);
const isProcessingRef = useRef(false);
@@ -42,12 +44,15 @@ export function CrackerPanel({ packets, channels, onChannelCreate }: CrackerPane
const retryFailedRef = useRef(false);
const maxLengthRef = useRef(6);
// Initialize cracker
// Initialize cracker and NoSleep
useEffect(() => {
const cracker = new GroupTextCracker();
crackerRef.current = cracker;
setGpuAvailable(cracker.isGpuAvailable());
const noSleep = new NoSleep();
noSleepRef.current = noSleep;
// Load wordlist
cracker.loadWordlist('/words_alpha.txt')
.then(() => setWordlistLoaded(true))
@@ -56,6 +61,8 @@ export function CrackerPanel({ packets, channels, onChannelCreate }: CrackerPane
return () => {
cracker.destroy();
crackerRef.current = null;
noSleep.disable();
noSleepRef.current = null;
};
}, []);
@@ -265,6 +272,7 @@ export function CrackerPanel({ packets, channels, onChannelCreate }: CrackerPane
setIsRunning(true);
isRunningRef.current = true;
abortedRef.current = false;
noSleepRef.current?.enable();
processNext();
};
@@ -273,6 +281,7 @@ export function CrackerPanel({ packets, channels, onChannelCreate }: CrackerPane
isRunningRef.current = false;
abortedRef.current = true;
crackerRef.current?.abort();
noSleepRef.current?.disable();
};