Esempio n. 1
0
function get_model_list($data)
{
    $response = array();
    $vendor = $data['vendor'];
    $sensor = $data['sensor'];
    ossim_valid($vendor, OSS_NULLABLE, OSS_ALPHA, OSS_PUNC_EXT, 'illegal:' . _("Vendor"));
    ossim_valid($sensor, OSS_ALPHA, OSS_HEX, 'illegal:' . _("Sensor"));
    check_ossim_error();
    if (empty($vendor)) {
        $items = array();
    } else {
        $items = Software::get_models_by_vendor($vendor, $sensor);
    }
    $response['error'] = FALSE;
    $response['data']['items'] = $items;
    return $response;
}
Esempio n. 2
0
     $vendors = array();
     Av_exception::write_log(Av_exception::USER_ERROR, $e->getMessage());
 }
 $device_list = array();
 foreach ($hosts as $asset_id => $host) {
     $plugin_list = array();
     $asset_id_canonical = Util::uuid_format($asset_id);
     if (count($active_plugins[$asset_id_canonical]) < 1) {
         $plugin_list[$asset_id][] = array('vendor' => '', 'model' => '', 'version' => '', 'model_list' => array(), 'version_list' => array());
     } else {
         foreach ($active_plugins[$asset_id_canonical] as $pdata) {
             $models = array();
             $versions = array();
             if ($pdata['vendor'] != '') {
                 try {
                     $models = Software::get_models_by_vendor($pdata['vendor']);
                 } catch (Exception $e) {
                     Av_exception::write_log(Av_exception::USER_ERROR, $e->getMessage());
                 }
             }
             if ($pdata['model'] != '') {
                 try {
                     $versions = Software::get_versions_by_model($pdata['vendor'] . ':' . $pdata['model']);
                 } catch (Exception $e) {
                     Av_exception::write_log(Av_exception::USER_ERROR, $e->getMessage());
                 }
             }
             $plugin_list[$asset_id][] = array('vendor' => $pdata['vendor'], 'model' => $pdata['vendor'] . ':' . $pdata['model'], 'version' => $pdata['vendor'] . ':' . $pdata['model'] . ':' . $pdata['version'], 'model_list' => $models, 'version_list' => $versions);
         }
     }
     $device_list[$asset_id] = array("name" => $host['name'], "ips" => Asset::format_to_print($host['ips']), "plugins" => $plugin_list[$asset_id]);
Esempio n. 3
0
$i = 0;
try {
    if ($edit_mode) {
        /**
         * EDIT MODE: No order, no search filter, and looping $plugin_data array is a based asset_id Hash
         */
        $total_filtered = $total;
        foreach ($plugin_data as $asset_id => $asset_plugins) {
            // Apply pagination
            if ($i >= $from && $i < $from + $maxrows) {
                $_row_data = array();
                foreach ($asset_plugins as $_pdata) {
                    $model_list = array();
                    $version_list = array();
                    if ($_pdata['vendor'] != '') {
                        $model_list = Software::get_models_by_vendor($_pdata['vendor'], $sensor_id);
                    }
                    if ($_pdata['model'] != '') {
                        $version_list = Software::get_versions_by_model($_pdata['vendor'] . ':' . $_pdata['model'], $sensor_id);
                    }
                    $_row_data[$asset_id][] = array('asset_id' => $asset_id, 'vendor' => $_pdata['vendor'], 'model' => $_pdata['vendor'] . ':' . $_pdata['model'], 'version' => $_pdata['vendor'] . ':' . $_pdata['model'] . ':' . $_pdata['version'], 'model_list' => json_encode($model_list), 'version_list' => json_encode($version_list));
                }
                $aux_data = array();
                $aux_data[] = $_pdata['asset'];
                $aux_data[] = '';
                // Empty. Here will be located the vendor/model/version select boxes
                $aux_data['DT_RowData'] = $_row_data;
                //Row ID
                $aux_data['DT_RowId'] = $asset_id;
                $data[] = $aux_data;
            }