2010-11-04 Ramon Novoa <rnovoa@artica.es>

* godmode/servers/manage_export.php,
	  godmode/servers/manage_export_form.php: Moved to Pandora FMS
	  Enteprise.

	* godmode/menu.php: Removed the export targets menu entry.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3519 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
Ramon Novoa 2010-11-04 16:15:41 +00:00
parent 7fe994164d
commit 789b64829e
4 changed files with 9 additions and 332 deletions

View File

@ -1,3 +1,11 @@
2010-11-04 Ramon Novoa <rnovoa@artica.es>
* godmode/servers/manage_export.php,
godmode/servers/manage_export_form.php: Moved to Pandora FMS
Enteprise.
* godmode/menu.php: Removed the export targets menu entry.
2010-11-04 Miguel de Dios <miguel.dedios@artica.es>
* godmode/users/configure_user.php: fixed lost lines deleted in previous

View File

@ -171,7 +171,7 @@ if (give_acl ($config['id_user'], 0, "PM")) {
$sub["godmode/servers/recon_script"]["text"] = __('Manage recon script');
$sub["godmode/servers/manage_export"]["text"] = __('Export targets');
enterprise_hook('export_target_submenu');
$menu["gservers"]["sub"] = $sub;
}

View File

@ -1,130 +0,0 @@
<?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Load global vars
global $config;
check_login ();
if (! give_acl ($config['id_user'], 0, "PM")) {
pandora_audit("ACL Violation",
"Trying to access Export Server Management");
require ("general/noaccess.php");
exit;
}
$name = (string) get_parameter ("name");
$export_server = (int) get_parameter ("export_server");
$preffix = (string) get_parameter ("preffix");
$interval = (int) get_parameter ("interval");
$ip_server = (string) get_parameter ("ip_server");
$connect_mode = (string) get_parameter ("connect_mode");
$user = (string) get_parameter ("user");
$password = (string) get_parameter ("password");
$port = (string) get_parameter ("port");
$directory = (string) get_parameter ("directory");
$options = (string) get_parameter ("options");
$create = (int) get_parameter ("create");
$delete = (int) get_parameter ("delete");
$update = (int) get_parameter ("update");
// Headers
print_page_header (__('Export targets'), "", false, "", true);
// Update
if ($update) {
$sql = sprintf ("UPDATE tserver_export SET name = '%s', id_export_server = %d,
preffix = '%s', `interval` = %d, ip_server = '%s', connect_mode = '%s',
user = '%s', pass = '%s', port = %d, directory = '%s', options = '%s'
WHERE id = %d",
$name, $export_server, $preffix, $interval, $ip_server, $connect_mode,
$user, $password, $port, $directory, $options, $update);
if (process_sql ($sql) === false) {
echo '<h3 class="error">'.__('Error updating export target').'</h3>';
} else {
echo '<h3 class="suc">'.__('Successfully updated export target').'</h3>';
}
}
// Delete
if ($delete) {
$sql = sprintf("DELETE FROM tserver_export WHERE id = '%d'", $delete);
if (process_sql ($sql) === false) {
echo '<h3 class="error">'.__('Error deleting export target').'</h3>';
} else {
echo '<h3 class="suc">'.__('Successfully deleted export target').'</h3>';
}
}
// Create
if ($create) {
$sql = sprintf ("INSERT INTO tserver_export
(`name`, `id_export_server`, `preffix`, `interval`, `ip_server`, `connect_mode`,
`user`, `pass`, `port`, `directory`, `options`)
VALUES ('%s', %d, '%s', %d, '%s', '%s', '%s', '%s', %d, '%s', '%s')",
$name, $export_server, $preffix, $interval, $ip_server, $connect_mode,
$user, $password, $port, $directory, $options);
if (process_sql ($sql) === false) {
echo '<h3 class="error">'.__('Error creating export target').'</h3>';
} else {
echo '<h3 class="suc">'.__('Successfully created export target').'</h3>';
}
}
$result = get_db_all_rows_in_table ("tserver_export");
if (!$result) {
echo '<div class="nf">'.__('There are no export targets configured').'</div>';
echo '<div class="action-buttons" style="width: 700px">';
echo '<form method="post" action="index.php?sec=gservers&sec2=godmode/servers/manage_export_form&create">';
echo print_submit_button (__('Create'),"crt",false,'class="sub next"',true);
echo '</form>';
echo '</div>';
return;
}
$table->head = array (__('Name'), __('Preffix'), __('Interval'), __('Address'), __('Transfer mode'), __('Action'));
//$table->align = array ("","","","center","","","center","center");
$table->width = 700;
$table->cellpadding = 4;
$table->cellspacing = 4;
$table->class = "databox";
foreach ($result as $row) {
$table->data[] = array (
// Name
'<a href="index.php?sec=gservers&sec2=godmode/servers/manage_export_form&update=' . $row['id'] . '"><b>' . $row['name'] . '</b></a>',
$row['preffix'],
$row['interval'],
$row['ip_server'],
$row['connect_mode'],
// Action
'<a href="index.php?sec=gservers&sec2=godmode/servers/manage_export&delete=' . $row['id'] . '">
<img src="images/cross.png" border="0" /></a>&nbsp;&nbsp;<a href="index.php?sec=gservers&sec2=godmode/servers/manage_export_form&update=' . $row['id'] . '">
<img src="images/config.png" /></a>'
);
}
print_table ($table);
echo '<div class="action-buttons" style="width: 700px">';
echo '<form method="post" action="index.php?sec=gservers&sec2=godmode/servers/manage_export_form&create">';
echo print_submit_button (__('Create'),"crt",false,'class="sub next"',true);
echo '</form>';
echo '</div>';
?>

