mysql表的输出为
mysql> desc alienvault_siem.po_acid_event;
+------------+------------------+------+-----+------------------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------+------------------+------+-----+------------------+-------+
| ctx | binary(16) | NO | PRI | NULL | |
| device_id | int(10) unsigned | NO | PRI | NULL | |
| plugin_id | int(10) unsigned | NO | PRI | NULL | |
| plugin_sid | int(10) unsigned | NO | PRI | NULL | |
| ip_src | varbinary(16) | NO | PRI | NULL | |
| ip_dst | varbinary(16) | NO | PRI | NULL | |
| timestamp | datetime | NO | PRI | NULL | |
| src_host | binary(16) | NO | PRI | | |
| dst_host | binary(16) | NO | PRI | | |
| src_net | binary(16) | NO | PRI | | |
| dst_net | binary(16) | NO | PRI | | |
| cnt | int(10) unsigned | NO | | 0 | |
+------------+------------------+------+-----+------------------+-------+
12 rows in set (0.00 sec)
我对src_host
感兴趣。在php中,我的代码如下:
.....
$sqlgraph = "select count(distinct plugin_id, plugin_sid) as num_events,ip_src, hex(src_host) as name from alienvault_siem.po_acid_event AS acid_event WHERE 1=1 $query_where group by name having ip_src>0x00000000000000000000000000000000 order by num_events desc limit $limit";
$rg = $conn->CacheExecute($sqlgraph);
if (!$rg)
{
print $conn->ErrorMsg();
}
else
{
while (!$rg->EOF)
{
$data[] = $rg->fields["num_events"];
$label[] = $rg->fields["name"];
$links[] = $forensic_link . '&ip_addr[0][0]=+&ip_addr[0][1]=ip_src&ip_addr[0][2]=%3D&ip_addr[0][3]=' . inet_ntop($rg->fields["name"]) . '&ip_addr[0][8]=+&ip_addr[0][9]=+&ip_addr_cnt=1';
$rg->MoveNext();
}
}
$colors = get_widget_colors(count($data));
break;
实际上src_host
包含例如
alienvault
主持人-10-27-0-23
我想知道如何将其显示为asci字符串,而不是十六进制十进制或二进制。谢谢