コード例 #1
0
/*
**  Initialize the portscan infrastructure.  We check to make sure that
**  we have enough memory to support at least 100 nodes.
**
**  @return int
**
**  @retval -2 memcap is too low
*/
int ps_init(struct _SnortConfig *sc, PortscanConfig *config, int detect_scans, int detect_scan_type,
            int sense_level, IPSET *scanner, IPSET *scanned, IPSET *watch, unsigned long memcap)
{
    if (getParserPolicy(sc) != getDefaultPolicy())
    {
        /**checks valid for non-default policy only. Default is allowed to specify
         * just memcap.
         */
        if (!(detect_scans & PS_PROTO_ALL))
            return -1;

        if(!(detect_scan_type & PS_TYPE_ALL))
            return -1;

        if(sense_level < 1 || sense_level > 3)
            return -1;

    }
    else
    {
        /**memcap from non-default is ignored, so check is valid for default policy
         * only
         */
        if(memcap <= 0 || (unsigned)memcap < (sizeof(PS_TRACKER) * 100))
            return -2;
    }

    config->memcap           = memcap;
    config->detect_scans     = detect_scans;
    config->detect_scan_type = detect_scan_type;
    config->sense_level      = sense_level;
    config->ignore_scanners  = scanner;
    config->ignore_scanned   = scanned;
    config->watch_ip         = watch;

    return 0;
}
コード例 #2
0
ファイル: snort_stream_udp.c プロジェクト: richardqa/snort
static SessionControlBlock *StreamUDPCreateSession(const SessionKey *key)
{
    setNapRuntimePolicy(getDefaultPolicy());

    return session_api->create_session(udp_lws_cache, NULL, key );
}
コード例 #3
0
ファイル: output_plugin.c プロジェクト: GumpChan/blackcat
tSfPolicyId GetDefaultPolicy(void)
{
    return getDefaultPolicy();
}