This commit is contained in:
Sefinek committed 2025-03-22 23:42:29 +01:00
1 parent 67d47e1786
commit 87ba156f03
2 files changed
+8 -10

No files matched your search

+7 -9
View File
@@ -20,23 +20,21 @@ exports.MAIN = {
}; };
/** // Generates a report submission to AbuseIPDB.
* Generates a report submission to AbuseIPDB. const serverId = this.MAIN.SERVER_ID && this.MAIN.SERVER_ID !== 'null' ? `on ${this.MAIN.SERVER_ID} ` : '';
* @returns {string} A formatted string report. exports.REPORT_COMMENT = ({ date, srcIp, dstIp, proto, spt, dpt, In, Out, mac, len, ttl, id, tos, prec, res, window, urgp, syn }, fullLog) =>
*/ `Blocked by UFW ${serverId}[${dpt || 'N/A'}/${proto?.toLowerCase() || 'N/A'}]
exports.REPORT_COMMENT = ({ date, srcIp, dstIp, proto, spt, dpt, In, Out, mac, len, ttl, id, tos, prec, res, window, urgp, syn }, fullLog, serverName) =>
`Blocked by UFW ${serverName ? `on ${serverName} ` : ''}[${dpt || 'N/A'}/${proto?.toLowerCase() || 'N/A'}]
Source port: ${spt || 'N/A'} Source port: ${spt || 'N/A'}
TTL: ${ttl || 'N/A'} TTL: ${ttl || 'N/A'}
Packet length: ${len || 'N/A'} Packet length: ${len || 'N/A'}
TOS: ${tos || 'N/A'} TOS: ${tos || 'N/A'}
This report was generated by: This report was generated by:
https://github.com/sefinek/UFW-AbuseIPDB-Reporter`; // Please do not delete this URL. I would be very grateful, thank you! 💙 https://github.com/sefinek/UFW-AbuseIPDB-Reporter`; // Please, don't delete this URL. I would be very grateful! Thank you. 💙
// Alternative version: // Alternative version:
// exports.REPORT_COMMENT = ({ date, srcIp, dstIp, proto, spt, dpt, In, Out, mac, len, ttl, id, tos, prec, res, window, urgp, syn }, fullLog, serverName) => // exports.REPORT_COMMENT = ({ date, srcIp, dstIp, proto, spt, dpt, In, Out, mac, len, ttl, id, tos, prec, res, window, urgp, syn }, fullLog) =>
// `Blocked by UFW ${serverName ? `on ${serverName} ` : ''}[${dpt}/${proto?.toLowerCase()}]. Generated by: https://github.com/sefinek/UFW-AbuseIPDB-Reporter`; // `Blocked by UFW ${serverId}[${dpt}/${proto?.toLowerCase()}]. Generated by: https://github.com/sefinek/UFW-AbuseIPDB-Reporter`;
// See: https://www.abuseipdb.com/categories // See: https://www.abuseipdb.com/categories
+1 -1
View File
@@ -108,7 +108,7 @@ const processLogLine = async (line, test = false) => {
} }
const categories = config.DETERMINE_CATEGORIES(logData); const categories = config.DETERMINE_CATEGORIES(logData);
const comment = config.REPORT_COMMENT(logData, line, SERVER_ID); const comment = config.REPORT_COMMENT(logData, line);
if (await reportToAbuseIPDb(logData, categories, comment)) { if (await reportToAbuseIPDb(logData, categories, comment)) {
markIPAsReported(srcIp); markIPAsReported(srcIp);