Bluehost.com Web Hosting $6.95

RE: [Snort-users] clearing logs in acid console

This is a discussion on RE: [Snort-users] clearing logs in acid console within the Snort forums, part of the System Security and Security Related category; This is a multi-part message in MIME format. ------=_NextPart_000_0000_01C4A086.F4B71EC0 Content-Type: text/plain; charset="iso-8859-1&...


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-22-2004
 
Posts: n/a
Default RE: [Snort-users] clearing logs in acid console

This is a multi-part message in MIME format.

------=_NextPart_000_0000_01C4A086.F4B71EC0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

I'm using the following script to delete events from snort database.
Use it at your own risk.=20
Before use it do a backup of the database with: mysqldump -opt
snort_database > /backup/snort_backup

Hope this helps.

#!/bin/bash
#
# Script to delete old data from the snort sql database.

# NOTE! Before you can use this script, you must change the defines
# in the following lines to match those at your company.
#
# A few constants needed. User with R/W privileges to snort database.
MYUSER=3D"database_user"
MYPASS=3D"password"
SNORTDB=3D"snort_database"
# Now define the public IP address ranges used by your company.
# If you have more than one discontiguous range, you'll need to edit
# the SQL generation code lower down in this script. It's not hard to =
do.
IPLOW=3D"192.168.0.0"
IPHIGH=3D"192.168.0.254"

function usage() {
cat <<EOF >&2
Usage: $0 [ -<options> ] hours

Deletes old data in the snort database, keeping entries received within
the past <hours>. You can limit the data deleted by signature or ip,
using the specified options.

Options:
-b Debug SQL - Prints executed SQL to stderr
-d Use destination IP with -r or -i; default is =
source.
-i "ip" Have the given source IP exclusive of -r.
-n Don't actually do anything; just look up data.
-o Optimize the tables after deleting.
-r Remote source IPs only (incoming, not outgoing).
-s "x" Signature must be like '%x%'
EOF
}

if TEMP=3D`getopt -o bdi:nors: -n "$0" -- "$@"`; [ $? -ne 0 ]; then
usage; exit 1
fi

eval set -- "$TEMP"

LIKE=3D""; REMOTES=3D""; IP=3D""; SRCDST=3D"ip_src"; NOEXEC=3D""; =
DBG=3D""; OPTIM=3D""
while true ; do
if [ "$1" =3D "-b" ]; then DBG=3D1; shift
elif [ "$1" =3D "-d" ]; then SRCDST=3D"ip_dst"; shift
elif [ "$1" =3D "-i" ]; then IP=3D"$2"; shift 2
elif [ "$1" =3D "-n" ]; then NOEXEC=3D1; shift
elif [ "$1" =3D "-o" ]; then OPTIM=3D1; shift
elif [ "$1" =3D "-r" ]; then REMOTES=3D1; shift
elif [ "$1" =3D "-s" ]; then LIKE=3D"$2"; shift 2
elif [ "$1" =3D "--" ]; then shift; break
else echo "Internal getopt error?" >&2; exit 2
fi
done
if [ $# -ne 1 ]; then
usage; exit 1
elif [ -n "$IP" -a -n "$REMOTES" ]; then
echo -e "\n\nCannot specify both -i and -r.\n" >&2
usage; exit 1
elif HOURS=3D"$1"; ! echo "$HOURS" | grep -q '^[0-9]\+$'; then
echo -e "\n\nThe <Hours> argument must be a non-negative integer.\n" =
>&2

usage; exit 1
elif [ -z "$IP" -a -z "$REMOTES" -a -z "$LIKE" -a $(($HOURS+0)) =3D 0 ]; =
then
echo -e "\n\nMust specify at least one of either -i, -r or -s" >&2
echo -e "when the <hours> argument is zero (else delete entire =
DB!).\n"
>&2

usage; exit 1
fi

function makequery () {
local wa=3D"WHERE"
echo -n "SELECT event.sid, event.cid FROM "
if [ -n "$IP$REMOTES" ]; then echo -n "iphdr, "; fi
if [ -n "$LIKE" ]
then echo -n "signature, event"
else echo -n "event"
fi
if [ $HOURS -gt 0 ]; then
echo -en "\n $wa event.timestamp < NOW() - INTERVAL '$HOURS' =
HOUR"
wa=3D"AND"
fi
if [ -n "$LIKE" ]; then
if ! echo "$LIKE" | grep -q '%'; then
LIKE=3D"%${LIKE}%"
fi
echo -e "\n $wa signature.sig_name LIKE '$LIKE'"
echo -n " AND signature.sig_id =3D event.signature"; =
wa=3D"AND"
fi
if [ -n "$IP" ]; then
echo -e "\n $wa iphdr.$SRCDST =3D INET_ATON('$IP')"
elif [ -n "$REMOTES" ]; then
cat <<EOF

$wa iphdr.$SRCDST NOT BETWEEN INET_ATON('$IPLOW')
AND INET_ATON('$IPHIGH')
AND iphdr.$SRCDST NOT BETWEEN INET_ATON('10.0.0.0')
AND INET_ATON('10.255.255.255')
AND iphdr.$SRCDST NOT BETWEEN INET_ATON('192.168.0.0')
AND INET_ATON('192.168.255.255')
AND iphdr.$SRCDST NOT BETWEEN INET_ATON('172.0.0.0')
AND INET_ATON('172.255.255.255')
AND iphdr.$SRCDST NOT BETWEEN INET_ATON('65.88.87.64')
AND INET_ATON('65.88.87.127')
EOF
fi
if [ -n "$IP$REMOTES" ]
then echo " AND iphdr.sid =3D event.sid AND iphdr.cid =3D =
event.cid;"
else echo ";"
fi
}

