Fix broken timestamps by using 24 hour clock and ISO 8601 date format

The event view shows a wrong "Last change", e.g. "2018/08/23 06:01:45"
for "2018/08/23 18:01:45".  The same problem affects the timestamp in
the XML generated by IOCExportTool.php.  Fix by correcting the PHP
date() code "h" to "H".

While here, also switch to a clearer ISO 8601 date representation for
"Last change", using dashes instead of slashes for separation of year,
month and day.
pull/3587/head
Daniel Roethlisberger 2018-08-23 18:35:21 +02:00
parent 113fa25471
commit b19e405b32
2 changed files with 2 additions and 2 deletions

View File

@ -55,7 +55,7 @@ class IOCExportTool
{ {
$temp = ''; $temp = '';
// We will start adding all the components that will be in the xml file here // We will start adding all the components that will be in the xml file here
$date = date("Y-m-d\Th:i:s"); $date = date("Y-m-d\TH:i:s");
$temp .= '<?xml version="1.0" encoding="utf-8"?>' . PHP_EOL; $temp .= '<?xml version="1.0" encoding="utf-8"?>' . PHP_EOL;
$temp .= '<ioc xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" id="' . CakeText::uuid() . '" last-modified="' . $date . '" xmlns="http://schemas.mandiant.com/2010/ioc">' . PHP_EOL; $temp .= '<ioc xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" id="' . CakeText::uuid() . '" last-modified="' . $date . '" xmlns="http://schemas.mandiant.com/2010/ioc">' . PHP_EOL;
$temp .= ' <short_description>Filtered indicator list</short_description>' . PHP_EOL; $temp .= ' <short_description>Filtered indicator list</short_description>' . PHP_EOL;

View File

@ -170,7 +170,7 @@
<dd><?php echo h($attribute_count);?></dd> <dd><?php echo h($attribute_count);?></dd>
<dt><?php echo __('Last change');?></dt> <dt><?php echo __('Last change');?></dt>
<dd> <dd>
<?php echo date('Y/m/d h:i:s', $event['Event']['timestamp']);; ?> <?php echo date('Y-m-d H:i:s', $event['Event']['timestamp']);; ?>
&nbsp; &nbsp;
</dd> </dd>
<dt><?php echo __('Extends');?></dt> <dt><?php echo __('Extends');?></dt>