if ($pconfig['barnconfigpassthru'] != "") {
     $natent['barnconfigpassthru'] = $pconfig['barnconfigpassthru'];
 }
 if ($pconfig['rulesets'] != "") {
     $natent['rulesets'] = $pconfig['rulesets'];
 }
 if ($pconfig['rule_sid_off'] != "") {
     $natent['rule_sid_off'] = $pconfig['rule_sid_off'];
 }
 if ($pconfig['rule_sid_on'] != "") {
     $natent['rule_sid_on'] = $pconfig['rule_sid_on'];
 }
 $if_real = snort_get_real_interface($natent['interface']);
 if (isset($id) && $a_nat[$id]) {
     if ($natent['interface'] != $a_nat[$id]['interface']) {
         Running_Stop($snort_uuid, $if_real, $id);
     }
     $a_nat[$id] = $natent;
 } else {
     if (is_numeric($after)) {
         array_splice($a_nat, $after + 1, 0, array($natent));
     } else {
         $a_nat[] = $natent;
     }
 }
 write_config();
 sync_snort_package_config();
 sleep(1);
 /* if snort.sh crashed this will remove the pid */
 exec('/bin/rm /tmp/snort.sh.pid');
 header('Expires: Sat, 26 Jul 1997 05:00:00 GMT');
Ejemplo n.º 2
0
        exec("/bin/echo {$i} > /tmp/snort_testing.sh.pid");
        // remove when finnished testing
        sleep(2);
    }
};
$snort_bootupWait();
$snort_bootupCleanStartStop = function ($type) use(&$_GET, &$g) {
    $snortstartArray = explode(',', $_GET[$type]);
    foreach ($snortstartArray as $iface_pre) {
        if (!empty($iface_pre)) {
            $iface = explode('_', $iface_pre);
            if (!empty($iface[0]) && !empty($iface[1]) && is_numeric($iface[2])) {
                if ($type === 'snortstart') {
                    Running_Start($iface[0], $iface[1], $iface[2]);
                }
                if ($type === 'snortstop') {
                    Running_Stop($iface[0], $iface[1], $iface[2]);
                }
            }
        }
    }
};
if (!empty($_GET[snortstart])) {
    $snort_bootupCleanStartStop('snortstart');
}
if (!empty($_GET[snortstop])) {
    $snort_bootupCleanStartStop('snortstop');
}
// important
@exec("/bin/rm /tmp/snort_startstop.php.pid");
exit;