aegis-q
Version:
AEGIS-Q Quantum-Resistant Protection with SNITCH MODE
113 lines (97 loc) • 4.69 kB
JavaScript
// AEGIS-Q Modal Snitch - SHOWS ATTACKING FILES!
const fs = require('fs');
const path = require('path');
const crypto = require('crypto');
class ModalSnitch {
constructor() {
this.threats = [];
this.monitoring = false;
this.knownFiles = new Map();
}
// EXPOSE THE ATTACKER!
showThreatModal(threat) {
console.log('\n');
console.log('╔══════════════════════════════════════════════╗');
console.log('║ 🚨 THREAT DETECTED - SNITCH MODE 🚨 ║');
console.log('╠══════════════════════════════════════════════╣');
console.log('║ ATTACKING FILE: ' + threat.file.substring(0, 28).padEnd(28) + ' ║');
console.log('║ THREAT TYPE: ' + threat.type.substring(0, 31).padEnd(31) + ' ║');
console.log('║ RISK LEVEL: ' + threat.risk.padEnd(32) + ' ║');
console.log('║ TIME: ' + threat.time.padEnd(38) + ' ║');
console.log('╠══════════════════════════════════════════════╣');
console.log('║ ACTION OPTIONS: ║');
console.log('║ [1] DELETE FILE (Remove threat) ║');
console.log('║ [2] QUARANTINE (Move to safe zone) ║');
console.log('║ [3] IGNORE (Dangerous!) ║');
console.log('╠══════════════════════════════════════════════╣');
console.log('║ This file is trying to access your system! ║');
console.log('║ AEGIS-Q caught it red-handed! ║');
console.log('╚══════════════════════════════════════════════╝');
console.log('\n');
// Log to snitch file
this.logSnitch(threat);
}
// Keep permanent record of attacks
logSnitch(threat) {
const log = 'ATTACK DETECTED: ' + new Date().toISOString() + '\n' +
'FILE: ' + threat.file + '\n' +
'TYPE: ' + threat.type + '\n' +
'RISK: ' + threat.risk + '\n' +
'HASH: ' + threat.hash + '\n' +
'----------------------------\n';
fs.appendFileSync('aegis-snitch.log', log);
}
// Scan for suspicious files
scanForThreats(directory) {
const suspicious = [
'.exe', '.dll', '.bat', '.cmd', '.ps1',
'.scr', '.vbs', '.jar', '.app', '.dmg'
];
try {
const files = fs.readdirSync(directory);
files.forEach(file => {
const ext = path.extname(file).toLowerCase();
const fullPath = path.join(directory, file);
// Check if suspicious
if (suspicious.includes(ext)) {
const stats = fs.statSync(fullPath);
const hash = this.getFileHash(fullPath);
// New file? THREAT!
if (!this.knownFiles.has(hash)) {
this.showThreatModal({
file: file,
type: 'SUSPICIOUS EXECUTABLE',
risk: 'HIGH',
time: new Date().toLocaleTimeString(),
hash: hash
});
this.knownFiles.set(hash, true);
}
}
});
} catch(e) {
console.log('Scan error:', e.message);
}
}
getFileHash(filepath) {
try {
const data = fs.readFileSync(filepath);
return crypto.createHash('sha256').update(data).digest('hex').substring(0, 16);
} catch(e) {
return 'unknown';
}
}
// Start monitoring
startSnitching(directory) {
console.log('👁️ AEGIS-Q SNITCH MODE ACTIVATED');
console.log('📡 Watching for attacking files...');
// Initial scan
this.scanForThreats(directory);
// Keep watching
setInterval(() => {
this.scanForThreats(directory);
}, 5000); // Check every 5 seconds
}
}
module.exports = new ModalSnitch();