View File

@ -1,201 +0,0 @@
<?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Load global vars
global $config;
check_login ();
if (! give_acl ($config['id_user'], 0, "PM")) {
pandora_audit("ACL Violation",
"Trying to access Agent Management");
require ("general/noaccess.php");
return;
}
if (isset (get_parameter("update"))) { // Edit mode
$id_rt = (int) get_parameter_get ("update");
$row = get_db_row ("trecon_task","id_rt",$id_rt);
$name = $row["name"];
$network = $row["subnet"];
$id_recon_server = $row["id_recon_server"];
$description = $row["description"];
$interval = $row["interval_sweep"];
$id_group = $row["id_group"];
$create_incident = $row["create_incident"];
$id_network_profile = $row["id_network_profile"];
$id_os = $row["id_os"];
$recon_ports = $row["recon_ports"];
$snmp_community = $row["snmp_community"];
$id_recon_script = $row["id_recon_script"];
$field1 = $row["field1"];
$field2 = $row["field2"];
$field3 = $row["field3"];
$field4 = $row["field4"];
if ($id_recon_script == 0)
$mode = "network_sweep";
else
$mode = "recon_script";
} elseif (isset (get_parameter("create"))) {
$id_rt = -1;
$name = "";
$network = "";
$description = "";
$id_recon_server = 0;
$interval = 43200;
$id_group = 0;
$create_incident = 1;
$snmp_community = "public";
$id_network_profile = 1;
$id_os = -1; // Any
$recon_ports = ""; // Any
$field1 = "";
$field2 = "";
$field3 = "";
$field4 = "";
$id_recon_script = 0;
$mode = "network_sweep";
}
// Headers
print_page_header (__('Manage recontask')." ".print_help_icon ("recontask", true), "", false, "", true);
$table->width=600;
$table->cellspacing=4;
$table->cellpadding=4;
$table->class="databox_color";
$table->rowclass[12] = "recon_script";
$table->rowclass[13] = "recon_script";
$table->rowclass[14] = "recon_script";
$table->rowclass[15] = "recon_script";
// Name
$table->data[0][0] = "<b>".__('Task name')."</b>";
$table->data[0][1] = print_input_text ('name', $name, '', 25, 0, true);
// Recon server
$table->data[1][0] = "<b>".__('Recon server').'<a href="#" class="tip">&nbsp;<span>'.__('You must select a Recon Server for the Task, otherwise the Recon Task will never run').'</span></a>';
$table->data[1][1] = print_select_from_sql ('SELECT id_server, name FROM tserver WHERE server_type = 3 ORDER BY name', "id_recon_server", $id_recon_server, '', '', '', true);
$fields['network_sweep'] = __("Network sweep");
$fields['recon_script'] = __("Custom script");
$table->data[2][0] = "<b>".__('Mode')."</b>";
$table->data[2][1] = print_select ($fields, "mode", $mode, '', '', 0, true);
// Network
$table->data[3][0] = "<b>".__('Network');
$table->data[3][1] = print_input_text ('network', $network, '', 25, 0, true);
// Interval
$values = array ();
$values[3600] = __('%d hour', 1);
$values[7200] = __('%d hours', 2);
$values[21600] = __('%d hours', 6);
$values[43200] = __('%d hours', 12);
$values[86400] = __('%d day', 1);
$values[432000] = __('%d days', 5);
$values[604800] = __('%d week', 1);
$values[1209600] = __('%d weeks', 2);
$values[2592000] = __('%d month', 1);
$table->data[4][0] = "<b>".__('Interval');
$table->data[4][1] = print_select ($values, "interval", $interval, '', '', '', true);
// Module template
$table->data[5][0] = "<b>".__('Module template');
$table->data[5][1] = print_select_from_sql ('SELECT id_np, name FROM tnetwork_profile',
"id_network_profile", $id_network_profile, '', '', '', true);
// Recon script
$table->data[6][0] = "<b>".__('Recon script');
$table->data[6][1] = print_select_from_sql ('SELECT id_recon_script, name FROM trecon_script', "id_recon_script", $id_recon_script, '', '', '', true);
// OS
$table->data[7][0] = "<b>".__('OS');
$table->data[7][1] = print_select_from_sql ('SELECT id_os, name FROM tconfig_os ORDER BY name',
"id_os", $id_os, '', __('Any'), -1, true);
// Recon ports
$table->data[8][0] = "<b>".__('Ports');
$table->data[8][1] = print_input_text ('recon_ports', $recon_ports, '', 25, 0, true);
$table->data[8][1] .= '<a href="#" class="tip">&nbsp;<span>'.__('Ports defined like: 80 or 80,443,512 or even 0-1024 (Like Nmap command line format). If dont want to do a sweep using portscan, left it in blank').'</span></a>';
// Group
$table->data[9][0] = "<b>".__('Group');
$groups = get_user_groups (false, "AR", false);
$table->data[9][1] = print_select_groups(false, "AR", false, 'id_group', $id_group, '', '', 0, true);
// Incident
$values = array (0 => __('No'), 1 => __('Yes'));
$table->data[10][0] = "<b>".__('Incident');
$table->data[10][1] = print_select ($values, "create_incident", $create_incident,
'','','',true);
// SNMP default community
$table->data[11][0] = "<b>".__('SNMP Default community');
$table->data[11][1] = print_input_text ('snmp_community', $snmp_community, '', 35, 0, true);
// Field1
$table->data[12][0] = "<b>".__('Script field #1');
$table->data[12][1] = print_input_text ('field1', $field1, '', 40, 0, true);
// Field2
$table->data[13][0] = "<b>".__('Script field #2');
$table->data[13][1] = print_input_text ('field2', $field2, '', 40, 0, true);
// Field3
$table->data[14][0] = "<b>".__('Script field #3');
$table->data[14][1] = print_input_text ('field3', $field3, '', 40, 0, true);
// Field4
$table->data[15][0] = "<b>".__('Script field #4');
$table->data[15][1] = print_input_text ('field4', $field4, '', 40, 0, true);
// Comments
$table->data[16][0] = "<b>".__('Comments');
$table->data[16][1] = print_input_text ('description', $description, '', 45, 0, true);
// Different Form url if it's a create or if it's a update form
echo '<form name="modulo" method="post" action="index.php?sec=gservers&sec2=godmode/servers/manage_recontask&'.(($id_rt != -1) ? 'update='.$id_rt : 'create=1').'">';
print_table ($table);
echo '<div class="action-buttons" style="width: 620px">';
if ($id_rt != -1)
print_submit_button (__('Update'), "crt", false, 'class="sub upd"');
else
print_submit_button (__('Add'), "crt", false, 'class="sub wand"');
echo "</div>";
echo "</form>";
?>
<script type="text/javascript">
/* <![CDATA[ */
$(document).ready (function () {
alert("perro");
});
/* ]]> */
</script>