Step-by-Step Guide to Setting Up Snort Hybrid Intrusion Detection on Windows Server 2003

Deployment Process

Once all the required environment packages are downloaded, you can begin the setup process.

Environment package download link: https://download.csdn.net/download/weixin_42431775/19826391?spm=1001.2014.3001.5503

I. Installing and Configuring Snort

1. Installing Snort

This guide uses Snort version 2.8.6. The installation process is straightforward—simply click “Next” throughout the setup without any special configurations.

2. Replacing Snort Rules

Copy the doc, rules, and so_rules folders from the rule package corresponding to your Snort version into the Snort installation directory, and overwrite all files.
Snort hybrid intrusion detection

3. Opening the Configuration File

Navigate to the etc folder in the Snort installation directory and open snort.conf using a text editor (Notepad++ or similar is recommended, as plain text editors may not display the code properly).

4. Modifying the Configuration File

1. Locate the line containing the keyword var RULE_PATH and modify it as follows:
Snort hybrid intrusion detection

  
// Copy and overwrite directly  
var RULE_PATH c:\snort\rules  
var SO_RULE_PATH c:\snort\so_rules  
var PREPROC_RULE_PATH c:\snort\preproc_rules  

2. Locate the line containing the keyword # path to dynamic preprocessor and modify it as follows:
Insert image description here

  
// Copy and overwrite directly  
# path to dynamic preprocessor libraries  
dynamicpreprocessor directory c:\snort\lib\snort_dynamicpreprocessor  

# path to base preprocessor engine  
dynamicengine c:\snort\lib\snort_dynamicengine\sf_engine.dll  

3. Locate the line containing the keyword preprocessor http_inspect and modify it as follows:
Insert image description here

  
// Copy and overwrite directly  
preprocessor http_inspect: global iis_unicode_map c:\snort\etc\unicode.map 1252  

4. Locate the line containing the keyword output database and modify it as follows:
Insert image description here

  
// Copy and overwrite directly  
output database: alert, mysql, user=snort password=snort dbname=snortdb host=localhost  

5. Locate the line containing the keyword # decoder and preprocessor event rules and modify the relevant lines as follows:
Insert image description here

  
// Copy and overwrite directly. Pay attention to the range of lines being replaced!  
include $RULE_PATH/snmp.rules  
include $RULE_PATH/icmp.rules  
include $RULE_PATH/tftp.rules  
include $RULE_PATH/scan.rules  
include $RULE_PATH/finger.rules  
include $RULE_PATH/web-attacks.rules  
include $RULE_PATH/shellcode.rules  
include $RULE_PATH/policy.rules  
include $RULE_PATH/info.rules  
include $RULE_PATH/icmp-info.rules  
include $RULE_PATH/virus.rules  
include $RULE_PATH/chat.rules  
include $RULE_PATH/multimedia.rules  
include $RULE_PATH/p2p.rules  
include $RULE_PATH/spyware-put.rules  
include $RULE_PATH/specific-threats.rules  
include $RULE_PATH/voip.rules  
include $RULE_PATH/other-ids.rules  
include $RULE_PATH/bad-traffic.rules  

# decoder and preprocessor event rules  
include $PREPROC_RULE_PATH/preprocessor.rules  
include $PREPROC_RULE_PATH/decoder.rules  

# dynamic library rules  
include $SO_RULE_PATH/bad-traffic.rules  
include $SO_RULE_PATH/chat.rules  
include $SO_RULE_PATH/dos.rules  
include $SO_RULE_PATH/exploit.rules  
include $SO_RULE_PATH/imap.rules  
include $SO_RULE_PATH/misc.rules  
include $SO_RULE_PATH/multimedia.rules  
include $SO_RULE_PATH/netbios.rules  
include $SO_RULE_PATH/nntp.rules  
include $SO_RULE_PATH/p2p.rules  
include $SO_RULE_PATH/smtp.rules  
include $SO_RULE_PATH/sql.rules  
include $SO_RULE_PATH/web-activex.rules  
include $SO_RULE_PATH/web-client.rules  
include $SO_RULE_PATH/web-misc.rules  

