当前位置: 首页>>代码示例>>PHP>>正文


PHP safe_mkdir函数代码示例

本文整理汇总了PHP中safe_mkdir函数的典型用法代码示例。如果您正苦于以下问题:PHP safe_mkdir函数的具体用法?PHP safe_mkdir怎么用?PHP safe_mkdir使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了safe_mkdir函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: onMeta

 function onMeta()
 {
     # Run this function during meta-load (debugmode >>ONLY<<)
     ###### -> Construct should add this module to the onMeta array
     if (!is_dir(CONS_FMANAGER . "_undodata/")) {
         safe_mkdir(CONS_FMANAGER . "_undodata/");
     }
 }
开发者ID:Prescia,项目名称:Prescia,代码行数:8,代码来源:module.php

示例2: recursive_copy

function recursive_copy($source, $destination)
{
    $counter = 0;
    if (substr($source, strlen($source), 1) != "/") {
        $source .= "/";
    }
    if (substr($destination, strlen($destination), 1) != "/") {
        $destination .= "/";
    }
    if (!is_dir($destination)) {
        makeDirs($destination);
    }
    $itens = listFiles($source);
    foreach ($itens as $id => $name) {
        if ($name[0] == "/") {
            $name = substr($name, 1);
        }
        if (is_file($source . $name)) {
            // file
            if ($name != "Thumbs.db") {
                $counter++;
                if (!copy($source . $name, $destination . $name)) {
                    echo "Error: " . $source . $name . " -> " . $destination . $name . "<br/>";
                } else {
                    safe_chmod($destination . $name, 0775);
                }
            } else {
                @unlink($source . $name);
            }
        } else {
            if (is_dir($source . $name)) {
                // dir
                if (!is_dir($destination . $name)) {
                    safe_mkdir($destination . $name);
                }
                $counter += recursive_copy($source . $name, $destination . $name);
            }
        }
    }
    return $counter;
}
开发者ID:Prescia,项目名称:Prescia,代码行数:41,代码来源:recursive_copy.php

示例3: makeDirs

function makeDirs($path, $base = "")
{
    if ($base != "" && substr($base, strlen($base) - 1) != "/") {
        $base .= '/';
    }
    $paths = explode("/", $path);
    if ($base != "" && !is_dir($base)) {
        if (!safe_mkdir($base)) {
            return false;
        }
    }
    while (count($paths) > 0) {
        $starter = array_shift($paths);
        if ($starter != "") {
            $base .= $starter . "/";
            if (!is_dir($base)) {
                if (!safe_mkdir($base)) {
                    return false;
                }
            }
        }
    }
    return true;
}
开发者ID:Prescia,项目名称:Prescia,代码行数:24,代码来源:dirBundle.php

示例4: conf_mount_rw

