Experiment 1ss Merged
Experiment 1ss Merged
01
A.1 Aim:
Design and Implementation of a product cipher using Substitution and Transposition
ciphers.
A.2 Prerequisite:
1. Basic Knowledge of Cryptography.
2. Knowledge of Substitution Cipher techniques.
A.3 Outcome:
After the successful completion of this experiment, students will be able to
apply the knowledge of symmetric cryptography to implement simple ciphers.
A.4 Theory:
● Cryptography is the art of achieving security by encoding messages to make
them non-readable.
There are two types of cryptographic algorithms:
● Substitution and
● Transposition.
Product cipher is a combination of both these types to achieve a better effect of
security.
An original message is known as the plaintext, while the coded message is called
the ciphertext.
The many schemes used for encryption constitute the area of study known as
cryptography. Such a scheme is known as a cryptographic system or a cipher.
Output:
Output:
A.2 Prerequisite:
Basic Knowledge of Asymmetric Key Cryptography.
A.3 Outcome:
After the successful completion of this experiment, students will be able to
Analyze the various public-key cryptographic techniques and their applications.
A.4 Theory:
A. RSA Algorithm:
● A user of RSA creates and then publishes a public key based on two large
prime numbers, along with an auxiliary value. The prime numbers must be
kept secret. Anyone can use the public key to encrypt a message, but with
currently published methods, and if the public key is large enough, only
someone with knowledge of the prime numbers can decode the message
feasibly.[2] Breaking RSA encryption is known as the RSA problem. Whether it
is as difficult as the factoring problem remains an open question.
1. Accept two prime numbers from the user (say p and q).
2. Calculate n = p * q.
3. Calculate Φ(n) as
Φ (n) = (p - 1) * (q – 1).
4. Considering e * d = Φ(n) + 1, determine e and d where e and d are prime
numbers.
5. To display information at sender as (e, n) and information at receiver as (d,
n).
6. Check whether the user is sender or receiver.
7. If the user is the sender
a. Get message M from the user.
b. C = Me mod n.
c. Send ciphertext C to the receiver.
d. Go to stop.
8. If the user is the receiver
a. Get ciphertext C from the user.
b. M = Cd mod n.
c. Display plain text M to the receiver.
d. Go to stop.
9. Ask whether the user wants to continue (yes or no?)
If yes, go to step 7.
Else go to stop.
▪ EXAMPLE:
● Choose p = 3 and q = 11
● Compute n = p * q = 3 * 11 = 33
● Compute φ(n) = (p - 1) * (q - 1) = 2 * 10 = 20
● Choose e such that 1 < e < φ(n) and e and n are co-prime. Let e = 7
● Compute a value for d such that (d * e) % φ(n) = 1. One solution is d = 3 [(3 *
7) % 20 = 1]
● Public key is (e, n) => (7, 33)
Therefore, a digital signature is required not to be separated from the message and
attached to another. That is a digital signature is required to be both message and
signer dependent. For validating the signature anyone can verify the signature, so a
digital signature is supposed to be verified easily.
1. Key generation:- User compute their public key and corresponding private key.
2. Signing:- In this step, the user signs a given message with his/her private key.
3. Verification:- In this step user verify a signature for a given message and public
key.
Non- repudiation:- For a valid signature sender of the message cannot deny having
signed it.
Grade:
2. RSA_2.PY
3. RSA_math.py
Conclusion:
This experiment helped us understand the working of the RSA algorithm and its
mathematical foundations such as prime numbers, modular arithmetic, and the concept
of public and private keys. We learned how encryption and decryption are performed
using key pairs, ensuring secure communication. The experiment also demonstrated
how digital signatures and public key cryptography enhance data security and
authentication. Overall, it provided practical knowledge of implementing RSA using
Python
For varying message sizes, test the integrity of the message using MD-5, SHA-
1, and analyze the performance of the two protocols. Use crypt APIs.
A.2 Prerequisite:
A.3 Outcome:
After the successful completion of this experiment, students will be able to
analyze and evaluate the performance of hashing algorithms.
A.4 Theory:
MD5 (Message-Digest algorithm 5) is a widely used cryptographic hash
function with a 128-bit hash value. An MD5 hash is typically expressed as a 32 digit
hexadecimal number. MD5 processes a variable-length message into a fixed-length
output of 128 bits. The input message is broken up into chunks of 512-bit blocks
(sixteen 32bit little-endian integers) ; The message is padded so that its length is
divisible by 512. The padding works as follows: first, a single bit, 1, is appended to
the end of the message. This is followed by as many zeros as are required to bring
the length of the message up to 64 bits less than a multiple of 512. The remaining
bits are filled up with a 64bit integer representing the length of the original message,
in bits.
The main MD5 algorithm operates on a 128bit state, divided into four 32bit
words, denoted A, B, C and D. These are initialized to certain fixed constants. The
main algorithm then operates on each 512bit message block, in turn, each block
modifying the state. The processing of a message block consists of our similar
stages, termed rounds; each round is composed of 16 similar operations based on a
nonlinear function F, modular addition, and left rotation.
Figure 1 illustrates one operation within one round. There are four possible
functions F; a different one is used in each round:
F(X ,Y, Z) = (X˄Y ) ˅ (¬ X ˄ Z)
G(X ,Y, Z) = ( X ˄ Z) ˅ (Y ˄¬Z)
H (X ,Y, Z) = X ⊕ Y ⊕ Z
I(X ,Y , Z) =Y ⊕ (X ˅ ¬Z)
2. Append Length
A 64-bit representation of b (the length of the message before the padding bits were
added) is appended to the result of the previous step. In the unlikely event that b is
greater than 2^64, then only the low order 64 bits of b are used. (These bits are
appended as two 32bit words and appended low- order word first following the
previous conventions.) At this point, the resulting message (after padding with bits
and with b) has a length that is an exact multiple of 512 bits. Equivalently, this
message has a length that is an exact multiple of 16 (32 bit) words. Let M[0 ... N1]
denote the words of the resulting message, where N is a multiple of16.
3. Initialize MD Buffer
A four-word buffer (A, B, C, D) is used to compute the message digest. Here each of
A, B, C, D is a 32bit register. These registers are initialized to the following values in
hexadecimal, low-order bytes first):
Note: Don’t write code for MD5 or SHA1. Analyze the performance using crypt APIs.
Grade:
INPUT:
OUTPUT:
INPUT:
● SHA1
OUTPUT:
MD5 codes any stream of bytes into a 128-bit value while SHA1 codes any
stream of bytes into a 160-bit value. Therefore the SHA1 will provide more security
compared to MD5. The MD5 algorithm is cheaper to compute, however, MD5 is found
to be more vulnerable to collision attacks. Comparison of both algorithms in terms of
output length, memory usage, processing time, variance and time to brute force can
be seen in more detail can be seen in Table.
SHA-1 has a processing time that is not much different than MD5, even
relatively the same. The MD5 algorithm has a processing time of 0.029 seconds for
each variation of the password length (8, 9, 10 characters), MD5 + salt for 0.028
seconds, SHA-1 for 0.029 seconds, while SHA-1 + salt has 0.03 seconds. While for the
use of CPU resources, SHA-1 uses more resources than MD5, but the differences were
not so big. The MD5 algorithm used 9.56%, 9.96%, and 10.57% CPU resources for a
password length of 8, 9, and 10 characters respectively. While MD5 + salt used 9.85%,
10.29%, and 10.96%, SHA-1 used 10.36%, 10.96%, and 12.4%, and SHA1 + salt used
10.39%, 11.27%, and 12.65 % respectively. From the three testings conducted, we
can conclude that SHA-1 + salt gives better security for password protection in
B.3 Conclusion:
This experiment helped us understand the working of the MD5 hashing algorithm
and its ability to convert input data into a fixed-length 128-bit hash value. We
observed that even small changes in input produce completely different hash
outputs, demonstrating the avalanche effect. The experiment also showed how
hashing ensures data integrity by generating unique digests for different inputs.
Overall, it provided practical insight into how MD5 is used for data verification,
although it is less secure compared to modern hashing algorithms.
A.1 Aim:
Study the use of network reconnaissance tools like WHOIS, dig, traceroute,
nslookup to gather information about networks and domain registrars.
A.2 Prerequisite:
Basic Knowledge of IP addresses, DNS.
A.3 Outcome:
After the successful completion of this experiment, students will be able to
apply basic network commands to gather basic network information.
A.4 Theory:
Network Reconnaissance:
● Act of reconnoitring ---explore to find something(especially to gain
information about enemy)
● In the world of hacking, reconnaissance begins with “Footprinting”
● i.e accumulating data about the target’s environment, and finding
vulnerabilities.
● The attacker gathers information in two phases viz: passive attacks and
active attacks
Passive attacks:
● Gathering information about a target without his/her
knowledge….Eavesdropping
● Yahoo or google search
● Surfing online community groups
● Gathering information from websites of organisations. e.g. contact details,
email address etc.
● Blogs, newsgroups, press releases etc.
● Going through job posting in particular job profiles
Reconnaissance Tools:
● WHOIS, dig, traceroute, nslookup
● WHOIS: WHOIS is the Linux utility for searching an object in a WHOIS
1
● Dig - Dig is a networking tool that can query DNS servers for information. It
can be beneficial for diagnosing problems with domain pointing and is a good
way to verify that your configuration is working. The most basic way to use
dig is to specify the domain we wish to query:
Example:
$ dig [Link]
● Traceroute - traceroute prints the route that packets take to a network host.
Traceroute utility uses the TTL field in the IP header to achieve its operation.
For users who are new to the TTL field, this field describes how much hops a
particular packet will take while travelling on the network. So, this effectively
outlines the lifetime of the packet on the network. This field is usually set to
32 or 64. Each time the packet is held on an intermediate router, it decreases
the TTL value by 1. When a router finds the TTL value of 1 in a received
packet then that packet is not forwarded but instead discarded. After
discarding the packet, the router sends an ICMP error message of ― Time
exceededǁ back to the source from where the packet generated. The ICMP
packet that is sent back contains the IP address of the router. So now it can
be easily understood that traceroute operates by sending packets with TTL
value starting from 1 and then incrementing by one each time. Each time a
router receives the packet, it checks the TTL field, if the TTL field is 1 then it
discards the packet and sends the ICMP error packet containing its IP address
and this is what the traceroute requires. So traceroute incrementally fetches
the IP of all the routers between the source and the destination.
Example:
$traceroute [Link]
Grade:
● WHOIS ([Link])
# 1. WHOIS
print_separator(f"1. WHOIS ({target_domain})")
[Link](f"whois {target_domain}")
OUTPUT:
# 2. NSLOOKUP
print_separator(f"2. NSLOOKUP ({target_domain})")
[Link](f"nslookup {target_domain}")
OUTPUT:
● TRACERT ([Link])
OUTPUT:
● DIG ([Link])
# 4. DIG
print_separator(f"4. DIG ({target_domain})")
[Link](f"dig {target_domain}")
print("\n" + "="*60)
print(" Network Reconnaissance Completed")
print("="*60 + "\n")
OUTPUT:
2. NSLOOKUP : [Link]
3. TRACERT : [Link]
4. DIG : [Link]
B.4 Conclusion:
A.1 Aim:
Design a network and implement packet sniffing on telnet traffic using
Wireshark.
A.2 Prerequisite:
Basic Knowledge of IP addresses, port numbers, TCP and UDP Protocols.
A.3 Outcome:
After the successful completion of this experiment, students will be able to
apply basic network commands to gather basic network information.
A.4 Theory:
Wireshark, a network analysis tool formerly known as Ethereal, captures
packets in real-time and display them in a human-readable format. Wireshark
includes filters, colour-coding and other features that let you dig deep into network
traffic and inspect individual packets.
Features of Wireshark :
Capturing Packets
After downloading and installing Wireshark, you can launch it and click the
name of an interface under Interface List to start capturing packets on that
interface. For example, if you want to capture traffic on the wireless network, click
your wireless interface. You can configure advanced features by clicking Capture
Options.
1
Name: Saish Parab [Link].: 05 Batch:D1
Filtering Packets
A6. Design
2
Name: Saish Parab [Link].: 05 Batch:D1
PART B
Grade:
IMPLEMENTATION :
import sys
from [Link] import sniff, IP, TCP
def packet_callback(packet):
"""
Callback function to process each captured packet.
"""
# Check if the packet has an IP layer
if [Link](IP):
src_ip = packet[IP].src
dst_ip = packet[IP].dst
protocol = packet[IP].proto
3
Name: Saish Parab [Link].: 05 Batch:D1
if [Link](TCP) and packet[TCP].playload:
print(f" Payload: {bytes(packet[TCP].payload)}")
else:
# General TCP Packet
print(f"[*] TCP Packet: {src_ip}:{src_port} ->
{dst_ip}:{dst_port}")
# Sniff packets
# filter="tcp" restricts capture to TCP protocol
# prn specifies the callback function
# count stops after N packets (remove for infinite loop)
try:
sniff(iface=interface, filter="tcp", prn=packet_callback,
count=count)
print("[-] Sniffing finished.")
except Exception as e:
print(f"[!] Error: {e}")
print("[!] Ensure you are running as Administrator/Root.")
4
Name: Saish Parab [Link].: 05 Batch:D1
B.1 Output
5
Name: Saish Parab [Link].: 05 Batch:D1
Filtering of packets(ARP):
import sys
from [Link] import sniff, ARP
def packet_callback(packet):
# Check specifically for ARP layer (Address Resolution Protocol)
if [Link](ARP):
src_ip = packet[ARP].psrc
dst_ip = packet[ARP].pdst
hw_src = packet[ARP].hwsrc
if packet[ARP].op == 1:
print(f"[?] ARP Request: {src_ip} is asking who has
{dst_ip}")
elif packet[ARP].op == 2:
print(f"[*] ARP Reply: {src_ip} is at {hw_src}")
6
Name: Saish Parab [Link].: 05 Batch:D1
def start_sniffer(interface=None, count=20):
print("[-] Starting ARP Sniffer...")
print(f"[-] Capturing {count} packets...")
try:
sniff(iface=interface, filter="arp", prn=packet_callback,
count=count)
print("[-] Sniffing finished.")
except Exception as e:
print(f"[!] Error: {e}")
OUTPUT:
7
Name: Saish Parab [Link].: 05 Batch:D1
Filtering packets (LLMNR):
import sys
from [Link] import sniff, IP, UDP # Added UDP to imports
def packet_callback(packet):
# LLMNR sits on top of IP and UDP
if [Link](IP) and [Link](UDP):
src_ip = packet[IP].src
dst_ip = packet[IP].dst
try:
# filter="udp port 5355" targets LLMNR specifically
sniff(iface=interface, filter="udp port 5355",
prn=packet_callback, count=20 , timeout=60)
print("[-] Sniffing finished.")
except Exception as e:
print(f"[!] Error: {e}")
8
Name: Saish Parab [Link].: 05 Batch:D1
OUTPUT:
B.3 Conclusion:
This experiment helped us understand how network packet sniffing works using the
Scapy library in Python. We were able to capture and analyze network packets,
specifically identifying protocols such as IP, TCP, and ARP. The experiment
demonstrated how specific traffic, like Telnet and ARP requests/replies, can be
monitored in real time. It highlighted the importance of packet analysis in network
security, as it helps in detecting vulnerabilities, unauthorized access, and
suspicious activities. Overall, this experiment provided practical knowledge of
network monitoring and traffic analysis techniques.
9
Name: Saish Parab [Link].: 05 Batch:D1
Experiment No.06
A.1 Aim:
Implement ARP Spoofing using Ettercap.
A.2 Prerequisite:
Basic Knowledge of IP addresses, port numbers, ARP.
A.3 Outcome:
After successful completion of this experiment, students will be able to
explore and use tools like sniffers, port scanners and other related tools for analyzing
packets in a network.
A.4 Theory:
In an ARP spoofing attack, a program like Ettercap will send spoofed messages
attempting to get nearby devices to associate the hacker's MAC address with the IP
address of the target. When successful, they're stored temporarily in a configuration
setting on other network devices. If the rest of the network starts delivering packets
intended for the target to the attacker instead, the attacker effectively controls the
target's data connection.
There can be three primary outcomes after an attacker gains initial success in
poisoning the ARP cache of other hosts on the network:
● The attacker can spy on traffic. They can lurk in the shadows, seeing everything
that the target user does on the network. It's pretty self-explanatory.
A5. Procedure
Ettercap Graphical
Once we do all of that, we can figuratively watch over the target's shoulder as they
browse the internet, and we can even kill the connection from websites we want to
steer them away from. We can also run various payloads, like isolating a host from
the rest of the network, denying them service by dropping all packets sent to them,
or running scripts to attempt to downgrade the security of the connection.
The first step of ARP spoofing is to connect to the network you want to attack. If
you're attacking an encrypted WEP, WPA, or WPA2 network, you'll need to know the
password. This is because we're attacking the network internally, so we need to be
able to see some information about the other hosts on the network and the data
passing within it.
You can connect to a network for ARP spoofing in two ways. The first is to connect
via Ethernet, which is very effective but may not always be practical and is rarely
subtle. Instead, many people prefer to use a wireless network adapter and perform
the ARP spoofing over Wi-Fi.
Once it starts up, you should find yourself on the Ettercap main screen. You'll see the
spooky Ettercap logo, and a few drop-down menus to start the attack from. In the
next step, we'll start exploring the "Sniff" menu.
At this point, make sure you have an active connection to the network before you
continue.
Now, you'll see some text confirming that sniffing has started, and you'll be able to
access more advanced menu options such as Targets, Hosts, Mitm, Plugins, etc.
Before we get started using any of them, we'll need to identify our target on the
network.
To find the device we want to attack the network, Ettercap has a few tricks up its
sleeve. First, we can do a simple scan for hosts by clicking "Hosts," then "Scan for
hosts." A scan will execute, and after it finishes, you can see the resulting hosts
Ettercap has identified on the network by clicking "Hosts," then "Hosts list."
We can now see a list of targets we've discovered on the network. Want to see what
they're doing or narrow down the targets? Click on "View," then "Connections" to
start snooping on connections.
Once in the Connections view, you can filter the connections by IP address, type of
connection, and whether the connection is open, closed, active, or killed. This gives
you a lot of snooping power, which can be augmented by clicking the "View," then
"Resolve IP addresses." This means Ettercap will try to resolve the IP addresses it
sees other devices on the network connecting to.
If you want to identify a target on a network and know what they're browsing, look
over their shoulder at what website they're on, and match the website to an IP
address with an active connection to the same website. Otherwise, you can usually
tell by the MAC address, as you can look it up online to see the manufacturer.
Now that we've identified our target's IP address, it's time to add them to a target
list. Once we do this, we'll be telling Ettercap that we want to designate that IP
address as one we want to pretend to be, so that we're receiving messages from the
router that were meant to be sent to the target.
Go back to the "Hosts" screen, and select the IP address of the target you want to
target. Click the IP address to highlight it, then click on"Targets," followed by "Target
list," to see a list of devices that have been targeted for ARP spoofing.
Click on the "Mitm" menu, and select "ARP poisoning." A popup will open, and you'll
select "Sniff remote connections" to begin the sniffing attack.
Once this attack has begun, you'll be able to intercept login credentials if the user
you're targeting enters them into a website that doesn't use HTTPS. This could be a
router or a device on the network or even a website that uses poor security.
To try another attack, you can click on "Plugins," then "Load plugins," to show the
plugin menu. If you select the DOS attack, it will begin dropping the packets sent to
this target, cutting off their internet access.
Now, let's try intercepting a password. A website that's great for testing is
[Link], which deliberately uses bad security so that you can intercept
credentials. On the target device, navigate to [Link]. Once it loads, you'll see a
login screen you can enter a fake login and password into.
Enter a username and password, then hit "Submit." If Ettercap is successful, you
should see the login and password you typed appear on the attacker's screen!
In this result above, we can see that Ettercap successfully ARP poisoned the target
and intercepted an HTTP login request the target was sending to an insecure
website.
The major obvious limitation of ARP spoofing is that it only works if you're connected
to a Wi-Fi network. This means it works on open networks but may not work well
against networks that have more sophisticated monitoring or firewalls that may
detect this sort of behaviour.
ARP spoofing attacks is another example of why it's so important to pick strong
passwords for your networks and limit access to those you trust. You're giving away
a lot of trusts when you give someone your network password or an Ethernet
connection, so remember to carefully pick your passwords and who you share them
with.
Grade:
B.1 Output
➔ Unified Sniffing
➔ Network Interface: eth0
➔ Current Targets: 1. Default Gateway, 2. IPv4 Address
➔ ARP Poisoning
➔ Sniff Remote Connection
➔ tcpdump -i eth0 -n port 80 and host [Link]
1. What is ARP?
Ans:
➔ Address Resolution Protocol (ARP) is an important protocol of the network
layer in the OSI model, which helps find the MAC (Media Access Control)
Ans:
➔ MAC address is a unique identifier that is assigned to a NIC (Network Interface
Controller/ Card). It consists of a 48 bit or 64-bit address, which is associated
with the network adapter. MAC address can be in hexadecimal format. The full
form of MAC address is the Media Access Control address.
➔ media access control address is a unique identifier assigned to a network
interface controller for use as a network address in communications within a
network segment. This use is common in most IEEE 802 networking
technologies, including Ethernet, Wi-Fi, and Bluetooth.
B.4 Conclusion:
This experiment helped us understand the concept of ARP spoofing and how it can
be performed using tools like Ettercap. We observed how an attacker can intercept
and manipulate network traffic by sending fake ARP messages, thereby positioning
themselves between communicating devices. This demonstrated the vulnerability of
ARP protocol in local networks and highlighted the importance of security measures
such as encryption and network monitoring. Overall, the experiment provided
practical insight into man-in-the-middle attacks and their impact on network
security. Hence, we successfully implemented ARP Spoofing using the Ettercap GUI
tool.
A.1 Aim:
Download and install Nmap. Use it with different options to scan open ports,
perform OSfingerprinting, do a ping scan, TCP port scan, UDP port scan, Xmas scan etc.
A.2 Prerequisite:
Basic Knowledge of Ports, TCP, UDP, Ping
A.3 Outcome:
After successful completion of this experiment, students will be able to Install and
use Nmap and use it for gathering detailed network and remote host information.
A.4 Theory:
➔ Nmap (Network Mapper) is a security scanner originally written by Gordon Lyon
(also known by his pseudonym Fyodor Vaskovich) used to discover hosts and
services on a computer network, thus creating a "map" of the network. To
accomplish its goal, Nmap sends specially crafted packets to the target host and
then analyzes the responses. Unlike many simple port scanners that just send
packets at some predefined constant rate, Nmap accounts for the network
conditions (latency fluctuations, network congestion, the target interference
with the scan) during the run. Also, owing to the large and active user community
providing feedback and contributing to its features, Nmap has been able to
extend its discovery capabilities beyond simply figuring out whether a host is up
or down and which ports are open and closed; it can determine the operating
system of the target, names and versions of the listening services, estimated
uptime, type of device, and presence of a firewall.
● Host Discovery – Identifying hosts on a network. For example, listing the hosts
which respond to pings or have a particular port open.
● Port Scanning – Enumerating the open ports on one or more target hosts.
● Version Detection – Interrogating listening network services listening on remote
devices to determine the application name and version number.
● OS Detection –Remotely determining the operating system and some hardware
characteristics of network devices.
● For target specifications: Nmap <target‘s URL or IP with spaces between them>
● For OS detection: Nmap -O <target-host's URL or IP>
● For version detection: Nmap -SV <target-host's URL or IP>
SYN scan is the default and most popular scan option for good reasons. It can be
performed quickly, scanning thousands of ports per second on a fast network not
hampered by restrictive firewalls. It is also relatively unobtrusive and stealthy since it
never completes TCP connections.
[Link]:
Installation of Nmap:
Commands:
● -O (Enable OS detection).
This option specifies which ports you want to scan and overrides the
default. Individual port numbers are OK, as are ranges separated by a hyphen (e.g.
1-1023). The beginning and/or end values of a range may be omitted, causing
Nmap to use 1 and 65535, respectively.
● Nmap –-iflist
host interface and route information with nmap by using ―–iflist‖ option.
Grade:
B.1 Output
1. nmap [Link]
3. nmap -O [Link]
→ Used for operating system detection of the target.
uname = [Link]['username']
passwd = [Link]['password']
[Link](sql)
➔ These input fields are vulnerable to SQL Injection. An attacker could use SQL
commands in the input in a way that would alter the SQL statement executed by
the database server. For example, they could use a trick involving a single quote
and set the password field to password' OR 1=1
3. Explain “ OR 1 = 1” and what happens to SQL when this condition is used in the
query.
Ans:
➔ As a result, the database server runs the following SQL query:
➔ Because of the OR 1=1 statement, the WHERE clause returns the first id from the
user’s table no matter what the username and password are. The first user id in
B.4 Conclusion:
After successful completion of this experiment, we have Installed and used Nmap for
gathering detailed network and remote host information. This experiment helped us
understand the use of Nmap as a powerful network reconnaissance tool. We performed
various types of scans such as basic scan, ping scan, TCP scan, OS detection, and service
version detection to gather information about a target system. Through this
experiment, we learned how to identify open ports, active hosts, and system details,
which are essential in network security analysis. Overall, it provided practical knowledge
of how reconnaissance is performed to detect vulnerabilities and analyze network
infrastructure.
A.1 Aim:
Perform SQL injection on a vulnerable website.
A.2 Prerequisite:
Basic Knowledge of SQL queries, HTML/PHP.
A.3 Outcome:
After successful completion of this experiment, students will be able to set up
firewalls and intrusion detection systems using open source technologies and explore
email security and explore various attacks like buffer overflow, SQL injection and web
application attacks.
A.4 Theory:
➔ SQL Injection (SQLi) is a type of injection attack that makes it possible to execute
malicious SQL statements. These statements control a database server behind a
web application. Attackers can use SQL Injection vulnerabilities to bypass
application security measures. They can go around authentication and
authorization of a web page or web application and retrieve the content of the
entire SQL database. They can also use SQL Injection to add, modify, and delete
records in the database.
➔ An SQL Injection vulnerability may affect any website or web application that uses
an SQL database such as MySQL, Oracle, SQL Server, or others. Criminals may use
it to gain unauthorized access to your sensitive data: customer information,
personal data, trade secrets, intellectual property, and more. SQL Injection
attacks are one of the oldest, most prevalent, and most dangerous web
application vulnerabilities.
➔ To make an SQL Injection attack, an attacker must first find vulnerable user
inputs within the web page or web application. A web page or web application
that has an SQL Injection vulnerability uses such user input directly in an SQL
query. The attacker can create input content. Such content is often called a
malicious payload and is the key part of the attack. After the attacker sends this
content, malicious SQL commands are executed in the database.
➔ SQL is a query language that was designed to manage data stored in relational
databases. You can use it to access, modify, and delete data. Many web
applications and websites store all the data in SQL databases. In some cases, you
can also use SQL commands to run operating system commands. Therefore, a
successful SQL Injection attack can have very serious consequences.
1
Name: Saish Parab [Link].: 05 Batch:D1
● Attackers can use SQL Injections to find the credentials of other users in
the database. They can then impersonate these users. The impersonated
user may be a database administrator with all database privileges.
● SQL lets you select and output data from the database. An SQL Injection
vulnerability could allow the attacker to gain complete access to all data in
a database server.
● SQL also lets you alter data in a database and add new data. For example,
in a financial application, an attacker could use SQL Injection to alter
balances, void transactions, or transfer money to their account.
● You can use SQL to delete records from a database, even drop tables. Even
if the administrator makes database backups, deletion of data could affect
application availability until the database is restored. Also, backups may
not cover the most recent data.
● In some database servers, you can access the operating system using the
database server. This may be intentional or accidental. In such a case, an
attacker could use an SQL Injection as the initial vector and then attack the
internal network behind a firewall.
2
Name: Saish Parab [Link].: 05 Batch:D1
PART B
Class:TE-D Batch:D1
Grade:
B.1 Output
3
Name: Saish Parab [Link].: 05 Batch:D1
OUTPUT:
4
Name: Saish Parab [Link].: 05 Batch:D1
3. python [Link] -u "[Link] -D manavi -
T hello --columns --batch
→ Used to extract column names from the selected table.
Ans:
➔ SQL Injection (SQLi) is a type of injection attack that makes it possible to execute
malicious SQL statements. These statements control a database server behind a
web application. Attackers can use SQL Injection vulnerabilities to bypass
application security measures. They can go around authentication and
authorization of a web page or web application and retrieve the content of the
entire SQL database. They can also use SQL Injection to add, modify, and delete
records in the database.
Ans:
➔ In SQL Injection, the UNION operator is commonly used to attach a malicious SQL
query to the original query intended to be run by the web application. The result
of the injected query will be joined with the result of the original query. This allows
the attacker to obtain column values from other tables.
3. Explain “ OR 1 = 1” and what happens to SQL when this condition is used in the
query.
Ans:
➔ We are selecting the password from the table where the user name is admin. We
are also pulling the password from the table where ever 1=1 - which is always
true. Each row is evaluated to true, thus all passwords are returned. A hacker
5
5 Parab
Name: Saish [Link].: 05 Batch:D1
might get access to all the user names and passwords in a database, by simply
inserting 105 OR 1=1 into the input field.
B.4 Conclusion:
This experiment helped us understand the concept of SQL Injection and how
vulnerabilities in web applications can be exploited using tools like sqlmap. We
performed database enumeration, table extraction, and data retrieval, which
demonstrated how attackers can gain unauthorized access to sensitive information. The
experiment highlighted the importance of secure coding practices and input validation
to prevent such attacks. Overall, it provided practical knowledge of web security
vulnerabilities and their impact on data protection successful execution of this
experiment, we can set up firewalls and intrusion detection systems using opensource
technologies and explore email security and explore various attacks like buffer overflow,
SQL injection and web-application attacks.
6
5 Parab
Name: Saish [Link].: 05 Batch:D1