diff --git a/pandora_console/godmode/groups/credential_store.php b/pandora_console/godmode/groups/credential_store.php index 9a822dc986..8c9540d581 100644 --- a/pandora_console/godmode/groups/credential_store.php +++ b/pandora_console/godmode/groups/credential_store.php @@ -534,8 +534,8 @@ echo ''; $('#div-extra_1').hide(); $('#div-extra_2').hide(); } else if ($('#product :selected').val() == "AZURE") { - $('#div-username label').text(''); - $('#div-password label').text(''); + $('#div-username label').text(''); + $('#div-password label').text(''); $('#div-extra_1 label').text(''); $('#div-extra_2 label').text(''); $('#div-extra_1').show(); diff --git a/pandora_console/godmode/wizards/DiscoveryTaskList.class.php b/pandora_console/godmode/wizards/DiscoveryTaskList.class.php index e018ec3d30..586f24335b 100644 --- a/pandora_console/godmode/wizards/DiscoveryTaskList.class.php +++ b/pandora_console/godmode/wizards/DiscoveryTaskList.class.php @@ -501,41 +501,60 @@ class DiscoveryTaskList extends Wizard $data[5] = __('Pending'); } - if ($task['id_recon_script'] == 0) { - // Internal discovery task. - switch ($task['type']) { - case DISCOVERY_CLOUD_AWS_RDS: - // Discovery Applications MySQL. - $data[6] = html_print_image( - 'images/network.png', - true, - ['title' => __('Discovery Cloud RDS')] - ).' '; - $data[6] .= __('Discovery.Cloud.Aws.RDS'); - break; + switch ($task['type']) { + case DISCOVERY_CLOUD_AZURE_COMPUTE: + // Discovery Applications MySQL. + $data[6] = html_print_image( + 'images/plugin.png', + true, + ['title' => __('Discovery Cloud Azure Compute')] + ).' '; + $data[6] .= __('Cloud.Azure.Compute'); + break; - case DISCOVERY_APP_MYSQL: - // Discovery Applications MySQL. - $data[6] = html_print_image( - 'images/network.png', - true, - ['title' => __('Discovery Applications MySQL')] - ).' '; - $data[6] .= __('Discovery.App.MySQL'); - break; + case DISCOVERY_CLOUD_AWS_EC2: + // Discovery Applications MySQL. + $data[6] = html_print_image( + 'images/plugin.png', + true, + ['title' => __('Discovery Cloud AWS EC2')] + ).' '; + $data[6] .= __('Cloud.AWS.EC2'); + break; - case DISCOVERY_APP_ORACLE: - // Discovery Applications Oracle. - $data[6] = html_print_image( - 'images/network.png', - true, - ['title' => __('Discovery Applications Oracle')] - ).' '; - $data[6] .= __('Discovery.App.Oracle'); - break; + case DISCOVERY_CLOUD_AWS_RDS: + // Discovery Cloud RDS. + $data[6] = html_print_image( + 'images/network.png', + true, + ['title' => __('Discovery Cloud RDS')] + ).' '; + $data[6] .= __('Discovery.Cloud.Aws.RDS'); + break; - case DISCOVERY_HOSTDEVICES: - default: + case DISCOVERY_APP_MYSQL: + // Discovery Applications MySQL. + $data[6] = html_print_image( + 'images/network.png', + true, + ['title' => __('Discovery Applications MySQL')] + ).' '; + $data[6] .= __('Discovery.App.MySQL'); + break; + + case DISCOVERY_APP_ORACLE: + // Discovery Applications Oracle. + $data[6] = html_print_image( + 'images/network.png', + true, + ['title' => __('Discovery Applications Oracle')] + ).' '; + $data[6] .= __('Discovery.App.Oracle'); + break; + + case DISCOVERY_HOSTDEVICES: + default: + if ($task['id_recon_script'] == 0) { // Discovery NetScan. $data[6] = html_print_image( 'images/network.png', @@ -550,15 +569,15 @@ class DiscoveryTaskList extends Wizard } else { $data[6] .= __('Discovery.NetScan'); } - break; - } - } else { - // APP recon task. - $data[6] = html_print_image( - 'images/plugin.png', - true - ).' '; - $data[6] .= $recon_script_name; + } else { + // APP or external script recon task. + $data[6] = html_print_image( + 'images/plugin.png', + true + ).' '; + $data[6] .= $recon_script_name; + } + break; } if ($task['status'] <= 0 || $task['status'] > 100) { @@ -699,7 +718,16 @@ class DiscoveryTaskList extends Wizard if ($script !== false) { switch ($script['type']) { case DISCOVERY_SCRIPT_CLOUD_AWS: - return 'wiz=cloud&mode=amazonws&ki='.$task['auth_strings'].'&page=1'; + switch ($task['type']) { + case DISCOVERY_CLOUD_AWS_EC2: + return 'wiz=cloud&mode=amazonws&ki='.$task['auth_strings'].'&page=1'; + + case DISCOVERY_CLOUD_AZURE_COMPUTE: + return 'wiz=cloud&mode=azure&ki='.$task['auth_strings'].'&sub=compute&page=0'; + + default: + return 'wiz=cloud'; + } case DISCOVERY_SCRIPT_APP_VMWARE: return 'wiz=app&mode=vmware&page=0'; diff --git a/pandora_console/include/constants.php b/pandora_console/include/constants.php index 6edfdf1f70..c0a03ea34d 100644 --- a/pandora_console/include/constants.php +++ b/pandora_console/include/constants.php @@ -582,6 +582,7 @@ define('DISCOVERY_APP_MYSQL', 4); define('DISCOVERY_APP_ORACLE', 5); define('DISCOVERY_CLOUD_AWS_EC2', 6); define('DISCOVERY_CLOUD_AWS_RDS', 7); +define('DISCOVERY_CLOUD_AZURE_COMPUTE', 8); // Discovery types matching definition. @@ -594,6 +595,7 @@ define('DISCOVERY_SCRIPT_IPAM_RECON', 3); define('DISCOVERY_SCRIPT_IPMI_RECON', 4); // Discovery task descriptions. +define('CLOUDWIZARD_AZURE_DESCRIPTION', 'Discovery.Cloud.Azure.Compute'); define('CLOUDWIZARD_AWS_DESCRIPTION', 'Discovery.Cloud.AWS.EC2'); define('CLOUDWIZARD_VMWARE_DESCRIPTION', 'Discovery.App.VMware'); diff --git a/pandora_console/include/functions_credential_store.php b/pandora_console/include/functions_credential_store.php index cf09e6d67b..eaf756f7b1 100644 --- a/pandora_console/include/functions_credential_store.php +++ b/pandora_console/include/functions_credential_store.php @@ -72,6 +72,10 @@ function credentials_get_all( throw new Exception('[credential_get_all] Fields must be an array or "count".'); } + if (isset($filter['product']) && !empty($filter['product'])) { + $sql_filters[] = sprintf(' AND cs.product = "%s"', $filter['product']); + } + if (isset($filter['free_search']) && !empty($filter['free_search'])) { $sql_filters[] = vsprintf( ' AND (lower(cs.username) like lower("%%%s%%") @@ -163,7 +167,7 @@ function credentials_get_all( %s %s', join(',', $fields), - join(',', $sql_filters), + join(' ', $sql_filters), $order_by, $pagination ); @@ -292,8 +296,8 @@ function print_inputs($values=null) 'script' => 'calculate_inputs()', 'fields' => [ // 'CUSTOM' => __('Custom'), - 'AWS' => __('Aws'), - // 'AZURE' => __('Azure'), + 'AWS' => __('Aws'), + 'AZURE' => __('Azure'), // 'GOOGLE' => __('Google'), ], 'selected' => $values['product'], @@ -319,7 +323,7 @@ function print_inputs($values=null) case 'AZURE': $user_label = __('Account ID'); - $pass_label = __('Password'); + $pass_label = __('Application secret'); $extra_1_label = __('Tenant or domain name'); $extra_2_label = __('Subscription id'); break; @@ -358,7 +362,7 @@ function print_inputs($values=null) 'label' => $extra_1_label, 'name' => 'extra_1', 'input_class' => 'flex-row', - 'type' => 'password', + 'type' => 'text', 'value' => $values['extra_1'], 'return' => true, ] @@ -371,7 +375,7 @@ function print_inputs($values=null) 'label' => $extra_2_label, 'name' => 'extra_2', 'input_class' => 'flex-row', - 'type' => 'password', + 'type' => 'text', 'value' => $values['extra_2'], 'return' => true, 'display' => $extra2, diff --git a/pandora_console/include/functions_snmp_browser.php b/pandora_console/include/functions_snmp_browser.php index dded175af5..dc423481f2 100644 --- a/pandora_console/include/functions_snmp_browser.php +++ b/pandora_console/include/functions_snmp_browser.php @@ -96,7 +96,6 @@ function snmp_browser_get_html_tree( foreach ($tree['__LEAVES__'] as $level => $sub_level) { // Id used to expand leafs. $sub_id = time().rand(0, getrandmax()); - // Display the branch. $output .= '