function formprint($nessus_id, $field, $vname, $type, $default, $value, $dbconn) { # Commenting this out as there is no nessus_nkb table in 0.22 #$field = getKBURL($dbconn, $field, $nessus_id); # The pseudocode below will load a default value for an undefined field # to help make it easier for new fields to be added into the structure # $retstr = ""; if (is_null($value) || $value == "") { if ($type == "R") { $value = explode(";", $default); $value = $value[0]; } else { $value = $default; } } if ($type == "C") { # Checkbox code here $retstr = "<tr><td style='text-align:left;width:65%'>{$field}</td><td><INPUT type=\"checkbox\" name=\"{$vname}\" value=\"yes\""; if ($value == "yes") { $retstr .= " checked"; } $retstr .= "></td></tr>"; } elseif ($type == "R") { # Radio button code here $retstr = "<tr><td style='text-align:left;width:65%'>{$field}</td><td>"; $array = explode(";", $default); foreach ($array as $myoption) { $retstr .= "<INPUT type=\"radio\" name=\"{$vname}\" value=\"" . trim($myoption) . "\""; if ($value == $myoption) { $retstr .= " checked"; } $retstr .= "> {$myoption} </option> "; } $retstr .= "</td></tr>"; } elseif ($type == "P") { # Password code here #$retstr="$nessus_id $field <INPUT type=\"password\" name=\"$vname\" value=\"$value\"><BR>"; $value = Util::fake_pass($value); $retstr = "<tr><td style='text-align:left;width:65%'>{$field}</td><td><input type=\"password\" name=\"{$vname}\" value=\"{$value}\"></td></tr>"; } else { # Assume it is a text box $sufix = preg_match("/\\[file\\]/", $nessus_id) ? " [" . _("full file path") . "]" : ""; $retstr = "<tr><td style='text-align:left;width:65%'>{$field} {$sufix}</td><td><INPUT type=\"text\" name=\"{$vname}\" value=\"{$value}\"></td></tr>"; } $retstr .= "\n"; return $retstr; }
$ip = $server->get_ip(); $port = $server->get_port(); $descr = $server->get_descr(); $correlate = $role->get_correlate(); $cross_correlate = $role->get_cross_correlate(); $store = $role->get_store(); $rep = $role->get_reputation(); $qualify = $role->get_qualify(); $resend_events = $role->get_resend_event(); $resend_alarms = $role->get_resend_alarm(); $sign = $role->get_sign(); $sem = $role->get_sem(); $sim = $role->get_sim(); $alarm_to_syslog = $role->get_alarms_to_syslog(); $remoteadmin = $server->get_remoteadmin(); $remotepass = Util::fake_pass($server->get_remotepass()); $remoteurl = $server->get_remoteurl(); $my_rservers = ''; $rservers_list = Server::get_my_hierarchy($conn, $id); foreach ($rservers_list as $sid => $sdata) { $val = $sid . "@" . $sdata[2]; $text = $sdata[0] . " (" . $sdata[2] . ")"; $my_rservers .= "<option value='{$val}'>{$text}</option>\n"; if (!$all_rservers[$sid]) { $error_forward = $sdata[0]; } } // Check if you can edit it $external_ctxs = Session::get_external_ctxs($conn, $id); foreach ($external_ctxs as $e_id => $e_name) { if (!empty($external_ctxs[$e_id])) {
"/> </span> </td> </tr> </table> </td> </tr> </table> </div> </td> </tr> <?php $show_nagios_options = $properties['has_nagios'] == '1' ? '' : 'style="display:none;"'; $nagios_options = $sensor_obj->get_nagios_credentials($conn); $nagios_options['password'] = Util::fake_pass($nagios_options['password']); ?> <tr> <td colspan="5" style="text-align:center;" class="noborder"> <div id="nagios_option" <?php echo $show_nagios_options; ?> > <table width="65%" align='center' style='margin:10px auto;'> <tr> <th><?php echo _('Availability Monitoring Options'); ?> </th> </tr>
function formprint($nessus_id, $field, $vname, $type, $default, $value, $dbconn) { $retstr = ""; if (is_null($value) || $value == "") { if ($type == "R") { $value = explode(";", $default); $value = $value[0]; } else { $value = $default; } } if ($type == "C") { # Checkbox code here $retstr = "<tr><td style='text-align:left;width:65%'>{$field}</td><td><INPUT type=\"checkbox\" name=\"{$vname}\" value=\"yes\""; if ($value == "yes") { $retstr .= " checked"; } $retstr .= "></td></tr>"; } elseif ($type == "R") { # Radio button code here $retstr = "<tr><td style='text-align:left;width:65%'>{$field}</td><td>"; $array = explode(";", $default); foreach ($array as $myoption) { $retstr .= "<INPUT type=\"radio\" name=\"{$vname}\" value=\"" . trim($myoption) . "\""; if ($value == $myoption) { $retstr .= " checked"; } $retstr .= "> {$myoption} </option> "; } $retstr .= "</td></tr>"; } elseif ($type == "P") { # Password code here #$retstr="$nessus_id $field <INPUT type=\"password\" name=\"$vname\" value=\"$value\"><BR>"; $value = Util::fake_pass($value); $retstr = "<tr><td style='text-align:left;width:65%'>{$field}</td><td><input type=\"password\" name=\"{$vname}\" value=\"{$value}\" autocomplete=\"off\"></td></tr>"; } else { // call to avoid XSS attacks $value = Util::htmlentities($value); # Assume it is a text box $sufix = preg_match("/\\[file\\]/", $nessus_id) ? " [" . _("full file path") . "]" : ""; $retstr = "<tr><td style='text-align:left;width:65%'>{$field} {$sufix}</td><td><INPUT type=\"text\" name=\"{$vname}\" value=\"{$value}\"></td></tr>"; } $retstr .= "\n"; return $retstr; }
ossim_valid($ip, OSS_IP_ADDR, 'illegal:' . _("Ip Address")); if (ossim_error()) { $info_error = ossim_get_error(); ossim_clean_error(); } else { $db = new ossim_db(); $conn = $db->connect(); $extra = "WHERE ip = '{$ip}'"; $agentless = array_shift(Agentless::get_list($conn, $extra)); if (!empty($agentless)) { $ip = $agentless->get_ip(); $hostname = $agentless->get_hostname(); $user = $agentless->get_user(); $pass = Util::fake_pass($agentless->get_pass()); $passc = $pass; $ppass = Util::fake_pass($agentless->get_ppass()); $ppassc = $ppass; $descr = $agentless->get_descr(); $error_m_entries = null; $monitoring_entries = Agentless::get_list_m_entries($conn, $extra); if (!is_array($monitoring_entries)) { $error_m_entries = $monitoring_entries; $monitoring_entries = array(); } } else { $info_error = _("No agentless host found"); } $db->close($conn); } ?>
echo $ppass; ?> " autocomplete="off"/> </td> </tr> <tr> <th> <label for='ppassc'><?php echo _('Privileged Password confirm'); ?> </label> </th> <td class="left"> <?php $ppassc = Util::fake_pass($ppassc); ?> <input type="password" class='vfield' name="ppassc" id="ppassc" value="<?php echo $ppassc; ?> " autocomplete="off"/> <div class='al_advice'><?php echo _("(*) If you want to add support for \"su\", you need to provide Privileged Password"); ?> </div> </td> </td> </tr> <tr> <th>
$extra = $_SESSION['_credentials']['extra']; unset($_SESSION['_credentials']); } else { if ($host_list = Host::get_list($conn, "WHERE ip = '{$ip}'")) { $host = $host_list[0]; } if (!empty($host)) { $hostname = $host->get_hostname(); $ip = $host->get_ip(); $credentials = array(); $credentials = Host::get_credentials_ip($conn, $ip); if ($action == "edit") { $credentials_id = Host::get_credentials_id($conn, $id); $type = $credentials_id['type']; $user_ct = $credentials_id['username']; $pass_ct = $pass_ct2 = Util::fake_pass($credentials_id['password']); $extra = $credentials_id['extra']; } } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title> <?php echo gettext("OSSIM Framework"); ?> </title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/> <meta http-equiv="Pragma" content="no-cache"/>
$input .= "</optgroup>"; } $input .= "</select>"; // Add some extra text if (!empty($type['more'])) { $input .= $type['more']; } } } elseif ($type['type'] == 'textarea') { $input .= "<textarea rows='3' cols='40' name=\"value_{$count}\" {$disabled}>{$conf_value}</textarea>"; } elseif ($type['type'] == 'link') { $input .= $type['disabled'] == 1 ? '<span class="disabled" style="color:gray">' . _("Feature not available") . '</span>' : $type['value']; } elseif ($type["type"] == 'html') { $input .= $type['value'] . "<input type='hidden' name='value_{$count}' value='skip_this_config_value'>"; } else { $conf_value = $type['type'] == "password" ? Util::fake_pass($conf_value) : str_replace("'", "'", $conf_value); $autocomplete = $type['type'] == "password" ? "autocomplete='off'" : ""; $select_change = $type['onchange'] != "" ? "onchange=\"" . $type['onchange'] . "\"" : ""; $input_id = $type['id'] != '' ? "id=\"" . $type['id'] . "\"" : ""; $classname = $type['classname'] != '' ? "class=\"" . $type['classname'] . "\"" : ""; $input .= "<input type='" . $type['type'] . "' size='30' name='value_{$count}' {$style} {$input_id} {$classname} value='{$conf_value}' {$select_change} {$disabled} {$autocomplete}/>"; } echo $input; ?> </td> <td class='conf_help_td'> <?php $conf_info = str_replace("'", "\\'", $var) . "###" . str_replace("\n", " ", str_replace("'", "\\'", $type["help"])); $help_id = 'help_' . $count; $info_id = 'info_' . $count;
$db = new ossim_db(); $conn = $db->connect(); $db_id = GET('id'); $update = intval(GET('update')); ossim_valid($db_id, OSS_DIGIT, OSS_NULLABLE, 'illegal:' . _('Database ID')); if (ossim_error()) { die(ossim_error()); } if ($db_id != '') { if ($db_list = Databases::get_list($conn, "WHERE id = '{$db_id}'")) { $db = array_shift($db_list); $db_name = $db->get_name(); $ip = $db->get_ip(); $port = $db->get_port(); $user = $db->get_user(); $pass = Util::fake_pass($db->get_pass()); $icon = $db->get_html_icon(); $pass2 = $pass; } } else { $db_id = ''; $db_name = ''; $ip = ''; $user = ''; $pass = ''; $port = '3306'; $icon = ''; } $action = $db_id != '' ? 'modifydbs.php' : 'newdbs.php'; ?>
<tr class='cms_options' <?php echo $cms_style; ?> > <th class='_label pleft_20'><?php display_label($cnf_data['mailserver_relay_passwd2']); ?> </th> <td class='_data'><input type='password' id='<?php echo $cnf_data['mailserver_relay_passwd2']['id']; ?> ' name='<?php echo $cnf_data['mailserver_relay_passwd2']['id']; ?> ' class='vfield' value='<?php echo Util::fake_pass($cnf_data['mailserver_relay_passwd']['value']); ?> '/></td> </tr> <tr class='cms_options' <?php echo $cms_style; ?> > <th class='_label pleft_20'><?php display_label($cnf_data['mailserver_relay_port']); ?> </th> <td class='_data'><input type='text' id='<?php echo $cnf_data['mailserver_relay_port']['id']; ?>
} foreach ($type["type"] as $option_value => $option_text) { $input .= "<option "; if ($conf_value == $option_value) { $input .= " selected='selected' "; } $input .= "value='{$option_value}'>{$option_text}</option>"; } $input .= "</select>"; } } elseif ($type["type"] == "textarea") { $input .= "<textarea rows='2' cols='28' name=\"value_{$count}\" {$disabled}>{$conf_value}</textarea>"; } elseif ($type["type"] == "link") { $input .= ""; } else { $conf_value = $type["type"] == "password" ? Util::fake_pass($conf_value) : $conf_value; $input .= "<input type='" . $type["type"] . "' size='30' name='value_{$count}' value='{$conf_value}' {$disabled}/>"; } echo $input; ?> </td> <td align="left"> <a href="javascript:;" onmouseover="ticketon('<?php echo str_replace("'", "\\'", $var); ?> ','<?php echo str_replace("\n", " ", str_replace("'", "\\'", $type["help"])); ?> ')" onmouseout="ticketoff();"> <img src="../pixmaps/help.png" width="16" border='0'/>
unset($_SESSION['_dbs']); } else { $ip = $user = $pass = ""; $port = "3306"; if ($dbs_name != '') { ossim_valid($dbs_name, OSS_ALPHA, OSS_PUNC, OSS_SCORE, 'illegal:' . _("Database Server Name")); if (ossim_error()) { die(ossim_error()); } if ($server_list = Databases::get_list($conn, "WHERE name = '{$dbs_name}'")) { $server = $server_list[0]; $dbs_name = $server->get_name(); $ip = $server->get_ip(); $port = $server->get_port(); $user = $server->get_user(); $pass = Util::fake_pass($server->get_pass()); $icon = $server->get_name(); $pass2 = $pass; } } } if (GET('withoutmenu') != "1") { include "../hmenu.php"; } ?> <div id='info_error' class='ossim_error' style='display: none;'></div> <form name='form_dbs' id='form_dbs' method="POST" action="<?php echo GET('name') != "" ? "modifydbs.php" : "newdbs.php";
</th> <td style="text-align:left;padding-left:3px;" class="nobborder"> <textarea name="binddn" rows="2" style="width:212px"><?php echo $binddn; ?> </textarea> </td> </tr> <tr> <th> <?php echo gettext("Password"); ?> </th> <td style="text-align:left;padding-left:3px;" class="nobborder"> <?php $password = Util::fake_pass($password); ?> <input type="password" name="password" value="<?php echo $password; ?> " size="32"/> </td> </tr> <tr> <th> <?php echo gettext("Scope"); ?> </th> <td style="text-align:left;padding-left:3px;" class="nobborder"> <textarea name="scope" rows="2" style="width:212px"><?php