# This takes the output of makequery, pipes it through mysql to get the
# list of rows to delete, generates the delete statements for each =
table,
# then optionally adds optimize commands.
function makesql () {
local rhs table
rhs=3D's%^\([0-9]\+\)[[:space:]]\+\([0-9]\+\)$%\
'
for table in data event icmphdr tcphdr udphdr iphdr opt; do
rhs=3D"${rhs}DELETE FROM $table WHERE sid=3D'\1' AND cid=3D'\2';\\
"
done
rhs=3D"$rhs%"
makequery | mysql --user=3D"$MYUSER" --password=3D"$MYPASS" -s -B =
"$SNORTDB"
|\
sed -e "$rhs"
if [ -n "$OPTIM" ]; then
# Order tables by approximate size.
for table in icmphdr udphdr opt event tcphdr iphdr data; do
echo "OPTIMIZE TABLE $table;"
done
fi
}

################################################## #######################=

# =
#
# Run the query and output the results... =
#
# =
#
################################################## #######################=


if [ -n "$DBG" ]; then
echo -e "\nSQL Query:\n" >&2; makequery >&2; echo >&2
fi

if [ -n "$NOEXEC" ]
then makesql
else makesql | mysql --user=3D"$MYUSER" --password=3D"$MYPASS" =
"$SNORTDB"=20


Thank you,
___________________________
Catalin A. Ghercoias
WEB/Network Security Administrator=20
Office Phone: +(518) 452-1242 Ext.7435
Fax: (518) 452-4768


-----Original Message-----
From: snort-users-admin@lists.sourceforge.net
[mailto:snort-users-admin@lists.sourceforge.net] On Behalf Of Jose Maria
Lopez
Sent: Tuesday, September 21, 2004 8:05 AM
To: snort-users@lists.sourceforge.net
Subject: RE: [Snort-users] clearing logs in acid console

El vie, 17 de 09 de 2004 a las 20:37, support escribi=F3:
> Hi jose
>=20
> Thanks for your help
>=20
> But I am facing problem if snort is that the /usr partition is going=20
> 100% utilized becoz of which acid console is not showing any new=20
> alerts . can u tell me how and which files to delete from this=20
> partition in order to work out.
>=20
> Regards,
> raj


You could delete the whole snort directory under the mysql directory, =
but
then you will have to create the tables for snort and acid from new. =
Check
this directory and see if you can delete it safely and create the tables =
for
acid from new.

Maybe someone can give you better advice.

--
Jose Maria Lopez Hernandez
Director Tecnico de bgSEC
jkerouac@bgsec.com
bgSEC Seguridad y Consultoria de Sistemas Informaticos =
http://www.bgsec.com
ESPA=D1A

The only people for me are the mad ones -- the ones who are mad to live, =
mad
to talk, mad to be saved, desirous of everything at the same time, the =
ones
who never yawn or say a commonplace thing, but burn, burn, burn like
fabulous yellow Roman candles.
-- Jack Kerouac, "On the Road"



-------------------------------------------------------
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. 24. 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.php3?listort-users


------=_NextPart_000_0000_01C4A086.F4B71EC0
Content-Type: application/x-pkcs7-signature;
name="smime.p7s"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="smime.p7s"

MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCS qGSIb3DQEHAQAAoIILoTCCBNEw
ggO5oAMCAQICEF0RwlS/WpmpShXtwA/IalwwDQYJKoZIhvcNAQEFBQAwUjETMBEGCgmSJomT8ixk
ARkWA2NvbTEUMBIGCgmSJomT8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wDgYIKoZIhvcNAw ICAgCAMA0GCCqGSIb3DQMCAgFA
MAcGBSsOAwIHMA0GCCqGSIb3DQMCAgEoMAcGBSsOAwIaMAoGCC qGSIb3DQIFMG8GCSsGAQQBgjcQ
BDFiMGAwUjETMBEGCgmSJomT8ixkARkWA2NvbTEUMBIGCgmSJo mT8ixkARkWBHR3ZWMxJTAjBgNV
BAMTHFRyYW5zIFdvcmxkIEVudGVydGFpbm1lbnQgQ0ECChdGJt AAAAAAAXIwcQYLKoZIhvcNAQkQ
AgsxYqBgMFIxEzARBgoJkiaJk/IsZAEZFgNjb20xFDASBgoJkiaJk/IsZAEZFgR0d2VjMSUwIwYD
VQQDExxUcmFucyBXb3JsZCBFbnRlcnRhaW5tZW50IENBAgoXRi bQAAAAAAFyMA0GCSqGSIb3DQEB
AQUABIGAeT0OtjMEkVJTvBIKc90Vb8b6dKMxmYGG62L0+ncYRc O/FybV/c0UtfB/Uhw0uxew3HZC
/Rd49Rg12YIGw+/qDtkVJKgfOLHTbQ/+uRAq//t4nR7c1WzIdEfRGcIH+raz/t65gjYvYQYt0ctn
87ZFzRAKf7SL/aOYDxudU9VJBvMAAAAAAAA=

------=_NextPart_000_0000_01C4A086.F4B71EC0--


-------------------------------------------------------
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. 24. 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:19 AM.


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