spamscanner 7.0.9 → 7.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/arf.cjs.map +1 -1
- package/dist/cjs/index.cjs +1338 -179
- package/dist/cjs/index.cjs.map +4 -4
- package/dist/esm/arf.js.map +1 -1
- package/dist/esm/cli.js +1266 -123
- package/dist/esm/cli.js.map +4 -4
- package/dist/esm/index.js +1306 -163
- package/dist/esm/index.js.map +4 -4
- package/dist/types/attachments.d.ts +1 -0
- package/dist/types/entities.d.ts +2 -0
- package/dist/types/html.d.ts +2 -2
- package/dist/types/index.d.ts +26 -6
- package/dist/types/links.d.ts +24 -0
- package/dist/types/parse.d.ts +1 -1
- package/package.json +1 -1
package/dist/types/html.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Text with its character references decoded, as browsers decode them: by
|
|
3
|
-
* number, also without a ";", and by name (
|
|
4
|
-
*
|
|
3
|
+
* number, also without a ";", and by name (every name browsers know; also
|
|
4
|
+
* without a ";" for the names browsers read so,
|
|
5
5
|
* except in an attribute where a letter, digit or "=" follows, as in a link
|
|
6
6
|
* "?a=1©=2"). An unknown name stays as it is.
|
|
7
7
|
* @param {string} value
|
package/dist/types/index.d.ts
CHANGED
|
@@ -9,6 +9,9 @@ export namespace DEFAULTS {
|
|
|
9
9
|
let cloudflare: boolean;
|
|
10
10
|
let adult: boolean;
|
|
11
11
|
let maxHosts: number;
|
|
12
|
+
let attachments: boolean;
|
|
13
|
+
let timeout: any;
|
|
14
|
+
let hostsInText: boolean;
|
|
12
15
|
let maxLength: number;
|
|
13
16
|
let homograph: {};
|
|
14
17
|
}
|
|
@@ -17,10 +20,12 @@ export namespace DEFAULTS {
|
|
|
17
20
|
let domain: any[];
|
|
18
21
|
}
|
|
19
22
|
export namespace dns {
|
|
20
|
-
let servers: any;
|
|
21
|
-
let
|
|
23
|
+
export let servers: any;
|
|
24
|
+
let timeout_1: number;
|
|
25
|
+
export { timeout_1 as timeout };
|
|
22
26
|
}
|
|
23
|
-
|
|
27
|
+
let attachments_1: boolean;
|
|
28
|
+
export { attachments_1 as attachments };
|
|
24
29
|
export let arbitrary: boolean;
|
|
25
30
|
export let authentication: boolean;
|
|
26
31
|
export let reputation: boolean;
|
|
@@ -30,8 +35,8 @@ export namespace DEFAULTS {
|
|
|
30
35
|
export let nsfw: boolean;
|
|
31
36
|
let maxLength_1: number;
|
|
32
37
|
export { maxLength_1 as maxLength };
|
|
33
|
-
let
|
|
34
|
-
export {
|
|
38
|
+
let timeout_2: number;
|
|
39
|
+
export { timeout_2 as timeout };
|
|
35
40
|
export let session: {};
|
|
36
41
|
}
|
|
37
42
|
/**
|
|
@@ -141,7 +146,7 @@ export class SpamScanner {
|
|
|
141
146
|
* @returns {Promise<ScanResult>}
|
|
142
147
|
*/
|
|
143
148
|
scanFile(file: string, options?: ScanOptions): Promise<ScanResult>;
|
|
144
|
-
checkLinks(links: any, config: any, hosts?: any[],
|
|
149
|
+
checkLinks(links: any, config: any, hosts?: any[], options?: {}): Promise<{
|
|
145
150
|
phishing: any[];
|
|
146
151
|
homographs: any[];
|
|
147
152
|
uncheckedHosts: number;
|
|
@@ -274,6 +279,9 @@ export type ScannerSettings = {
|
|
|
274
279
|
cloudflare?: boolean;
|
|
275
280
|
adult?: boolean;
|
|
276
281
|
maxHosts?: number;
|
|
282
|
+
attachments?: boolean;
|
|
283
|
+
hostsInText?: boolean;
|
|
284
|
+
timeout?: number;
|
|
277
285
|
maxLength?: number;
|
|
278
286
|
homograph?: object;
|
|
279
287
|
};
|
|
@@ -485,6 +493,14 @@ export type ScanDetails = {
|
|
|
485
493
|
* - whether text beyond phishing.maxLength was not read for links
|
|
486
494
|
*/
|
|
487
495
|
linksTruncated: boolean;
|
|
496
|
+
/**
|
|
497
|
+
* - whether a link host of the message or of what it carries was never read whole
|
|
498
|
+
*/
|
|
499
|
+
linksTooComplex: boolean;
|
|
500
|
+
/**
|
|
501
|
+
* - whether an attachment was left unread for links, for time
|
|
502
|
+
*/
|
|
503
|
+
linksIncomplete: boolean;
|
|
488
504
|
idnHomographAttack: {
|
|
489
505
|
detected: boolean;
|
|
490
506
|
domains: ScanFinding[];
|
|
@@ -507,6 +523,10 @@ export type ScanResult = {
|
|
|
507
523
|
* - the message parsed by mailparser
|
|
508
524
|
*/
|
|
509
525
|
mail: object;
|
|
526
|
+
/**
|
|
527
|
+
* - its attachments and those of its attached messages (see expandAttachments)
|
|
528
|
+
*/
|
|
529
|
+
attached: Array<object>;
|
|
510
530
|
version: string;
|
|
511
531
|
metrics: {
|
|
512
532
|
totalTime: number;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The link hosts of a message and of what it carries, as they are looked up
|
|
3
|
+
* (see lookupName; an address as it is), in the order they are found, up to
|
|
4
|
+
* `maxHosts`; names with no "/" after them come last, as far as there is
|
|
5
|
+
* room, as text that is not a link may read as one.
|
|
6
|
+
* @param {object} mail - the message, as mailparser parsed it
|
|
7
|
+
* @param {object} [options]
|
|
8
|
+
* @param {object[]} [options.mails] - the messages attached to it, opened (see expandAttachments)
|
|
9
|
+
* @param {object[]} [options.attachments] - its attachments and theirs (see expandAttachments)
|
|
10
|
+
* @param {number} [options.maxHosts]
|
|
11
|
+
* @param {boolean} [options.hostsInText] - also names with no "/" after them, "evil.example", as mail clients make links of them
|
|
12
|
+
* @returns {{hosts: string[], more: boolean, tooComplex: boolean, incomplete: boolean}} `more`: it has more hosts, so not every link was read; `tooComplex`: a link whose host was never read whole (it runs past where the text is cut to be read, it is wrapped deeper than unwrapLink unwraps, or in more documents than are read); `incomplete`: an attachment was left unread for time
|
|
13
|
+
*/
|
|
14
|
+
export function carriedLinkHosts(mail: object, { mails, attachments, maxHosts, hostsInText, }?: {
|
|
15
|
+
mails?: object[];
|
|
16
|
+
attachments?: object[];
|
|
17
|
+
maxHosts?: number;
|
|
18
|
+
hostsInText?: boolean;
|
|
19
|
+
}): {
|
|
20
|
+
hosts: string[];
|
|
21
|
+
more: boolean;
|
|
22
|
+
tooComplex: boolean;
|
|
23
|
+
incomplete: boolean;
|
|
24
|
+
};
|
package/dist/types/parse.d.ts
CHANGED
|
@@ -106,7 +106,7 @@ export function parseWithin(raw: Buffer, parse?: (raw: Buffer, options: {
|
|
|
106
106
|
* @param {(raw: Buffer) => Promise<object>} [parse] - for tests
|
|
107
107
|
* @returns {Promise<Array<object>>}
|
|
108
108
|
*/
|
|
109
|
-
export function expandAttachments(attachments?: Array<object>, errors?: string[], parse?: (raw: Buffer) => Promise<object>,
|
|
109
|
+
export function expandAttachments(attachments?: Array<object>, errors?: string[], parse?: (raw: Buffer) => Promise<object>, gets?: {}): Promise<Array<object>>;
|
|
110
110
|
/**
|
|
111
111
|
* DKIM-Signature fields mailauth reads of a message (see boundedForAuth): it
|
|
112
112
|
* checks every signature, hashing the body once for each body length (l=)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "spamscanner",
|
|
3
3
|
"description": "Spam, phishing and malware filter for email in any language: a trainable classifier, link and attachment checks, SPF/DKIM/DMARC, and an optional AI second opinion from any LLM, including local Ollama models. Works as a library, CLI, Postfix milter or HTTP API.",
|
|
4
|
-
"version": "7.0.
|
|
4
|
+
"version": "7.0.11",
|
|
5
5
|
"author": "Forward Email (https://forwardemail.net)",
|
|
6
6
|
"bin": {
|
|
7
7
|
"spamscanner": "./dist/esm/cli.js"
|