exec("/usr/local/bin/perl -pi -e 's/## alert/# alert/g' /usr/local/etc/snort/rules/*.rules");
    }
}
/*  remove old $tmpfname files */
if (file_exists("{$tmpfname}")) {
    update_status(gettext("Cleaning up..."));
    exec("/bin/rm -r /root/snort_rules_up");
    //	apc_clear_cache();
}
/* php code to flush out cache some people are reportting missing files this might help  */
sleep(2);
apc_clear_cache();
exec("/bin/sync ;/bin/sync ;/bin/sync ;/bin/sync ;/bin/sync ;/bin/sync ;/bin/sync ;/bin/sync");
/* if snort is running hardrestart, if snort is not running do nothing */
if (file_exists("/tmp/snort_download_halt.pid")) {
    start_service("snort");
    update_status(gettext("The Rules update finished..."));
    update_output_window(gettext("Snort has restarted with your new set of rules..."));
    exec("/bin/rm /tmp/snort_download_halt.pid");
} else {
    update_status(gettext("The Rules update finished..."));
    update_output_window(gettext("You may start snort now..."));
}
/* hide progress bar and lets end this party */
hide_progress_bar_status();
conf_mount_ro();
?>

<?php 
function read_body_firmware($ch, $string)
{
Esempio n. 2
0
}
if(posix_getuid()<>0){die("Cannot be used in web server mode\n\n");}
$GLOBALS["posix_getuid"]=0;
include_once(dirname(__FILE__) . '/ressources/class.users.menus.inc');
include_once(dirname(__FILE__) . '/ressources/class.mysql.inc');
include_once(dirname(__FILE__) . '/ressources/class.user.inc');
include_once(dirname(__FILE__) . '/ressources/class.ini.inc');
include_once(dirname(__FILE__) . '/ressources/class.mysql.inc');
include_once(dirname(__FILE__) . '/framework/class.unix.inc');
include_once(dirname(__FILE__) . '/framework/frame.class.inc');


if($argv[1]=='--build'){build();die();}
if($argv[1]=='--checks'){TestConfig();die();}
if($argv[1]=='--mysql'){dumpdb();die();}
if($argv[1]=='--start'){start_service();die();}
if($argv[1]=='--networks'){snort_NetWorks();die();}
if($argv[1]=='--purge'){purge();die();}




