Add Ignoring local IP address
This commit is contained in:
1 parent
bb8fc08598
commit
b22897af80
1 file changed
+8
-3
@@ -5,10 +5,11 @@
|
|||||||
|
|
||||||
const fs = require('node:fs');
|
const fs = require('node:fs');
|
||||||
const chokidar = require('chokidar');
|
const chokidar = require('chokidar');
|
||||||
|
const isLocalIP = require('./scripts/utils/isLocalIP.js');
|
||||||
const parseTimestamp = require('./scripts/utils/parseTimestamp.js');
|
const parseTimestamp = require('./scripts/utils/parseTimestamp.js');
|
||||||
const { reportedIPs, loadReportedIPs, saveReportedIPs, isIPReportedRecently, markIPAsReported } = require('./scripts/services/cache.js');
|
|
||||||
const log = require('./scripts/utils/log.js');
|
const log = require('./scripts/utils/log.js');
|
||||||
const axios = require('./scripts/services/axios.js');
|
const { post } = require('./scripts/services/axios.js');
|
||||||
|
const { reportedIPs, loadReportedIPs, saveReportedIPs, isIPReportedRecently, markIPAsReported } = require('./scripts/services/cache.js');
|
||||||
const { refreshServerIPs, getServerIPs } = require('./scripts/services/ipFetcher.js');
|
const { refreshServerIPs, getServerIPs } = require('./scripts/services/ipFetcher.js');
|
||||||
const discordWebhooks = require('./scripts/services/discord.js');
|
const discordWebhooks = require('./scripts/services/discord.js');
|
||||||
const config = require('./config.js');
|
const config = require('./config.js');
|
||||||
@@ -19,7 +20,7 @@ let fileOffset = 0;
|
|||||||
|
|
||||||
const reportToAbuseIPDb = async (logData, categories, comment) => {
|
const reportToAbuseIPDb = async (logData, categories, comment) => {
|
||||||
try {
|
try {
|
||||||
const { data: res } = await axios.post('https://api.abuseipdb.com/api/v2/report', new URLSearchParams({
|
const { data: res } = await post('https://api.abuseipdb.com/api/v2/report', new URLSearchParams({
|
||||||
ip: logData.srcIp,
|
ip: logData.srcIp,
|
||||||
categories,
|
categories,
|
||||||
comment,
|
comment,
|
||||||
@@ -77,6 +78,10 @@ const processLogLine = async (line, test = false) => {
|
|||||||
return log(0, `Ignoring own IP address! PROTO=${proto?.toLowerCase()} SRC=${srcIp} DPT=${dpt} ID=${logData.id}`);
|
return log(0, `Ignoring own IP address! PROTO=${proto?.toLowerCase()} SRC=${srcIp} DPT=${dpt} ID=${logData.id}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isLocalIP(srcIp)) {
|
||||||
|
return log(0, `Ignoring local IP address! PROTO=${proto?.toLowerCase()} SRC=${srcIp} DPT=${dpt} ID=${logData.id}`);
|
||||||
|
}
|
||||||
|
|
||||||
// Report MUST NOT be of an attack where the source address is likely spoofed i.e. SYN floods and UDP floods.
|
// Report MUST NOT be of an attack where the source address is likely spoofed i.e. SYN floods and UDP floods.
|
||||||
// TCP connections can only be reported if they complete the three-way handshake. UDP connections cannot be reported.
|
// TCP connections can only be reported if they complete the three-way handshake. UDP connections cannot be reported.
|
||||||
// Read more: https://www.abuseipdb.com/reporting-policy
|
// Read more: https://www.abuseipdb.com/reporting-policy
|
||||||
|
|||||||
Reference in new issue
Block a user