'noaccess']); } include 'general/noaccess.php'; exit; } // Set baseUrl for use it in several locations in this class. $this->baseUrl = ui_get_full_url('index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=agent_wizard'); // Capture all parameters before start. $this->ajaxController = $ajax_controller; $this->wizardSection = get_parameter('wizard_section', ''); $this->idAgent = get_parameter('id_agente', ''); return $this; } /** * Run main page. * * @return void */ public function run() { // CSS. ui_require_css_file('wizard'); ui_require_css_file('discovery'); // Javascript. // ui_require_javascript_file('jquery.caret.min'); $this->loadMainForm(); $this->performWizard(); // Load integrated JS $this->loadJS(); } /** * Common Main Wizard form * * @return void */ private function loadMainForm() { // Define name of explorer button switch ($this->wizardSection) { case 'snmp_explorer': case 'snmp_interfaces_explorer': // Define labels. $this->actionType = 'snmp'; $this->actionLabel = __('SNMP Walk'); // Fill with servers to perform SNMP walk. $fieldsServers = []; $fieldsServers[0] = __('Local console'); if (enterprise_installed()) { enterprise_include_once('include/functions_satellite.php'); // Get the servers. $rows = get_proxy_servers(); // Check if satellite server has remote configuration enabled. $satellite_remote = config_agents_has_remote_configuration($this->idAgent); // Generate a list with allowed servers. foreach ($rows as $row) { if ($row['server_type'] == 13) { $id_satellite = $row['id_server']; $serverType = ' (Satellite)'; } else { $serverType = ' (Standard)'; } $fieldsServers[$row['id_server']] = $row['name'].$serverType; } } // Fill with SNMP versions allowed. $fieldsVersions = [ '1' => '1', '2' => '2', '2c' => '2c', '3' => '3', ]; break; case 'wmi_explorer': $this->actionType = 'wmi'; $this->actionLabel = __('WMI Explorer'); break; default: $this->actionType = 'none'; $this->actionLabel = __('Nothing'); exit; break; } // Main form. $form = [ 'action' => '', // 'action' => $this->baseUrl, 'id' => 'main_wizard_form', 'method' => 'POST', ]; // Inputs. $inputs = []; $inputs[] = [ 'id' => 'hdn-type-action', 'arguments' => [ 'name' => 'type-action', 'type' => 'hidden', 'value' => $this->actionType, 'return' => true, ], ]; $inputs[] = [ 'label' => __('Target IP'), 'id' => 'txt-target-ip', 'arguments' => [ 'name' => 'target-ip', 'input_class' => 'flex-row', 'type' => 'text', 'class' => '', 'return' => true, ], ]; $inputs[] = [ 'label' => __('Port'), 'id' => 'txt-target-port', 'arguments' => [ 'name' => 'target-port', 'input_class' => 'flex-row', 'type' => 'text', 'size' => '20', 'class' => '', 'return' => true, ], ]; if ($this->actionType === 'snmp') { $inputs[] = [ 'label' => __('Use agent IP'), 'id' => 'txt-use-agent-ip', 'arguments' => [ 'name' => 'use-agent-ip', 'input_class' => 'flex-row', 'type' => 'checkbox', 'class' => '', 'return' => true, ], ]; } if ($this->actionType === 'wmi') { $inputs[] = [ 'label' => __('Namespace'), 'id' => 'txt-namespace', 'arguments' => [ 'name' => 'namespace', 'input_class' => 'flex-row', 'type' => 'text', 'class' => '', 'return' => true, ], ]; $inputs[] = [ 'label' => __('Username'), 'id' => 'txt-username', 'arguments' => [ 'name' => 'username', 'input_class' => 'flex-row', 'type' => 'text', 'class' => '', 'return' => true, ], ]; $inputs[] = [ 'label' => __('Password'), 'id' => 'txt-password', 'arguments' => [ 'name' => 'password', 'input_class' => 'flex-row', 'type' => 'text', 'class' => '', 'return' => true, ], ]; } $inputs[] = [ 'label' => __('Server to execute command'), 'id' => 'txt-target-port', 'arguments' => [ 'name' => 'target-port', 'input_class' => 'flex-row', 'type' => 'select', 'fields' => $fieldsServers, 'class' => '', 'return' => true, ], ]; if ($this->actionType === 'snmp') { $inputs[] = [ 'label' => __('SNMP community'), 'id' => 'txt-snmp-community', 'arguments' => [ 'name' => 'snmp-community', 'input_class' => 'flex-row', 'type' => 'text', 'size' => '20', 'class' => '', 'return' => true, ], ]; $inputs[] = [ 'label' => __('SNMP version'), 'id' => 'txt-snmnp-version', 'arguments' => [ 'name' => 'snmnp-version', 'input_class' => 'flex-row', 'type' => 'select', 'fields' => $fieldsVersions, 'class' => '', 'return' => true, ], ]; } $inputs[] = [ 'arguments' => [ 'label' => $this->actionLabel, 'name' => 'action', 'type' => 'submit', 'attributes' => 'class="sub next" onclick="performAction();return false;"', 'return' => true, ], ]; $output = '