function activate_account() { $data = POST('data'); $token = $data['token']; ossim_valid($token, OSS_ALPHA, 'illegal:' . _("OTX auth-token")); check_ossim_error(); $otx = new Otx(); $otx->register_token($token); return array('msg' => _("Your OTX account has been connected. The OTX pulses that you have subscribed to will begin downloading shortly. This process may take a few minutes."), 'token' => $token, 'username' => $otx->get_username(), 'user_id' => $otx->get_user_id(), 'contributing' => TRUE, 'key_version' => $otx->get_key_version(), 'latest_update' => $otx->get_latest_update()); }
function set_plugins($conn, $data) { $response = array(); $plugins = array(); foreach ($data['plugin_list'] as $id => $list_cpe) { ossim_valid($id, OSS_HEX, 'illegal:' . _("Host ID")); $list_cpe = is_array($list_cpe) ? $list_cpe : array(); foreach ($list_cpe as $p) { $cpe = ''; if ($p['version'] != '') { $cpe = $p['version']; } elseif ($p['model'] != '') { $cpe = $p['model']; } elseif ($p['vendor'] != '') { $cpe = $p['vendor']; } ossim_valid($cpe, OSS_NULLABLE, OSS_ALPHA, OSS_PUNC_EXT, 'illegal:' . _("CPE")); $plugins[$id][] = $cpe; } } $sensor = $data['sensor']; ossim_valid($sensor, 'a-fA-F0-9\\-', 'illegal:' . _("Sensor ID")); check_ossim_error(); Plugin::set_plugins_by_device_cpe($conn, $plugins, Util::uuid_format($sensor)); $response['error'] = FALSE; $response['msg'] = _("Plugin successfully configured."); return $response; }
function set_plugins($data) { $sensor = $data['sensor']; ossim_valid($sensor, OSS_HEX, 'illegal:' . _("Sensor ID")); check_ossim_error(); $response = array(); $plugins = Plugin::resolve_plugins_by_vmv($data['plugin_list'], $sensor); Plugin::set_plugins_by_assets($plugins, Util::uuid_format($sensor)); $response['error'] = FALSE; $response['msg'] = _("Plugin successfully configured."); return $response; }
function get_otx_user($data) { $response = array(); $token = $data['token']; /* VALIDATION */ ossim_valid($token, OSS_ALPHA, 'illegal:' . _("OTX auth-token")); check_ossim_error(); /* The try-catch check is done when the function is called in the main */ try { $otx = new Otx(); $otx->register_token($token); $response['error'] = FALSE; $response['msg'] = $otx->get_username(); } catch (Exception $e) { $response['error'] = TRUE; $response['msg'] = $e->getMessage(); } return $response; }
function get_otx_user($data) { $response = array(); $token = $data['token']; /* VALIDATION */ ossim_valid($token, OSS_ALPHA, 'illegal:' . _("OTX auth-token")); check_ossim_error(); $response['error'] = FALSE; $response['msg'] = Util::get_otx_username($token); if ($response['msg']) { $response['error'] = TRUE; } return $response; }
function save_member_selection($conn, $data) { $asset_id = $data['asset_id']; $asset_type = $data['asset_type']; $member_type = $data['member_type']; $all = $data['all']; $assets = $data['assets']; $search = $data['search']; ossim_valid($asset_id, OSS_HEX, 'illegal:' . _('Asset UUID')); ossim_valid($asset_type, 'asset', 'network', 'group', 'illegal:' . _('Asset Type')); ossim_valid($member_type, 'asset', 'network', 'group', 'illegal:' . _('Asset Type')); ossim_valid($search, OSS_INPUT, OSS_NULLABLE, 'illegal:' . _('Search Filter')); ossim_valid($assets, OSS_HEX, OSS_NULLABLE, 'illegal:' . _('Assets')); ossim_valid($all, OSS_BINARY, 'illegal:' . _('Asset Selection')); check_ossim_error(); if ($all) { $total = Filter_list::save_members_from_asset($conn, $asset_id, $asset_type, $search); } else { $total = Filter_list::save_items($conn, $member_type, $assets); } if ($total < 1) { Av_exception::throw_error(Av_exception::USER_ERROR, _('You need at least one asset to perform any action.')); } return $total; }