Spam Scanner: a powerful anti spam and anti phishing service platform

Posted by kts on Wed, 23 Feb 2022 15:29:25 +0100

About Spam Scanner

Spam Scanner is a powerful anti spam, email filtering and phishing defense service platform. Spam Scanner is also the best alternative to SpamAssassin, rspamd, SpamTitan and other products.

Our goal is to establish and utilize a scalable, high-performance, simple, easy to maintain and powerful API for our forwarding e-mail service to limit spam and provide other measures to prevent cyber criminals from attacking our users.

At first, we tried to use SpamAssassin, and then evaluated rspamd, but in the end, we found that all existing solutions are very complex, lack the required functions or documents, troublesome to configure, high technical barriers, and limit the scalability of the platform from other perspectives.

For us, we value privacy and the security of data and users - in particular, we have a "zero tolerance policy" for storing any type of log or metadata. None of these solutions comply with this Privacy Policy (without deleting the basic spam detection function), so Spam Scanner came into being.

Function introduction

Built on modern technology, Spam Scanner can provide high-performance services and help reduce spam, phishing and other types of attacks.

1. Naive Bayesian classifier 2. Spam content detection 3. Phishing content detection 4. Executable link and attachment detection 5. Virus detection 6. NSFW (Not Safe For Work) image detection

Tool dependent components

Node.js Cloudflare ClamAV

ClamAV configuration

Ubuntu

1. Install ClamAV

sudo apt-get update

sudo apt-get install build-essential clamav-daemon clamav-freshclam clamav-unofficial-sigs -qq
sudo service clamav-daemon start

2. Configure ClamAV

sudo vim /etc/clamav/clamd.conf

 -Example

 +#Example

 

 -#StreamMaxLength 10M

 +StreamMaxLength 50M

 

 +# this file path may be different on your OS (that's OK)

 

\-#LocalSocket /tmp/clamd.socket

\+LocalSocket /tmp/clamd.socket

sudo vim /etc/clamav/freshclam.conf

 -Example

 +#Example

3. Make sure that ClamAV starts automatically when it is turned on

systemctl enable freshclamd

systemctl enable clamd

systemctl start freshclamd

systemctl start clamd

macOS

1. Install ClamAV

brew install clamav

2. Configure ClamAV

# if you are on Intel macOS

sudo mv /usr/local/etc/clamav/clamd.conf.sample /usr/local/etc/clamav/clamd.conf

 

# if you are on M1 macOS (or newer brew which installs to `/opt/homebrew`)

sudo mv /opt/homebrew/etc/clamav/clamd.conf.sample /opt/homebrew/etc/clamav/clamd.conf

# if you are on Intel macOS

sudo vim /usr/local/etc/clamav/clamd.conf

 

# if you are on M1 macOS (or newer brew which installs to `/opt/homebrew`)

sudo vim /opt/homebrew/etc/clamav/clamd.conf

-Example

+#Example

 

-#StreamMaxLength 10M

+StreamMaxLength 50M

 

+# this file path may be different on your OS (that's OK)

 

\-#LocalSocket /tmp/clamd.socket

\+LocalSocket /tmp/clamd.socket

# if you are on Intel macOS

sudo mv /usr/local/etc/clamav/freshclam.conf.sample /usr/local/etc/clamav/freshclam.conf

 

# if you are on M1 macOS (or newer brew which installs to `/opt/homebrew`)

sudo mv /opt/homebrew/etc/clamav/freshclam.conf.sample /opt/homebrew/etc/clamav/freshclam.conf

# if you are on Intel macOS

sudo vim /usr/local/etc/clamav/freshclam.conf

 

# if you are on M1 macOS (or newer brew which installs to `/opt/homebrew`)

sudo vim /opt/homebrew/etc/clamav/freshclam.conf

-Example

+#Example

freshclam

3. Make sure that ClamAV starts automatically when it is turned on

sudo vim /Library/LaunchDaemons/org.clamav.clamd.plist

Tool installation - NPM installation

npm install spamscanner

Tool use

const fs = require('fs');

const path = require('path');



const SpamScanner = require('spamscanner');



const scanner = new SpamScanner();



//

// NOTE: The `source` argument is the full raw email to be scanned

// and you can pass it as String, Buffer, or valid file path

//

const source = fs.readFileSync(

  path.join(__dirname, 'test', 'fixtures', 'spam.eml')

);



// async/await usage

(async () => {

  try {

    const scan = await scanner.scan(source);

    console.log('scan', scan);

  } catch (err) {

    console.error(err);

  }

});



// then/catch usage

scanner

  .scan(source)

  .then(scan => console.log('scan', scan))

  .catch(console.error);



// callback usage

if (err) return console.error(err);

scanner.scan(source, (err, scan) => {

  if (err) return console.error(err);

  console.log('scan', scan);

});

License agreement

The development and release of this project follow BSL v1.0 1 open source license agreement.

Project address

Spam Scanner: [GitHub portal]

reference material

https://www.digitalocean.com/community/tutorials/how-to-setup-exim-spamassassin-clamd-and-dovecot-on-an-arch-linux-vps

https://medium.com/@wingsuitist/set-up-clamav-for-osx-1-the-open-source-virus-scanner-82a927b60fa3

http://redgreenrepeat.com/2019/08/09/setting-up-clamav-on-macos/

https://paulrbts.github.io/blog/software/2017/08/18/clamav/

https://gist.github.com/zhurui1008/4fdc875e557014c3a34e