Network Security Record
Network Security Record
Ex:No:01
IMPLEMENTINGSYMMETRICKEY ALGORITHM
AIM
PROCEDURE:
1. ClassSecureRandom: Thisclasshelpsgeneratea securerandomnumber.
2. Class KeyGenerator:This class provides the functionality for key generator.
The following are the standard KeyGenerator algorithms with the key sizes.
3. Approachtogeneratesymmetrickey:Thefollowingstepscanbefollowed in
order to generate a symmetric key.
Create a secrete key usingSecureRandom classin java which is used to
generate a random number. This will be used to Encrypt and Decrypt the
data.
The KeyGenerator class will provide a getInstance()method which canbe
used to pass a string variable which denotes the Key Generation
Algorithm. It returns a KeyGenerator Object.
4. EncryptionandDecryptionusingthesymmetrickey: Thefollowingsteps can
be followed in order to perform the encryption and decryption.
Create the Initialization vector that is required to avoid repetition during
the encryption process. This is basically a random number. The cipher
class provides two functionalities the Encryption and Decryption.
Finally doFinal()methodis invokedoncipher whichEncrypts or decrypts
data in a single-part operation, or finishes a multiple-part operation and
returns a byte array.
PROGRAM
//Javaprogramtoimplementthe//encryptionanddecryption
import java.security.SecureRandom;
import java.util.Scanner;
importjavax.crypto.Cipher;
JAYA COLLEGE OF ENGINEERING AND TECHNOLOGY
importjavax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
importjavax.crypto.spec.IvParameterSpec;
import javax.xml.bind.DatatypeConverter;
//classwhich implements
// the symmetric
publicclasssymmetric{
privatestaticfinalStringAES_CIPHER_ALGORITHM=
"AES/CBC/PKCS5PADDING";
privatestaticScannermessage;
// Function to create a
//secret key
publicstaticSecretKeycreateAESKey()
throws Exception
KeyGeneratorkeygenerator=KeyGenerator.getInstance(AES);
keygenerator.init(256, securerandom);
SecretKeykey=keygenerator.generateKey();
return key;
}
JAYA COLLEGE OF ENGINEERING AND TECHNOLOGY
//with an arbitraryvalue
publicstaticbyte[] createInitializationVector()
//Usedwith encryption
SecureRandomsecureRandom=newSecureRandom();
secureRandom.nextBytes(initializationVector);
return initializationVector;
// into CipherText.
Cipher cipher =
Cipher.getInstance(AES_CIPHER_ALGORITHM);
cipher.init(Cipher.ENCRYPT_MODE, secretKey,
ivParameterSpec);
returncipher.doFinal(plainText.getBytes());
//Thisfunctionperformsthe
JAYA COLLEGE OF ENGINEERING AND TECHNOLOGY
// reverseoperation of the
//do_AESEncryptionfunction.
publicstaticStringdo_AESDecryption(byte[]cipherText,SecretKey
secretKey, byte[] initializationVector)
throws Exception
IvParameterSpecivParameterSpec=newIvParameterSpec(
initializationVector);
cipher.init(Cipher.DECRYPT_MODE, secretKey,
ivParameterSpec);
byte[]result=cipher.doFinal(cipherText);
// Driver code
publicstaticvoidmain(Stringargs[])
throws Exception
byte[]initializationVector= createInitializationVector();
JAYA COLLEGE OF ENGINEERING AND TECHNOLOGY
//usingthesymmetric key
System.out.println("Theciphertextor"+"EncryptedMessageis:"
+DatatypeConverter.printHexBinary(cipherText));
// Decryptingtheencrypted
//message
StringdecryptedText=do_AESDecryption(cipherText, Symmetrickey,
initializationVector);
}
JAYA COLLEGE OF ENGINEERING AND TECHNOLOGY
OUTPUT:
Observation
Viva-Voce
Record
Total
RESULT:
Thus,theprogramimplementsasymmetrickeyalgorithmusingjavaand successfully
verified the output.
JAYA COLLEGE OF ENGINEERING AND TECHNOLOGY
Ex:No:02(a)
IMPLEMENTINGASYMMETRICKEYALGORITHM
AIM
ToimplementasymmetrickeyalgorithmusingtheJavaprogramming
language.
PROCEDURE:
1. To generate a keypair(public, private). The following steps can be followed
in order to generate asymmetric key:
Weneedtofirstgeneratepublic&privatekeyusingtheSecureRandom class.
SecureRandom class is used to generate random number.
The KeyGenerator classwill provide getInstance() method which can be
used to pass a string variable which denotes the Key Generation
Algorithm.ItreturnsKeyGeneratorObject.WeareusingRSAalgorithm for
generating the keys.
Initializing the keyGenerator object with 2048 bits key size and
passingthe 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. EncryptionandDecryptionusingtheasymmetric key:Intheabovesteps, 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.
FinallywegettheCiphertextafterEncryptionwith
ENCRYPT_MODE.
PROGRAM
// Java programtoperformthe
//usingasymmetrickey
package java_cryptography;
importjava.security.KeyPair;
importjava.security.KeyPairGenerator;
import java.security.PrivateKey;import
java.security.PublicKey;
importjava.security.SecureRandom;
import java.util.Scanner;
importjavax.crypto.Cipher;
import javax.xml.bind
.DatatypeConverter;
publicclassAsymmetric{
privatestaticfinal StringRSA
="RSA";
privatestaticScanner sc;
JAYA COLLEGE OF ENGINEERING AND TECHNOLOGY
//usingRSA algorithm.
publicstaticKeyPairgenerateRSAKkeyPair()
throws Exception
SecureRandomsecureRandom
= new SecureRandom();
KeyPairGeneratorkeyPairGenerator
= KeyPairGenerator.getInstance(RSA);
keyPairGenerator.initialize(
2048, secureRandom);
returnkeyPairGenerator
.generateKeyPair();
publicstaticbyte[]do_RSAEncryption(
String plainText,
PrivateKeyprivateKey)
throws Exception
{
JAYA COLLEGE OF ENGINEERING AND TECHNOLOGY
Ciphercipher
= Cipher.getInstance(RSA);
cipher.init(
Cipher.ENCRYPT_MODE,privateKey);
return cipher.doFinal(
plainText.getBytes());
// original plaintext.
publicstaticStringdo_RSADecryption(
byte[] cipherText,
PublicKeypublicKey)
throws Exception
Ciphercipher
= Cipher.getInstance(RSA);
cipher.init(Cipher.DECRYPT_MODE,
publicKey);
byte[]result
JAYA COLLEGE OF ENGINEERING AND TECHNOLOGY
= cipher.doFinal(cipherText);
return newString(result);
// Driver code
publicstaticvoidmain(Stringargs[])
throws Exception
KeyPairkeypair
= generateRSAKkeyPair();
byte[]cipherText
= do_RSAEncryption(
plainText,
keypair.getPrivate());
System.out.println(
+ DatatypeConverter.printHexBinary(
keypair.getPublic().getEncoded()));
JAYA COLLEGE OF ENGINEERING AND TECHNOLOGY
System.out.println(
+ DatatypeConverter.printHexBinary(
keypair.getPrivate().getEncoded()));
System.out.print("TheEncryptedTextis:");
System.out.println(
DatatypeConverter.printHexBinary(
cipherText));
String decryptedText
= do_RSADecryption(
cipherText,
keypair.getPublic());
System.out.println(
+ decryptedText);
}
JAYA COLLEGE OF ENGINEERING AND TECHNOLOGY
OUTPUT:
Observation
Viva-Voce
Record
Total
RESULT:
Thus,theprogramimplementsanasymmetricencryptionusingjavaand successfully
verified the output.
JAYA COLLEGE OF ENGINEERING AND TECHNOLOGY
Ex:No:2(b)
IMPLEMENTINGKEYEXCHANGEALGORITHM
(DIFFIE-HELLMAN ALGORITHM)
AIM
PROCEDURE:
The Diffie-Hellman algorithm is being used to establish a shared secret that can
beusedfor secretcommunications whileexchangingdataoverapublicnetwork
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.
x=(9^4mod23)=(6561mod23)=6
Bob: y =(9^3mod23)=(729mod23)= 16
Step5:Alicereceivespublickeyy=16and Bob
Alice:ka=y^amodp=65536mod23=9 Bob:
PROGRAM
//usingtheDiffie-HellmanKeyexchangealgorithm class
GFG {
//Powerfunctiontoreturnvalueofa^bmodP
if(b == 1)
returna;
else
return(((long)Math.pow(a,b))%p);
// Driver code
publicstaticvoidmain(String[] args)
JAYA COLLEGE OF ENGINEERING AND TECHNOLOGY
// publickeysG and P
//AprimenumberPistaken P =
23;
System.out.println("ThevalueofP:"+ P);
//AprimitiverootforP,Gistaken G =
9;
System.out.println("ThevalueofG:"+ G);
//aisthechosenprivatekey a =
4;
System.out.println("TheprivatekeyaforAlice:"
+ a);
//Getsthegeneratedkey x
= power(G, a, P);
//bisthechosenprivatekey b
= 3;
System.out.println("TheprivatekeybforBob:"
+ b);
//Getsthegeneratedkey y
= power(G, b, P);
//ofkeys
ka=power(y,a,P);//SecretkeyforAlice kb =
System.out.println("Secretkey fortheAliceis:"
+ ka);
System.out.println("SecretkeyfortheBobis:"
+ kb);
}
JAYA COLLEGE OF ENGINEERING AND TECHNOLOGY
OUTPUT
Observation
Viva-Voce
Record
Total
RESULT:
Thus,theprogramimplementsaKeyExchangeAlgorithm(DHalgorithm) using
java and successfully verified the output.
JAYA COLLEGE OF ENGINEERING AND TECHNOLOGY
Ex:No:03
IMPLEMENTINGDIGITALSIGNATURES
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:
//JavaimplementationforGenerating
packagejava_cryptography;
// Imports
importjava.security.KeyPair;
JAYA COLLEGE OF ENGINEERING AND TECHNOLOGY
importjava.security.KeyPairGenerator;
import java.security.PrivateKey;import
java.security.PublicKey;
importjava.security.SecureRandom;
import java.security.Signature;
import java.util.Scanner;
importjavax.xml.bind.DatatypeConverter;
publicclassDigital_Signature_GeeksforGeeks{
// Signing Algorithm
privatestaticfinalString
SIGNING_ALGORITHM
= "SHA256withRSA";
privatestaticfinalStringRSA="RSA";
//FunctiontoimplementDigitalsignature
//by passingprivatekey.
publicstaticbyte[]Create_Digital_Signature(
byte[] input,
PrivateKeyKey)
JAYA COLLEGE OF ENGINEERING AND TECHNOLOGY
throws Exception
Signature signature
= Signature.getInstance(
SIGNING_ALGORITHM);
signature.initSign(Key);
signature.update(input);
return signature.sign();
//Generatingthe asymmetrickeypair
publicstaticKeyPairGenerate_RSA_KeyPair()
throws Exception
SecureRandomsecureRandom
= new SecureRandom();
KeyPairGeneratorkeyPairGenerator
= KeyPairGenerator
.getInstance(RSA);
keyPairGenerator
.initialize(
2048, secureRandom);
JAYA COLLEGE OF ENGINEERING AND TECHNOLOGY
returnkeyPairGenerator
.generateKeyPair();
//digitalsignaturebyusingthepublickey public
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
publicstaticvoidmain(String args[])
JAYA COLLEGE OF ENGINEERING AND TECHNOLOGY
throws Exception
String input
="GEEKSFORGEEKS IS A"
+"COMPUTERSCIENCEPORTAL";
KeyPairkeyPair
= Generate_RSA_KeyPair();
//FunctionCall
byte[]signature
=Create_Digital_Signature(
input.getBytes(),
keyPair.getPrivate());
System.out.println(
+ DatatypeConverter
.printHexBinary(signature));
}
JAYA COLLEGE OF ENGINEERING AND TECHNOLOGY
OUTPUT:
Observation
Viva-Voce
Record
Total
RESULT:
Thus,theprogramimplementsaDigitalSignatureSchemeusingjavaand successfully
verified the output.
JAYA COLLEGE OF ENGINEERING AND TECHNOLOGY
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
InstallationofWireshark Software
1 Opentheweb browser.
3 SelecttheWindowsinstalleraccordingtoyoursystemconfiguration, either
32-bt or 64-bit. Save the program and close the browser.
4 Now,openthesoftware,andfollowtheinstallinstructionbyaccepting 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.
JAYA COLLEGE OF ENGINEERING AND TECHNOLOGY
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 IPv4isa32-bitaddressinwhicheachgrouprepresents8bitsranging from 0 to
255.
Wiresharkpacketsniffing
o OpentheWireshark Application.
I/OGRAPHS
JAYA COLLEGE OF ENGINEERING AND TECHNOLOGY
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:
JAYA COLLEGE OF ENGINEERING AND TECHNOLOGY
WIRESHARK DECRYPTION
Thedecryptionprocessisusedforthedatatobeinareadableformat.Beloware the steps
for the decryption process.
o Aboxwillappear.Clickontheoptionshownbelow:
o Selecttheoptionwpa-pwdandsetthepassword accordingly.
Observation
Viva-Voce
Record
Total
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.
JAYA COLLEGE OF ENGINEERING AND TECHNOLOGY
Ex:No:05
CHECKMESSAGEINTERGRITYAND
CONFIDENTIALITY USING SSL
AIM:
ToCheckMessageIntergrityAndConfidentiality UsingSSL.
PROCEDURE:
Installing&ConfiguringHTTPwithSSL(HTTPS)
PublicKeyCryptography(AsymmetricCryptography)
In public key cryptography, a matching pair of keys is used; one for encryption
and the other for decryption. One of the key is called the public key (can be
published or sent over the network and known to all users). The other is called
the private key (kept secretly by the owner).
KE≠ KD
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-KeyExchange
Oncetheciphersuittobeusedarenegotiatedandagree-upon,theclientand server will
establish a session key:
1. Theclientusesserver'spublickeytoencryptasecretandsendstothe server.
2. Only the server has the matching private key to decrypt the secret (not the
Eavesdroppers).
3. Theclientandserverthenusethissecrettogenerateasessionkey independently
and simultaneously.
Thissessionkeywouldthenbeusedforsecurecommunicationforthis particular
communication session
1. Theclientgeneratesa48-byte(384-bit)randomnumber
calledpre_master_secret, encrypts it using the verified server's public key
and sends it to the server.
JAYA COLLEGE OF ENGINEERING AND TECHNOLOGY
2. The sender hashes the compressed data and the secret HMAC key to make
an HMAC, to assure message integrity.
3. The sender encrypts the compressed data and HMAC using
encryption/decryption secret key, to assure message confidentiality.
Retrievemessages:
1. The receiver decrypts the ciphertext using the encryption/decryption secret
key to retrieve the compressed data and HMAC.
2. The receiver hashes the compressed data to independently produce the
HMAC. It then verifies the generated HMAC with the HMAC containedin
the message to assure message integrity.
3. The receiver un-compresses the data using the agreed-upon compression
method to recover the plaintext.
OUTPUT
>openssls_client?
(Display theavailableoptions)
The following command turns on the debug option and forces the protocol to be
TLSv1:
>openssls_client -connectlocalhost:443-CAfileca.crt-debug -tls1
Loading'screen'intorandomstate-done
CONNECTED(00000760)
readfrom00988EB0[00990AB8](5bytes=>5(0x5))
0000 - 16 03 01 00 2a ......................................*
JAYA COLLEGE OF ENGINEERING AND TECHNOLOGY
readfrom00988EB0[00990ABD](42bytes=>42(0x2A))
0000- 02 00 00 26 03 01 40 44-35 27 cc ef2b 51 e1b0 ...&..@D5'..+Q..
0010 - 44 1fefc483 72 df37-4f9b2b dd 11 50 13 87 D. .. r.7O.+..P..
0020- 91 0a a2 d2 28 b9 00 00-16 ....(....
002a - <SPACES/NULS>
readfrom00988EB0[00990AB8](5bytes=>5(0x5))
0000 - 16 03 01 02 05 .....
readfrom00988EB0[00990AB8](5bytes=>5(0x5))
0000 - 16 03 01 00 04 .....
JAYA COLLEGE OF ENGINEERING AND TECHNOLOGY
readfrom00988EB0[00990ABD](4bytes=>4(0x4))
0000 - 0e .
0004 - <SPACES/NULS>
writeto00988EB0[00999BE0](6bytes=>6(0x6))
0000 - 14 03 01 00 01 01 ......
readfrom00988EB0[00990AB8](5bytes=>5(0x5))
0000 - 14 03 01 00 01 .....
readfrom00988EB0[00990ABD](1bytes=>1(0x1))
0000 - 01 .
readfrom00988EB0[00990AB8](5bytes=>5(0x5))
0000 - 16 03 01 00 28 ...................................... (
readfrom00988EB0[00990ABD](40bytes=>40(0x28))
0000- d4 0b a6 b7 e8 91 091e-e4 1e fc 44 5f80 cca1 ...........D_...
0010- 5d 51 55 3e 62 e8 0f78-07 f6 2f cd f9 bc 49 8d ]QU>b..x../...I.
0020 - 56 5b e8 b2 09 2c 18 52- V[...,.R
---
JAYA COLLEGE OF ENGINEERING AND TECHNOLOGY
Certificatechain
0 s:/C=US/CN=chc/[email protected]
i:/C=US/OU=test101/CN=chc/[email protected]
---
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
-----ENDCERTIFICATE-----
subject=/C=US/CN=chc/[email protected]
issuer=/C=US/OU=test101/CN=chc/[email protected]
---
NoclientcertificateCAnames sent
---
JAYA COLLEGE OF ENGINEERING AND TECHNOLOGY
New,TLSv1/SSLv3,CipherisEDH-RSA-DES-CBC3-SHA
Serverpublickeyis1024bit
SSL-Session:
Protocol: TLSv1
Cipher :EDH-RSA-DES-CBC3-SHA
Session-ID:
Session-ID-ctx:
Master-Key:
57FDDAF85C7D287F9F9A070E8784A29C75E788DA2757699B
20F3CA50E7EE01A66182A71753B78DA218916136D50861AE
Key-Arg : None
Start Time: 1078211879
Timeout : 7200 (sec)
Verifyreturncode:0(ok)
---
GET/test.htmlHTTP/1.0
readfrom00988EB0[00990AB8](5bytes=>5(0x5))
0000 - 17 03 01 01 48 ...................................... H
JAYA COLLEGE OF ENGINEERING AND TECHNOLOGY
readfrom00988EB0[00990ABD](328bytes=>328(0x148))
0000- bd eb 8b 9c 01 ac 73 30-8fca a4 8b 2a6fbd 02 ......s0.... *o..
0010- d7 fc 7118 61 47 f21d-70 8b 10 7d98 28 a4 50 ..q.aG..p..}.(.P
0020- f3 0f42 e8c5 e1 3e53-34 bd c7 62 34 1b 5e 8c ..B...>S4..b4.^.
0030- 99 2d 89 c6b3 f0 19 96-22 9743 b8 8f9d 7642 .-......".C .. vB
0040- 95 a5 7c db 3b 22 dd 57-29 8d e8 d4 28 3e 89 d8 ..|.;".W)...(>..
0050- 46 e5 dc 35 51 56 f844-d1 82 44 a0 65 b0 93 22 F..5QV.D..D.e.."
0060- 4b 0a eb07 26 c9 2a e2-45 4c de 07 0cbb 3ec6 K...&.*.EL.... >.
0070 - bc 37 94 cd ec 94 2f35-76 37 13 4d 0f88 9c b1 .7..../5v7.M....
0080- d7 1c 58 8a 35 5b 32 bc-12 2b 9c e6 5b d4 86 bd ..X.5[2..+..[...
0090- 39 fc 9918 79 ecf753-db 59 74 49da 07 69 54 9...y..S.YtI..iT
00a0- f4 66 aa3634 39 f90b-87 50 9e 76db 9fd0 44 .f.649...P.v... D
00b0 - 0c 0d e7 65 80 9b b8 51-56 3d d0 db aa 55 ff ca ...e...QV=...U..
00c0 - 74 38 24 c1 8c d7 32 cf-ab 03 b3 59 29 0f 80 18 t8$...2....Y)...
00d0- 6ad4 e07e fd 41 8c f7-1d 81 12 a700 b3 71 39 j..~.A. ...... q9
00e0- 78 1e 3c 17 42 d4 99 22-69 7b 2d 09 efd8 6ef4 x.<.B.."i{ ....n.
00f0- 64f6 6134728c89 f5-a8ea 1cb1 0d08 ff17 d.a4r...........
0100- 51 3e 46 2b38 75 61 6a-1e 34f4 14 14 38 0d5e Q>F+8uaj.4. . 8.^
0110- 6e ba db ef 83 88 ee a5-2c 18 5a 0c27 e3 d9 19 n.......,.Z.'...
0120- 6ca3 12 c0a1 3d e114-96 d31a f9 c9 f2 aad6 l....=..........
0130- 12 d5 36 ae 36 f2 18f5-dfc6 ef34 d7 7d 2b 70 ..6.6. .... 4.}+p
0140- 99 88 47 93 91 09 56 b1- ..G. . V.
HTTP/1.1200OK
Date:Tue, 02 Mar2004 07:18:08GMT
Server:Apache/1.3.29(Win32)mod_ssl/2.8.16OpenSSL/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
<h1>Homepageonmainserver</h1>
readfrom00988EB0[00990AB8](5bytes=>5(0x5))
JAYA COLLEGE OF ENGINEERING AND TECHNOLOGY
0000 - 15 03 01 00 18 .....
readfrom00988EB0[00990ABD](24bytes=>24(0x18))
0000 - a5 47 51 bd aa 0f 9b e4-ac d4 28 f2 d0 a0 c8 fa .GQ.......(.....
0010 - 2c d4 e5 e4 be c5 01 85- ,.......
closed
Observation
Viva-Voce
Record
Total
RESULT:
Thus, the check message intergrityand confidentiality using SSL can verifiedthe
output successfully.
JAYA COLLEGE OF ENGINEERING AND TECHNOLOGY
Ex:No:06 EXPERIMENTEAVESDROPPING,DICTIONARY
ATTACKS, MITM ATTACK
AIM
Toexperimenteavesdropping,dictionaryattack,MITM attack.
PROCEDURE
ManintheMiddle(MITM)againstDiffie-Hellman:
A malicious Malory, that has a MitM (man in the middle) position, can
manipulatethecommunicationsbetweenAliceandBob,andbreakthe security of the
key exchange.
1. Selected public numbers p and g, p is a prime number, called the
“modulus” and g is called the base.
2. Selectingprivatenumbers.
let Alice pick a private random number a and let Bob pick a private
random number b, Malory picks 2 random numbers c and d.
3. Interceptingpublicvalues,
Malory intercepts Alice’s public value (ga(mod p)), block it fromreaching
Bob, and instead sends Bob her own public value (gc(modp))and Malory
intercepts Bob’s public value (gb(mod p)), block it from
reachingAlice,andinsteadsendsAliceherownpublicvalue(gd (modp))
4. Computingsecretkey
Alice will compute a key S1=gda(mod p), and Bob will compute a
different key, S2=gcb(mod p)
5. If Alice uses S1 as a key to encrypt a later message to Bob, Malory can
decryptit, re-encryptitusingS2,andsenditto Bob.BobandAlice won’t notice
any problem and may assume their communication is encrypted, but in
reality, Malory can decrypt, read, modify, and then re- encrypt all their
conversations.
PROGRAM:
importjava.util.Random;
JAYA COLLEGE OF ENGINEERING AND TECHNOLOGY
importjava.util.Scanner;
publicclassMain{
int p = scanner.nextInt();
intg=scanner.nextInt();
class A {
private int n;
publicA(){
this.n=random.nextInt(p)+1;
publicintpublish(){
return(int)Math.pow(g,n)%p;
JAYA COLLEGE OF ENGINEERING AND TECHNOLOGY
class B {
private int a;
privateintb;
privateint[]arr;
publicB(){
this.a = random.nextInt(p) + 1;
this.b = random.nextInt(p) + 1;
publicintpublish(inti){
return(int)Math.pow(g,arr[i])%p;
}
JAYA COLLEGE OF ENGINEERING AND TECHNOLOGY
return(int)Math.pow(ga,arr[i])%p;
Aalice=newA();
Abob=newA();
Beve=newB();
System.out.println("EveselectedprivatenumberforAlice(c):"+ eve.a);
int ga = alice.publish();
int gb = bob.publish();
intgeb=eve.publish(1);
}
JAYA COLLEGE OF ENGINEERING AND TECHNOLOGY
Output:
Enter a prime number (p) : 227
Enter a number (g) : 14
Alicecomputed(S1):41
EvecomputedkeyforAlice(S1):41
Bobcomputed(S2):167
EvecomputedkeyforBob(S2):167
JAYA COLLEGE OF ENGINEERING AND TECHNOLOGY
Observation
Viva-Voce
Record
Total
RESULT
Thus,theaboveprogramexperimenteavesdropping,dictionaryattacks, MITM attacks
are executed successfully and output are verified.
JAYA COLLEGE OF ENGINEERING AND TECHNOLOGY
AIM
ToexperimentwithsnifftrafficusingARPpoisoning.
PROCEDURE
Step1−InstalltheVMwareworkstationandinstalltheKaliLinuxoperating system.
Step2− LoginintotheKali Linuxusing usernamepass“root, toor”.
Step 3− Make sure you are connected to local LAN and check the IP addressby
typing the command ifconfig in the terminal.
Step4−Openuptheterminalandtype“Ettercap–G”tostartthegraphical version of
Ettercap.
JAYA COLLEGE OF ENGINEERING AND TECHNOLOGY
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 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.”
JAYA COLLEGE OF ENGINEERING AND TECHNOLOGY
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 victimIPand target 2 asrouter IP.
Observation
Viva-Voce
Record
Total
RESULT
Thus, the above experiment with sniff traffic using ARP poisoning are executed
successfully and output are verified.
JAYA COLLEGE OF ENGINEERING AND TECHNOLOGY
AIM
Todemonstrateintrusiondetectionsystemusinganytool(SNORT).
PROCEDURE
InWindows:
Step-1: Download SNORT installer from
https://www.snort.org/downloads/snort/Snort_2_9_15_Installer.exe
Step-1:ExecutetheSnort_2_9_15_Installer.exe
DifferentSNORTModes:
1. SnifferMode–
To print TCP/IP header use command./snort -v
ToprintIPaddressalongwithheaderusecommand./snort-vd
2. PacketLogging–
Tostorepacketindiskyouneedtogivepathwhereyouwanttostorethe logs. For this
command is./snort -dev -l ./SnortLogs.
3. Activatenetworkintrusiondetectionmode–
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
Thustheabovedemonstrateintrusion systemusingSNORTare
installed successfully and output are verified.
JAYA COLLEGE OF ENGINEERING AND TECHNOLOGY
Ex:No:09
EXPLORENETWORKMONITORINGTOOL
PROCEDURE
1. SematextExperience
HereiswhatputsSematextonthetopofourlist:
Easyinstallation
Singlepageapplicationsupport
Individualsessionperformance
InspectPageloadevents
MonitoryourApdexscore
Real-timeautomaticalerts
Furthermore, you can set up alerts for Apdex score, script errors, and page
loadtime andreceive real-timenotifications wheneverperformance anomalies
are detected. this, in turn, will enable you to troubleshoot issues faster.
SEMATEXTEXPERIENCE
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-classsupportforpopularfrontendframeworkssuchasReact, Ember, and
Angular
URLgroupingforbothpage-loadeventsandHTTPrequests
Powerfulcostcontrolusingdatasampling
Hasasolutionforsyntheticmonitoring
Errortracking
JAYA COLLEGE OF ENGINEERING AND TECHNOLOGY
2. DynatraceRUM
PartofDynatrace’sdigitalexperiencemonitoringtoolset,DynatraceRUMis a
powerful website monitoring service that offers complete real-time visibilityof
customer experience. You can monitor the activity of all mobile and web
application users across all devices and browsers to assess and improve user
satisfaction.
Features
Mapthewholeuserjourney
Replayindividualcustomersessions
Business-relevant,usertransactionmonitoring
Real-timeAI-basedanalysis
Pricing
Availableonrequest
Pros
Intuitivenon-technicaldashboardusability
InteractiveinterfacesandvisualreportsforROItracking
JAYA COLLEGE OF ENGINEERING AND TECHNOLOGY
Mobilemonitoringbreakdowns
Cons
Reportedlypricey
TheUIcanbeoverwhelmingatfirst
3. AppDynamicsBrowserRUM
Features
Real-timeintelligentalerting
Backendandfrontendmonitoringinsamesolution
Businesstransactioncorrelation
Browsersnapshotwaterfalls
Dynamicperformancebaselining
Pricing
JAYA COLLEGE OF ENGINEERING AND TECHNOLOGY
Availableintwooptions:Lite(free)versionandProversion.Pricing available
on request
Pros
Freetraining
Self-learningplatform
Cons
Reportedlypricey
4. NewRelicBrowser
New Relic is mostly known for their APM tool, but they completed their
monitoring tools set with a RUM solution, New RelicBrowser.
New Relic Browser has advanced RUM features that give you access toinsights
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.
JAYA COLLEGE OF ENGINEERING AND TECHNOLOGY
Features
BrowserPageviewsandPageLoadTimes
JavaErrorsandInstancedetails
AJAXTimingandCallReports
BrowserSessionTraces
FilterableGeographyAnalytics
Routechangesinappswithsinglepageapplication(SPA)architecture
Individualsessionperformance
Pricing
Pros
Syntheticmonitoringoptionavailable
Cons
MostfeaturesareavailableforProaccountsonly
Reportsarenotverycomprehensive
MissingdetailedHTTPresourcesmetrics
JAYA COLLEGE OF ENGINEERING AND TECHNOLOGY
5. Pingdom
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
betterexperience to yourmost valuable users. It’s highly scalable, allowingyou
to monitor millions of pageviews without compromising your data.
Features
Tailoredincidentmanagement
Real-timedataandalerting
Websiteandservermonitoring
Mobileaccessibility
Pricing
Thebasicsetupstartsat$10/month,upto$199–$15,000
Pros
JAYA COLLEGE OF ENGINEERING AND TECHNOLOGY
Customizable,fastandcomprehensivealertingandreporting
Syntheticandendusermonitoring
Notificationstomultipledestinations(textmessage,email)
Cons
Expensiveifyouincreasevolumeorscaleupasthereisnodata sampling
available
Noerrortrackingorerrormanagement
JAYA COLLEGE OF ENGINEERING AND TECHNOLOGY
Observation
Viva-Voce
Record
Total
RESULT
Thus, the above process are explore network monitoring tools and view the
output.
JAYA COLLEGE OF ENGINEERING AND TECHNOLOGY
Ex:No:10
STUDYTO CONFIGUREFIREWALL, VPN
AIM
Tostudy to configurefirewall,VPN usingGooglecloud services.
PROCEDURE
Consolegcloud
2. Go to VPN tunnels
3. ClicktheVPN tunnel thatyou want to use.
5. ClicktheFirewallrulestab.
6. ClickAdd firewall rule. Add arule for TCP, UDP, and ICMP:
Name:Enterallow-tcp-udp-icmp.
Specifiedprotocols orports:Selecttcpandudp.
Other protocols:Entericmp.
Targettags:Addanyvalidtag or tags.
7. ClickCreate.
JAYA COLLEGE OF ENGINEERING AND TECHNOLOGY
If you need to allow access to IPv6 addresses on your VPC network from your
peer network, add an allow-ipv6-tcp-udp-icmpv6firewall rule.
ClickAdd firewall rule. Add a rule for TCP, UDP, and ICMPv6:
Name:Enterallow-ipv6-tcp-udp-icmpv6.
Specifiedprotocols orports:Selecttcpandudp.
Targettags:Addanyvalidtagortags.
Click Create.
Observation
Viva-Voce
Record
Total
JAYA COLLEGE OF ENGINEERING AND TECHNOLOGY
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,wedonotconsiderourresultstobethatrevolutionarynorreliable. VPNs
allow users or corporations to connect to remote servers, branch offices, or to
other companies over a public internetwork, while maintaining secure
communications.Inallthesecases,thesecure connection appears tothe user as a
private network communication-despite the fact that this
communicationoccursoverapublicinternetwork. VPNtechnologyis designed to
address issues surrounding the current business trend towards increased
telecommuting and widely distributed global operations, where
workersmustbeableto connect tocentral resourcesand communicatewith each
other.