II. Installing and Configuring AppServ

1. Installing AppServ

AppServ is an integrated software package that includes Apache and MySQL. Proceed with the installation by clicking “Next” throughout, as shown below:
Insert image description here
Insert image description here

2. Verifying Apache Installation

Open a browser and enter localhost or 127.0.0.1 to verify that Apache is installed correctly. If it fails to load, check whether port 80 is occupied by IIS or whether the Apache service is running.
Insert image description here

3. Creating a MySQL Database and Tables

Insert image description here

  
// Copy and paste directly. Note that some lines require a semicolon at the end, while others do not!  
mysql> create database snortdb;  
mysql>  

sql
create database snortarc;
mysql> use snortdb;
mysql> source c:\snort\schemas\create_mysql
mysql> use snortarc;
mysql> source c:\snort\schemas\create_mysql
mysql> grant usage on *.* to “snort”@”localhost” identified by “snort”;
mysql> grant select,insert,update,delete,create,alter on snortdb.* to “snort”@”localhost”;
mysql> grant select,insert,update,delete,create,alter on snortarc.* to “snort”@”localhost”;
mysql> set password for “snort”@”localhost” = password(‘snort’);

3. Configure BASE

You can use either the command line or a visual window; the visual window is recommended.

1. Copy the base and adodb folders to the AppServ\www directory

![Insert image description here](https://www.ids-sax2.com/wp-content/uploads/picture/i-blog-csdnimg-cn-2444004c599163e13d9f08998d937a9d.png)

2. Perform operations in the visual window

![Insert image description here](https://www.ids-sax2.com/wp-content/uploads/picture/i-blog-csdnimg-cn-2866f93a2df47e14c8ae0fe32deb5abe.png)
![Insert image description here](https://www.ids-sax2.com/wp-content/uploads/picture/i-blog-csdnimg-cn-9d7d790d901e2260d692694bcf7deb27.png)
![Insert image description here](https://www.ids-sax2.com/wp-content/uploads/picture/i-blog-csdnimg-cn-31b3fb91f028d5a3be0c5cc69ca2da45.png)
![Insert image description here](https://www.ids-sax2.com/wp-content/uploads/picture/i-blog-csdnimg-cn-a10b10400bfe4c1ee502d7022d376a1f.png)
![Insert image description here](https://www.ids-sax2.com/wp-content/uploads/picture/i-blog-csdnimg-cn-1f038a1f41d84093156fe34b6377d9ae.png)
![Insert image description here](https://www.ids-sax2.com/wp-content/uploads/picture/i-blog-csdnimg-cn-b2c98b368e353bdd1e95de14c727b4b5.png)

In your browser, enter: `localhost\base\base_main.php` or `127.0.0.1\base\base_main.php` to access the BASE visual interface.

![Insert image description here](https://www.ids-sax2.com/wp-content/uploads/picture/i-blog-csdnimg-cn-0120dc615d62aa5d428c4236d5b96a05.png)

4. Start Snort

1. Navigate to the snort\bin directory

bash
cd /Snort/bin

2. Run Snort in network monitoring mode

bash
snort -c c:\snort\etc\snort.conf -l c:\snort\logs -d -e -v

3. Observe the statistics

Use another machine to scan this host with nmap, and you can see the statistics in the BASE interface (you need to manually refresh to see the new statistics).

bash
c:\snort\bin\snort -i1 -dev -c c:\snort\etc\snort.conf -l c:\snort\log

4. If Snort fails to start (fails to run in network monitoring mode) and displays an error, as shown below:

![Insert image description here](https://www.ids-sax2.com/wp-content/uploads/picture/i-blog-csdnimg-cn-5454c0a38dd068efaa646d4d27c8737e.png)