From 69774bc4e29dfda5f353345e2e987f445cd8c3d7 Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Mon, 15 Feb 2016 12:15:16 +0100 Subject: [PATCH] Some changes to upload --- .../include/class/Networkmap.class.php | 49 ++++++++++++++++--- .../include/functions_migration.php | 2 +- 2 files changed, 44 insertions(+), 7 deletions(-) diff --git a/pandora_console/include/class/Networkmap.class.php b/pandora_console/include/class/Networkmap.class.php index e3aff5a04b..598c76f95d 100644 --- a/pandora_console/include/class/Networkmap.class.php +++ b/pandora_console/include/class/Networkmap.class.php @@ -58,8 +58,43 @@ class Networkmap extends Map { parent::processDBValues($dbValues); } - protected function generateDot() { - // TODO + protected function generateDot($graph) { + $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() { @@ -153,15 +188,17 @@ class Networkmap extends Map { unlink($filename_dot); - html_debug($cmd); - html_debug($filename_plain); - html_debug(file_get_contents($filename_plain), true); + //~ html_debug($cmd); + //~ html_debug($filename_plain); + //~ html_debug(file_get_contents($filename_plain), true); + + $this->generateDot($graph); $nodes = networkmap_enterprise_loadfile($this->id, $filename_plain, $relation_nodes, $graph, $parameters['l2_network_interfaces']); - html_debug_print($graph); + //~ html_debug_print($graph); //~ html_debug_print($nodes); //~ html_debug_print($relation_nodes); diff --git a/pandora_console/include/functions_migration.php b/pandora_console/include/functions_migration.php index a5cb2f09ff..714fb8b3d0 100644 --- a/pandora_console/include/functions_migration.php +++ b/pandora_console/include/functions_migration.php @@ -75,7 +75,7 @@ function migration_open_networkmaps() { } $filter['text'] = $old_netw_open['text_filter']; $filter['show_pandora_nodes'] = 0; // Only metaconsole - switch ($depth) { + switch ($old_netw_open['depth']) { case 'agents': $filter['show_modules'] = 0; $filter['show_agents'] = 1;