Snort mailing list archives

Re: Some PHP guru on Snort?


From: Chris Adams <chris () improbable org>
Date: Thu, 6 Dec 2001 11:44:19 -0800

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tuesday, December 4, 2001, at 11:51 , Ivan Hernandez Puga wrote:
Now, this is the script:

#***********************************************
<?
        include("config.php");

        $fp = fopen("$logs_path/alert.ids", "r");
        while (!feof($fp)) {
                $sign = fgets($fp,100);
                if (substr($sign,0,4)== "[**]") {
                        $count{$sign}++;
                }
        }
        fclose($fp);
?>
#***********************************************

And the output says:
Warning: Undefined variable: count in c:\program files\apache
group\apache\htdocs\snortscan\x.php on line 8

Warning: Undefined index: [**] [1:1002:2] WEB-IIS cmd.exe access [**] in
c:\program files\apache group\apache\htdocs\snortscan\x.php on line 8

That first error will go away if you declare $count:
        $count = array();

The second one will also go away if you declare the array element before using it: if (!empty($count[$sign])) { $count[$sign]++; } else { $count[$sign] = 1; }

That's ugly, so you might just try this:
        @$count[$sign]++;

(The @ turns off error reporting for that statement)

Chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (Darwin)
Comment: For info see http://www.gnupg.org

iEYEARECAAYFAjwPypcACgkQpwjw3VnGunTlvwCgsP+bVMcIQ7zDQz0CXZku1CmC
qo4AoOBbb3pcYgxl9ACMIIc0XH3QCTuB
=uA6D
-----END PGP SIGNATURE-----


_______________________________________________
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://www.geocrawler.com/redir-sf.php3?list=snort-users


Current thread: