Snort mailing list archives

Snort Unixsock


From: patricio <paponcio6 () gmail com>
Date: Tue, 22 Jan 2013 12:00:53 -0300

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-users mailing list
Snort-users () lists sourceforge net
Go to this URL to change user options or unsubscribe:
https://lists.sourceforge.net/lists/listinfo/snort-users
Snort-users list archive:
http://sourceforge.net/mailarchive/forum.php?forum_name=snort-users

Please visit http://blog.snort.org to stay current on all the latest Snort news!


Current thread: