Snort mailing list archives

Re: Snort Unixsock


From: patricio <paponcio6 () gmail com>
Date: Wed, 23 Jan 2013 15:00:01 -0300


Em 22/01/2013 12:01, patricio escreveu:
Hi all, I write the following Java code to read snort alerts using 
unixsock.
The problem is that i just can read the alert message. Someone know 
how can i read the entire alert message?

thank you very much.




package com.google.code.juds.test;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder;

import com.google.code.juds.*;

public class TestUnixDomainSocket {

    public static void main(String[] args) throws IOException {


        byte[] b = new byte[1024];

        String socketFile = "/var/log/snort/snort_alert";
        File file = new File(socketFile);
        if (file.exists()){
            file.delete();
        }

        System.out.println("Testcase 2.2: Test UnixDomainSocketServer 
with "
                + "a datagram socket...");
        UnixDomainSocketServer ssocket = new 
UnixDomainSocketServer(socketFile,
                UnixDomainSocket.SOCK_DGRAM);
        System.out.println("Socket created");
        InputStream in;
        String str;


        while(true){
            in = ssocket.getInputStream();

            in.read(b);

            str = new String(b);
            System.out.println("byte-Text received: \"" + str + "\"");
            if(str=="END")break;
        }
        ssocket.unlink();
        ssocket.close();

    }
}




------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
_______________________________________________
Snort-devel mailing list
Snort-devel () lists sourceforge net
https://lists.sourceforge.net/lists/listinfo/snort-devel
Archive:
http://sourceforge.net/mailarchive/forum.php?forum_name=snort-devel

Please visit http://blog.snort.org for the latest news about Snort!


Current thread: