Exemple #1
0
 private function editOrSave($action)
 {
     $validations = array("exists" => array("Slug" => slug(POST("title", "clean")), "Year" => date("Y"), "Month" => date("m"), "Day" => date("d"), "Language" => POST("language")), "title" => "required", "content" => "required");
     $this->categories = POST("categories");
     $this->tags = POST("tags");
     $this->URL = PATH("blog/" . date("Y")) . "/" . date("m") . "/" . date("d") . "/" . slug(POST("title", "clean"));
     $this->muralExist = POST("mural_exist");
     $this->Files = $this->core("Files");
     $this->mural = FILES("mural");
     if ($this->mural["name"] !== "") {
         $dir = "www/lib/files/images/mural/";
         $this->mural = $this->Files->uploadImage($dir, "mural", "mural");
         if (is_array($this->mural)) {
             return $this->mural["alert"];
         }
     }
     $dir = "www/lib/files/images/blog/";
     $this->image = $this->Files->uploadImage($dir, "image", "resize", TRUE, TRUE, FALSE);
     $data = array("ID_User" => SESSION("ZanUserID"), "ID_URL" => 1, "Slug" => slug(POST("title", "clean")), "Content" => POST("content", "clean"), "Author" => SESSION("ZanUser"), "Year" => date("Y"), "Month" => date("m"), "Day" => date("d"), "Image_Small" => isset($this->image["small"]) ? $this->image["small"] : NULL, "Image_Medium" => isset($this->image["medium"]) ? $this->image["medium"] : NULL, "Pwd" => POST("pwd") ? POST("pwd", "encrypt") : NULL, "Start_Date" => now(4), "Text_Date" => now(2));
     $this->Data->ignore(array("categories", "tags", "mural_exists", "mural", "pwd", "category", "language_category", "application", "mural_exist"));
     $this->data = $this->Data->proccess($data, $validations);
     if (isset($this->data["error"])) {
         return $this->data["error"];
     }
 }
function validate_post_params($conn, $name, $descr, $sids, $imported_sids)
{
    $vals = array('name' => array(OSS_INPUT, 'illegal:' . _("Name")), 'descr' => array(OSS_TEXT, OSS_NULLABLE, 'illegal:' . _("Description")));
    ossim_valid($name, $vals['name']);
    ossim_valid($descr, $vals['descr']);
    $plugins = array();
    $sids = is_array($sids) ? $sids : array();
    if (intval(POST('pluginid')) > 0) {
        $sids[POST('pluginid')] = "0";
    }
    foreach ($sids as $plugin => $sids_str) {
        if ($sids_str !== '') {
            list($valid, $data) = Plugin_sid::validate_sids_str($sids_str);
            if (!$valid) {
                ossim_set_error(_("Error for data source ") . $plugin . ': ' . $data);
                break;
            }
            if ($sids_str == "ANY") {
                $sids_str = "0";
            } else {
                $aux = count(explode(',', $sids_str));
                $total = Plugin_sid::get_sidscount_by_id($conn, $plugin);
                $sids_str = $aux == $total ? "0" : $sids_str;
            }
            $plugins[$plugin] = $sids_str;
        }
    }
    if (!count($plugins) && !count($imported_sids)) {
        ossim_set_error(_("No Data Sources or Event Types selected"));
    }
    if (ossim_error()) {
        die(ossim_error());
    }
    return array($name, $descr, $plugins);
}
    public function update()
    {
        if (isset($_POST['mail']) && isset($_POST['pwd'])) {
            $mail = POST('mail');
            $password = secure_strip(POST('pwd'));
            if (($val = $this->model->login_with_password($mail, $password)) !== 0) {
                if ($val === 1) {
                    $field = "Le mot de passe entré est éronné";
                } else {
                    $field = "L'adresse mail est inconnue";
                }
                echo <<<TEXT

                <p>Une erreur est survenue : <br/>
                {$field}
                </p>
TEXT;
                return;
            } else {
                echo "<p>Logged</p>";
                $testAdm = $this->model->isAdmin($_SESSION['ID']);
                if ($testAdm === 'admin') {
                    $_SESSION['admin'] = $testAdm;
                }
            }
        }
        return;
    }
Exemple #4
0
 public function vote()
 {
     if (!POST("answer")) {
         showAlert("You must select an answer", _webBase);
     }
     $this->Polls_Model->vote();
     showAlert("Thanks for your vote", _webBase);
 }
Exemple #5
0
 public function data()
 {
     if ($this->method() === "PUT") {
         parse_str(file_get_contents("php://input"), $data);
     } elseif ($this->method() === "POST" or $this->method() === "DELETE") {
         $data = POST(true);
     }
     return isset($data) ? $data : false;
 }
Exemple #6
0
 public function search($search = FALSE)
 {
     if (!$search) {
         $search = POST("search");
     }
     if ($search) {
         $vars["response"] = $this->Videos_Model->search($search);
     } else {
         $vars["response"] = FALSE;
     }
     print json($vars);
 }
Exemple #7
0
function get_pulse_detail()
{
    $data = POST('data');
    ossim_valid($data['pulse_id'], OSS_HEX, 'illegal: Pulse ID');
    if (ossim_error()) {
        return array();
    }
    $otx = new Otx();
    $pulse = $otx->get_pulse_detail($data['pulse_id']);
    //Converting indicator hash to array to use it in the datatables.
    $pulse['indicators'] = array_values($pulse['indicators']);
    return $pulse;
}
Exemple #8
0
 public function setCategory()
 {
     if (!POST("category")) {
         $vars["error"] = __("You need write category");
     } elseif (!POST("language")) {
         $vars["error"] = __("You need select language");
     }
     if (!isset($vars["error"])) {
         $this->Categories_Model = $this->model("Categories_Model");
         $vars["response"] = $this->Categories_Model->save();
     }
     print json_encode($vars);
 }
Exemple #9
0
 public function login()
 {
     $this->title("Login");
     $this->CSS("login", "users");
     if (POST("connect")) {
         $this->Users_Controller = $this->controller("Users_Controller");
         $this->Users_Controller->login("cpanel");
     } else {
         $this->vars["URL"] = getURL();
         $this->vars["view"] = $this->view("login", TRUE);
     }
     $this->render("include", $this->vars);
     $this->rendering("header", "footer");
 }
Exemple #10
0
function change_account_contribution()
{
    $data = POST('data');
    $contribute = intval($data['status']);
    $otx = new Otx();
    if ($contribute) {
        $otx->enable_contribution();
        $msg = _('You are now contributing to OTX.');
    } else {
        $otx->disable_contribution();
        $msg = _('You are not contributing to OTX anymore.');
    }
    return array('msg' => $msg);
}
Exemple #11
0
 private function feedback()
 {
     $this->CSS("feedback", $this->application);
     $this->js("tiny-mce", NULL, "basic");
     $this->title("Feedback");
     if (POST("send")) {
         $this->vars["alert"] = $this->Feedback_Model->send();
         $this->vars["view"] = $this->view("send", TRUE);
         $this->template("content", $this->vars);
     } else {
         $this->vars["view"] = $this->view("send", TRUE);
         $this->template("content", $this->vars);
     }
 }
Exemple #12
0
 private function editOrSave()
 {
     if (!POST("title")) {
         return getAlert("You need to write a title");
     }
     $this->ID = POST("ID_Application");
     $this->title = POST("title", "decode", "escape");
     $this->slug = slug($this->title);
     $this->cpanel = POST("cpanel");
     $this->adding = POST("adding");
     $this->defult = POST("defult");
     $this->category = POST("category");
     $this->comments = POST("comments");
     $this->situation = POST("Situation");
 }
function build_url($action, $extra)
{
    global $date_from, $date_to, $show_options, $src_ip, $dst_ip, $num_alarms_page, $hide_closed, $autorefresh, $refresh_time, $inf, $sup;
    if (empty($action)) {
        $action = "none";
    }
    $options = "";
    if (!empty($date_from)) {
        $options = $options . "&date_from=" . $date_from;
    }
    if (!empty($date_to)) {
        $options = $options . "&date_to=" . $date_to;
    }
    if (!empty($show_options)) {
        $options = $options . "&show_options=" . $show_options;
    }
    if (!empty($autorefresh)) {
        $options = $options . "&autorefresh=on";
    }
    if (!empty($refresh_time)) {
        $options = $options . "&refresh_time=" . $refresh_time;
    }
    if (!empty($src_ip)) {
        $options = $options . "&src_ip=" . $src_ip;
    }
    if (!empty($dst_ip)) {
        $options = $options . "&dsp_ip=" . $dsp_ip;
    }
    if (!empty($num_alarms_page)) {
        $options = $options . "&num_alarms_page=" . $num_alarms_page;
    }
    if (!empty($hide_closed)) {
        $options = $options . "&hide_closed=on";
    }
    if ($action != "change_page") {
        if (!empty($inf)) {
            $options = $options . "&inf=" . $inf;
        }
        if (!empty($sup)) {
            $options = $options . "&sup=" . $sup;
        }
    }
    $url = $_SERVER["SCRIPT_NAME"] . "?action=" . $action . $extra . $options . "&bypassexpirationupdate=1&group_type=" . POST('group_type');
    return $url;
}
 public function update()
 {
     if ($_SESSION["logged"] === true) {
         if (isset($_POST["password1"]) && isset($_POST["password2"])) {
             //change password to new password
             if (POST("password1") === POST("password2")) {
                 $this->model->reset_password_with_id($_SESSION["ID"], POST("password1"));
                 $this->model->setStrategy(new PasswordChangedStrategy());
             } else {
                 $this->model->setStrategy(new Not_To_EasyStrategy());
             }
         } else {
             $this->model->setStrategy(new RequestStrategy());
         }
     } else {
         /**not logged in waiting for either :
          * -input mail
          * -input validation
          *
          */
         if (isset($this->options[0])) {
             //validation du token
             $this->model->login_with_validation($this->options[0]);
             if ($_SESSION['logged'] === true) {
                 //is connected, now request a new password
                 $this->model->setStrategy(new RequestStrategy());
             } else {
                 //bad token, invalid ID;
                 $this->model->setStrategy(new SetMailStrategy());
             }
         } else {
             //user wants to request a new password
             if (isset($_POST["mail"])) {
                 $this->model->setStrategy(new ClickSurMailStrategy());
                 $mail = POST("mail");
                 $token = $this->model->request_password_change($mail);
                 $this->send_mail_for_validation($mail, $token);
             } else {
                 // no mail set ; need to display form
                 $this->model->setStrategy(new SetMailStrategy());
             }
         }
     }
 }
 public function update()
 {
     if (mail_check(POST('mail')) === false) {
         echo 'Votre adresse est invalide';
     } else {
         if (isset($_POST['mail']) && isset($_POST['pwd0'])) {
             $mail = POST('mail');
             $password = POST('pwd0');
             if ($password !== POST('pwd1')) {
                 //do not match
                 return;
             }
             /*if (!mail_check($mail))
               {
                   $_SESSION['INSCRIPTION_FAILURE'] = "Adresse Email Non Valide !";
                   unset($_SESSION['INSCRIPTION_FAILURE']);
                   return;
               }*/
             $name = POST('fName');
             $crypt = true;
             $key = random_string_token(10, $crypt);
             $this->model->select_user_by_mail();
             $this->model->select($mail);
             $this->model->join('PASSWORD');
             $this->model->update();
             if ($this->model->rowCount() === 0) {
                 //user not found -> good case
                 $user = new User('0', $mail, $name, 0);
                 $this->model->create_new_user($user, $password, $key);
                 $destinataire = $mail;
                 $sujet = "Activation de votre compte";
                 $entete = "From: Equipe@aaron-aaron.com";
                 $message = "Bienvenue sur Aaron,\n\n                Pour activer votre compte, veuillez cliquer sur le lien ci-dessous\n                ou copier/coller dans votre navigateur internet.,\n                http://aaron-aaron.alwaysdata.net/confirmation/{$key}\n\n               ---------------\n               Ceci est un mail automatique, Merci de ne pas y répondre.";
                 mail($destinataire, $sujet, $message, $entete);
                 echo "Un mail vous a été envoyé sur votre adresse mail, veuillez suivre les indications pour\n                continuer votre inscription.";
             } else {
                 //mail already exists;
                 //$_SESSION["INSCRIPTION_FAILURE"] = "Cette adresse email existe déjà dans nos bases de données !";
             }
         }
     }
 }
