资源简介
利用syslog协议 ,发送网络安全设备日志。java版
代码片段和文件信息
/*
** Tim Endres‘ net package.
** Copyright (c) 1997 by Tim Endres
**
** This program is free software.
**
** You may redistribute it and/or modify it under the terms of the GNU
** General Public License as published by the Free Software Foundation.
** Version 2 of the license should be included with this distribution in
** the file LICENSE as well as License.html. If the license is not
** included with this distribution you may find a copy at the FSF web
** site at ‘www.gnu.org‘ or ‘www.fsf.org‘ or you may write to the
** Free Software Foundation 675 Mass Ave Cambridge MA 02139 USA.
**
** THIS SOFTWARE IS PROVIDED AS-IS WITHOUT WARRANTY OF ANY KIND
** NOT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY. THE AUTHOR
** OF THIS SOFTWARE ASSUMES _NO_ RESPONSIBILITY FOR ANY
** CONSEQUENCE RESULTING FROM THE USE MODIFICATION OR
** REDISTRIBUTION OF THIS SOFTWARE.
**
*/
package com.ice.net;
import java.net.*;
import java.io.*;
import java.util.*;
import java.lang.*;
import java.text.*;
public class SimpleSMTP
{
private static final String RCS_ID = “$Id: SimpleSMTP.javav 1.1.1.1 1997/11/03 18:03:12 time Exp $“;
private static final String RCS_REV = “$Revision: 1.1.1.1 $“;
public static final int SMTP_PORT = 25;
public static final String EOL = “\r\n“;
protected Socket sock = null;
protected BufferedReader recv = null;
protected PrintWriter send = null;
/**
* Create an smtp object connected to the specified host
*
* @param hostid The host to connect to.
* @exception UnknownHostException
* @exception IOException
*/
public
SimpleSMTP( String hostname )
throws UnknownHostException IOException
{
this( hostname SimpleSMTP.SMTP_PORT );
}
public
SimpleSMTP( String hostid int port )
throws UnknownHostException IOException
{
this.sock = new Socket( hostid port );
this.send =
new PrintWriter( sock.getOutputStream() );
this.recv = new BufferedReader(
new InputStreamReader( sock.getInputStream() ) );
String replyStr = this.readLine();
if ( ! replyStr.startsWith( “220“ ) )
{
throw new ProtocolException( replyStr );
}
for ( ; replyStr.indexOf( ‘-‘ ) == 3 ; )
{
replyStr = this.readLine();
if ( ! replyStr.startsWith(“220“) )
{
throw new ProtocolException( replyStr );
}
}
}
public
SimpleSMTP( InetAddress address )
throws IOException
{
this( address SimpleSMTP.SMTP_PORT );
}
public
SimpleSMTP( InetAddress address int port )
throws IOException
{
this.sock = new Socket( address port );
this.send =
new PrintWriter( sock.getOutputStream() );
this.recv = new BufferedReader(
new InputStreamReader( sock.getInputStream() ) );
String replyStr = this.readLine();
if ( ! replyStr.startsWith(“220“) )
{
throw new ProtocolException( replyS
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 1998-07-28 22:52 syslogd-2.2\
目录 0 1998-07-28 22:53 syslogd-2.2\application\
文件 281 1997-11-23 22:45 syslogd-2.2\application\syslog.conf
文件 1359 1997-11-23 22:02 syslogd-2.2\application\syslog.conf.example
文件 139934 1998-07-28 22:46 syslogd-2.2\application\syslogd.jar
目录 0 1998-07-28 22:53 syslogd-2.2\doc\
文件 6443 1997-11-23 22:34 syslogd-2.2\doc\config.html
文件 1611 1997-11-23 22:37 syslogd-2.2\doc\index.html
文件 15314 1997-11-17 22:29 syslogd-2.2\doc\LICENSE
文件 17700 1997-11-17 22:23 syslogd-2.2\doc\license.html
文件 3492 1997-11-23 22:34 syslogd-2.2\doc\manual.html
文件 1286 1997-11-23 22:34 syslogd-2.2\doc\README.html
文件 3627 1997-11-24 11:08 syslogd-2.2\doc\syslogd.html
目录 0 1998-07-28 22:54 syslogd-2.2\source\
目录 0 1998-07-28 22:57 syslogd-2.2\source\com\
目录 0 1998-07-28 22:54 syslogd-2.2\source\com\ice\
目录 0 1998-07-28 22:55 syslogd-2.2\source\com\ice\net\
文件 7100 1998-02-21 19:03 syslogd-2.2\source\com\ice\net\SimpleSMTP.java
目录 0 1998-07-28 22:55 syslogd-2.2\source\com\ice\syslog\
文件 9521 1998-07-28 22:41 syslogd-2.2\source\com\ice\syslog\Syslog.java
文件 8512 1998-07-28 22:08 syslogd-2.2\source\com\ice\syslog\Syslogap
文件 8240 1998-02-22 00:54 syslogd-2.2\source\com\ice\syslog\SyslogDefs.java
文件 222 1998-02-22 00:54 syslogd-2.2\source\com\ice\syslog\SyslogException.java
文件 2257 1998-07-28 21:07 syslogd-2.2\source\com\ice\syslog\Syslogfr
文件 321 1998-07-28 22:06 syslogd-2.2\source\com\ice\syslog\SyslogTest.java
目录 0 1998-07-28 22:55 syslogd-2.2\source\com\ice\syslogd\
文件 4486 1998-07-28 22:05 syslogd-2.2\source\com\ice\syslogd\AboutDialog.java
文件 601 1998-02-22 00:48 syslogd-2.2\source\com\ice\syslogd\ActionThread.java
文件 6246 1998-02-22 00:48 syslogd-2.2\source\com\ice\syslogd\ConfigEntry.java
文件 595 1998-02-22 00:48 syslogd-2.2\source\com\ice\syslogd\ConfigEntryVector.java
文件 5452 1998-02-22 00:48 syslogd-2.2\source\com\ice\syslogd\ConfigFormat.java
............此处省略94个文件信息
评论
共有 条评论