ossec / ossec-wui

OSSEC Web User Interface - Unmaintained!!
Other
163 stars 87 forks source link

search.php and stats.php stats epoch time #26

Open ummeegge opened 5 years ago

ummeegge commented 5 years ago

Hi all, i know that the Ossec WebUI project is currently dead, i would nevertheless post a solution for the above mentioned problem. Since we tried the WebUI again out in the IPFire project --> https://forum.ipfire.org/viewtopic.php?f=50&p=125255#p125255 we discovered the problem that the stats.php and the search.php starts the time ranges at 1970 (epoch time) we find a work around with this diff:

--- /srv/web/ossec.orig/site/search.php 2019-06-10 12:58:12.516654796 +0200
+++ /srv/web/ossec/site/search.php  2019-06-10 12:48:30.129985517 +0200
@@ -28,7 +28,7 @@

 /* Initializing some variables */
-$u_final_time = time(0);
+$u_final_time = time();
 $u_init_time = $u_final_time - $ossec_search_time;
 $u_level = $ossec_search_level;
 $u_pattern = "";
diff -Nur /srv/web/ossec.orig/site/stats.php /srv/web/ossec/site/stats.php
--- /srv/web/ossec.orig/site/stats.php  2019-06-10 12:58:12.516654796 +0200
+++ /srv/web/ossec/site/stats.php   2019-06-10 12:48:30.106652183 +0200
@@ -29,7 +29,7 @@

 /* Current date values */
-$curr_time = time(0);
+$curr_time = time();
 $curr_day = date('d',$curr_time);
 $curr_month = date('m', $curr_time);
 $curr_year = date('Y', $curr_time);

We are using: $ php -v PHP 7.3.6 (cli) (built: Jun 8 2019 13:33:53) ( ZTS DEBUG ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.3.6, Copyright (c) 1998-2018 Zend Technologies

Not sure if this might be a help for others. Would like to say a big thanks to the Ossec project and also to the done work for the WebUI .

Best regards,

Erik