Package org.jasen.core

Examples of org.jasen.core.PointTestResult


    /* (non-Javadoc)
     * @see org.jasen.interfaces.JasenPlugin#test(org.jasen.core.Jasen, javax.mail.internet.MimeMessage, org.jasen.interfaces.JasenMessage, org.jasen.interfaces.ParserData, org.jasen.interfaces.ReceivedHeaderParser)
     */
    public JasenTestResult test(Jasen engine, MimeMessage rawMessage, JasenMessage parsedMessage, ParserData data, ReceivedHeaderParser parser) throws JasenException {

        PointTestResult result = new PointTestResult();
        result.setMin(min);
        result.setMax(max);
        result.setThreshold(threshold);

        int matches = analyzer.analyze(rawMessage, parsedMessage, definitions, threshold);

        if(data instanceof StandardParserData) {
            result.setPoints(matches);
        }

        return result;
    }
View Full Code Here


    /*
     * (non-Javadoc)
     * @see org.jasen.interfaces.JasenPlugin#test(org.jasen.core.Jasen, javax.mail.internet.MimeMessage, org.jasen.interfaces.JasenMessage, org.jasen.interfaces.ParserData, org.jasen.interfaces.ReceivedHeaderParser)
     */
    public JasenTestResult test(Jasen engine, MimeMessage rawMessage, JasenMessage parsedMessage, ParserData data, ReceivedHeaderParser parser) throws JasenException {
        PointTestResult result = new PointTestResult();

        result.setMin(min);
        result.setMax(max);
        result.setThreshold(threshold);

        String[] names = parsedMessage.getAttachmentNames();

        if(names != null) {

            String ext;

            for (int i = 0; i < names.length; i++)
            {
                ext = getFileExtension(names[i]);

                if(ext != null) {
                    if(Arrays.binarySearch(extensions, ext) > -1) {
                        result.setAbsolute(true);
                        break;
                    }
                }
            }
        }
View Full Code Here

       
        // Look into the text part
        char[] charData = null;
       
        if(chars != null && thresholds != null && chars.length == thresholds.length) {
            PointTestResult result = null;
            MultiPointTestResult multiResult = new MultiPointTestResult(calculator, min);
           
            int count = 0;
           
            for (int i = 0; i < chars.length; i++) {
                result = new PointTestResult(min, max, thresholds[i]);
                count += TextUtils.countChars(parsedMessage.getTextPart(), chars[i]);
                count += TextUtils.countChars(data.getHtmlAsText(), chars[i]);
               
                result.setPoints(count);
               
                multiResult.addPointResult(result);
               
                count = 0;
            }
           
            return multiResult;
        }
        else
        {
            return new PointTestResult();
        }
    }
View Full Code Here

     (non-Javadoc)
     * @see org.jasen.interfaces.JasenPlugin#test(org.jasen.core.Jasen, javax.mail.internet.MimeMessage, org.jasen.interfaces.JasenMessage, org.jasen.interfaces.ParserData, org.jasen.interfaces.ReceivedHeaderParser)
     */
    public JasenTestResult test(Jasen engine, MimeMessage rawMessage, JasenMessage parsedMessage, ParserData data, ReceivedHeaderParser parser) throws JasenException {
        // Get the count
        PointTestResult result = new PointTestResult();
        result.setMin(min);
        result.setMax(max);
        result.setThreshold(threshold);

        int count = 0;

        if(data instanceof StandardParserData) {

            StandardParserData spData = (StandardParserData)data;

            if(spData.getSrcPortCount() > 0 && spData.getPorts() != null) {

                String port = null;


                // Check against the list of known ports...
                for (int i = 0; i < spData.getPorts().size(); i++)
                {
                    port = (String)spData.getPorts().get(i);

                    if(Arrays.binarySearch(knownPorts, port) <= -1) {
                        // not a known port
                        count++;
                    }
                }
            }
        }

        result.setPoints(count);
        return result;
    }
View Full Code Here

     (non-Javadoc)
     * @see org.jasen.interfaces.JasenPlugin#test(org.jasen.core.Jasen, javax.mail.internet.MimeMessage, org.jasen.interfaces.JasenMessage, org.jasen.interfaces.ParserData, org.jasen.interfaces.ReceivedHeaderParser)
     */
    public JasenTestResult test(Jasen engine, MimeMessage rawMessage, JasenMessage parsedMessage, ParserData data, ReceivedHeaderParser parser) throws JasenException {
        // Get the count
        PointTestResult result = new PointTestResult();
        result.setMin(min);
        result.setMax(max);
        result.setThreshold(threshold);

        if(data instanceof StandardParserData) {
            result.setPoints(((StandardParserData)data).getSrcCgiCount());
        }

        return result;
    }
View Full Code Here

     (non-Javadoc)
     * @see org.jasen.interfaces.JasenPlugin#test(org.jasen.core.Jasen, javax.mail.internet.MimeMessage, org.jasen.interfaces.JasenMessage, org.jasen.interfaces.ParserData, org.jasen.interfaces.ReceivedHeaderParser)
     */
    public JasenTestResult test(Jasen engine, MimeMessage rawMessage, JasenMessage parsedMessage, ParserData data, ReceivedHeaderParser parser) throws JasenException {

        PointTestResult result = new PointTestResult();
        result.setMin(min);
        result.setMax(max);
        result.setThreshold(threshold);

        if(data instanceof StandardParserData) {
            StandardParserData spData = (StandardParserData)data;
            result.setPoints(spData.getFalseAnchorCount());
        }

        return result;
    }
View Full Code Here

    (non-Javadoc)
    * @see org.jasen.interfaces.JasenPlugin#test(org.jasen.core.Jasen, javax.mail.internet.MimeMessage, org.jasen.interfaces.JasenMessage, org.jasen.interfaces.ParserData, org.jasen.interfaces.ReceivedHeaderParser)
    */
    public JasenTestResult test(Jasen engine, MimeMessage rawMessage, JasenMessage parsedMessage, ParserData data, ReceivedHeaderParser parser) throws JasenException {
        // Get the concealment count
        PointTestResult result = new PointTestResult();
        result.setMin(min);
        result.setMax(max);
        result.setThreshold(threshold);

        if(data instanceof StandardParserData) {
            result.setPoints(((StandardParserData)data).getConcealedHtmlCount());
        }

        return result;
    }
View Full Code Here

     */
    public JasenTestResult test(Jasen engine, MimeMessage rawMessage,
            JasenMessage parsedMessage, ParserData data,
            ReceivedHeaderParser parser) throws JasenException {
        // Get the obfuscation count
        PointTestResult result = new PointTestResult();
        result.setMin(min);
        result.setMax(max);
        result.setThreshold(threshold);

        if(data instanceof StandardParserData) {
            result.setPoints(((StandardParserData)data).getObfuscatedCharacterCount());
        }

        return result;
    }
View Full Code Here

TOP

Related Classes of org.jasen.core.PointTestResult

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.