Architecture framework of Snort (1)

Source: Internet
Author: User

 

Snort has many running Modes

For example:

 

# Define mode_packet_dump 1

# Define mode_packet_log 2

# Define mode_ids 3

# Define mode_test 4

# Define mode_rule_dump 5

# Define mode_version 6

 

Extern u_int8_t runmode;

 

 

 

The following section only analyzes the mode_ids mode ....

 

Main ()

{

Parsesponline function ===" initialize global variable PV;

 

Initoutputplugins () ;==> Generate an Alarm Type Library...

For example:

# Define nt_output_alert 0x1/* output node type alert */
# Define nt_output_log 0x2/* output node type log */
# Define nt_output_special 0x4/* Special output node type */


Initpreprocessors ()

Initplugins () ;== "generate the detection plug-in library ....

 

Parserulesfile (Pv. config_file, 0, parse_rule_lines) ;== "parse the configuration file. The most important step is to select the alarm type linked list from the Alarm Type Library according to the configuration, select a plug-in from the detection plug-in library according to the configuration to generate a rule tree ..

 

Setpktprocessor (); select the package processor based on the network card type ..

 

Fpcreatefastpacketdetection (); generate a quick detection rule tree based on the generated rule tree...

 

Interfacethread (); starts to capture packets, analyzes and matches packets with the selected package processor, and generates alarms...

}

 

The next section describes how to generate a rule tree .. The flexible plug-in technique is used here ..

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.