Network Security Record
Network Security Record
NO:
Ex.No. 1 : Implement symmetric key algorithms
DATE:
AIM:
ALGORITHM:
PROGRAM:
import javax.crypto.Cipher;
import
javax.crypto.KeyGenerator;
import
javax.crypto.SecretKey;
import java.util.Scanner;
// Initialize Cipher
Cipher cipher = Cipher.getInstance("AES");
DATE:
// Encrypt
cipher.init(Cipher.ENCRYPT_MODE,
secretKey); byte[] encrypted =
cipher.doFinal(plainText.getBytes());
System.out.println("Encrypted Text (Base64 Encoded): " +
java.util.Base64.getEncoder().encodeToString(encrypted));
// Decrypt
cipher.init(Cipher.DECRYPT_MODE,
secretKey); byte[] decrypted =
cipher.doFinal(encrypted);
System.out.println("Decrypted Text: " + new String(decrypted));
}
}
OUTPUT:
RESULT:
The implementation of AES Symmetric Key Encryption and Decryption
was successfully executed.
AIM:
To implement Asymmetric Key Cryptography using the RSA algorithm and perform
key exchange for secure communication.
ALGORITHM:
PROGRAM:
importjava.security.*;
import javax.crypto.Cipher;
import java.util.Scanner;
DATE:
DATE:
}
}
OUTPUT:
RESULT:
The implementation of Asymmetric Key Encryption and Decryption using the RSA
Algorithm was successfully executed.
AIM:
To implement a Digital Signature Scheme using the RSA algorithm and SHA-
256 hashing for message authentication and integrity verification.
ALGORITHM:
PROGRAM:
import java.security.*;
import java.util.Base64;
import java.util.Scanner;
DATE:
DATE:
OUTPUT:
RESULT:
The implementation of Digital Signature Scheme using RSA and SHA-256 was
successfully executed
AIM:
To install and use Wireshark and tcpdump to observe network traffic and
analyze TCP/UDP datagrams in client-server communication.
PROCEDURE:
● Launch Wireshark:
sudo wireshark
● Select the network interface (e.g., eno1 for Ethernet).
● Start capturing packets by clicking the Start button.
● Use display filters to focus on specific traffic:
○ For TCP: tcp
○ For UDP: udp
● Observe the packets in the capture window. You can see details like source IP,
destination IP, ports, and payload.
USING TCPDUMP:
● Open a terminal.
● Capture TCP traffic:
sudo tcpdump -i <interface> tcp
Replace <interface> with your network interface (e.g., eno1).
● Capture UDP traffic:
sudo tcpdump -i <interface> udp
DATE:
nc localhost 12345
● Type messages in the client and observe transmission.
DATE:
● UDP Datagram:
○ Connectionless protocol.
○ No handshake or acknowledgment.
○ Smaller header (8 bytes).
● TCP Datagram:
○ Connection-oriented protocol.
○ Three-way handshake (SYN, SYN-ACK, ACK).
○ Larger header (20 bytes) with sequence numbers, acknowledgment
numbers, and flags.
RESULT:
Aim:
PROCEDURE:
DATE:
RESULT:
AIM:
PROCEDURE:
You can think of this type of attack as similar to the game of telephone where
one person's words are carried along from participant to participant until it has
changed by the time it reaches the final person. In a man-in-the-middle attack,
the middle participant manipulates the conversation unknown to either of the
two legitimate participants, acting to retrieve confidential information and
otherwise cause damage.
Man-in-the-middle attacks:
DATE:
1. The attacker installs a packet sniffer to analyze network traffic for insecure
communications.
2. When a user logs in to a site, the attacker retrieves their user information and
redirects them to a fake site that mimics the real one.
3. The attacker's fake site gathers data from the user, which the attacker can
then use on the real site to access the target's information.
In this scenario, an attacker intercepts a data transfer between a client and server.
By tricking the client into believing it is still communicating with the server and
the server into believing it is still receiving information from the client, the
attacker is able to intercept data from both as well as inject their own false
information into any future transfers.
1. The attacker sets up a fake chat service that mimics that of a well-known
bank.
2. Using knowledge gained from the data intercepted in the first scenario, the
attacker pretends to be the bank and starts a chat with the target.
3. The attacker then starts a chat on the real bank site, pretending to be the
target and passing along the needed information to gain access to the target's
account.
DATE:
In 2011, Dutch registrar site DigiNotar was breached, which enabled a threat
actor to gain access to 500 certificates for websites like Google, Skype, and
others. Access to these certificates allowed the attacker to pose as legitimate
websites in a MITM attack, stealing users' data after tricking them into entering
passwords on malicious mirror sites. DigiNotar ultimately filed for bankruptcy as
a result of the breach.
In 2017, credit score company Equifax removed its apps from Google and Apple
after a breach resulted in the leak of personal data. A researcher found that the
app did not consistently use HTTPS, allowing attackers to intercept data as users
accessed their accounts.
Any improperly secured interaction between two parties, whether it's a data
transfer between a client and server or a communication between two
individuals over an internet messaging system, can be targeted by man-in-the-
middle attacks. Logins and authentication at financial sites, connections that
should be secured by public or private keys, and any other situation where an
ongoing transaction could grant an attacker access to confidential information
are all susceptible.
Sniffing - An attacker uses software to intercept (or "sniff") data being sent
to or from your device.
RESULT:
Thus the study of Eavesdropping, Dictionary attacks, MITM attacks is successfully
completed.
AIM:
Static ARP entries: these can be defined in the local ARP cache and the switch
configured to ignore all auto ARP reply packets. The disadvantage of this
method is, it’s difficult to maintain on large networks. IP/MAC address mapping
has to be distributed to all the computers on the network.
ARP poisoning detection software: these systems can be used to cross check
the IP/MAC address resolution and certify them if they are authenticated.
Uncertified IP/MAC address resolutions can then be blocked.
Microsoft Windows: the ARP cache behavior can be configured via the
registry. The following list includes some of the software that can be
used to protect networks against sniffing;
DATE:
We are using Windows 7 for this exercise, but the commands should be able to
work on other versions of windows as well.
HERE,
Note: dynamic entries are added and deleted automatically when using TCP/IP sessions
with remote computers.
Static entries are added manually and are deleted when the computer is
restarted, and the network interface card restarted or other activities that affect
it.
DATE:
The MAC address is represented using the Physical Address and the IP address is
IPv4Address.
Note: The IP and MAC address will be different from the ones used here. This
is because they are unique.
DATE:
Note the IP address has been resolved to the MAC address we provided and it is
of a static type.
P.S. ARP poisoning works by sending fake MAC addresses to the switch.
RESULT:
Thus the Sniff Traffic using ARP Poisoning is demonstrated successfully.
AIM:
3. Double click on the .exe to install snort. This will install snort in
the “C:\Snort” folder.It is important to have WinPcap
(https://www.winpcap.org/install/) installed
4. Extract the Rules file. You will need WinRAR for the .gz file.
5. Copy all files from the “rules” folder of the extracted folder. Now paste the
rules into “C:\Snort\rules” folder.
6. Copy “snort.conf” file from the “etc” folder of the extracted folder. You must
paste it into “C:\Snort\etc” folder. Overwrite any
existing file. Remember if you modify your snort.conf file and download a new
file, you must modify it for Snort to work.
-i indicates the interface number. You must pick the correct interface number. In my
case, it is 3.
snort -W
DATE:
Finding an interface
You can tell which interface to use by looking at the Index number and finding
Microsoft. As you can see in the above example, the other interfaces are for
VMWare. My interface is 3.
9. To run snort in IDS mode, you will need to configure the file “snort.conf”
according to your network environment.
10. To specify the network address that you want to protect in snort.conf file,
look for the following line. var HOME_NET 192.168.1.0/24 (You will normally
see any here)
11. You may also want to set the addresses of DNS_SERVERS, if you have
some on your network.
Example:
example snort
path to rules
13. Change the path of all library files with the name and path on your system.
and you must change the path of snort_dynamicpreprocessorvariable.
C:\Snort\lib\snort_dynamiccpreprocessor.
DATE:
You need to do this to all library files in the “C:\Snort\lib” folder. The old path
might be: “/usr/local/lib/…”. you will need to replace that path with your
system path. Using C:\Snort\lib
14. Change the path of the “dynamicengine” variable value in the “snort.conf”
file.
Example:
dynamicengine C:\Snort\lib\snort_dynamicengine\sf_engine.dll
include
c:\snort\etc\classification.config
include c:\snort\etc\reference.config
16. Remove the comment (#) on the line to allow ICMP rules, if it
is commented
with a #.
include $RULE_PATH/icmp.rules
17. You can also remove the comment of ICMP-info rules comment, if it is
commented.
include $RULE_PATH/icmp-info.rules
18. To add log files to store alerts generated by snort, search for the “output
log” test in snort.conf and add the following line: output alert_fast: snort-
alerts.ids
DATE:
#preprocessor normalize_ip4
#preprocessor normalize_tcp: ips ecn
stream #preprocessor normalize_icmp4
#preprocessor normalize_ip6
#preprocessor normalize_icmp6
If a log is created, select the appropriate program to open it. You can use
WordPard or NotePad++ to read the file.
To generate Log files in ASCII mode, you can use following command while
running snort in IDS mode:
After scanning or during the scan you can check the snort-alerts.ids file in the
log folder to insure it is logging properly. You will see IP address folders appear.
DATE:
RESULT:
Thus the Intrusion Detection System (IDS) has been demonstrated by using the Open
Source Snort Intrusion Detection Tool.
AIM:
EXPLORING N-STALKER:
4. After the scan completes, the N−Stalker Report Manager will prompt
DATE:
Manual test which will crawl the website and will be waiting
for manual attacks.
owasp policy
Once, the option has been selected, next step is “Optimize settings” which will
crawl the whole website for further analysis.
In review option, you can get all the information like host information,
technologies used, policy name, etc.
DATE:
DATE:
The scanner will crawl the whole website and will show the scripts, broken
pages, hidden fields, information leakage, web forms related information which
helps to analyze further.
Once the scan is completed, the NStalker scanner will show details like severity
level, vulnerability class, why is it an issue, the fix for the issue and the URL
which is vulnerable to the particular vulnerability?
RESULT:
Thus the N-Stalker Vulnerability Assessment tool has been downloaded,
installed and the features has been explored by using a vulnerable website.
AIM:
When you configure Cloud VPN tunnels to connect to your peer network, review and
modify firewall rules in your Google Cloud and peer networks to make sure that they
meet your needs. If your peer network is another Virtual Private Cloud (VPC) network,
then configure Google Cloud firewall rules for both sides of the network connection.
Google Cloud firewall rules apply to packets sent to and from virtual machine (VM)
instances within your VPC network and through Cloud VPN tunnels.
The implied allow egress rules allow VM instances and other resources in your Google
Cloud network to make outgoing requests and receive established responses. However,
the implied deny ingress rule blocks all incoming traffic to your Google Cloud
resources.
At a minimum, create firewall rules to allow ingress traffic from your peer network to
Google Cloud. If you created egress rules to deny certain types of traffic, you might
also need to create other egress rules.
Traffic containing the protocols UDP 500, UDP 4500, and ESP (IPsec, IP protocol 50)
is always allowed to and from one or more external IP addresses on a Cloud VPN
gateway. However, Google Cloud firewall rules do not apply to the post- encapsulated
IPsec packets that are sent from a Cloud VPN gateway to a peer VPN gateway.
EXAMPLE CONFIGURATIONS
For multiple examples of restricting ingress or egress traffic, see the configuration
examples in the VPC documentation.
The following example creates an ingress allow firewall rule. This rule permits all TCP,
UDP, and ICMP traffic from your peer network's CIDR to your VMs in your VPC
network.
DATE:
6. Click Create.
If you need to allow access to IPv6 addresses on your VPC network from your
peer network, add an allow-ipv6-tcp-udp-icmpv6 firewall rule.
1. Click Add firewall rule. Add a rule for TCP, UDP, and ICMPv6:
Name: Enter allow-ipv6-tcp-udp-icmpv6.
Source filter: Select IPv6 ranges.
Source IP ranges: Enter a Remote network IP range value from when you
created the tunnel. If you have more than one peer network range, enter each
one.
Press the Tab key between entries. To allow traffic from all source IPv6
addresses
in your peer network, specify::/0.
Specified protocols or ports: Select tcp and udp.
Other protocols: Enter 58. 58 is the protocol number for ICMPv6.
Target tags: Add any valid tag or tags.
2. Click Create.
Create other firewall rules if necessary.
Alternatively, you can create rules from the Google Cloud console Firewall
page.
DATE:
Configure rules to allow egress and ingress traffic to and from the IP ranges
used by the subnets in your VPC network.
You can choose to permit all protocols and ports, or you can restrict traffic to
only the necessary set of protocols and ports to meet your needs.
Allow ICMP traffic if you need to use ping to be able to communicate among
peer systems and instances or resources in Google Cloud.
If you need to access IPv6 addresses on your peer network with ping, allow
ICMPv6 (IP protocol 58) in your peer firewall.
RESULT:
Thus the study of Firewall and VPN is demonstrated successfully.