Add User-Agent logging

This commit is contained in:
2025-10-02 08:56:26 +02:00
parent ed11b2d15d
commit 20881c1ba4

View File

@@ -11,11 +11,14 @@ const server = createServer((req, res) => {
const connOpenDate = new Date();
const dateText = connOpenDate.toLocaleString('pl');
const scannerIP = req.headers['x-forwarded-for'];
const userAgent = req.headers['user-agent'];
const host = req.headers['x-forwarded-host'];
const endpoint = `${req.method} ${req.url}`;
let charIdx = 0;
console.log(`[${dateText}] ${scannerIP} targeted ${host} on ${endpoint}`);
console.log(
`[${dateText}] ${scannerIP} (${userAgent}) targeted ${host} on ${endpoint}`
);
const hang = () => {
if (res.closed) return;