-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
366 lines (322 loc) · 13.6 KB
/
script.js
File metadata and controls
366 lines (322 loc) · 13.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
class MrDetective {
constructor() {
this.debugDisplay = document.getElementById('debugDisplay');
this.statusBar = document.getElementById('statusBar');
this.commandInput = document.getElementById('commandInput');
this.exeFileInput = document.getElementById('exeFile');
this.initializeEventListeners();
this.testConnection();
}
initializeEventListeners() {
document.getElementById('investigateBtn').addEventListener('click', () => this.investigate());
document.getElementById('interrogateBtn').addEventListener('click', () => this.interrogate());
document.getElementById('refreshBtn').addEventListener('click', () => this.refresh());
document.getElementById('selectExeBtn').addEventListener('click', () => this.exeFileInput.click());
this.exeFileInput.addEventListener('change', (e) => this.handleFileSelect(e));
this.commandInput.addEventListener('keypress', (e) => {
if (e.key === 'Enter') {
this.executeCommand(this.commandInput.value);
this.commandInput.value = '';
}
});
}
async testConnection() {
try {
const response = await fetch('test.php');
const data = await response.json();
if (data.status === 'success') {
this.log('PHP backend connected successfully', 'success');
this.updateSystemInfo();
}
} catch (error) {
this.log('⚠️ PHP backend not available. Running in simulation mode.', 'warning');
this.log('To enable full features, run this application on a web server with PHP support.', 'info');
}
}
log(message, type = 'info') {
const line = document.createElement('div');
line.className = `debug-line ${type}`;
line.textContent = `> ${message}`;
this.debugDisplay.appendChild(line);
this.debugDisplay.scrollTop = this.debugDisplay.scrollHeight;
}
setStatus(message) {
this.statusBar.textContent = message;
}
async investigate() {
this.setStatus('INVESTIGATING SYSTEM...');
this.log('Starting comprehensive system investigation...', 'loading');
try {
const response = await fetch('investigate.php');
const text = await response.text();
let data;
try {
data = JSON.parse(text);
} catch (parseError) {
this.log('Failed to parse server response', 'error');
this.log('Server returned:', 'error');
this.log(text.substring(0, 200) + '...', 'error');
this.fallbackToSimulation();
return;
}
if (data.error) {
this.log(`Server error: ${data.message}`, 'error');
this.fallbackToSimulation();
} else {
this.displayInvestigationResults(data);
}
} catch (error) {
this.log(`Investigation failed: ${error.message}`, 'error');
this.fallbackToSimulation();
}
this.setStatus('READY');
}
fallbackToSimulation() {
this.log('Falling back to simulation mode...', 'warning');
this.log('Displaying simulated system information', 'info');
const simulatedData = this.getSimulatedSystemInfo();
this.displayInvestigationResults(simulatedData);
}
getSimulatedSystemInfo() {
return {
os: {
name: 'Windows 10 Pro',
version: '10.0.19045',
architecture: '64-bit',
build: '19045',
bloatwareLevel: 'Medium',
dualBoot: false
},
cpu: {
brand: 'Intel',
model: 'Core i7-10700K',
cores: 8,
threads: 16,
clockSpeed: '3.8 GHz'
},
ram: {
total: 16,
type: 'DDR4',
speed: '3200 MHz',
slotsUsed: 2
},
storage: [
{
type: 'NVMe M.2 SSD',
capacity: 512,
model: 'Samsung SSD 970 EVO',
readSpeed: '3500 MB/s'
},
{
type: 'SATA SSD',
capacity: 1000,
model: 'Crucial MX500',
readSpeed: '560 MB/s'
}
],
gpu: [
{
brand: 'NVIDIA',
model: 'GeForce RTX 3070',
memory: 8,
driverVersion: '456.71'
}
],
display: {
resolution: '1920x1080',
refreshRate: '144 Hz',
panelType: 'IPS'
},
battery: {
isCharging: false,
estimatedLife: '5 hours',
health: '95%'
},
applications: {
count: 147,
systemApps: 29,
userApps: 118
}
};
}
displayInvestigationResults(data) {
this.log('=== SYSTEM INVESTIGATION RESULTS ===', 'success');
this.log('', 'info');
// OS Information
this.log('--- OPERATING SYSTEM ---', 'success');
this.log(`Name: ${data.os.name}`, 'info');
this.log(`Version: ${data.os.version}`, 'info');
this.log(`Architecture: ${data.os.architecture}`, 'info');
this.log(`Bloatware Level: ${data.os.bloatwareLevel}`, 'info');
this.log(`Dual Boot: ${data.os.dualBoot ? 'Yes' : 'No'}`, 'info');
this.log('', 'info');
// CPU Information
this.log('--- PROCESSOR (CPU) ---', 'success');
this.log(`Brand: ${data.cpu.brand}`, 'info');
this.log(`Model: ${data.cpu.model}`, 'info');
this.log(`Cores: ${data.cpu.cores}`, 'info');
this.log(`Threads: ${data.cpu.threads}`, 'info');
this.log(`Clock Speed: ${data.cpu.clockSpeed}`, 'info');
this.log('', 'info');
// RAM Information
this.log('--- MEMORY (RAM) ---', 'success');
this.log(`Total: ${data.ram.total} GB`, 'info');
this.log(`Type: ${data.ram.type}`, 'info');
this.log(`Speed: ${data.ram.speed}`, 'info');
this.log(`Memory Slots Used: ${data.ram.slotsUsed}`, 'info');
this.log('', 'info');
// Storage Information
this.log('--- STORAGE DEVICES ---', 'success');
data.storage.forEach((drive, index) => {
this.log(`Drive ${index + 1}:`, 'info');
this.log(` Type: ${drive.type}`, 'info');
this.log(` Capacity: ${drive.capacity} GB`, 'info');
this.log(` Model: ${drive.model}`, 'info');
this.log(` Read Speed: ${drive.readSpeed}`, 'info');
});
this.log('', 'info');
// GPU Information
this.log('--- GRAPHICS CARDS (GPU) ---', 'success');
data.gpu.forEach((gpu, index) => {
this.log(`GPU ${index + 1}:`, 'info');
this.log(` Brand: ${gpu.brand}`, 'info');
this.log(` Model: ${gpu.model}`, 'info');
this.log(` Memory: ${gpu.memory} GB`, 'info');
this.log(` Driver: ${gpu.driverVersion}`, 'info');
});
this.log('', 'info');
// Display Information
this.log('--- DISPLAY ---', 'success');
this.log(`Resolution: ${data.display.resolution}`, 'info');
this.log(`Refresh Rate: ${data.display.refreshRate}`, 'info');
this.log(`Panel Type: ${data.display.panelType}`, 'info');
this.log('', 'info');
// Battery Information
this.log('--- POWER ---', 'success');
if (data.battery.isCharging) {
this.log('Battery: Plugged in (charging)', 'info');
} else {
this.log(`Battery: ${data.battery.estimatedLife} estimated life`, 'info');
}
this.log(`Battery Health: ${data.battery.health}`, 'info');
this.log('', 'info');
// Applications
this.log('--- APPLICATIONS ---', 'success');
this.log(`Total Installed Applications: ${data.applications.count}`, 'info');
this.log(`System Applications: ${data.applications.systemApps}`, 'info');
this.log(`User Applications: ${data.applications.userApps}`, 'info');
this.log('', 'info');
this.log('Investigation complete. All system components scanned.', 'success');
}
// ... rest of the methods remain the same as previous version
async interrogate() {
this.setStatus('INTERROGATING FILE...');
if (!this.selectedFile) {
this.log('No file selected. Scanning for malware...', 'loading');
this.scanForMalware();
return;
}
this.log(`Analyzing file: ${this.selectedFile.name}`, 'loading');
try {
const formData = new FormData();
formData.append('exeFile', this.selectedFile);
const response = await fetch('interrogate.php', {
method: 'POST',
body: formData
});
const result = await response.json();
this.displayInterrogationResults(result);
} catch (error) {
this.log(`Interrogation failed: ${error.message}`, 'error');
this.log('Showing simulated file analysis...', 'info');
this.displaySimulatedInterrogation();
}
this.setStatus('READY');
}
displaySimulatedInterrogation() {
const simulatedResult = {
fileName: this.selectedFile?.name || 'unknown.exe',
fileSize: this.selectedFile?.size || 0,
status: 'Analyzed (Simulated)',
fileType: 'Executable',
architecture: 'x64',
digitalSignature: 'Valid',
compilationDate: new Date().toISOString(),
errors: [],
warnings: ['Simulated analysis - PHP backend not available']
};
this.displayInterrogationResults(simulatedResult);
}
async scanForMalware() {
try {
const response = await fetch('interrogate.php?scan=malware');
const result = await response.json();
this.log('=== MALWARE SCAN RESULTS ===', 'success');
if (result.malwareFound) {
this.log(`🚨 MALWARE DETECTED: ${result.malwareName}`, 'error');
this.log(`Threat Level: ${result.threatLevel}`, 'error');
this.log(`Location: ${result.location}`, 'error');
this.log(`Suggested Action: ${result.suggestedAction}`, 'error');
} else {
this.log('✅ No malware detected.', 'success');
this.log(`Files scanned: ${result.filesScanned}`, 'info');
this.log(`Scan time: ${result.scanTime}`, 'info');
}
} catch (error) {
this.log(`Malware scan failed: ${error.message}`, 'error');
this.log('Showing simulated malware scan...', 'info');
// Simulated malware scan result
this.log('=== MALWARE SCAN RESULTS (SIMULATED) ===', 'success');
this.log('✅ No malware detected.', 'success');
this.log('Files scanned: 0 (Simulation mode)', 'info');
this.log('Scan time: ' + new Date().toISOString(), 'info');
}
}
async refresh() {
this.setStatus('REFRESHING...');
this.debugDisplay.innerHTML = '';
this.log('Display cleared.', 'success');
this.log('Mr.Detective ready for new commands.', 'info');
this.setStatus('READY');
}
handleFileSelect(event) {
this.selectedFile = event.target.files[0];
if (this.selectedFile) {
this.log(`File selected: ${this.selectedFile.name}`, 'success');
this.log('Click "INTERROGATE" to analyze this file.', 'info');
}
}
executeCommand(command) {
this.log(`Executing: ${command}`, 'info');
switch(command.toLowerCase()) {
case 'help':
this.log('Available commands: help, system, clear, scan, test', 'info');
break;
case 'system':
this.investigate();
break;
case 'clear':
this.refresh();
break;
case 'scan':
this.scanForMalware();
break;
case 'test':
this.testConnection();
break;
default:
this.log(`Unknown command: ${command}`, 'error');
this.log('Type "help" for available commands', 'info');
}
}
updateSystemInfo() {
// Update footer with basic system info
document.getElementById('cpuInfo').textContent = 'CPU: Ready';
document.getElementById('ramInfo').textContent = 'RAM: Ready';
document.getElementById('osInfo').textContent = 'OS: Ready';
}
}
// Initialize the application
document.addEventListener('DOMContentLoaded', () => {
new MrDetective();
});