mirror of
https://github.com/jkingsman/Remote-Terminal-for-MeshCore.git
synced 2026-08-12 03:33:03 +02:00
Add historical decrypt opt-out
This commit is contained in:
+23
-23
File diff suppressed because one or more lines are too long
Vendored
+1
-1
@@ -4,7 +4,7 @@
|
|||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>RemoteTerm for MeshCore</title>
|
<title>RemoteTerm for MeshCore</title>
|
||||||
<script type="module" crossorigin src="/assets/index-Bl6mT-Tv.js"></script>
|
<script type="module" crossorigin src="/assets/index-BaffKzEs.js"></script>
|
||||||
<link rel="stylesheet" crossorigin href="/assets/index-RWG6EjFU.css">
|
<link rel="stylesheet" crossorigin href="/assets/index-RWG6EjFU.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
@@ -31,11 +31,13 @@ export function CrackerPanel({ packets, channels, onChannelCreate, onRunningChan
|
|||||||
const [isRunning, setIsRunning] = useState(false);
|
const [isRunning, setIsRunning] = useState(false);
|
||||||
const [maxLength, setMaxLength] = useState(6);
|
const [maxLength, setMaxLength] = useState(6);
|
||||||
const [retryFailedAtNextLength, setRetryFailedAtNextLength] = useState(false);
|
const [retryFailedAtNextLength, setRetryFailedAtNextLength] = useState(false);
|
||||||
|
const [decryptHistorical, setDecryptHistorical] = useState(true);
|
||||||
const [progress, setProgress] = useState<ProgressReport | null>(null);
|
const [progress, setProgress] = useState<ProgressReport | null>(null);
|
||||||
const [queue, setQueue] = useState<Map<number, QueueItem>>(new Map());
|
const [queue, setQueue] = useState<Map<number, QueueItem>>(new Map());
|
||||||
const [crackedRooms, setCrackedRooms] = useState<CrackedRoom[]>([]);
|
const [crackedRooms, setCrackedRooms] = useState<CrackedRoom[]>([]);
|
||||||
const [wordlistLoaded, setWordlistLoaded] = useState(false);
|
const [wordlistLoaded, setWordlistLoaded] = useState(false);
|
||||||
const [gpuAvailable, setGpuAvailable] = useState<boolean | null>(null);
|
const [gpuAvailable, setGpuAvailable] = useState<boolean | null>(null);
|
||||||
|
const [undecryptedPacketCount, setUndecryptedPacketCount] = useState<number | null>(null);
|
||||||
|
|
||||||
const crackerRef = useRef<GroupTextCracker | null>(null);
|
const crackerRef = useRef<GroupTextCracker | null>(null);
|
||||||
const noSleepRef = useRef<NoSleep | null>(null);
|
const noSleepRef = useRef<NoSleep | null>(null);
|
||||||
@@ -45,6 +47,7 @@ export function CrackerPanel({ packets, channels, onChannelCreate, onRunningChan
|
|||||||
const queueRef = useRef<Map<number, QueueItem>>(new Map());
|
const queueRef = useRef<Map<number, QueueItem>>(new Map());
|
||||||
const retryFailedRef = useRef(false);
|
const retryFailedRef = useRef(false);
|
||||||
const maxLengthRef = useRef(6);
|
const maxLengthRef = useRef(6);
|
||||||
|
const decryptHistoricalRef = useRef(true);
|
||||||
const undecryptedIdsRef = useRef<Set<number>>(new Set());
|
const undecryptedIdsRef = useRef<Set<number>>(new Set());
|
||||||
|
|
||||||
// Initialize cracker and NoSleep
|
// Initialize cracker and NoSleep
|
||||||
@@ -69,6 +72,19 @@ export function CrackerPanel({ packets, channels, onChannelCreate, onRunningChan
|
|||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
// Fetch undecrypted packet count
|
||||||
|
useEffect(() => {
|
||||||
|
const fetchCount = () => {
|
||||||
|
api.getUndecryptedPacketCount()
|
||||||
|
.then(({ count }) => setUndecryptedPacketCount(count))
|
||||||
|
.catch(() => setUndecryptedPacketCount(null));
|
||||||
|
};
|
||||||
|
fetchCount();
|
||||||
|
// Refresh periodically
|
||||||
|
const interval = setInterval(fetchCount, 30000);
|
||||||
|
return () => clearInterval(interval);
|
||||||
|
}, []);
|
||||||
|
|
||||||
// Get existing channel keys for filtering
|
// Get existing channel keys for filtering
|
||||||
const existingChannelKeys = new Set(channels.map(c => c.key.toUpperCase()));
|
const existingChannelKeys = new Set(channels.map(c => c.key.toUpperCase()));
|
||||||
|
|
||||||
@@ -116,6 +132,10 @@ export function CrackerPanel({ packets, channels, onChannelCreate, onRunningChan
|
|||||||
maxLengthRef.current = maxLength;
|
maxLengthRef.current = maxLength;
|
||||||
}, [maxLength]);
|
}, [maxLength]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
decryptHistoricalRef.current = decryptHistorical;
|
||||||
|
}, [decryptHistorical]);
|
||||||
|
|
||||||
// Keep undecrypted IDs ref in sync - used to skip packets already decrypted by other means
|
// Keep undecrypted IDs ref in sync - used to skip packets already decrypted by other means
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
undecryptedIdsRef.current = new Set(undecryptedGroupText.map(p => p.id));
|
undecryptedIdsRef.current = new Set(undecryptedGroupText.map(p => p.id));
|
||||||
@@ -245,9 +265,11 @@ export function CrackerPanel({ packets, channels, onChannelCreate, onRunningChan
|
|||||||
try {
|
try {
|
||||||
const channelName = '#' + result.roomName;
|
const channelName = '#' + result.roomName;
|
||||||
await onChannelCreate(channelName, result.key);
|
await onChannelCreate(channelName, result.key);
|
||||||
// Decrypt any other historical packets with this newly discovered key
|
// Optionally decrypt any other historical packets with this newly discovered key
|
||||||
// This prevents wasting cracking cycles on packets from the same channel
|
// This prevents wasting cracking cycles on packets from the same channel
|
||||||
await api.decryptHistoricalPackets({ key_type: 'channel', channel_name: channelName });
|
if (decryptHistoricalRef.current) {
|
||||||
|
await api.decryptHistoricalPackets({ key_type: 'channel', channel_name: channelName });
|
||||||
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Failed to create channel or decrypt historical:', err);
|
console.error('Failed to create channel or decrypt historical:', err);
|
||||||
}
|
}
|
||||||
@@ -355,6 +377,21 @@ export function CrackerPanel({ packets, channels, onChannelCreate, onRunningChan
|
|||||||
/>
|
/>
|
||||||
Retry failed at n+1
|
Retry failed at n+1
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
|
<label className="flex items-center gap-2 text-sm text-muted-foreground cursor-pointer">
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
checked={decryptHistorical}
|
||||||
|
onChange={(e) => setDecryptHistorical(e.target.checked)}
|
||||||
|
className="rounded"
|
||||||
|
/>
|
||||||
|
Decrypt historical
|
||||||
|
</label>
|
||||||
|
{decryptHistorical && undecryptedPacketCount !== null && undecryptedPacketCount > 0 && (
|
||||||
|
<span className="text-xs text-muted-foreground">
|
||||||
|
(may take a while for {undecryptedPacketCount.toLocaleString()} packets)
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Status */}
|
{/* Status */}
|
||||||
|
|||||||
Reference in New Issue
Block a user