Some changes to upload

This commit is contained in:
mdtrooper 2016-02-15 12:15:16 +01:00
parent 9d2c2049cf
commit 69774bc4e2
2 changed files with 44 additions and 7 deletions

View File

@ -58,8 +58,43 @@ class Networkmap extends Map {
parent::processDBValues($dbValues); parent::processDBValues($dbValues);
} }
protected function generateDot() { protected function generateDot($graph) {
// TODO $graph = preg_replace('/^graph .*/', '', $graph);
$nodes_and_edges = explode("];", $graph);
$nodes = array();
$edges = array();
foreach ($nodes_and_edges as $node_or_edge) {
$node_or_edge = trim($node_or_edge);
$chunks = explode("[", $node_or_edge);
if (strstr($chunk[0], "--") !== false) {
// EDGE
$graphviz_ids = explode("--", $chunk[0]);
$edges[] = array(
'to' => trim($graphviz_ids[0]),
'from' => trim($graphviz_ids[1]));
}
else {
// NODE
$graphviz_id = trim($chunk[0]);
if (strstr($chunk[1], "&id_module=") !== false) {
// MODULE
}
else {
// AGENT
}
}
html_debug($chunks, true);
}
} }
protected function temp_parseParameters_generateDot() { protected function temp_parseParameters_generateDot() {
@ -153,15 +188,17 @@ class Networkmap extends Map {
unlink($filename_dot); unlink($filename_dot);
html_debug($cmd); //~ html_debug($cmd);
html_debug($filename_plain); //~ html_debug($filename_plain);
html_debug(file_get_contents($filename_plain), true); //~ html_debug(file_get_contents($filename_plain), true);
$this->generateDot($graph);
$nodes = networkmap_enterprise_loadfile($this->id, $nodes = networkmap_enterprise_loadfile($this->id,
$filename_plain, $filename_plain,
$relation_nodes, $graph, $relation_nodes, $graph,
$parameters['l2_network_interfaces']); $parameters['l2_network_interfaces']);
html_debug_print($graph); //~ html_debug_print($graph);
//~ html_debug_print($nodes); //~ html_debug_print($nodes);
//~ html_debug_print($relation_nodes); //~ html_debug_print($relation_nodes);

View File

@ -75,7 +75,7 @@ function migration_open_networkmaps() {
} }
$filter['text'] = $old_netw_open['text_filter']; $filter['text'] = $old_netw_open['text_filter'];
$filter['show_pandora_nodes'] = 0; // Only metaconsole $filter['show_pandora_nodes'] = 0; // Only metaconsole
switch ($depth) { switch ($old_netw_open['depth']) {
case 'agents': case 'agents':
$filter['show_modules'] = 0; $filter['show_modules'] = 0;
$filter['show_agents'] = 1; $filter['show_agents'] = 1;