$stateorprovince = $stateorprovinceA[1];
$cityname = $citynameA[1];
$orginizationname = $orginizationnameA[1];
$orginizationdepartment = $orginizationdepartmentA[1];
$commonname = $commonnameA[1];
if ($_POST) {
    /* Grab posted variables and create a new openssl.cnf */
    $countrycode = $_POST['countrycode'];
    $stateorprovince = $_POST['stateorprovince'];
    $cityname = $_POST['cityname'];
    $orginizationname = $_POST['orginizationname'];
    $orginizationdepartment = $_POST['orginizationdepartment'];
    $commonname = $_POST['commonname'];
    /* Write out /var/etc/ssl/openssl.cnf */
    conf_mount_rw();
    safe_mkdir("/usr/local/ssl/");
    $fd = fopen("/usr/local/ssl/openssl.cnf", "w");
    fwrite($fd, "");
    fwrite($fd, "[ req ]\n");
    fwrite($fd, "distinguished_name=req_distinguished_name \n");
    fwrite($fd, "req_extensions = v3_req \n");
    fwrite($fd, "prompt=no\n");
    fwrite($fd, "default_bits            = 1024\n");
    fwrite($fd, "default_keyfile         = privkey.pem\n");
    fwrite($fd, "distinguished_name      = req_distinguished_name\n");
    fwrite($fd, "attributes              = req_attributes\n");
    fwrite($fd, "x509_extensions = v3_ca # The extentions to add to the self signed cert\n");
    fwrite($fd, "[ req_distinguished_name ] \n");
    fwrite($fd, "C=" . $countrycode . " \n");
    fwrite($fd, "ST=" . $stateorprovince . " \n");
    fwrite($fd, "L=" . $cityname . " \n");
开发者ID:rootsghost,项目名称:5651-pfsense,代码行数:31,代码来源:zaman_damgasi_certs.php

示例5: update_status

            update_status(gettext("Copying md5 sig to snort directory..."));
            @copy("{$tmpfname}/{$emergingthreats_filename_md5}", "{$snortdir}/{$emergingthreats_filename_md5}");
        }
    }
}
/* Untar snort rules file individually to help people with low system specs */
if ($snortdownload == 'on') {
    if (file_exists("{$tmpfname}/{$snort_filename}")) {
        if ($pfsense_stable == 'yes') {
            $freebsd_version_so = 'FreeBSD-7-2';
        } else {
            $freebsd_version_so = 'FreeBSD-8-1';
        }
        update_status(gettext("Extracting Snort.org rules..."));
        /* extract snort.org rules and  add prefix to all snort.org files*/
        safe_mkdir("{$snortdir}/tmp/snortrules");
        exec("/usr/bin/tar xzf {$tmpfname}/{$snort_filename} -C {$snortdir}/tmp/snortrules rules/");
        $files = glob("{$snortdir}/tmp/snortrules/rules/*.rules");
        foreach ($files as $file) {
            $newfile = basename($file);
            @copy($file, "{$snortdir}/rules/snort_{$newfile}");
        }
        /* IP lists */
        $files = glob("{$snortdir}/tmp/snortrules/rules/*.txt");
        foreach ($files as $file) {
            $newfile = basename($file);
            @copy($file, "{$snortdir}/rules/{$newfile}");
        }
        exec("rm -r {$snortdir}/tmp/snortrules");
        /* extract so rules */
        exec('/bin/mkdir -p /usr/local/lib/snort/dynamicrules/');
开发者ID:netceler,项目名称:pfsense-packages,代码行数:31,代码来源:snort_check_for_rule_updates.php

示例6: trim

    $external_net = "[" . trim($external_net) . "]";
} else {
    foreach ($home_net_list as $ip) {
        $external_net .= "!{$ip},";
    }
    $external_net = trim($external_net, ', ');
}
/* User added custom configuration arguments */
$snort_config_pass_thru = str_replace("\r", "", base64_decode($snortcfg['configpassthru']));
// Remove the trailing newline
$snort_config_pass_thru = rtrim($snort_config_pass_thru);
/* create a few directories and ensure the sample files are in place */
$snort_dirs = array($snortdir, $snortcfgdir, "{$snortcfgdir}/rules", "{$snortlogdir}/snort_{$if_real}{$snort_uuid}", "{$snortlogdir}/snort_{$if_real}{$snort_uuid}/barnyard2", "{$snortcfgdir}/preproc_rules", "dynamicrules" => "{$snortlibdir}/snort_dynamicrules", "dynamicengine" => "{$snortlibdir}/snort_dynamicengine", "dynamicpreprocessor" => "{$snortcfgdir}/snort_dynamicpreprocessor");
foreach ($snort_dirs as $dir) {
    if (!is_dir($dir)) {
        safe_mkdir($dir);
    }
}
/********************************************************************/
/* For fail-safe on an initial startup following installation, and  */
/* before a rules update has occurred, copy the default config      */
/* files to the interface directory.  If files already exist in     */
/* the interface directory, or they are newer, that means a rule    */
/* update has been done and we should leave the customized files    */
/* put in place by the rules update process.                        */
/********************************************************************/
$snort_files = array("gen-msg.map", "classification.config", "reference.config", "attribute_table.dtd", "sid-msg.map", "unicode.map", "file_magic.conf", "threshold.conf", "preproc_rules/preprocessor.rules", "preproc_rules/decoder.rules", "preproc_rules/sensitive-data.rules");
foreach ($snort_files as $file) {
    if (file_exists("{$snortdir}/{$file}")) {
        $ftime = filemtime("{$snortdir}/{$file}");
        if (!file_exists("{$snortcfgdir}/{$file}") || $ftime > filemtime("{$snortcfgdir}/{$file}")) {
开发者ID:randyqx,项目名称:pfsense-packages,代码行数:31,代码来源:snort_generate_conf.php

示例7: exit

}
/**********************************************************************
 * Start of main code                                                 *
 **********************************************************************/
global $g, $config;
$suricata_geoip_dbdir = SURICATA_PBI_BASEDIR . 'share/GeoIP/';
$geoip_tmppath = "{$g['tmp_path']}/geoipup/";
// If auto-updates of GeoIP are disabled, then exit
if ($config['installedpackages']['suricata']['config'][0]['autogeoipupdate'] == "off") {
    exit(0);
} else {
    log_error(gettext("[Suricata] Updating the GeoIP country database files..."));
}
// Download the free GeoIP Legacy country name databases for IPv4 and IPv6
// to a temporary location.
safe_mkdir("{$geoip_tmppath}");
if (download_file("http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz", "{$geoip_tmppath}GeoIP.dat.gz") != true) {
    log_error(gettext("[Suricata] An error occurred downloading the 'GeoIP.dat.gz' update file for GeoIP."));
}
if (download_file("http://geolite.maxmind.com/download/geoip/database/GeoIPv6.dat.gz", "{$geoip_tmppath}GeoIPv6.dat.gz") != true) {
    log_error(gettext("[Suricata] An error occurred downloading the 'GeoIPv6.dat.gz' update file for GeoIP."));
}
// Mount filesystem read-write since we need to write
// the extracted databases to PBI_BASE/share/GeoIP.
conf_mount_rw();
// If the files downloaded successfully, unpack them and store
// the DB files in the PBI_BASE/share/GeoIP directory.
if (file_exists("{$geoip_tmppath}GeoIP.dat.gz")) {
    mwexec("/usr/bin/gunzip -f {$geoip_tmppath}GeoIP.dat.gz");
    @rename("{$geoip_tmppath}GeoIP.dat", "{$suricata_geoip_dbdir}GeoIP.dat");
}
开发者ID:LFCavalcanti,项目名称:pfsense-packages,代码行数:31,代码来源:suricata_geoipupdate.php

示例8: pfblockerng_uc_countries

function pfblockerng_uc_countries()
{
    global $g, $pfb;
    $maxmind_cont = "{$pfb['dbdir']}/country_continent.csv";
    $maxmind_cc4 = "{$pfb['dbdir']}/GeoIPCountryWhois.csv";
    $maxmind_cc6 = "{$pfb['dbdir']}/GeoIPv6.csv";
    // Create Folders if not Exist
    $folder_array = array("{$pfb['dbdir']}", "{$pfb['logdir']}", "{$pfb['ccdir']}");
    foreach ($folder_array as $folder) {
        safe_mkdir("{$folder}", 0755);
    }
    $now = date("m/d/y G:i:s", time());
    $log = "Country Code Update Start - [ NOW ]\n\n";
    print "Country Code Update Start - [ {$now} ]\n\n";
    pfb_logger("{$log}", "3");
    if (!file_exists($maxmind_cont) || !file_exists($maxmind_cc4) || !file_exists($maxmind_cc6)) {
        $log = " [ MAXMIND UPDATE FAIL, CSV Missing, using Previous Country Code Database \n";
        print $log;
        pfb_logger("{$log}", "3");
        return;
    }
    // Save Date/Time Stamp to MaxMind version file
    $maxmind_ver = "MaxMind GeoLite Date/Time Stamps \n\n";
    $remote_tds = @implode(preg_grep("/Last-Modified/", get_headers("http://geolite.maxmind.com/download/geoip/database/GeoIPCountryCSV.zip")));
    $maxmind_ver .= "MaxMind_v4 \t" . $remote_tds . "\n";
    $local_tds = @gmdate("D, d M Y H:i:s T", filemtime($maxmind_cc4));
    $maxmind_ver .= "Local_v4 \tLast-Modified: " . $local_tds . "\n\n";
    $remote_tds = @implode(preg_grep("/Last-Modified/", get_headers("http://geolite.maxmind.com/download/geoip/database/GeoIPv6.csv.gz")));
    $maxmind_ver .= "MaxMind_v6 \t" . $remote_tds . "\n";
    $local_tds = @gmdate("D, d M Y H:i:s T", filemtime($maxmind_cc6));
    $maxmind_ver .= "Local_v6 \tLast-Modified: " . $local_tds . "\n";
    $maxmind_ver .= "\nThese Timestamps should *match* \n";
    @file_put_contents("{$pfb['logdir']}/maxmind_ver", $maxmind_ver);
    // Collect ISO Codes for Each Continent
    $log = "Processing Continent Data\n";
    print $log;
    pfb_logger("{$log}", "3");
    $cont_array = array(array($AF), array($AS), array($EU), array($NA), array($OC), array($SA), array($AX));
    if (($handle = fopen("{$maxmind_cont}", 'r')) !== FALSE) {
        while (($cc = fgetcsv($handle)) !== FALSE) {
            $cc_key = $cc[0];
            $cont_key = $cc[1];
            switch ($cont_key) {
                case "AF":
                    $cont_array[0]['continent'] = "Africa";
                    $cont_array[0]['iso'] .= "{$cc_key},";
                    $cont_array[0]['file4'] = "{$pfb['ccdir']}/Africa_v4.txt";
                    $cont_array[0]['file6'] = "{$pfb['ccdir']}/Africa_v6.txt";
                    break;
                case "AS":
                    $cont_array[1]['continent'] = "Asia";
                    $cont_array[1]['iso'] .= "{$cc_key},";
                    $cont_array[1]['file4'] = "{$pfb['ccdir']}/Asia_v4.txt";
                    $cont_array[1]['file6'] = "{$pfb['ccdir']}/Asia_v6.txt";
                    break;
                case "EU":
                    $cont_array[2]['continent'] = "Europe";
                    $cont_array[2]['iso'] .= "{$cc_key},";
                    $cont_array[2]['file4'] = "{$pfb['ccdir']}/Europe_v4.txt";
                    $cont_array[2]['file6'] = "{$pfb['ccdir']}/Europe_v6.txt";
                    break;
                case "NA":
                    $cont_array[3]['continent'] = "North America";
                    $cont_array[3]['iso'] .= "{$cc_key},";
                    $cont_array[3]['file4'] = "{$pfb['ccdir']}/North_America_v4.txt";
                    $cont_array[3]['file6'] = "{$pfb['ccdir']}/North_America_v6.txt";
                    break;
                case "OC":
                    $cont_array[4]['continent'] = "Oceania";
                    $cont_array[4]['iso'] .= "{$cc_key},";
                    $cont_array[4]['file4'] = "{$pfb['ccdir']}/Oceania_v4.txt";
                    $cont_array[4]['file6'] = "{$pfb['ccdir']}/Oceania_v6.txt";
                    break;
                case "SA":
                    $cont_array[5]['continent'] = "South America";
                    $cont_array[5]['iso'] .= "{$cc_key},";
                    $cont_array[5]['file4'] = "{$pfb['ccdir']}/South_America_v4.txt";
                    $cont_array[5]['file6'] = "{$pfb['ccdir']}/South_America_v6.txt";
                    break;
            }
        }
    }
    unset($cc);
    fclose($handle);
    // Add Maxmind Anonymous Proxy and Satellite Providers to array
    $cont_array[6]['continent'] = "Proxy and Satellite";
    $cont_array[6]['iso'] = "A1,A2";
    $cont_array[6]['file4'] = "{$pfb['ccdir']}/Proxy_Satellite_v4.txt";
    $cont_array[6]['file6'] = "{$pfb['ccdir']}/Proxy_Satellite_v6.txt";
    // Collect Country ISO data and sort to Continent arrays (IPv4 and IPv6)
    foreach (array("4", "6") as $type) {
        $log = "Processing ISO IPv{$type} Continent/Country Data\n";
        print $log;
        pfb_logger("{$log}", "3");
        if ($type == "4") {
            $maxmind_cc = "{$pfb['dbdir']}/GeoIPCountryWhois.csv";
        } else {
            $maxmind_cc = "{$pfb['dbdir']}/GeoIPv6.csv";
        }
        $iptype = "ip{$type}";
//.........这里部分代码省略.........
开发者ID:ronnel25,项目名称:pfsense-packages,代码行数:101,代码来源:pfblockerng.php

示例9: foreach

     /* except when in post-install mode.  Post-install does its own rebuild. */
     if ($g['suricata_postinstall']) {
         $rebuild_rules = false;
     } else {
         $rebuild_rules = true;
     }
     /* Create configuration for each active Suricata interface */
     foreach ($config['installedpackages']['suricata']['rule'] as $value) {
         $if_real = get_real_interface($value['interface']);
         // Make sure the interface subdirectory exists.  We need to re-create
         // it during a pkg reinstall on the intial rules set download.
         if (!is_dir("{$suricatadir}suricata_{$value['uuid']}_{$if_real}")) {
             safe_mkdir("{$suricatadir}suricata_{$value['uuid']}_{$if_real}");
         }
         if (!is_dir("{$suricatadir}suricata_{$value['uuid']}_{$if_real}/rules")) {
             safe_mkdir("{$suricatadir}suricata_{$value['uuid']}_{$if_real}/rules");
         }
         $tmp = "Updating rules configuration for: " . convert_friendly_interface_to_friendly_descr($value['interface']) . " ...";
         if ($pkg_interface != "console") {
             update_status(gettext($tmp));
             update_output_window(gettext("Please wait while Suricata interface files are being updated..."));
         }
         suricata_apply_customizations($value, $if_real);
         $tmp = "\t" . $tmp . "\n";
         error_log($tmp, 3, SURICATA_RULES_UPD_LOGFILE);
     }
 } else {
     if ($pkg_interface != "console") {
         update_output_window(gettext("Warning:  No interfaces configured for Suricata were found..."));
         update_output_window(gettext("No interfaces currently have Suricata configured and enabled on them..."));
     }
开发者ID:randyqx,项目名称:pfsense-packages,代码行数:31,代码来源:suricata_check_for_rule_updates.php

示例10: loadLangFile

 function loadLangFile($file, $standard = true, $plugin = '')
 {
     # loads a templating language file to the template, checks if cache is present
     # called by /index.php
     $file .= ".php";
     $strippedFile = str_replace("/", "_", $file);
     if ($standard) {
         if ($plugin == "") {
             $file = CONS_PATH_SETTINGS . "locale/" . $file;
         } else {
             $file = CONS_PATH_SYSTEM . "plugins/{$plugin}/locale/{$file}";
         }
     } else {
         $file = CONS_PATH_PAGES . $_SESSION['CODE'] . "/_config/locale/{$file}";
     }
     if (!is_file($file)) {
         return false;
     }
     if (!isset($_REQUEST['nocache'])) {
         # if nocache is specified, ignore caches ... not the case
         if ($standard) {
             if ($plugin != '') {
                 $plugin .= '/';
             }
             if (!is_dir(CONS_PATH_CACHE . "locale/{$plugin}")) {
                 safe_mkdir(CONS_PATH_CACHE . "locale/{$plugin}");
             }
             $cacheFile = CONS_PATH_CACHE . "locale/{$plugin}" . $strippedFile . ".cache";
             $cacheMTFile = CONS_PATH_CACHE . "locale/{$plugin}" . $strippedFile . ".cachemd";
         } else {
             if (!is_dir(CONS_PATH_CACHE . $_SESSION['CODE'] . "/meta/locale/")) {
                 safe_mkdir(CONS_PATH_CACHE . $_SESSION['CODE'] . "/meta/locale/");
             }
             $cacheFile = CONS_PATH_CACHE . $_SESSION['CODE'] . "/meta/locale/" . $strippedFile . ".cache";
             $cacheMTFile = CONS_PATH_CACHE . $_SESSION['CODE'] . "/meta/locale/" . $strippedFile . ".cachemd";
         }
         if (is_file($cacheFile) && is_file($cacheMTFile)) {
             $ofMD = filemtime($file);
             # modify date of ORIGINAL file
             $cMD = cReadFile($cacheMTFile);
             # modify date of ORIGINAL file when CACHE file was created
             if ($cMD == $ofMD) {
                 # valid cache file (it was created from the current original file)
                 $newData = @unserialize(cReadFile($cacheFile));
                 if (is_array($newData)) {
                     $this->parent->template->lang_replacer = array_merge($this->parent->template->lang_replacer, $newData);
                     return true;
                 } else {
                     $this->parent->errorControl->raise(6, $_SESSION[CONS_SESSION_LANG], $plugin, $standard ? "standard" : "non-standard");
                 }
             } else {
                 if ($this->parent->debugmode && CONS_CACHE) {
                     # Warning: if the lang file was replaced, template caches might be invalid
                     # So we must delete ALL TEMPLATE CACHES!
                     $this->parent->cacheControl->dumpTemplateCaches();
                 }
             }
         }
     }
     # no cache available or no cache specified
     $data = (include $file);
     if ($data === false || !is_array($data)) {
         $this->parent->errorControl->raise(7, $_SESSION[CONS_SESSION_LANG], $plugin, $standard ? "standard" : "non-standard");
         return false;
     }
     if (!isset($_REQUEST['nocache'])) {
         $ofMD = filemtime($file);
         cWriteFile($cacheMTFile, $ofMD);
         cWriteFile($cacheFile, serialize($data));
     }
     foreach ($data as $term => $trans) {
         $this->parent->template->lang_replacer[$term] = $trans;
         // array_merge has issues
     }
     return true;
 }
开发者ID:Prescia,项目名称:Prescia,代码行数:76,代码来源:intlControl.php

示例11: log_error

}
// If auto-updates of ET IQRisk are disabled, then exit
if ($config['installedpackages']['suricata']['config'][0]['et_iqrisk_enable'] == "off") {
    return 0;
} else {
    log_error(gettext("[Suricata] Updating the Emerging Threats IQRisk IP List..."));
}
// Construct the download URL using the saved ET IQRisk Subscriber Code
if (!empty($config['installedpackages']['suricata']['config'][0]['iqrisk_code'])) {
    $et_iqrisk_url = str_replace("_xxx_", $config['installedpackages']['suricata']['config'][0]['iqrisk_code'], ET_IQRISK_DNLD_URL);
} else {
    log_error(gettext("[Suricata] No IQRisk subscriber code found!  Aborting scheduled update of Emerging Threats IQRisk IP List."));
    return 0;
}
// Download the IP List files to a temporary location
safe_mkdir("{$iqRisk_tmppath}");
// Test the posted MD5 checksum file against our local copy
// to see if an update has been posted for 'categories.txt'.
if (suricata_check_iprep_md5("categories.txt")) {
    log_error(gettext("[Suricata] An updated IPREP 'categories.txt' file is available...downloading new file."));
    if (download_file("{$et_iqrisk_url}categories.txt", "{$iqRisk_tmppath}categories.txt") != true) {
        log_error(gettext("[Suricata] An error occurred downloading the 'categories.txt' file for IQRisk."));
    } else {
        // If the files downloaded successfully, unpack them and store
        // the list files in the SURICATA_IPREP_PATH directory.
        if (file_exists("{$iqRisk_tmppath}categories.txt") && file_exists("{$iqRisk_tmppath}categories.txt.md5")) {
            $new_md5 = trim(file_get_contents("{$iqRisk_tmppath}categories.txt.md5"));
            if ($new_md5 == md5_file("{$iqRisk_tmppath}categories.txt")) {
                @rename("{$iqRisk_tmppath}categories.txt", "{$iprep_path}categories.txt");
                @rename("{$iqRisk_tmppath}categories.txt.md5", "{$iprep_path}categories.txt.md5");
                $success = TRUE;
开发者ID:LFCavalcanti,项目名称:pfsense-packages,代码行数:31,代码来源:suricata_etiqrisk_update.php

示例12: exec

    }
}
if ($_POST['remove']) {
    exec("/sbin/pfctl -t {$suri_pf_table} -T flush");
    header("Location: /suricata/suricata_blocked.php");
    exit;
}
/* TODO: build a file with block ip and disc */
if ($_POST['download']) {
    $blocked_ips_array_save = "";
    exec("/sbin/pfctl -t {$suri_pf_table} -T show", $blocked_ips_array_save);
    /* build the list */
    if (is_array($blocked_ips_array_save) && count($blocked_ips_array_save) > 0) {
        $save_date = date("Y-m-d-H-i-s");
        $file_name = "suricata_blocked_{$save_date}.tar.gz";
        safe_mkdir("{$g['tmp_path']}/suricata_blocked");
        file_put_contents("{$g['tmp_path']}/suricata_blocked/suricata_block.pf", "");
        foreach ($blocked_ips_array_save as $counter => $fileline) {
            if (empty($fileline)) {
                continue;
            }
            $fileline = trim($fileline, " \n\t");
            file_put_contents("{$g['tmp_path']}/suricata_blocked/suricata_block.pf", "{$fileline}\n", FILE_APPEND);
        }
        // Create a tar gzip archive of blocked host IP addresses
        exec("/usr/bin/tar -czf {$g['tmp_path']}/{$file_name} -C{$g['tmp_path']}/suricata_blocked suricata_block.pf");
        // If we successfully created the archive, send it to the browser.
        if (file_exists("{$g['tmp_path']}/{$file_name}")) {
            ob_start();
            //important or other posts will fail
            if (isset($_SERVER['HTTPS'])) {
开发者ID:LFCavalcanti,项目名称:pfsense-packages,代码行数:31,代码来源:suricata_blocked.php

示例13: array

/* fix up the preprocessor rules filenames from a PBI package install */
$preproc_rules = array("decoder.rules", "preprocessor.rules", "sensitive-data.rules");
foreach ($preproc_rules as $file) {
    if (file_exists("{$snortdir}/preproc_rules/{$file}-sample")) {
        @rename("{$snortdir}/preproc_rules/{$file}-sample", "{$snortdir}/preproc_rules/{$file}");
    }
}
/* Remove any previously installed scripts since we rebuild them */
unlink_if_exists("{$snortdir}/sid");
unlink_if_exists("{$rcdir}snort.sh");
unlink_if_exists("{$rcdir}barnyard2");
/* Create required log and db directories in /var */
safe_mkdir(SNORTLOGDIR);
safe_mkdir(SNORT_IPREP_PATH);
safe_mkdir(SNORT_SID_MODS_PATH);
safe_mkdir(SNORT_APPID_ODP_PATH);
/* If installed, absorb the Snort Dashboard Widget into this package */
/* by removing it as a separately installed package.                 */
$pkgid = get_pkg_id("Dashboard Widget: Snort");
if ($pkgid >= 0) {
    log_error(gettext("[Snort] Removing legacy 'Dashboard Widget: Snort' package because the widget is now part of the Snort package."));
    unset($config['installedpackages']['package'][$pkgid]);
    unlink_if_exists("/usr/local/pkg/widget-snort.xml");
}
/* Define a default Dashboard Widget Container for Snort */
$snort_widget_container = "snort_alerts-container:col2:close";
/*********************************************************/
/* START OF BUG FIX CODE                                 */
/*                                                       */
/* Remove any Snort cron tasks that may have been left   */
/* from a previous uninstall due to a bug that saved     */
开发者ID:peekmessage,项目名称:pfsense-packages,代码行数:31,代码来源:snort_post_install.php

示例14: conf_mount_rw

        $command = "";
    }
    if ($first_command == "reset") {
        $playbackbuffer = "";
        echo "\nBuffer reset.\n\n";
        continue;
    }
    if ($first_command == "record") {
        if (!$command_split[1]) {
            echo "usage: record playbackname\n";
            echo "\tplaybackname will be created in /etc/phpshellsessions.\n";
            $command = "";
        } else {
            /* time to record */
            conf_mount_rw();
            safe_mkdir("/etc/phpshellsessions");
            $recording_fn = basename($command_split[1]);
            $recording_fd = fopen("/etc/phpshellsessions/{$recording_fn}", "w");
            if (!$recording_fd) {
                echo "Could not start recording session.\n";
                $command = "";
            } else {
                $recording = true;
                echo "Recording of {$recording_fn} started.\n";
                $command = "";
            }
        }
    }
    $playbackbuffer .= $command . "\n";
}
function show_recordings()
开发者ID:KyleJohnstonNet,项目名称:pfsense,代码行数:31,代码来源:pfSsh.php

示例15: killbyname

    killbyname("barnyard2");
    sleep(2);
    // Delete any leftover barnyard2 PID files in /var/run
    unlink_if_exists("{$g['varrun_path']}/barnyard2_*.pid");
}
// Set flag for post-install in progress
$g['suricata_postinstall'] = true;
// Mount file system read/write so we can modify some files
conf_mount_rw();
// Remove any previously installed script since we rebuild it
@unlink("{$rcdir}suricata.sh");
// Create the top-tier log directory
safe_mkdir(SURICATALOGDIR);
// Create the IP Rep and SID Mods lists directory
safe_mkdir(SID_MODS_PATH);
safe_mkdir(IPREP_PATH);
// remake saved settings if previously flagged
if ($config['installedpackages']['suricata']['config'][0]['forcekeepsettings'] == 'on') {
    log_error(gettext("[Suricata] Saved settings detected... rebuilding installation with saved settings..."));
    update_status(gettext("Saved settings detected..."));
    /****************************************************************/
    /* Do test and fix for duplicate UUIDs if this install was      */
    /* impacted by the DUP (clone) bug that generated a duplicate   */
    /* UUID for the cloned interface.  Also fix any duplicate       */
    /* entries in ['rulesets'] for "dns-events.rules".              */
    /****************************************************************/
    if (count($config['installedpackages']['suricata']['rule']) > 0) {
        $uuids = array();
        $suriconf =& $config['installedpackages']['suricata']['rule'];
        foreach ($suriconf as &$suricatacfg) {
            // Remove any duplicate ruleset names from earlier bug
开发者ID:MarkVLK,项目名称:pfsense-packages,代码行数:31,代码来源:suricata_post_install.php


注:本文中的safe_mkdir函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。