NETWORK SECURITY RECORD
NETWORK SECURITY RECORD
AIM
PROCEDURE:
PROGRAM
import java.security.SecureRandom;
import java.util.Scanner;
import javax.crypto.Cipher;
import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
import javax.xml.bind.DatatypeConverter;
// the symmetric
// Function to create a
// secret key
throws Exception
keygenerator.init(256, securerandom);
return key;
}
// Function to initialize a vector
return initializationVector;
// into CipherText.
Cipher cipher =
Cipher.getInstance(AES_CIPHER_ALGORITHM);
cipher.init(Cipher.ENCRYPT_MODE, secretKey,
ivParameterSpec);
return cipher.doFinal(plainText.getBytes());
// do_AESEncryption function.
// It converts ciphertext to
throws Exception
cipher.init(Cipher.DECRYPT_MODE, secretKey,
ivParameterSpec);
// Driver code
throws Exception
// message
}
OUTPUT:
Observation
Viva-Voce
Record
Total
RESULT:
Thus, the program implements a symmetric key algorithm using java and
successfully verified the output.
Ex:No:02(a)
IMPLEMENTING ASYMMETRIC KEY ALGORITHM
AIM
PROCEDURE:
Initializing the keyGenerator object with 2048 bits key size and passing
the random number.
Now, the secret key is generated and if we wish to actually see the
generated key which is an object, we can convert it into hexbinary format
using DatatypeConverter.
2. Encryption and Decryption using the asymmetric key: In the above steps,
we have created the public & private keys for Encryption and Decryption.
Now, let us implement Asymmetric Encryption using the RSA algorithm.
The following steps can be followed in order to implement the encryption
and decryption.
The cipher class is used for two different modes the encryption and
decryption. As Asymmetric encryption uses different keys, we use the
private key for encryption and the public key for decryption.
PROGRAM
package java_cryptography;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.security.SecureRandom;
import java.util.Scanner;
import javax.crypto.Cipher;
import javax.xml.bind
.DatatypeConverter;
= "RSA";
throws Exception
SecureRandom secureRandom
= new SecureRandom();
KeyPairGenerator keyPairGenerator
= KeyPairGenerator.getInstance(RSA);
keyPairGenerator.initialize(
2048, secureRandom);
return keyPairGenerator
.generateKeyPair();
String plainText,
PrivateKey privateKey)
throws Exception
{
Cipher cipher
= Cipher.getInstance(RSA);
cipher.init(
Cipher.ENCRYPT_MODE, privateKey);
return cipher.doFinal(
plainText.getBytes());
// original plaintext.
byte[] cipherText,
PublicKey publicKey)
throws Exception
Cipher cipher
= Cipher.getInstance(RSA);
cipher.init(Cipher.DECRYPT_MODE,
publicKey);
byte[] result
= cipher.doFinal(cipherText);
// Driver code
throws Exception
KeyPair keypair
= generateRSAKkeyPair();
byte[] cipherText
= do_RSAEncryption(
plainText,
keypair.getPrivate());
System.out.println(
+ DatatypeConverter.printHexBinary(
keypair.getPublic().getEncoded()));
System.out.println(
+ DatatypeConverter.printHexBinary(
keypair.getPrivate().getEncoded()));
System.out.println(
DatatypeConverter.printHexBinary(
cipherText));
String decryptedText
= do_RSADecryption(
cipherText,
keypair.getPublic());
System.out.println(
+ decryptedText);
}
OUTPUT:
Observation
Viva-Voce
Record
Total
RESULT:
AIM
PROCEDURE:
The Diffie-Hellman algorithm is being used to establish a shared secret that can
be used for secret communications while exchanging data over a public network
using the elliptic curve to generate points and get the secret key using the
parameters.
P and G are both publicly available numbers. Users (say Alice and Bob)
pick private values a and b and they generate a key and exchange it
publicly. The opposite person receives the key and that generates a secret
key, after which they have the same secret key to encrypt.
Step 2: Alice selected a private key a = 4 and Bob selected a private key b = 3
PROGRAM
class GFG {
if (b == 1)
return a;
else
// Driver code
P = 23;
G = 9;
a = 4;
+ a);
x = power(G, a, P);
b = 3;
+ b);
y = power(G, b, P);
// of keys
+ ka);
+ kb);
}
OUTPUT
Observation
Viva-Voce
Record
Total
RESULT:
AIM
PROCEDURE:
Let us implement the digital signature using algorithms SHA and RSA and also
verify if the hash matches with a public key.
2. The next step is to generate asymmetric key pair using RSA algorithm and
SecureRandom class functions.
PROGRAM:
package java_cryptography;
// Imports
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.security.SecureRandom;
import java.security.Signature;
import java.util.Scanner;
import javax.xml.bind.DatatypeConverter;
// Signing Algorithm
SIGNING_ALGORITHM
= "SHA256withRSA";
byte[] input,
PrivateKey Key)
throws Exception
Signature signature
= Signature.getInstance(
SIGNING_ALGORITHM);
signature.initSign(Key);
signature.update(input);
return signature.sign();
throws Exception
SecureRandom secureRandom
= new SecureRandom();
KeyPairGenerator keyPairGenerator
= KeyPairGenerator
.getInstance(RSA);
keyPairGenerator
.initialize(
2048, secureRandom);
return keyPairGenerator
.generateKeyPair();
Verify_Digital_Signature(
byte[] input,
byte[] signatureToVerify,
PublicKey key)
throws Exception
Signature signature
= Signature.getInstance(
SIGNING_ALGORITHM);
signature.initVerify(key);
signature.update(input);
return signature
.verify(signatureToVerify);
// Driver Code
String input
= "GEEKSFORGEEKS IS A"
KeyPair keyPair
= Generate_RSA_KeyPair();
// Function Call
byte[] signature
= Create_Digital_Signature(
input.getBytes(),
keyPair.getPrivate());
System.out.println(
+ DatatypeConverter
.printHexBinary(signature));
}
OUTPUT:
Observation
Viva-Voce
Record
Total
RESULT:
Thus, the program implements a Digital Signature Scheme using java and
successfully verified the output.
Ex:No:04 INSTALLATION OF WIRESHARK, TCPDUMP AND
OBSERVE THE DATA TRANSFERRED IN CLIENT
SERVER COMMUNICATION USING TCP/UDP AND
IDENTIFY THE TCP/UDP DATAGRAM.
AIM
To installation of wire shark, tcpdump observe the data transfer in client server
communication using TCP/UDP and identify the TCP/UDP datagram.
PROCEDURE
Below are the steps to install the Wire shark software on the computer:
4 Now, open the software, and follow the install instruction by accepting
the license.
o First part contains a menu bar and the options displayed below it. This
part is at the top of the window. File and the capture menus options are
commonly used in Wire shark. The capture menu allows to start the
capturing process. And the File menu is used to open and save a capture
file.
o The second part is the packet listing window. It determines the packet
flow or the captured packets in the traffic. It includes the packet number,
time, source, destination, protocol, length, and info. We can sort the
packet list by clicking on the column name.
o The bottom window called the packet contents window, which displays
the content in ASCII and hexadecimal format.
o At last, is the filter field which is at the top of the display. The captured
packets on the screen can be filtered based on any component according
to your requirements. For example, if we want to see only the packets
with the HTTP protocol, we can apply filters to that option. All the
packets with HTTP as the protocol will only be displayed on the screen,
shown below:
IP Addresses: It was designed for the devices to communicate with each other
on a local network or over the Internet. It is used for host or network interface
identification. It provides the location of the host and capacity of establishing
the path to the host in that network. Internet Protocol is the set of predefined
rules or terms under which the communication should be conducted. The types
of IP addresses are IPv4 and IPv6.
o Open the Wireshark. Click on the interface to watch the network traffic.
o Click on the option 'Statistics 'on the menu bar and select 'TCP Stream
graphs' and select 'Time sequence (tcptrace). You can also choose other
options in the 'TCP Stream graphs' category depending on your
requirements. Now the screen will look as:
WIRESHARK DECRYPTION
The decryption process is used for the data to be in a readable format. Below are
the steps for the decryption process.
RESULT:
Thus, the installation of wire shark, tcpdump observes the data transfer in client
server communication using TCP/UDP and identify the TCP/UDP datagram
successfully install and output is verified.
Ex:No:05
CHECK MESSAGE INTERGRITY AND
CONFIDENTIALITY USING SSL
AIM:
PROCEDURE:
In some public-key algorithms, such as RSA, both keys can be used for
encryption. In other algorithms, one key is for encryption only and the other for
decryption.
Handshaking - Key Exchange
Once the ciphersuit to be used are negotiated and agree-upon, the client and
server will establish a session key:
1. The client uses server's public key to encrypt a secret and sends to the
server.
2. Only the server has the matching private key to decrypt the secret (not the
Eavesdroppers).
3. The client and server then use this secret to generate a session key
independently and simultaneously.
This session key would then be used for secure communication for this
particular communication session
The following command turns on the debug option and forces the protocol to be
TLSv1:
> openssl s_client -connect localhost:443 -CAfile ca.crt -debug -tls1
Server certificate
-----BEGIN CERTIFICATE-----
MIIB9zCCAWACAQEwDQYJKoZIhvcNAQEEBQAwTTELMAkGA1UEBh
MCVVMxEDAOBgNV
BAsTB3Rlc3QxMDExDDAKBgNVBAMTA2NoYzEeMBwGCSqGSIb3DQEJ
ARYPY2hjQHRl
c3QxMDEuY29tMB4XDTA0MDIyNjA2NTY1NFoXDTA1MDIyNTA2NTY1
NFowOzELMAkG
A1UEBhMCVVMxDDAKBgNVBAMTA2NoYzEeMBwGCSqGSIb3DQEJA
RYPY2hjQHRlc3Qx
MDEuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDN5J58
ttI0TtNTRiXH
U4glYOZG22Q6c2GSrCOSzSyUqY/Gf0dzwNmNNLcs3cmGvYJvzqzY4roP5f
U6ZyyJ
GhsD6yGFKOMpmITtRnWC+g8wo6mlcUZM1g0XxBn9RPviGEamnauR3mu
hf/4wBihd
2NMpAMMdTBMAYY/zhVH1aNhpJQIDAQABMA0GCSqGSIb3DQEBBA
UAA4GBACn9v1rt
cI9TpOkUTF66hMZUG/LAPMQwD38SgE4Bt/05UPFBDdiqd9mHJRoe4peIT
1N1yHAi
agFhD1E+ExmcZPJ2FOiFJSOiEcSM+CMs0cPTcTrmcVQQB9xy/+7oPs+Od3
Ppn/Wa
kGBNoKoDMh8Rby6aXzx3BSIMgb8plq3LOxiu
-----END CERTIFICATE-----
subject=/C=US/CN=chc/[email protected]
issuer=/C=US/OU=test101/CN=chc/[email protected]
---
HTTP/1.1 200 OK
Date: Tue, 02 Mar 2004 07:18:08 GMT
Server: Apache/1.3.29 (Win32) mod_ssl/2.8.16 OpenSSL/0.9.7c
Last-Modified: Sat, 07 Feb 2004 10:53:25 GMT
ETag: "0-23-4024c3a5"
Accept-Ranges: bytes
Content-Length: 35
Connection: close
Content-Type: text/html
closed
Observation
Viva-Voce
Record
Total
RESULT:
Thus, the check message intergrity and confidentiality using SSL can verified
the output successfully.
Ex:No:06 EXPERIMENT EAVESDROPPING, DICTIONARY
ATTACKS, MITM ATTACK
AIM
PROCEDURE
PROGRAM:
import java.util.Random;
import java.util.Scanner;
int p = scanner.nextInt();
int g = scanner.nextInt();
class A {
private int n;
public A() {
this.n = random.nextInt(p) + 1;
class B {
private int a;
private int b;
public B() {
this.a = random.nextInt(p) + 1;
this.b = random.nextInt(p) + 1;
}
public int compute_secret(int ga, int i) {
int ga = alice.publish();
int gb = bob.publish();
}
Output:
Enter a prime number (p) : 227
Enter a number (g) : 14
RESULT
Thus, the above program experiment eavesdropping, dictionary attacks,
MITM attacks are executed successfully and output are verified.
Ex:No:07 EXPERIMENT WITH SNIFF TRAFFIC USING ARP
POISONING
AIM
To experiment with sniff traffic using ARP poisoning.
PROCEDURE
Step 1 − Install the VMware workstation and install the Kali Linux operating
system.
Step 2 − Login into the Kali Linux using username pass “root, toor”.
Step 3 − Make sure you are connected to local LAN and check the IP address
by typing the command ifconfig in the terminal.
Step 4 − Open up the terminal and type “Ettercap –G” to start the graphical
version of Ettercap.
Step 5 − Now click the tab “sniff” in the menu bar and select “unified sniffing”
and click OK to select the interface. We are going to use “eth0” which means
Ethernet connection.
Step 6 − Now click the “hosts” tab in the menu bar and click “scan for hosts”. It
will start scanning the whole network for the alive hosts.
Step 7 − Next, click the “hosts” tab and select “hosts list” to see the number of
hosts available in the network. This list also includes the default gateway
address. We have to be careful when we select the targets.
Step 8 − Now we have to choose the targets. In MITM, our target is the host
machine, and the route will be the router address to forward the traffic. In an
MITM attack, the attacker intercepts the network and sniffs the packets. So, we
will add the victim as “target 1” and the router address as “target 2.”
In VMware environment, the default gateway will always end with “2” because
“1” is assigned to the physical machine.
Step 9 − In this scenario, our target is “192.168.121.129” and the router is
“192.168.121.2”. So we will add target 1 as victim IP and target 2 as router IP.
Step 10 − Now click on “MITM” and click “ARP poisoning”. Thereafter, check
the option “Sniff remote connections” and click OK.
Step 11 − Click “start” and select “start sniffing”. This will start ARP poisoning
in the network which means we have enabled our network card in “promiscuous
mode” and now the local traffic can be sniffed.
Note − We have allowed only HTTP sniffing with Ettercap, so don’t expect
HTTPS packets to be sniffed with this process.
Step 12 − Now it’s time to see the results; if our victim logged into some
websites. You can see the results in the toolbar of Ettercap.
Observation
Viva-Voce
Record
Total
RESULT
Thus, the above experiment with sniff traffic using ARP poisoning are executed
successfully and output are verified.
Ex:No:08 DEMONSTRATE INTRUSION DETECTION SYSTEM
USING ANY TOOL
AIM
To demonstrate intrusion detection system using any tool (SNORT).
PROCEDURE
In Windows:
Step-1: Download SNORT installer from
https://www.snort.org/downloads/snort/Snort_2_9_15_Installer.exe
Step-1: Execute the Snort_2_9_15_Installer.exe
Different SNORT Modes:
1. Sniffer Mode –
To print TCP/IP header use command ./snort -v
To print IP address along with header use command ./snort -vd
2. Packet Logging –
To store packet in disk you need to give path where you want to store the
logs. For this command is./snort -dev -l ./SnortLogs.
3. Activate network intrusion detection mode –
To start this mode use this command ./snort -dev -l ./SnortLogs -h
192.127.1.0/24 -c snort.conf
Observation
Viva-Voce
Record
Total
RESULT
Thus the above demonstrate intrusion system using SNORT are
installed successfully and output are verified.
Ex:No:09
EXPLORE NETWORK MONITORING TOOL
PROCEDURE
1. Sematext Experience
Easy installation
Single page application support
Individual session performance
Inspect Page load events
Monitor your Apdex score
Real-time automatic alerts
SEMATEXT EXPERIENCE
Sematext Experience was designed so DevOps and BizOps can work together.
Having easy access to all your actionable data provides your whole team with
in-depth insights. With this data, effectual decisions can be made with ease to
ensure your customers are always satisfied.
Pricing
From $9/mo
Pros
Combine the power of metrics, logs, and end-user monitoring under one
roof with Sematext Cloud
First-class support for popular frontend frameworks such as React,
Ember, and Angular
URL grouping for both page-load events and HTTP requests
Powerful cost control using data sampling
Has a solution for synthetic monitoring
Error tracking
2. Dynatrace RUM
Features
Pricing
Available on request
Pros
Cons
Reportedly pricey
The UI can be overwhelming at first
Features
Pricing
Available in two options: Lite (free) version and Pro version. Pricing
available on request
Pros
Free training
Self-learning platform
Cons
Reportedly pricey
New Relic is mostly known for their APM tool, but they completed their
monitoring tools set with a RUM solution, New Relic Browser.
New Relic Browser has advanced RUM features that give you access to
insights from the users’ perspective by focusing on browser performance. It
monitors the entire life cycle of a page or a view, from the moment users enter
the app until they disconnect.
Features
Pricing
Pros
Cons
Pingdom allows you to filter data from specific users to get greater insights on
the regional performance of your website and make optimizations to deliver a
better experience to your most valuable users. It’s highly scalable, allowing
you to monitor millions of pageviews without compromising your data.
Features
Pricing
Pros
Customizable, fast and comprehensive alerting and reporting
Synthetic and end user monitoring
Notifications to multiple destinations (text message, email)
Cons
RESULT
Thus, the above process are explore network monitoring tools and view the
output.
Ex:No:10
STUDY TO CONFIGURE FIREWALL, VPN
AIM
PROCEDURE
Consolegcloud
2. Go to VPN tunnels
3. Click the VPN tunnel that you want to use.
4. In the VPN gateway section, click the name of the VPC network. This
action directs you to the VPC network details page that contains the tunnel.
6. Click Add firewall rule. Add a rule for TCP, UDP, and ICMP:
7. 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.
Click Add firewall rule. Add a rule for TCP, UDP, and ICMPv6:
Click Create.
Observation
Viva-Voce
Record
Total
CONCLUSION
The purpose of this study was to explore the role of the firewall in network
security. This was done by researching five more specific problems. Two of
them were concerned with the relationship between firewalls and network
services, and it is in this area we believe this study makes its foremost
contribution. With regard to the question about firewall configurations, our
results are in line with findings from other studies, not least those by Wool.
Realistically, we do not consider our results to be that revolutionary nor reliable.
VPNs allow users or corporations to connect to remote servers, branch offices,
or to other companies over a public internetwork, while maintaining secure
communications. In all these cases, the secure connection appears to the
user as a private network communication-despite the fact that this
communication occurs over a public internetwork. VPN technology is
designed to address issues surrounding the current business trend towards
increased telecommuting and widely distributed global operations, where
workers must be able to connect to central resources and communicate with
each other.