This is a discussion on [Snort-users] Alerts on Unix Sockets within the Snort forums, part of the System Security and Security Related category; <P class=3DMsoPlainText style=3D"MARGIN: 0cm 0cm 0pt"><FONT face=3D"Couri= er ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
<P class=3DMsoPlainText style=3D"MARGIN: 0cm 0cm 0pt"><FONT face=3D"Couri=
er New">Hello list, <BR><BR>I wrote this program to receive the alerts sende= d from the snort by the unix socket. It's working, but I just only receive = the message of the alert. I want to receive, also, the ip destination, ip sou= rce and others informations, like protocol, priority... <BR><BR>I want to receive the same alerts, emmited on the console (with -A console option). <BR><BR>Is it possible?<BR><BR>The simple code, receive correctly the messages alerts. I didn't receive the rest of the information. <BR><BR>Fo= r Example, for the alert relationed with bad-traffic, I receive on console this alert:</FONT></P> <P class=3DMsoPlainText style=3D"MARGIN: 0cm 0cm 0pt"><FONT face=3D"Couri= er New"><B style=3D"mso-bidi-font-weight: normal">Potentially Bad Traffic [Priority: 2] {ICMP} 127.0.0.1 -> 127.0.0.1 .......<BR></B><BR>By the Unix Socket:</FONT></P> <P class=3DMsoPlainText style=3D"MARGIN: 0cm 0cm 0pt"><FONT face=3D"Couri= er New"><B style=3D"mso-bidi-font-weight: normal">BAD-TRAFFIC loopback traffic<BR></B><BR><BR><BR>************************************ **********= ********************<BR>Code:<BR><BR>#include <sys/socket.h><BR>#include <sys/un.h><BR>#include <stdio.h><BR>#define UNSOCK "/var/log/snort/snort_alert"<BR>main()<BR>{<BR><SPAN style=3D"mso-spaceru= n: yes"> </SPAN>int sock, length;<BR><SPAN style=3D"mso-spacerun: yes"> </SPAN>struct sockaddr_un name;<BR><SPAN style=3D"mso-spacerun: yes"> </SPAN>char buf[1024];<BR><BR><SPAN style=3D"mso-spacerun: yes"> </SPAN>sock =3D socket(AF_UNIX, SOCK_DGRAM, 0);<BR><SPAN style=3D"mso-spacerun: yes"> </SPAN><SPAN style=3D"mso-spacerun: yes"> </SPAN>if (sock < 0)<BR><SPAN style=3D"mso-spacerun: yes"> </SPAN>{<BR><SPAN style=3D"mso-spacerun: yes"> &nb sp; &n= bsp; </SPAN>perror("opening datagram socket");<BR><SPAN style=3D"mso-spacerun: yes"> &nb sp; &n= bsp; </SPAN>exit(1);<BR><SPAN style=3D"mso-spacerun: yes"> </SPAN>}<BR><BR><SPAN style=3D"mso-spacerun: yes"> </SPAN>name.sun_family =3D AF_UNIX;<BR><SPAN style=3D"mso-spacerun: yes"> </SPAN>strcpy(name.sun_pa= th, NAME);<BR><BR><SPAN style=3D"mso-spacerun: yes"> </SPAN>if (bind(sock, (struct sockaddr *) &name, sizeof(struct sockaddr_un)))<BR><SPAN style=3D"mso-spacerun: yes"> </SPAN>{<BR><SPAN style=3D"mso-spacerun: yes"> &nb sp; &n= bsp; </SPAN>perror("binding name to datagram socket");<BR><SPAN style=3D"mso-spacerun: yes"> &nb sp; &n= bsp; </SPAN>exit(1);<BR><SPAN style=3D"mso-spacerun: yes"> </SPAN>}<BR><BR><SPAN style=3D"mso-spacerun: yes"> </SPAN>printf("socket -->%s\n", NAME);<BR><BR><SPAN style=3D"mso-space= run: yes"> </SPAN>while (recvfrom(sock,buf,1024,0,(struct sockaddr *) &name, sizeof(struct sockaddr_un) > 0))<BR><SPAN style=3D"mso-spacerun: yes"> </SPAN><= SPAN style=3D"mso-spacerun: yes"> &nb sp; &n= bsp; </SPAN>printf("-->%s\n", buf);<BR><SPAN style=3D"mso-spacerun: yes"> </SPAN>close(sock);<BR><S= PAN style=3D"mso-spacerun: yes"> </SPAN>unlink(NAME);<BR>}<BR><BR><BR>Thank you, <BR><BR>Maicon Melo Alves= .. <?xml:namespace prefix =3D o ns =3D "urn:schemas-microsoft-com:office:off= ice" /><o:p></o:p></FONT></P> <P> </P><BR /> <BR /> ________________________________________________<B R /> Message sent using UebiMiau 2.7.2<BR /> ------------------------------------------------------- This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170 Project Admins to receive an Apple iPod Mini FREE for your judgement on who ports your project to Linux PPC the best. Sponsored by IBM. Deadline: Sept. 13. Go here: http://sf.net/ppc_contest.php _______________________________________________ Snort-users mailing list Snort-users@lists.sourceforge.net Go to this URL to change user options or unsubscribe: https://lists.sourceforge.net/lists/...fo/snort-users Snort-users list archive: http://www.geocrawler.com/redir-sf.p...st=snort-users |