spamscanner 4.0.0 → 5.1.1
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/README.md +79 -8
- package/cedict_1_0_ts_utf-8_mdbg.txt +120853 -0
- package/index.js +284 -119
- package/package.json +37 -73
- package/vocabulary-limit.js +3 -1
package/README.md
CHANGED
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
<a href="https://spamscanner.net"><img src="https://d1i8ikybhfrv4r.cloudfront.net/spamscanner.png" alt="spamscanner" /></a>
|
|
3
3
|
</h1>
|
|
4
4
|
<div align="center">
|
|
5
|
-
<a href="https://
|
|
6
|
-
<a href="https://travis-ci.com/spamscanner/spamscanner"><img src="https://travis-ci.com/spamscanner/spamscanner.svg?branch=master" alt="build status" /></a>
|
|
7
|
-
<a href="https://codecov.io/github/spamscanner/spamscanner"><img src="https://img.shields.io/codecov/c/github/spamscanner/spamscanner/master.svg" alt="code coverage" /></a>
|
|
5
|
+
<a href="https://github.com/spamscanner/spamscanner/actions/workflows/ci.yml"><img src="https://github.com/spamscanner/spamscanner/actions/workflows/ci.yml/badge.svg" alt="build status" /></a>
|
|
8
6
|
<a href="https://github.com/sindresorhus/xo"><img src="https://img.shields.io/badge/code_style-XO-5ed9c7.svg" alt="code style" /></a>
|
|
9
7
|
<a href="https://github.com/prettier/prettier"><img src="https://img.shields.io/badge/styled_with-prettier-ff69b4.svg" alt="styled with prettier" /></a>
|
|
10
8
|
<a href="https://lass.js.org"><img src="https://img.shields.io/badge/made_with-lass-95CC28.svg" alt="made with lass" /></a>
|
|
@@ -48,6 +46,7 @@
|
|
|
48
46
|
* [`scanner.getVirusResults(mail)`](#scannergetvirusresultsmail)
|
|
49
47
|
* [`scanner.parseLocale(locale)`](#scannerparselocalelocale)
|
|
50
48
|
* [Caching](#caching)
|
|
49
|
+
* [Debugging](#debugging)
|
|
51
50
|
* [Contributors](#contributors)
|
|
52
51
|
* [References](#references)
|
|
53
52
|
* [License](#license)
|
|
@@ -188,11 +187,48 @@ Note that you can simply use the Spam Scanner API for free at <https://spamscann
|
|
|
188
187
|
2. Configure ClamAV:
|
|
189
188
|
|
|
190
189
|
```sh
|
|
190
|
+
# if you are on Intel macOS
|
|
191
|
+
sudo mv /usr/local/etc/clamav/clamd.conf.sample /usr/local/etc/clamav/clamd.conf
|
|
192
|
+
|
|
193
|
+
# if you are on M1 macOS (or newer brew which installs to `/opt/homebrew`)
|
|
194
|
+
sudo mv /opt/homebrew/etc/clamav/clamd.conf.sample /opt/homebrew/etc/clamav/clamd.conf
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
```sh
|
|
198
|
+
# if you are on Intel macOS
|
|
199
|
+
sudo vim /usr/local/etc/clamav/clamd.conf
|
|
200
|
+
|
|
201
|
+
# if you are on M1 macOS (or newer brew which installs to `/opt/homebrew`)
|
|
202
|
+
sudo vim /opt/homebrew/etc/clamav/clamd.conf
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
```diff
|
|
206
|
+
-Example
|
|
207
|
+
+#Example
|
|
208
|
+
|
|
209
|
+
-#StreamMaxLength 10M
|
|
210
|
+
+StreamMaxLength 50M
|
|
211
|
+
|
|
212
|
+
+# this file path may be different on your OS (that's OK)
|
|
213
|
+
|
|
214
|
+
\-#LocalSocket /tmp/clamd.socket
|
|
215
|
+
\+LocalSocket /tmp/clamd.socket
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
```sh
|
|
219
|
+
# if you are on Intel macOS
|
|
191
220
|
sudo mv /usr/local/etc/clamav/freshclam.conf.sample /usr/local/etc/clamav/freshclam.conf
|
|
221
|
+
|
|
222
|
+
# if you are on M1 macOS (or newer brew which installs to `/opt/homebrew`)
|
|
223
|
+
sudo mv /opt/homebrew/etc/clamav/freshclam.conf.sample /opt/homebrew/etc/clamav/freshclam.conf
|
|
192
224
|
```
|
|
193
225
|
|
|
194
226
|
```sh
|
|
227
|
+
# if you are on Intel macOS
|
|
195
228
|
sudo vim /usr/local/etc/clamav/freshclam.conf
|
|
229
|
+
|
|
230
|
+
# if you are on M1 macOS (or newer brew which installs to `/opt/homebrew`)
|
|
231
|
+
sudo vim /opt/homebrew/etc/clamav/freshclam.conf
|
|
196
232
|
```
|
|
197
233
|
|
|
198
234
|
```diff
|
|
@@ -210,6 +246,8 @@ Note that you can simply use the Spam Scanner API for free at <https://spamscann
|
|
|
210
246
|
sudo vim /Library/LaunchDaemons/org.clamav.clamd.plist
|
|
211
247
|
```
|
|
212
248
|
|
|
249
|
+
> If you are on Intel macOS:
|
|
250
|
+
|
|
213
251
|
```plist
|
|
214
252
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
215
253
|
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
@@ -231,12 +269,37 @@ Note that you can simply use the Spam Scanner API for free at <https://spamscann
|
|
|
231
269
|
</plist>
|
|
232
270
|
```
|
|
233
271
|
|
|
272
|
+
> If you are on M1 macOS (or newer brew which installs to `/opt/homebrew`)
|
|
273
|
+
|
|
274
|
+
```plist
|
|
275
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
276
|
+
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
277
|
+
<plist version="1.0">
|
|
278
|
+
<dict>
|
|
279
|
+
<key>Label</key>
|
|
280
|
+
<string>org.clamav.clamd</string>
|
|
281
|
+
<key>KeepAlive</key>
|
|
282
|
+
<true/>
|
|
283
|
+
<key>Program</key>
|
|
284
|
+
<string>/opt/homebrew/sbin/clamd</string>
|
|
285
|
+
<key>ProgramArguments</key>
|
|
286
|
+
<array>
|
|
287
|
+
<string>clamd</string>
|
|
288
|
+
</array>
|
|
289
|
+
<key>RunAtLoad</key>
|
|
290
|
+
<true/>
|
|
291
|
+
</dict>
|
|
292
|
+
</plist>
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
4. Enable it and start it on boot:
|
|
296
|
+
|
|
234
297
|
```sh
|
|
235
298
|
sudo launchctl load /Library/LaunchDaemons/org.clamav.clamd.plist
|
|
236
299
|
sudo launchctl start /Library/LaunchDaemons/org.clamav.clamd.plist
|
|
237
300
|
```
|
|
238
301
|
|
|
239
|
-
|
|
302
|
+
5. You may want to periodically run `freshclam` to update the config, or configure a similar `plist` configuration for `launchctl`.
|
|
240
303
|
|
|
241
304
|
|
|
242
305
|
## Install
|
|
@@ -244,7 +307,7 @@ Note that you can simply use the Spam Scanner API for free at <https://spamscann
|
|
|
244
307
|
[npm][]:
|
|
245
308
|
|
|
246
309
|
```sh
|
|
247
|
-
npm install spamscanner
|
|
310
|
+
npm install spamscanner
|
|
248
311
|
```
|
|
249
312
|
|
|
250
313
|
|
|
@@ -359,7 +422,7 @@ Currently Spam Scanner supports the following locales for tokenization, stemming
|
|
|
359
422
|
| Finnish | `fn` |
|
|
360
423
|
| Farsi | `fa` |
|
|
361
424
|
| French | `fr` |
|
|
362
|
-
| German | `
|
|
425
|
+
| German | `de` |
|
|
363
426
|
| Hungarian | `hr` |
|
|
364
427
|
| Indonesian | `in` |
|
|
365
428
|
| Italian | `it` |
|
|
@@ -406,7 +469,7 @@ A common example of this is a link of `рaypal.com` which when converted to ASCI
|
|
|
406
469
|
|
|
407
470
|
This method checks against [Cloudflare for Families](https://developers.cloudflare.com/1.1.1.1/1.1.1.1-for-families) servers for both adult-related content, malware, and phishing. This means we do two separate DNS over HTTPS requests to `1.1.1.2` for malware and `1.1.1.3` for adult-related content. You can parse the messages results Array for messages that contain "adult-related content" if you need to parse whether or not you want to flag for adult-related content or not on your application.
|
|
408
471
|
|
|
409
|
-
If you are using Cloudflare for Families DNS servers as mentioned in [Requirements](#requirements)), then if there are any HTTPS over DNS request errors, it will fallback to use the DNS servers set on the system for lookups, which would in turn use Cloudflare for Family DNS. (using DNS over HTTPS with a fallback of [dns.resolve4](https://nodejs.org/api/dns.html#
|
|
472
|
+
If you are using Cloudflare for Families DNS servers as mentioned in [Requirements](#requirements)), then if there are any HTTPS over DNS request errors, it will fallback to use the DNS servers set on the system for lookups, which would in turn use Cloudflare for Family DNS. (using DNS over HTTPS with a fallback of [dns.resolve4](https://nodejs.org/api/dns.html#dns_dns_resolve4_hostname_options_callback)) – and if it returns `0.0.0.0` then it is considered to be phishing.
|
|
410
473
|
|
|
411
474
|
We actually helped Cloudflare in August 2020 to update their documentation to note that this result of `0.0.0.0` is returned for maliciously found content on FQDN and IP lookups.
|
|
412
475
|
|
|
@@ -430,7 +493,7 @@ Returns an Array of SHA-256 hashed tokenized and stemmed words, with respect to
|
|
|
430
493
|
|
|
431
494
|
Note that this is "smart" in the sense it will parse the "Content-Language" header of the message, the `content` attribute of the HTML message's `<meta http-equiv="Content-Language" content="en-us">`, or the `lang` attribute of `<html lang="en">`.
|
|
432
495
|
|
|
433
|
-
After parsing the language of the message, it will then use the package [franc][] to attempt to determine the language of the message (as long as the message has at least
|
|
496
|
+
After parsing the language of the message, it will then use the package [franc][] to attempt to determine the language of the message (as long as the message has at least 5 characters, which is configurable).
|
|
434
497
|
|
|
435
498
|
**Most importantly** the following types of tokens are replaced with cryptographically generated random hashes:
|
|
436
499
|
|
|
@@ -501,6 +564,13 @@ const scanner = new SpamScanner({
|
|
|
501
564
|
Note that in [Forward Email][forward-email] we use the `client` approach as we have multiple threads across multiple servers running, and in-memory caching would not be efficient.
|
|
502
565
|
|
|
503
566
|
|
|
567
|
+
## Debugging
|
|
568
|
+
|
|
569
|
+
Spam Scanner has built-in debug output via `util.debuglog('spamscanner')`.
|
|
570
|
+
|
|
571
|
+
This means you can run your app with `NODE_DEBUG=spamscanner node app.js` to get useful debug output to your console.
|
|
572
|
+
|
|
573
|
+
|
|
504
574
|
## Contributors
|
|
505
575
|
|
|
506
576
|
| Name | Website |
|
|
@@ -511,6 +581,7 @@ Note that in [Forward Email][forward-email] we use the `client` approach as we h
|
|
|
511
581
|
|
|
512
582
|
## References
|
|
513
583
|
|
|
584
|
+
* [CC-CEDICT](https://cc-cedict.org/) is licensed under Creative Commons Attribution-ShareAlike 4.0 International License.
|
|
514
585
|
* <https://www.digitalocean.com/community/tutorials/how-to-setup-exim-spamassassin-clamd-and-dovecot-on-an-arch-linux-vps>
|
|
515
586
|
* <https://medium.com/@wingsuitist/set-up-clamav-for-osx-1-the-open-source-virus-scanner-82a927b60fa3>
|
|
516
587
|
* <http://redgreenrepeat.com/2019/08/09/setting-up-clamav-on-macos/>
|