30 lines
No EOL
1.3 KiB
JavaScript
30 lines
No EOL
1.3 KiB
JavaScript
module.exports = ({ action, clientAsn, clientASNDescription, clientRequestHTTPProtocol, clientRequestHTTPMethodName, clientRequestHTTPHost, clientRequestPath, clientRequestQuery, datetime, rayName, ruleId, userAgent, source, clientCountryName }) => {
|
||
const fields = [
|
||
{ label: 'Action taken', value: action?.toUpperCase() },
|
||
{ label: 'ASN', value: `${clientAsn} (${clientASNDescription})` },
|
||
{ label: 'Protocol', value: `${clientRequestHTTPProtocol} (${clientRequestHTTPMethodName} method)` },
|
||
{ label: 'Zone', value: clientRequestHTTPHost },
|
||
{ label: 'Endpoint', value: clientRequestPath },
|
||
{ label: 'Query', value: clientRequestQuery },
|
||
{ label: 'Timestamp', value: datetime },
|
||
{ label: 'Ray ID', value: rayName },
|
||
// { label: 'Rule ID', value: ruleId },
|
||
{ label: 'UA', value: userAgent || 'Empty string' },
|
||
];
|
||
|
||
const reportLines = fields
|
||
.filter(({ value }) => value)
|
||
.map(({ label, value }) => `${label}: ${value}`);
|
||
|
||
return `Triggered Cloudflare WAF (${source}) from ${clientCountryName}.
|
||
${reportLines.join('\n')}
|
||
|
||
Report generated by Cloudflare-WAF-To-AbuseIPDB:
|
||
https://github.com/sefinek/Cloudflare-WAF-To-AbuseIPDB`;
|
||
};
|
||
|
||
/*
|
||
* Hello! 👋 I'm really glad you're here.
|
||
* Please do not remove the repository URL in the comment above.
|
||
* I’d really appreciate it (:
|
||
*/ |