function start_service(){
	@mkdir("/var/log/snort");
	$sock=new sockets();
	$snortInterfaces=unserialize(base64_decode($sock->GET_INFO("SnortNics")));
	if(count($snortInterfaces)==0){
		echo "Starting......: Snort Daemon version No interfaces to listen set...\n";
		return;
	}	
	echo "Starting......: Snort Daemon building configuration...\n";
            }
        }
        $pkg_id = 0;
        foreach ($todo as $pkgtodo) {
            $static_output = "";
            if ($pkgtodo['name']) {
                update_output_window($static_output);
                delete_package($pkgtodo['name'] . '-' . $pkgtodo['version'], $pkg_id);
                delete_package_xml($pkgtodo['name']);
                install_package($pkgtodo['name']);
                $pkg_id++;
            }
        }
        update_status("All packages reinstalled.");
        $static_output .= "\n\nAll packages reinstalled.";
        start_service(htmlspecialchars($_GET['pkg']));
        update_output_window($static_output);
        break;
    default:
        $status = install_package(htmlspecialchars($_GET['id']));
        if ($status == -1) {
            update_status("Installation of " . htmlspecialchars($_GET['id']) . " FAILED!");
            $static_output .= "\n\nInstallation halted.";
        } else {
            update_status("Installation of " . $_GET['id'] . " completed.");
            $static_output .= "\n\nInstallation completed.   Please check to make sure that the package is configured from the respective menu then start the package.";
        }
        update_output_window($static_output);
}
// Delete all temporary package tarballs and staging areas.
unlink_if_exists("/tmp/apkg_*");
            }
        } catch (Exception $e) {
            flash('error', _('PirateBox') . " {$id}: " . $e->getMessage() . ' (' . _('configuration not updated') . ').');
            goto redirect;
        }
    }
    stop_service();
    ynh_setting_set('service_enabled', $service_enabled);
    if ($service_enabled == 1) {
        ynh_setting_set('opt_name', $_POST['opt_name']);
        ynh_setting_set('opt_renaming', isset($_POST['opt_renaming']) ? 1 : 0);
        ynh_setting_set('opt_maxspace', $_POST['opt_maxspace']);
        ynh_setting_set('opt_deleting', isset($_POST['opt_deleting']) ? 1 : 0);
        ynh_setting_set('opt_chat', isset($_POST['opt_chat']) ? 1 : 0);
        ynh_setting_set('wifi_device_id', $_POST['wifi_device_id']);
        $retcode = start_service();
        if ($retcode == 0) {
            flash('success', _('Configuration updated and service successfully reloaded'));
        } else {
            flash('error', _('Configuration updated but service reload failed'));
        }
    } else {
        flash('success', _('Service successfully disabled'));
    }
    redirect:
    redirect_to('/');
});
dispatch('/status', function () {
    $status_lines = service_status();
    $status_list = '';
    foreach ($status_lines as $status_line) {
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
	POSSIBILITY OF SUCH DAMAGE.
*/
require_once "guiconfig.inc";
require_once "service-utils.inc";
$logfile = "/var/log/arp.dat";
if ($_POST['clear']) {
    conf_mount_rw();
    stop_service("arpwatch");
    unlink_if_exists($logfile);
    touch($logfile);
    start_service("arpwatch");
    conf_mount_ro();
}
if (file_exists($logfile)) {
    $rawrep = file($logfile);
    foreach ($rawrep as $line) {
        $todo = preg_split('/\\s/', $line);
        $rawmac = explode(":", trim($todo[0]));
        foreach ($rawmac as $set) {
            $mac[] = str_pad($set, 2, "0", STR_PAD_LEFT);
        }
        $newmac = implode(":", $mac);
        $report[$todo[1]][] = array("mac" => $newmac, "timestamp" => trim($todo[2]), "hostname" => trim($todo[3]) ? trim($todo[3]) : "Unknown");
        unset($mac);
    }
}
Esempio n. 6
0
    install();
    exit;
}
if ($argv[1] == "--scan") {
    $GLOBALS["PROGRESS"] = true;
    scanservices();
    exit;
}
if ($argv[1] == "--stop") {
    $GLOBALS["PROGRESS"] = true;
    stop_service();
    exit;
}
if ($argv[1] == "--start") {
    $GLOBALS["PROGRESS"] = true;
    start_service();
    exit;
}
build_init();
function build_init($noprogress = false)
{
    $unix = new unix();
    $sock = new sockets();
    $GLOBALS["echobin"] = $unix->find_program("echo");
    $php = $unix->LOCATE_PHP5_BIN();
    $KERNEL_VERSION = $unix->KERNEL_VERSION();
    $modprobe = $unix->find_program("modprobe");
    $sh[] = "#!/bin/sh -e";
    $sh[] = "### BEGIN INIT INFO";
    $sh[] = "# Builded on " . date("Y-m-d H:i:s");
    $sh[] = "# Provides:          fireqos";
        case 'dnsmasq':
            services_dnsmasq_configure();
            break;
        case 'dhcpd':
            services_dhcpd_configure();
            break;
        case 'miniupnpd':
            upnp_action('start');
            break;
        case 'racoon':
            exec("killall -9 racoon");
            sleep(1);
            vpn_ipsec_force_reload();
            break;
        default:
            start_service($_GET['service']);
            break;
    }
    $savemsg = "{$_GET['service']} başlatıldı.";
    sleep(5);
}
/* stop service */
if ($_GET['mode'] == "stopservice" && $_GET['service']) {
    switch ($_GET['service']) {
        case 'ntpd':
            killbyname("ntpd");
            break;
        case 'bsnmpd':
            killbypid("{$g['varrun_path']}/snmpd.pid");
            break;
        case 'choparp':
Esempio n. 8
0
             $target_id = $v;
             insert_action_queue_new($pdo, SERVICE_RECONFIGURE, $service_id, $target_id, $username);
             insert_action_queue_new($pdo, SERVICE_RELOAD, $service_id, $target_id, $username);
         }
         if ($cfg["puppet"]["enable"]) {
             insert_action_queue($pdo, XMLRPC_RECONFIGURE, 0, $username);
             insert_action_queue($pdo, XMLRPC_RELOAD, 0, $username);
         }
     }
     service_redirect();
     break;
 case 'start':
     $username = check_login($def_url);
     $service_id = $params['service_id'];
     if (lock_service($pdo, $service_id)) {
         start_service($pdo, $service_id);
         foreach ($cfg['lb_host'] as $key => $v) {
             $target_id = $v;
             insert_action_queue_new($pdo, SERVICE_RECONFIGURE, $service_id, $target_id, $username);
             insert_action_queue_new($pdo, SERVICE_RELOAD, $service_id, $target_id, $username);
         }
         if ($cfg["puppet"]["enable"]) {
             insert_action_queue($pdo, XMLRPC_RECONFIGURE, 0, $username);
             insert_action_queue($pdo, XMLRPC_RELOAD, 0, $username);
         }
     }
     service_redirect();
     break;
 case 'reload':
     $username = check_login($def_url);
     $service_id = $params['service_id'];