/*
* @(#)Jasen.java 30/10/2004
*
* Copyright (c) 2004, 2005 jASEN.org
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the distribution.
*
* 3. The names of the authors may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* 4. Any modification or additions to the software must be contributed back
* to the project.
*
* 5. Any investigation or reverse engineering of source code or binary to
* enable emails to bypass the filters, and hence inflict spam and or viruses
* onto users who use or do not use jASEN could subject the perpetrator to
* criminal and or civil liability.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JASEN.ORG,
* OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
package org.jasen.core.engine;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Properties;
import java.util.Vector;
import javax.mail.internet.MimeMessage;
import org.apache.log4j.Logger;
import org.jasen.config.DefaultJasenConfigurationLoader;
import org.jasen.config.JasenConfiguration;
import org.jasen.config.JasenDigester;
import org.jasen.config.JasenPluginConfiguration;
import org.jasen.core.JasenMessageWrapper;
import org.jasen.core.PluginContainer;
import org.jasen.core.StandardScanResult;
import org.jasen.core.parsers.SpamHTMLParser;
import org.jasen.error.ErrorHandlerBroker;
import org.jasen.error.JasenException;
import org.jasen.error.JasenParseException;
import org.jasen.error.ParseErrorType;
import org.jasen.error.SystemErrorHandler;
import org.jasen.interfaces.DNSResolver;
import org.jasen.interfaces.InetAddressResolver;
import org.jasen.interfaces.JasenConfigurationLoader;
import org.jasen.interfaces.JasenErrorHandler;
import org.jasen.interfaces.JasenMessage;
import org.jasen.interfaces.JasenPlugin;
import org.jasen.interfaces.JasenScanResult;
import org.jasen.interfaces.JasenTestResult;
import org.jasen.interfaces.MimeMessageParser;
import org.jasen.interfaces.MimeMessageTokenizer;
import org.jasen.interfaces.ParserData;
import org.jasen.interfaces.ProbabilityCalculator;
import org.jasen.interfaces.ReceivedHeaderParser;
import org.jasen.update.JasenAutoUpdateConfiguration;
import org.jasen.update.JasenAutoUpdateManager;
import org.jasen.update.JasenAutoUpdater;
import org.jasen.util.FileUtils;
import org.xml.sax.SAXException;
/**
* <P>
* The core scanning class of the jASEN framework.
* </P>
* <P>
* Jasen scans a MimeMessage using the internal logic and any registered plugins and returns a scan result object indicating the results of the scan
* </P>
* <P>
* NOTE: You should not call this class directly. Use the JasenScanner singleton as it provides thread safety during updates
* </P>
* @see org.jasen.JasenScanner
* @author Jason Polites
*/
public class Jasen
{
static final Logger logger = Logger.getLogger(Jasen.class);
public static final float NO_THRESHOLD = -1.0f;
private Vector plugins;
private ProbabilityCalculator calculator;
private MimeMessageParser mimeParser;
private Class headerParserClass;
private MimeMessageTokenizer tokenizer;
private JasenErrorHandler errorHandler;
private JasenConfiguration config;
private JasenConfigurationLoader configurationLoader;
private InetAddressResolver inetAddressResolver;
private DNSResolver dnsResolver;
private Class scanResultClass;
private float boundary = 0.0f;
private ClassLoader contextClassLoader;
/**
* The index into the test results array for the probability
*/
public static final int RESULT_INDEX_PROBABILITY = 0;
/**
* The index into the test results array for the plugin execution time
*/
public static final int RESULT_INDEX_TIME = 1;
/**
* The index into the test results array for the plugin name
*/
public static final int RESULT_INDEX_NAME = 2;
/**
* The index into the test results array for the plugin display name
*/
public static final int RESULT_INDEX_DISPLAY = 3;
/**
*
*/
public Jasen() {
super ();
}
/**
* Initialises the engine with the default configuration
* @throws JasenException
*
*/
public void init() throws JasenException {
if(configurationLoader == null) {
configurationLoader = new DefaultJasenConfigurationLoader();
}
init(configurationLoader);
}
/**
* Initialises the engine with the configuration file specified
* @param config The absolute path to the configuration file
* @throws JasenException
* @deprecated Use init(JasenConfigurationLoader loader)
*/
public void init(String config) throws JasenException {
InputStream in = null;
try
{
in = new FileInputStream(config);
init(in);
}
catch (FileNotFoundException e)
{
throw new JasenException(e);
}
finally
{
if(in != null) {
try
{
in.close();
}
catch (IOException ignore)
{
// Ignore this error, just print for debugging
ErrorHandlerBroker.getInstance().getErrorHandler().handleException(ignore);
}
}
}
}
/**
* Initialises the engine with the configuration document passed as a stream
* @param in The input stream from which the configuration may be read
* @throws JasenException
* @deprecated Use init(JasenConfigurationLoader loader)
*/
public void init(InputStream in) throws JasenException {
initInternal(in);
}
/**
* Initialises the engine with the configuration loader provided
* @param loader
* @throws JasenException
*/
public void init(JasenConfigurationLoader loader) throws JasenException {
try {
configurationLoader = loader;
initInternal(configurationLoader.openConfigurationStream());
}
finally {
loader.closeConfigurationStream();
}
}
/**
* Initialises the engine with the configuration document passed as a stream
* @param in The input stream
没有合适的资源?快使用搜索试试~ 我知道了~
Jasen 0.9.zip
共620个文件
html:438个
java:138个
properties:21个
需积分: 0 1 下载量 168 浏览量
2009-11-10
16:57:53
上传
评论
收藏 5MB ZIP 举报
温馨提示
纯 Java 发垃圾,能集成在程序上. Jasen 实现 类试于贝叶斯算法,
资源详情
资源评论
资源推荐
收起资源包目录
Jasen 0.9.zip (620个子文件)
scanfolder.bat 137B
scanfile.bat 108B
stylesheet.css 1KB
jasen.dat 2.87MB
heuristics.dat 724B
english.dic 550KB
inherit.gif 57B
MimeType.html 369KB
constant-values.html 233KB
JasenException.html 102KB
index-7.html 78KB
index-18.html 78KB
index-1.html 77KB
JasenConfiguration.html 68KB
Jasen.html 54KB
JasenMessage.html 52KB
MimeUtils.html 45KB
JasenScanner.html 45KB
SpamHTMLParser.html 44KB
index-9.html 42KB
serialized-form.html 41KB
overview-tree.html 40KB
ParserData.html 40KB
Jasen.html 39KB
ReceivedHeaderParser.html 37KB
ReadOnlyList.html 37KB
package-use.html 36KB
index-19.html 35KB
Jasen.html 35KB
JasenTestResult.html 34KB
ControlledThread.html 32KB
FileUtils.html 32KB
JasenAutoUpdateParcel.html 31KB
StandardParserData.html 30KB
index-10.html 30KB
Jasen.html 29KB
StandardHTMLParser.html 28KB
JasenTrainer.html 27KB
DNSUtils.html 27KB
JasenPluginConfiguration.html 26KB
StoppableThread.html 26KB
JasenAutoUpdateNotifier.html 25KB
LinguisticAnalyzer.html 25KB
JasenAutoUpdater.html 25KB
JasenMap.html 25KB
URLParser.html 24KB
EmailTokenizer.html 24KB
StandardJasenMessage.html 24KB
JasenDigester.html 24KB
index-3.html 23KB
JasenEngineConfiguration.html 23KB
ChiSquaredCalculator.html 23KB
SpamTokenizer.html 22KB
JasenAutoUpdateReaper.html 22KB
MimeParser.html 22KB
JasenMessageWrapper.html 22KB
JasenAutoUpdateParcelWrapper.html 22KB
StandardScanResult.html 21KB
ReceivedHeaderParserDataImpl.html 21KB
JasenAutoUpdateConfiguration.html 21KB
PluginContainer.html 21KB
index-4.html 20KB
PointTestResult.html 20KB
allclasses-frame.html 20KB
JasenAutoUpdateReport.html 19KB
RBLScanner.RBLResponse.html 19KB
MSSMTPReceivedHeaderParser.html 19KB
package-use.html 19KB
JasenParseException.html 19KB
InetAddressResolver.html 19KB
JasenScanResult.html 18KB
HeuristicScanner.html 18KB
RBLScanner.html 18KB
TagFalseAnchorScanner.html 18KB
ObfuscatedCharacterScanner.html 18KB
SenderAddressValidationScanner.html 18KB
WebUtils.html 18KB
SenderServerValidationScanner.html 18KB
JasenAutoUpdateListener.html 18KB
RobinsonScanner.html 18KB
FromAddressValidationScanner.html 18KB
HTMLConcealmentScanner.html 18KB
TagSourceCgiScanner.html 18KB
JasenAutoUpdateManager.html 18KB
TagSourcePortScanner.html 18KB
NonBlockingIOException.html 18KB
ImageDominanceScanner.html 18KB
InvisiMailScanner.html 18KB
AttachmentScanner.html 18KB
KeywordScanner.html 18KB
CachedInetAddress.html 18KB
RecipientScanner.html 18KB
AnomalousCharacterScanner.html 18KB
URLScanner.html 17KB
index-8.html 17KB
JasenPlugin.html 17KB
URLPortTagHandler.html 17KB
allclasses-noframe.html 17KB
index-16.html 17KB
MultiPointTestResult.html 17KB
共 620 条
- 1
- 2
- 3
- 4
- 5
- 6
- 7
zhouquan33907
- 粉丝: 0
- 资源: 3
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 微信小程序源码 车源宝 二手车交易平台 源码下载
- 微信小程序源码 实现 城市切换 demo 根据城市首字母排序城市 选择城市 源码下载
- VMware7.0虚拟机硬盘无法编辑,无法连接到Profile-Driven Storage Service
- arm64内核的mongo镜像
- 基于stm32f103c单片机+MPU6050+0.96英寸OLED显示屏双柄遥控器硬件(原理图+PCB)工程文件.zip
- 整理的关于少儿编程的学习路径,以及如何在小升初,初升高和大学充分的利用起来编程经验的优势
- nhit完整源码+论文学习
- 足球比赛结果统计表2006-2011年大约28W场比赛
- 基于PHP+mysql的社区交流系统(源代码)
- yolov5,SSD 可能使用到的一些代码
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0