From 3ec2d702b4cb47bed06fe82ba663f493772d2ea4 Mon Sep 17 00:00:00 2001 From: Sefinek Date: Sun, 15 Sep 2024 23:24:46 +0200 Subject: [PATCH] 1.1.4 --- index.js | 9 ++++++--- package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/index.js b/index.js index 8ca719d..14eb081 100644 --- a/index.js +++ b/index.js @@ -122,7 +122,6 @@ const reportIP = async (event, country, hostname, endpoint, userAgent, cycleErro const userIp = clientIp.getAddress(); if (!userIp) log('warn', `Your IP address is missing! Received: ${userIp}`); - let reportedIPs = readReportedIPs(); let cycleImageSkippedCount = 0, cycleProcessedCount = 0, cycleReportedCount = 0, cycleSkippedCount = 0; const cycleErrorCounts = { blocked: 0, noResponse: 0, otherErrors: 0 }; let imageRequestLogged = false; @@ -130,7 +129,13 @@ const reportIP = async (event, country, hostname, endpoint, userAgent, cycleErro for (const event of blockedIPEvents) { cycleProcessedCount++; const ip = event.clientIP; + if (ip === userIp) { + log('log', `The IP address ${ip} belongs to this machine. Ignoring...`); + cycleSkippedCount++; + continue; + } + const reportedIPs = readReportedIPs(); const { recentlyReported, timeDifference } = isIPReportedRecently(event.rayName, ip, reportedIPs); if (recentlyReported) { const hoursAgo = Math.floor(timeDifference / (1000 * 60 * 60)); @@ -156,8 +161,6 @@ const reportIP = async (event, country, hostname, endpoint, userAgent, cycleErro if (wasReported) { cycleReportedCount++; await new Promise(resolve => setTimeout(resolve, SUCCESS_COOLDOWN_MS)); - } else { - reportedIPs = readReportedIPs(); } } diff --git a/package-lock.json b/package-lock.json index b51725d..b606168 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "cf-waf-to-abuseipdb", - "version": "1.1.3", + "version": "1.1.4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "cf-waf-to-abuseipdb", - "version": "1.1.3", + "version": "1.1.4", "license": "MIT", "dependencies": { "axios": "^1.7.7", diff --git a/package.json b/package.json index 0a5afaa..fc41b6a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cf-waf-to-abuseipdb", - "version": "1.1.3", + "version": "1.1.4", "description": "A Node.js project that enables automatic reporting of incidents detected by Cloudflare WAF to the AbuseIPDB database.", "keywords": [ "abuseipdb",