java Anti Spam ENgine SourceForge.net Logo
The pure java Anti Spam ENgine
Overview
Features
Getting Started
Download
User Guide
FAQ
Forums SourceForge Link
Javadoc New Window
License
Commercial Use
Project Home SourceForge Link
 
java.net member!

Getting Started

JDK Requirements

jASEN has currently only been tested on JDK 1.4.2. If you are using a later JDK, please let us know if it doesn't work

3rd Party Libraries

jASEN currently has a dependency on the following 3rd party libraries: All of the above libraries are included in the jASEN distributable.

NOTE: The FastUtil library is quite large (~9MB) so a slimmed-down version is packaged with jASEN.
This was created using the AutoJar tool by Bernd Eggink.

Running the samples

Two sample applications are included in the "bin" directory.

NOTE: All files scanned by the sample applications MUST be MIME formatted text files

scanfile

Scans a single file and prints detailed results to the console

scanfile takes one argument:
scanfile <file path>
Example:
scanfile c:/test/test.eml

Sample Output:

Initialising jASEN ...
Scanning file...c:\test\test.eml

Test Results
----------------------------------

Prob	: Time		: Scanner
----------------------------------
0.500	: 0.000 (ms)	: Empty Mail Scanner (InvisiMailScannner)
0.998	: 15.000 (ms)	: AI Scanner (RobinsonScanner)
0.850	: 0.000 (ms)	: White Noise Detector (HTMLConcealmentScanner)
0.800	: 0.000 (ms)	: Image Misuse Detector (ImageDominanceScanner)
0.500	: 0.000 (ms)	: Bug Detector (TagSourceCgiScanner)
0.500	: 0.000 (ms)	: Port Scanner (TagSourcePortScanner)
0.500	: 0.000 (ms)	: Phishing Detector (TagFalseAnchorScanner)
0.500	: 0.000 (ms)	: Character Misuse Scanner (ObfuscatedCharacterScanner)
0.500	: 0.000 (ms)	: Shouting Detector (AnomalousCharacterScanner)
0.500	: 0.000 (ms)	: Worm and Trojan Detector (AttachmentScanner)
0.500	: 0.000 (ms)	: Bulk List Detector (RecipientScanner)
0.500	: 32.000 (ms)	: Fraud Detector (SenderAddressValidationScanner)
0.500	: 0.000 (ms)	: Forgery Detector (FromAddressValidationScanner)
0.500	: 0.000 (ms)	: Email Fingerprint Scanner (HeuristicScanner)
0.500	: 31.000 (ms)	: Keyword Scanner (KeywordScanner)
0.990	: 4531.000 (ms)	: Real Time Black List Detector (RBLScanner)

Overall (normalized) Result
----------------------------------
0.9999954986887116

Judgement:

Most likely SPAM

scanfolder Scans all the files in a given folder and returns summary results

scanfolder has the capability to take several command line arguments:
Usage: ScanFolder <folder path>
	Optional parameters:
	---------------------------------------
	-H : Look specifically for HAM messages
	-S : Look specifically for SPAM messages
	-B : Look specifically for BORDERLINE messages
	-TL <threshold>: Specify the low score threshold (0.0 < TL <= HL < 1.0)
	-TH <threshold>: Specify the low score threshold (0.0 < TL <= HL < 1.0)
	-D <folder path>: The path to the folder in which to move matched messages
	-? : Display this help topic	
Example:
scanfolder c:/test/ -H -TL 0.1 -TH 0.9 -D c:/drop/

Sample Output:

Initialising jASEN ...
Scanning files in path... C:\test\

Scanning        :       I'm_quite_frazzled!_Messire.eml
Result          :       0.579
Judgement       :       Can't be sure.  Borderline case
--------------------------------------------------------

Scanning        :       jerry_private_ip_port_scan.eml
Result          :       0.984
Judgement       :       Most likely SPAM
--------------------------------------------------------