function get_pulse_detail_from_id($conn)
{
    $type = POST('type');
    $pulse = POST('pulse');
    $id = POST('id');
    ossim_valid($type, 'alarm|event|alarm_event', 'illegal:' . _('Type'));
    ossim_valid($pulse, OSS_HEX, 'illegal:' . _('Pulse'));
    ossim_valid($id, OSS_HEX, 'illegal:' . _('ID'));
    if (ossim_error()) {
        Av_exception::throw_error(Av_exception::USER_ERROR, ossim_get_error_clean());
    }
    if ($type == 'alarm') {
        $pulse = Alarm::get_pulse_data_from_alarm($conn, $id, $pulse, TRUE);
    } elseif ($type == 'event') {
        $pulse = Siem::get_pulse_data_from_event($conn, $id, $pulse, FALSE, TRUE);
    } elseif ($type == 'alarm_event') {
        $pulse = Siem::get_pulse_data_from_event($conn, $id, $pulse, TRUE, TRUE);
    }
    return array('name' => $pulse['name'], 'descr' => $pulse['descr'], 'iocs' => array_values($pulse['iocs']));
}
function validate_post_params($conn, $name, $descr, $sids, $imported_sids, $group_id = NULL)
{
    $vals = array('name' => array(OSS_INPUT, 'illegal:' . _("Name")), 'descr' => array(OSS_ALL, OSS_NULLABLE, 'illegal:' . _("Description")), 'group_id' => array(OSS_HEX, OSS_NULLABLE, 'illegal:' . _("Group ID")));
    ossim_valid($group_id, $vals['group_id']);
    ossim_valid($name, $vals['name']);
    if (ossim_error() == FALSE && Plugin_group::is_valid_group_name($conn, $name, $group_id) == FALSE) {
        $name = Util::htmlentities($name);
        ossim_set_error(sprintf(_("DS group name '<strong>%s</strong>' already exists"), $name));
    }
    ossim_valid($descr, $vals['descr']);
    $plugins = array();
    $sids = is_array($sids) ? $sids : array();
    $pluginid = intval(POST('pluginid'));
    if ($pluginid > 0) {
        $sids[$pluginid] = "0";
    }
    foreach ($sids as $plugin => $sids_str) {
        if ($sids_str !== '') {
            list($valid, $data) = Plugin_sid::validate_sids_str($sids_str);
            if (!$valid) {
                ossim_set_error(_("Error for data source ") . $plugin . ': ' . $data);
                break;
            }
            if ($sids_str == "ANY") {
                $sids_str = "0";
            } else {
                $aux = count(explode(',', $sids_str));
                $total = Plugin_sid::get_sidscount_by_id($conn, $plugin);
                $sids_str = $aux == $total ? "0" : $sids_str;
            }
            $plugins[$plugin] = $sids_str;
        }
    }
    if (!count($plugins) && !count($imported_sids)) {
        ossim_set_error(_("No Data Sources or Event Types selected"));
    }
    return array($group_id, $name, $descr, $plugins, ossim_error());
}
function get_ip_reputation_summary()
{
    $data = POST('data');
    $type = intval($data['type']);
    //Initialization of Vars
    $ips = array();
    $top = array();
    $chart = array();
    $total = 0;
    $date = _('Unknown');
    $Reputation = new Reputation();
    if ($Reputation->existReputation()) {
        list($ips, $cou, $order, $total) = $Reputation->get_data($type, 'All');
        session_write_close();
        //Getting IPs by Country
        $cou = array_splice($cou, 0, 10);
        foreach ($cou as $c => $value) {
            $info = explode(";", $c);
            $flag = '';
            if ($info[1] != '') {
                $flag = "<img src='/ossim/pixmaps/" . ($info[1] == "1x1" ? "" : "flags/") . strtolower($info[1]) . ".png'>";
            }
            $top[] = array('flag' => $flag, 'name' => $info[0], 'occurrences' => Util::number_format_locale($value, 0));
        }
        //Getting IPs by Activity
        $order = array_splice($order, 0, 10);
        foreach ($order as $type => $ocurrences) {
            $chart[] = array($type . ' [' . Util::number_format_locale($ocurrences, 0) . ']', $ocurrences);
        }
        //Getting total of IPs
        $total = Util::number_format_locale($total, 0);
        //Getting Date of the last Update.
        $date = gmdate("Y-m-d H:i:s", filemtime($Reputation->rep_file) + 3600 * Util::get_timezone());
    }
    return array('ips' => $ips, 'top_countries' => $top, 'ip_by_activity' => $chart, 'total' => $total, 'last_updated' => $date);
}
Exemple #19
0
* along with this package; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
* MA  02110-1301  USA
*
*
* On Debian GNU/Linux systems, the complete text of the GNU General
* Public License can be found in `/usr/share/common-licenses/GPL-2'.
*
* Otherwise you can read it here: http://www.gnu.org/licenses/gpl-2.0.txt
*
*/
//Config File
require_once dirname(__FILE__) . '/../../../config.inc';
session_write_close();
$system_id = POST('system_id');
$confirm = intval(POST('confirm'));
ossim_valid($system_id, OSS_UUID, 'illegal:' . _('System ID'));
if (ossim_error()) {
    $data['status'] = 'error';
    $data['data'] = ossim_get_error();
} else {
    //Getting system status
    $local_id = strtolower(Util::get_system_uuid());
    try {
        $db = new ossim_db();
        $conn = $db->connect();
        $ha_enabled = Av_center::is_ha_enabled($conn, $system_id);
        $db->close();
    } catch (Exception $e) {
        $db->close();
        $data['status'] = 'error';
* along with this package; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
* MA  02110-1301  USA
*
*
* On Debian GNU/Linux systems, the complete text of the GNU General
* Public License can be found in `/usr/share/common-licenses/GPL-2'.
*
* Otherwise you can read it here: http://www.gnu.org/licenses/gpl-2.0.txt
*
*/
require_once 'av_init.php';
require_once 'os_report_common.php';
Session::logcheck('report-menu', 'ReportsReportServer');
$action = POST('action');
$data = POST('data');
if ($action == 'check_file') {
    $data = explode('###', base64_decode($data));
    $report_name = trim($data[0]);
    $filename = trim($data[1]);
    ossim_valid($report_name, OSS_SCORE, OSS_NULLABLE, OSS_ALPHA, OSS_PUNC, 'illegal:' . _('Report name'));
    if (ossim_error()) {
        echo 'error###' . ossim_get_error_clean();
        exit;
    }
    // Init PDF Report
    $pdfReport = new Pdf_report($report_name, 'P', 'A4', NULL, FALSE);
    if (isset($filename) && !empty($filename)) {
        ossim_valid($filename, OSS_FILENAME, 'illegal:' . _('Filename'));
        //Get complete path
        $path = $pdfReport->getpath() . $filename;
 * @copyright  2003-2006 ossim.net
 * @copyright  2007-2013 AlienVault
 * @link       https://www.alienvault.com/
 */
require_once 'av_init.php';
Session::logcheck("environment-menu", "PolicyHosts");
// Close session write for real background loading
session_write_close();
$group_id = GET('group_id');
$asset_type = GET('asset_type');
$maxrows = POST('iDisplayLength') != '' ? POST('iDisplayLength') : 15;
$search_str = POST('sSearch') != '' ? POST('sSearch') : '';
$from = POST('iDisplayStart') != '' ? POST('iDisplayStart') : 0;
$order = POST('iSortCol_0') != '' ? POST('iSortCol_0') : '';
$torder = POST('sSortDir_0');
$sec = POST('sEcho');
switch ($order) {
    case 0:
        $order = 'hostname';
        break;
        /*
        case 1:
        	$order = 'ip';
        	break;
        */
    /*
    case 1:
    	$order = 'ip';
    	break;
    */
    default:
}
switch ($action) {
    case 'new':
        if ($order == 0) {
            $order = Policy::get_next_order($conn, $ctx, $group);
        }
        $newid = Policy::insert($conn, $ctx, $priority, $active, $group, $order, $tzone, $b_month, $b_month_day, $b_week_day, $b_hour, $b_minute, $e_month, $e_month_day, $e_week_day, $e_hour, $e_minute, $descr, $source_ips, $source_host_groups, $dest_ips, $dest_host_groups, $source_nets, $source_net_groups, $dest_nets, $dest_net_groups, $portsrc, $portdst, $plug_groups, $sensors, $target, $taxonomy, $reputation, $event_conds, $idm, $correlate, $cross_correlate, $store, $rep, $qualify, $resend_alarms, $resend_events, $frw_conds, $sign, $sem, $sim);
        // Actions
        if (!empty($newid) && count($policy_action) > 0) {
            foreach ($policy_action as $action_id) {
                Policy_action::insert($conn, $action_id, $newid);
            }
        }
        break;
    case 'edit':
        $id = POST('policy_id');
        if (!Policy::is_visible($conn, $id)) {
            die(ossim_error(_("You do not have permission to edit this policy")));
        }
        ossim_valid($id, OSS_HEX, 'illegal:' . _("Policy ID"));
        if (ossim_error()) {
            die(ossim_error());
        }
        Policy::update($conn, $id, $ctx, $priority, $active, $group, $order, $tzone, $b_month, $b_month_day, $b_week_day, $b_hour, $b_minute, $e_month, $e_month_day, $e_week_day, $e_hour, $e_minute, $descr, $source_ips, $source_host_groups, $dest_ips, $dest_host_groups, $source_nets, $source_net_groups, $dest_nets, $dest_net_groups, $portsrc, $portdst, $plug_groups, $sensors, $target, $taxonomy, $reputation, $event_conds, $idm, $correlate, $cross_correlate, $store, $rep, $qualify, $resend_alarms, $resend_events, $frw_conds, $sign, $sem, $sim);
        // Actions
        if (count($policy_action) > 0) {
            Policy_action::delete($conn, $id);
            foreach ($policy_action as $action_id) {
                Policy_action::insert($conn, $action_id, $id);
            }
        }
Exemple #23
0
*
*
* On Debian GNU/Linux systems, the complete text of the GNU General
* Public License can be found in `/usr/share/common-licenses/GPL-2'.
*
* Otherwise you can read it here: http://www.gnu.org/licenses/gpl-2.0.txt
*
*/
require_once dirname(__FILE__) . '/../../conf/config.inc';
Session::logcheck('environment-menu', 'EventsHidsConfig');
$data['status'] = 'success';
$data['data'] = NULL;
$file = $_SESSION['_current_file'];
$sensor_id = POST('sensor_id');
$new_xml_data = $_POST['data'];
$token = POST('token');
ossim_valid($sensor_id, OSS_HEX, 'illegal:' . _('Sensor ID'));
ossim_valid($file, OSS_ALPHA, OSS_SCORE, OSS_DOT, 'illegal:' . _('File'));
if (ossim_error()) {
    $data['status'] = 'error';
    $data['data'] = ossim_get_error_clean();
} else {
    if (!Token::verify('tk_f_rules', $token)) {
        $data['status'] = 'error';
        $data['data'] = Token::create_error_message();
    } else {
        $db = new ossim_db();
        $conn = $db->connect();
        if (!Ossec_utilities::is_sensor_allowed($conn, $sensor_id)) {
            $data['status'] = 'error';
            $data['data'] = _('Error! Sensor not allowed');
//save title content first
if (POST("submit") == 'create') {
    $title = POST("title");
    $content = POST("content");
    $_SESSION['title'] = $title;
    $_SESSION['content'] = $content;
}
?>

<?php 
if (SESSION('login') === true) {
    $title = POST("title");
    $content = POST("content");
    $statement = savePost2Database($title, $content);
    showModalNotification("Post saved!", "New post has saved with post id: {$statement}");
} elseif (POST('submit') == 'login') {
    $username = $_POST['username'];
    $password = $_POST['password'];
    $statement = getEncryptedPassword($username);
    $encryptedPassword = "";
    $o = $statement->fetchObject();
    if ($o) {
        $encryptedPassword = $o->password;
    }
    if (strtoupper(md5($password)) == $encryptedPassword) {
        $_SESSION['login'] = true;
        //        $title = POST("title");
        //        $content = POST("content");
        //        global $title, $content;
        $statement = savePost2Database($_SESSION['title'], $_SESSION['content']);
        echo "<h3>Login success, saved!</h3>";
Exemple #25
0
if ($action == 'check_cidr') {
    $cidr = POST('cidr');
    ossim_valid($cidr, OSS_IP_CIDR, 'illegal:' . _('CIDR'));
    if (ossim_error()) {
        $res['status'] = 'error';
        $res['data'] = ossim_get_error();
    } else {
        $res['status'] = 'success';
        $res['data'] = md5($cidr);
    }
    echo json_encode($res);
    exit;
} elseif ($action == 'check_server') {
    $new_server = POST('new_server');
    $old_server = POST('old_server');
    $priority = POST('priority');
    ossim_valid($new_server, OSS_IP_ADDR, 'illegal:' . _('IP Address'));
    ossim_valid($priority, '0,1,2,3,4,5', 'illegal:' . _('Priority'));
    if (!empty($old_server)) {
        ossim_valid($old_server, OSS_IP_ADDR, 'illegal:' . _('IP Address'));
    }
    if (ossim_error()) {
        $res['status'] = 'error';
        $res['data'] = ossim_get_error();
        echo json_encode($res);
        exit;
    }
    session_start();
    $cnf_data = $_SESSION['sensor_cnf'];
    $server_ip = $cnf_data['server_ip']['value'];
    session_write_close();
Exemple #26
0
*
* You should have received a copy of the GNU General Public License
* along with this package; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
* MA  02110-1301  USA
*
*
* On Debian GNU/Linux systems, the complete text of the GNU General
* Public License can be found in `/usr/share/common-licenses/GPL-2'.
*
* Otherwise you can read it here: http://www.gnu.org/licenses/gpl-2.0.txt
*
*/
require_once 'av_init.php';
Session::logcheck("configuration-menu", "ConfigurationUserActionLog");
$update = isset($_POST['update']) && POST('update') != '' ? true : false;
/* connect to db */
$db = new ossim_db();
$conn = $db->connect();
$status = true;
$ua_items = array();
$ua_logged = array();
$ua_not_logged = array();
if ($log_conf_list = Log_config::get_list($conn, "")) {
    foreach ($log_conf_list as $log_conf) {
        $descr = preg_replace('|%.*?%|', " ", $log_conf->get_descr());
        $descr = trim($descr) == '' ? _("Various") : $descr;
        $code = $log_conf->get_code();
        $ua_items[$code] = array("descr" => $descr, "log" => $log_conf->get_log());
        if ($log_conf->get_log()) {
            $ua_logged[$code] = $descr;
Exemple #27
0
        <title> <?php 
echo _('AlienVault ' . (Session::is_pro() ? 'USM' : 'OSSIM'));
?>
 </title>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
        <meta http-equiv="Pragma" content="no-cache"/>
        <?php 
//CSS Files
$_files = array(array('src' => 'av_common.css', 'def_path' => TRUE));
Util::print_include_files($_files, 'css');
?>
    </head>

    <body>
    <?php 
if (POST('insert') && empty($data['data']['id'])) {
    if ($data['status'] == 'error') {
        $txt_error = "<div>" . _("The following errors occurred") . ":</div>\n                          <div style='padding: 2px 10px 5px 10px;'>" . implode("<br/>", $validation_errors) . "</div>";
        $config_nt = array('content' => $txt_error, 'options' => array('type' => 'nf_error', 'cancel_button' => FALSE), 'style' => 'width: 80%; margin: 20px auto; text-align: left;');
        $nt = new Notification('nt_1', $config_nt);
        $nt->show();
        Util::make_form("POST", "modifyserverform.php?id={$id}");
        exit;
    }
    try {
        $db = new ossim_db();
        $conn = $db->connect();
        if (!isset($resend_alarms)) {
            $resend_alarms = 0;
        }
        if (!isset($resend_events)) {
    }
    $db->close();
    return $summary;
}
/****************************************************
 ******************** Import data *******************
 ****************************************************/
$import_type = REQUEST('import_type');
$import_type = empty($import_type) ? 'networks' : $import_type;
if ($_POST['import_assets'] == 1) {
    $data['status'] = 'error';
    $data['data'] = NULL;
    $file_csv = $_SESSION['file_csv'];
    unset($_SESSION['file_csv']);
    $iic = POST('iic');
    $ctx = POST('ctx');
    if (Session::is_pro()) {
        if (!valid_hex32($ctx) || Acl::entityAllowed($ctx) < 1) {
            $data['data'] = empty($ctx) ? _('You must select an entity') : _('Entity not allowed');
            echo json_encode($data);
            exit;
        }
    } else {
        $ctx = Session::get_default_ctx();
    }
    if (!empty($file_csv)) {
        $data['status'] = 'OK';
        $data['data'] = import_assets_from_csv($file_csv, $_POST['iic'], $ctx, $import_type);
        //@unlink($file_csv);
    } else {
        $data['data'] = _('Failed to read data from CSV file. File is missing');
Exemple #29
0
    $response['data'] = '';
    return $response;
}
/*
*
* <------------------------   END OF THE FUNCTIONS   ------------------------> 
*
*/
/*
*
* <-------------------------   BODY OF THE SCRIPT   -------------------------> 
*
*/
$action = POST("action");
//Action to perform.
$data = POST("data");
//Data related to the action.
ossim_valid($action, OSS_INPUT, 'illegal:' . _("Action"));
if (ossim_error()) {
    $response['error'] = TRUE;
    $response['msg'] = ossim_get_error();
    ossim_clean_error();
    echo json_encode($response);
    die;
}
//Default values for the response.
$response['error'] = TRUE;
$response['msg'] = _('Error when processing the request');
//checking if it is an ajax request
if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
    //Checking token
Exemple #30
0
*
* You should have received a copy of the GNU General Public License
* along with this package; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
* MA  02110-1301  USA
*
*
* On Debian GNU/Linux systems, the complete text of the GNU General
* Public License can be found in `/usr/share/common-licenses/GPL-2'.
*
* Otherwise you can read it here: http://www.gnu.org/licenses/gpl-2.0.txt
*
*/
require_once dirname(__FILE__) . '/../../conf/config.inc';
Session::logcheck('environment-menu', 'EventsHidsConfig');
$sensor_id = POST('sensor_id');
ossim_valid($sensor_id, OSS_HEX, 'illegal:' . _('Sensor ID'));
if (!ossim_error()) {
    $db = new ossim_db();
    $conn = $db->connect();
    if (!Ossec_utilities::is_sensor_allowed($conn, $sensor_id)) {
        ossim_set_error(_('Error! Sensor not allowed'));
    }
    $db->close();
}
if (ossim_error()) {
    echo '2###' . _('We found the followings errors') . ": <div style='padding-left: 15px; text-align:left;'>" . ossim_get_error_clean() . '</div>';
    exit;
}
//Current sensor
$_SESSION['ossec_sensor'] = $sensor_id;