Bluehost.com Web Hosting $6.95

[Snort-users] Alerts on Unix Sockets

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 ...


Go Back   Usenet Forums > System Security and Security Related > Snort

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 09-11-2004
Maicon Melo Alves
 
Posts: n/a
Default [Snort-users] Alerts on Unix Sockets

<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 -&gt; 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
&lt;sys/socket.h&gt;<BR>#include &lt;sys/un.h&gt;<BR>#include
&lt;stdio.h&gt;<BR>#define UNSOCK
"/var/log/snort/snort_alert"<BR>main()<BR>{<BR><SPAN style=3D"mso-spaceru=
n:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>int sock,
length;<BR><SPAN style=3D"mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>struct sockaddr_un
name;<BR><SPAN style=3D"mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>char
buf[1024];<BR><BR><SPAN style=3D"mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>sock =3D
socket(AF_UNIX, SOCK_DGRAM, 0);<BR><SPAN style=3D"mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style=3D"mso-spacerun:
yes">&nbsp;&nbsp;</SPAN>if (sock &lt; 0)<BR><SPAN style=3D"mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<BR><SPAN
style=3D"mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;
</SPAN>perror("opening datagram socket");<BR><SPAN style=3D"mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;
</SPAN>exit(1);<BR><SPAN style=3D"mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<BR><BR><SPAN
style=3D"mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</SPAN>name.sun_family =3D AF_UNIX;<BR><SPAN style=3D"mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>strcpy(name.sun_pa=
th,
NAME);<BR><BR><SPAN style=3D"mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>if (bind(sock,
(struct sockaddr *) &amp;name, sizeof(struct sockaddr_un)))<BR><SPAN
style=3D"mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</SPAN>{<BR><SPAN style=3D"mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;
</SPAN>perror("binding name to datagram socket");<BR><SPAN
style=3D"mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;
</SPAN>exit(1);<BR><SPAN style=3D"mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<BR><BR><SPAN
style=3D"mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</SPAN>printf("socket --&gt;%s\n", NAME);<BR><BR><SPAN style=3D"mso-space=
run:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>while
(recvfrom(sock,buf,1024,0,(struct sockaddr *) &amp;name, sizeof(struct
sockaddr_un) &gt; 0))<BR><SPAN style=3D"mso-spacerun: yes">&nbsp;</SPAN><=
SPAN
style=3D"mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;
</SPAN>printf("--&gt;%s\n", buf);<BR><SPAN style=3D"mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>close(sock);<BR><S=
PAN
style=3D"mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</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>&nbsp;</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
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 04:17 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0