Lab Manual
Lab Manual
NAME: _____________________________________
USN: _______________________________________
SEMESTER: _________________________________
BRANCH: ___________________________________
SUBJECT NAME: _____________________________
SUBJECT CODE: _____________________________
BATCH: _____________________________________
“Jnana Prabha”
#147 Bidarahalli, Virgonagar Post
(Near K.R. Puram – Avalahalli) T: +91 80 284 72 999 E: [email protected]
Bangalore – 560049 F: +91 80 250 73 903 www.eastpoint.ac.in
1
LAB PROGRAMS
Lab Page
EXPERIMENT NAME
No. No.
Lab 1 Install Virtual Box and Configure it. 03
Lab 7 Understand the Nmap command and scan targets using Nmap. 23
2
EXPERIMENT 01
Aim: Install Virtual Box and Configure it.
Objective:
Requirements:
o 8 GB RAM
Steps:
Part 1: Installation
• For VirtualBox:
2. Select and download the version suitable for your operating system (Windows,
macOS, or Linux).
• For VMware:
• VirtualBox:
3
▪ Allow any permissions requested.
Part 2: Configuration
1. Restart your computer and enter the BIOS/UEFI settings (typically by pressing Del,
F2, or F12 during boot).
• For VirtualBox:
1. Open VirtualBox and click New.
▪ Choose the type (e.g., VDI) and allocate storage (e.g., 20 GB).
4
6. Click Create.
• For VMware:
1. Open VMware Workstation Player and click Create a New Virtual Machine.
o VirtualBox: Go to Settings > Storage, select the empty optical drive, and add
the ISO.
o VMware: During the first boot, select the ISO file as the boot disk.
Verification
1. Verify that the virtual machine boots up successfully into the installed OS.
o Internet connectivity.
5
EXPERIMENT 02
Aim: Install Kali Linux in VirtualBox and Configure it
Objective:
To install Kali Linux, a penetration testing operating system, on VirtualBox and configure it
for basic use.
Requirements:
1. A computer with:
2. Kali Linux ISO file (download from Kali Linux Official Website)
4. Click Next.
6
Step 2: Configure Resources
1. Memory (RAM):
2. Hard Disk:
2. Navigate to Storage.
4. Click the disk icon on the right and select Choose a disk file.
7
Step 4: Partition the Disk
2. Select the virtual disk and follow the default partitioning scheme.
8
EXPERIMENT 03
Aim: Explore all the Basic Commands Used in Kali Linux.
Objective:
To understand and practice basic Linux commands essential for navigation, file management,
and system operations in Kali Linux
whoami
2. Switch User:
su <username>
uname -a
df -h
ls
o Options:
9
2. Change Directory:
cd <directory_name>
o Examples:
cd /home # Go to the home directory
3. Create a Directory:
mkdir <directory_name>
cat <file_name>
o Alternatives:
cp <source> <destination>
o Example:
cp file1.txt /home/user/backup/
mv <source> <destination>
o Example:
10
8. Delete Files or Directories:
rm <file_name>
o For directories:
rm -r <directory_name>
11
EXPERIMENT 04
Aim: Basic File Permissions and User Management.
Objective:
To understand and practice file permission management and user management in Kali Linux.
Steps:
2. ls -l
o Output example:
o Breakdown of permissions:
o Example:
▪ 4: Read-only (r--).
o Example usage:
o chmod 644 example.txt # Owner can read and write, others can read only
12
Step 3: Change File Ownership
o Example:
o sudo chown user2 example.txt
o Example:
o Example:
o Example:
o Example:
13
o sudo deluser john
o Example:
o Example:
o sudo gpasswd -d john sudo
Step 4: Manage User Passwords
o Example:
o Example:
o Example:
14
o sudo usermod -g developers john
o Example:
o sudo usermod -aG admin john
1. Remove a group:
o Example:
15
EXPERIMENT 05
Aim: Explore Kali Linux and bash scripting.
Objective:
To familiarize with the Kali Linux environment and learn the basics of Bash scripting to
automate tasks.
Steps:
3. ls /usr/share
o ifconfig
o ps aux
o Examples:
o which nmap
o which msfconsole
7. lsb_release -a
3. Verify updates:
4. uname -r
16
Part 2: Bash Scripting Basics
2. nano script.sh
3. Add the following script to the file:
4. #!/bin/bash
13. ./script.sh
2. nano check_file.sh
6. read filename
7. if [ -f "$filename" ]; then
9. else
17
14. ./check_file.sh
2. nano loop.sh
3. Add the following code:
4. #!/bin/bash
5. for i in {1..10}; do
7. done
9. chmod +x loop.sh
10. ./loop.sh
Step 4: Automate a Common Task
2. nano update_system.sh
4. #!/bin/bash
9. chmod +x update_system.sh
10. ./update_system.sh
2. #!/bin/bash
3. echo "Enter directory name:"
4. read dir_name
5. mkdir "$dir_name"
18
6. echo "Directory $dir_name created."
19
EXPERIMENT 06
Aim: Apply Netcraft, who is Lookups, DNS Reconnaissance, Harvester and
Maltego to perform open-source intelligence gathering.
Objective:
To utilize various OSINT tools for information gathering on a target domain or entity,
understanding how each tool contributes to reconnaissance.
Steps:
2. Enter the target domain (e.g., example.com) in the search bar and analyze the results.
o Information obtained:
▪ Hosting details.
▪ Server technologies.
▪ SSL/TLS certificates.
4. Analyze the output and identify useful intelligence for the investigation.
5. (Optional) Use online Whois lookup tools for cross-verification, e.g., ICANN Whois
Lookup.
1. Using nslookup:
20
o Perform a basic DNS query:
o nslookup example.com
o dig example.com
o dig example.com MX
3. Using dnsenum:
o Perform an in-depth DNS enumeration:
o dnsenum example.com
o Information retrieved:
▪ Subdomains.
▪ MX and NS records.
o Options:
o Emails.
o Subdomains.
o Associated IPs.
21
5. theharvester -d example.com -l 500 -b all -f report.txt
2. maltego
3. Create a new graph:
4. Add an entity:
5. Run transforms:
o Right-click the domain entity and select various transforms, such as:
▪ DNS to IP.
▪ Domain to email addresses.
6. Visualize relationships:
Part 6: Documentation
o Contact information.
22
EXPERIMENT 07
Aim: Understand the Nmap command and scan targets using Nmap.
Objective:
To explore the functionality of the Nmap (Network Mapper) tool and perform various types
of network scans on target systems.
Steps:
2. nmap --version
o Example output:
4. nmap -h
1. Ping Scan:
o Example:
o nmap -sn 192.168.1.0/24
2. Port Scan:
o nmap <target>
o Example:
o nmap 192.168.1.1
o Scan a range:
o nmap 192.168.1.1-50
23
Part 3: Advanced Scans
o nmap -O <target>
o Example:
o nmap -O 192.168.1.1
3. Aggressive Scan:
o Combine version detection, OS detection, and script scanning:
o nmap -A <target>
o Example:
o nmap -A 192.168.1.1
4. Stealth Scan:
1. UDP Scan:
o Example:
o nmap -sU 192.168.1.1
24
2. Scan Specific Ports:
o Example:
o nmap -p 22,80 192.168.1.1
o Example:
o Example:
2. nmap localhost
25
EXPERIMENT 08
Aim: Understand the Nmap command and scan targets using Nmap.
Objective:
To learn the basics of packet analysis using Wireshark by capturing, filtering, and analyzing
network traffic.
Steps:
4. Run Wireshark:
o Launch Wireshark with root privileges:
o sudo wireshark
o In the main Wireshark window, choose the network interface to capture traffic
(e.g., eth0 for Ethernet or wlan0 for Wi-Fi).
o View the packet list pane for detailed information, such as:
26
Part 3: Applying Filters
1. Basic Filters:
o tcp
o udp
o icmp
o ip.src == <source_IP>
o Example:
o ip.src == 192.168.1.1
o http
o DNS queries:
o dns
o tcp.port == 80
3. Combine Filters:
o tcp.flags.syn == 1
o Analyze the SYN, SYN-ACK, and ACK sequence to understand the TCP
handshake.
27
2. Analyze HTTP Requests:
o http
o dns
▪ IP header.
▪ TCP/UDP header.
2. Generate a Summary:
o Go to Statistics → Summary.
o ping <server_IP>
o Icmp
28
2. Capture HTTP Traffic:
o ftp
29
EXPERIMENT 09
Aim: Kali Linux-Social Engineering Tool Kit usage.
Objective:
To learn how to use the Social Engineering Toolkit (SET) in Kali Linux for simulating
social engineering attacks, including phishing and credential harvesting.
Steps:
1. Open Kali Linux and ensure SET is installed. It is pre-installed in Kali by default, so
you can check if it's available:
2. setoolkit
3. Launching SET:
o sudo setoolkit
4. Welcome Screen:
o The SET interface will appear with several options. You will be presented
with a menu that allows you to choose different types of social engineering
attacks.
▪ 1) Social-Engineering Attacks
▪ 6) Exit
o Select 1) Social-Engineering Attacks by typing 1 and pressing Enter.
▪ 1) Spear-Phishing Attack.
30
▪ 2) Website Attack Vectors.
▪ 5) Arduino-based attacks.
▪ 6) Exit.
3. Phishing Attacks:
▪ 5) Exit
o Select the site to mimic, such as Facebook, Google, Twitter, etc., or you can
provide a custom URL.
o SET will generate the fake phishing site and start the credential harvesting
process.
o Share the phishing URL (generated by SET) with your target. When the target
enters their credentials, they will be captured by the SET and saved for review.
o SET will show you the captured credentials on the terminal as they are entered
by the victim.
31
o Go back to the main Social Engineering menu and select 1) Spear-Phishing
Attack.
o This option allows you to create a fake email that contains a malicious link or
attachment.
o SET will create and send the email on your behalf, containing the malicious
link or attachment.
o If you choose the Java Applet Attack Method, SET will generate a malicious
Java applet that, when executed by the target, allows you to gain remote
access to the target system or execute other payloads.
o After the attack is complete, you can review the captured data:
32
▪ Examine any successful exploits triggered by malicious JavaScript or
the Metasploit integration.
2. Reporting:
o Document the attack vectors, tools used, and the results. This can include:
2. Avoid Misuse:
o Social Engineering Toolkit is a powerful tool and should only be used for
educational purposes or authorized penetration testing engagements.
33
EXPERIMENT 10
Aim: Kali Linux-Information Gathering Tools (NMAP and Zen MAP).
Objective:
To learn how to use Nmap and Zenmap for network reconnaissance, scanning, and
information gathering to identify active hosts, open ports, and services running on a target
system.
Steps:
1. What is Nmap?
o Zenmap is the graphical user interface (GUI) for Nmap. It provides a user-
friendly interface to interact with Nmap and visualize the results in a more
accessible format.
3. Verify Installation:
o Nmap is pre-installed on Kali Linux, but if you are using another system,
install Nmap using:
4. Launch Zenmap:
o sudo zenmap
o nmap --version
34
o To scan a target system, use the following command:
o nmap <target_ip>
o Example:
o nmap 192.168.1.1
3. Scan a Range of IPs:
o nmap 192.168.1.1-50
4. Scan a Subnet:
o nmap 192.168.1.0/24
o nmap -O 192.168.1.1
8. Aggressive Scan:
o nmap -A 192.168.1.1
1. Launching Zenmap:
35
o sudo zenmap
o In the Target field, enter the IP address or range of IP addresses you want to
scan.
o In the Profile dropdown, you can select various scan types like:
o Click Scan to begin the network scan. Zenmap will execute the Nmap scan in
the background and display the results in the interface.
o Hosts tab: View the list of active hosts and their IPs.
o Nmap Output tab: Raw Nmap scan results for detailed analysis.
o nmap 192.168.1.1,192.168.1.2,192.168.1.3
36
o Nmap has a powerful scripting engine that can be used to scan for specific
vulnerabilities and conduct more complex reconnaissance:
o Use timing options to speed up or slow down the scan. For example, a faster
scan:
4. Stealth Scan:
o Perform a stealth SYN scan to avoid detection by firewalls and intrusion
detection systems (IDS):
o nmap 192.168.1.100
o Scan for service versions on a remote host to identify software and potential
vulnerabilities:
o nmap -O 192.168.1.1
o Use the Intense Scan profile in Zenmap to scan a target for open ports,
services, and OS information.
37
EXPERIMENT 11
Aim: Using Netstat for Network Connection Monitoring.
Objective:
To learn how to use the Netstat command in Kali Linux for monitoring network connections,
identifying open ports, and troubleshooting network issues.
Steps:
1. What is Netstat?
2. Verify Installation:
o netstat --version
▪ Recv-Q and Send-Q: The number of bytes in the receive and send
queues.
o netstat -a
38
2. Show Listening Ports:
o To list only the ports that are in the "LISTEN" state (waiting for incoming
connections):
o netstat -l
o To display active connections along with the corresponding process IDs (PID)
and the name of the programs involved:
o netstat -t
o To display UDP connections only:
o netstat -u
o To view the system’s routing table (which networks are reachable through
which interfaces):
o netstat -r
o netstat -s
o To monitor network connections in real-time, you can use the watch command
to run netstat periodically:
o watch -n 1 'netstat -tulnp'
39
This will update the network connections every second.
o To monitor a specific port for any incoming or outgoing traffic, you can use
grep to filter results. For example, to check connections on port 80 (HTTP):
o To see which ports are open and listening for connections on your local
machine:
o This will show which services are listening on ports like 80 (HTTP), 443
(HTTPS), 22 (SSH), etc.
▪ Check for multiple connections from the same foreign IP, which could
indicate an attack or misuse.
o If you suspect suspicious activity, you can filter Netstat output by IP or port:
o netstat -tulnp | grep <IP_or_Port>
o This will help identify any unauthorized access or unexpected connections.
40
Part 5: Advanced Netstat Usage
o netstat -g
o For more specific searches, use grep to filter the results. For example, to check
all connections from a particular IP (e.g., 192.168.1.100):
o Open a web browser and browse different websites. Then, use Netstat to
observe the network connections:
o If you are connected to a remote machine via SSH, check the connection state:
o netstat -tulnp | grep ssh
41
EXPERIMENT 12
Aim: Basic Packet Capture with Tcpdump.
Objective:
To learn how to use Tcpdump for capturing and analyzing network traffic, helping you
understand network communication, troubleshoot issues, and analyze suspicious activity.
Steps:
1. What is Tcpdump?
o tcpdump --version
▪ Timestamp
▪ Packet length
o sudo tcpdump
42
o This will display captured packets in real-time. Press Ctrl + C to stop the
capture.
o Replace eth0 with the name of your network interface. You can list network
interfaces on your system using:
o tcpdump -D
o sudo tcpdump -c 10
o This will capture only the first 10 packets and then stop.
o To save the captured packets to a file for later analysis, use the -w option:
o This will save the packets to the capture.pcap file, which you can open later in
tools like Wireshark for detailed analysis.
o To capture packets only from or to a specific host, use the host filter:
43
o sudo tcpdump dst 192.168.1.1
o To display more detailed information about each captured packet, use the -v
option. Use multiple v options for more verbosity:
o sudo tcpdump -v
o To limit the number of bytes of each packet captured (useful for analyzing
headers without capturing the entire payload), use the -s option:
o sudo tcpdump -s 64
3. Capture Packets with Timestamp:
44
4. Capture Only Packets with a Specific Size:
o After capturing packets, use the tcpdump -r command to review the packets:
o This will display the raw packet data captured in the file.
o Tcpdump displays protocol information for each packet. You can look for:
Analyzing these protocols can help you troubleshoot network issues or detect suspicious
activity (e.g., denial of service attacks, unauthorized access attempts).
o To capture HTTP traffic (port 80) and save the output to a file:
45
5. Monitor Traffic on a Wireless Network Interface:
o If you're using a wireless interface (e.g., wlan0), you can monitor packets on
that interface:
46