Scanning        :       loovablle_modeel_cruellly_ravisheed_by_a_cuss__perrsia.eml
Result          :       0.748
Judgement       :       Can't be sure.  Borderline case
--------------------------------------------------------

Scanning        :       Micro_RC_toys_are_back_!.eml
Result          :       0.944
Judgement       :       Most likely SPAM
--------------------------------------------------------

Scanning        :       New_CitibankMAIL_Service.eml
Result          :       0.450
Judgement       :       Can't be sure.  Borderline case
--------------------------------------------------------

Scanning        :       new_deal,.eml
Result          :       0.992
Judgement       :       Most likely SPAM
--------------------------------------------------------

Scanning        :       Please_Complete_and_Return.eml
Result          :       0.340
Judgement       :       Can't be sure.  Borderline case
--------------------------------------------------------

Scanning        :       Reply_ Inneocnt Wrohes and Big Dick.eml
Result          :       0.988
Judgement       :       Most likely SPAM
--------------------------------------------------------

Scanning        :       Re_Agreement_Information.eml
Result          :       0.993
Judgement       :       Most likely SPAM
--------------------------------------------------------

Scanning        :       Re_Rat-slayer_-_is_he.eml
Result          :       0.731
Judgement       :       Can't be sure.  Borderline case
--------------------------------------------------------

Scanning        :       she'd.eml
Result          :       0.951
Judgement       :       Most likely SPAM
--------------------------------------------------------

Scanning        :       she_is_eighteen.eml
Result          :       0.335
Judgement       :       Can't be sure.  Borderline case
--------------------------------------------------------

Scanning        :       Sun,_07_Nov_2004_042443_-0600.eml
Result          :       0.990
Judgement       :       Most likely SPAM
--------------------------------------------------------

Scanning        :       Vlagra offer you can't say no to!.eml
Result          :       1.000
Judgement       :       Most likely SPAM
--------------------------------------------------------

Scanning        :       What_can_you_do.eml
Result          :       0.995
Judgement       :       Most likely SPAM
--------------------------------------------------------

Scanning        :       Why_Pay_M0re_GW9m.eml
Result          :       0.999
Judgement       :       Most likely SPAM
--------------------------------------------------------

Summary Results
--------------------------------------------------------
Spam            :       10
Ham             :       0
Borderline      :       6
Errors          :       0
Total -no error :       16
Total           :       16

Writing a simple scan class

Below is a simple demonstration use of the jASEN API
public class ScanFile
{
    public static void main(String[] args) {
        try
        {
            if(args.length < 1) {
                System.out.println ("Usage: ScanFile <file path>");
            }
            else
            {
				// Load the file into a MimeMessage
                File file = new File(args[0]);
                FileInputStream fin = new FileInputStream(file);
                MimeMessage mm = new MimeMessage(null, fin);

                System.out.println ("Initialising jASEN ...");

                // Initialise the scanner
                JasenScanner.getInstance().init();
				
                // Optionally set a scan event listener
                JasenScanner.getInstance().setScanListener(new ScanListener());

                // Optionally specify an error handler
                ErrorHandlerBroker.getInstance().setErrorHandler(new EmptyErrorHandler());

                System.out.println ("Scanning file..." + args[0]);
                System.out.println ("");

                // Scan the message
                JasenScanResult result = JasenScanner.getInstance().scan(mm);

                // Get the result
                System.out.println ("Result");
                System.out.println ("----------------------------------");

                // Get the probability of spam
                System.out.println (result.getProbability());

                System.out.println ("");
                System.out.println ("Judgement:");
                System.out.println ("");

                if(result.getProbability() >= 0.9) {
                    System.out.println ("Most likely SPAM");
                }
                else if (result.getProbability() <= 0.1) {
                    System.out.println ("Most likely HAM");
                }
                else {
                    System.out.println ("Can't be sure.  Borderline case");
                }
            }
        }
        catch (Exception e)
        {
            e.printStackTrace ();
        }
    }
}