Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 7

K. J.

SOMAIYA INSTITUTE OF ENGINEERING AND INFORMATION TECHNOLOGY, SION, MUMBAI-400022

Experiment No. 4
Aim: Study of packet sniffer tools Wireshark: -
a) Observer performance in promiscuous as well as non-promiscuous mode.
b) Show the packets can be traced based on different filters.
Objective: To analyze and implement packet sniffer tools Wireshark.
Software Required: Wireshark
Theory:
Wireshark is the world’s foremost and widely-used network protocol analyzer. It lets
you see what’s happening on your network at a microscopic level and is the de facto
(and often de jure) standard across many commercial and non-profit enterprises,
government agencies, and educational institutions. Wireshark development thrives
thanks to the volunteer contributions of networking experts around the globe and is the
continuation of a project started by Gerald Combs in 1998.

Wireshark has a rich feature set which includes the following:

 Deep inspection of hundreds of protocols, with more being added all the time

 Live capture and offline analysis

 Standard three-pane packet browser

 Multi-platform: Runs on Windows, Linux, macOS, Solaris, FreeBSD, NetBSD, and


many others

 Captured network data can be browsed via a GUI, or via the TTY-mode TShark
utility

 The most powerful display filters in the industry

 Rich VoIP analysis

 Read/write many different capture file formats: tcpdump (libpcap), Pcap NG,
Catapult DCT2000, Cisco Secure IDS iplog, Microsoft Network Monitor, Network
General Sniffer® (compressed and uncompressed), Sniffer® Pro, and NetXray®,
Network Instruments Observer, NetScreen snoop, Novell LANalyzer, RADCOM
WAN/LAN Analyzer, Shomiti/Finisar Surveyor, Tektronix K12xx, Visual Networks
Visual UpTime, WildPackets EtherPeek/TokenPeek/AiroPeek, and many others

 Capture files compressed with gzip can be decompressed on the fly

DEPARTMENT OF INFORMATION TECHNOLOGY / CLASS- TY / SEM-V / SECURITY LAB / ACADEMIC YEAR-2022-23(ODD) / AAYUSH GALA (14)
K. J. SOMAIYA INSTITUTE OF ENGINEERING AND INFORMATION TECHNOLOGY, SION, MUMBAI-400022

 Live data can be read from Ethernet, IEEE 802.11, PPP/HDLC, ATM, Bluetooth,
USB, Token Ring, Frame Relay, FDDI, and others (depending on your platform)

 Decryption support for many protocols, including IPsec, ISAKMP, Kerberos,


SNMPv3, SSL/TLS, WEP, and WPA/WPA2

 Coloring rules can be applied to the packet list for quick, intuitive analysis

 Output can be exported to XML, PostScript®, CSV, or plain text


Conclusion : Thus, The RSA public-key cryptosystem provides a digital signature scheme (sign
+ verify), based on the math of the modular exponentiations and discrete logarithms and the
computational difficulty of the RSA problem (and its related integer factorization problem). The
RSA sign / verify algorithm works as described below.
Outcome : Demonstrate Key management, distribution and user authentication.
Program Code & Output :
#include <stdio.h>
int prime(int a);
int modinverse(int e,int N);
int decryption(int D,int z,int n);
int d_sign(int m,int D,int n);
int encryption(int e,int m,int n);
int D,z;
int gcd(int a, int h)
{
int temp;
while(1)
{
temp = a%h;
if(temp==0)
return h;
a = h;
h = temp;
}

DEPARTMENT OF INFORMATION TECHNOLOGY / CLASS- TY / SEM-V / SECURITY LAB / ACADEMIC YEAR-2022-23(ODD) / AAYUSH GALA (14)
K. J. SOMAIYA INSTITUTE OF ENGINEERING AND INFORMATION TECHNOLOGY, SION, MUMBAI-400022

}
int modinverse(int e,int N)
{
int x,inv,d;
e=e%N;
for (int x = 1; x < 26; x++)
{
if((e*x)%N == 1)
d=x;
}
if((e*d)%N==1)
{
printf("The value of d is:%d\n",d);
D=d;
}
else
{
printf("Inverse not exist:\n");
}
}
int main()
{
int p,q,m,n,N,e,count;
while(1)
{
printf("Enter two prime numbers:\n");
scanf("%d %d",&p,&q);
prime(p);

DEPARTMENT OF INFORMATION TECHNOLOGY / CLASS- TY / SEM-V / SECURITY LAB / ACADEMIC YEAR-2022-23(ODD) / AAYUSH GALA (14)
K. J. SOMAIYA INSTITUTE OF ENGINEERING AND INFORMATION TECHNOLOGY, SION, MUMBAI-400022

prime(q);
if(prime(p)!=1||prime(q)!=1)
{
printf("enter number again because the previous numbers are not prime !!\n");
}
else
{
printf("valid prime numbers\n");
}
n=p*q;
printf("the value of n is :%d\n",n);
N=(p-1)*(q-1);
printf("the value of phi(N) is: %d\n",N);
printf("to calculate the public key(value of e):\n");
int e=2;
while(e<N){
count = gcd(e,N);
if(count==1)
break;
else
e++;
}
printf("The value of e is:%d\n",e);
printf("Enter a message M(plain-text)\n");
scanf("%d",&m);
printf("Now calculate the value of d:\n");
modinverse(e,N);
printf("Public keys are{%d,%d}\n",e,n);

DEPARTMENT OF INFORMATION TECHNOLOGY / CLASS- TY / SEM-V / SECURITY LAB / ACADEMIC YEAR-2022-23(ODD) / AAYUSH GALA (14)
K. J. SOMAIYA INSTITUTE OF ENGINEERING AND INFORMATION TECHNOLOGY, SION, MUMBAI-400022

printf("Private keys are{%d,%d}\n",D,n);


encryption(e,m,n);
decryption(D,z,n);
d_sign(m,D,n);
printf("RSA algorithm is successfully implemented");
exit(1);
}
}
int prime(int a)
{
if(a==2)
{
return 1;
}
else if((a<2) || ((a%2)==0))
{
return 0;
}
else if(a>2)
{
for(int i=2;i<=a;++i)
{
if(a%i!=0)
{
return 1;
}
}
}

DEPARTMENT OF INFORMATION TECHNOLOGY / CLASS- TY / SEM-V / SECURITY LAB / ACADEMIC YEAR-2022-23(ODD) / AAYUSH GALA (14)
K. J. SOMAIYA INSTITUTE OF ENGINEERING AND INFORMATION TECHNOLOGY, SION, MUMBAI-400022

}
int encryption(int e,int m,int n)
{
long value=1,encry;
while (e != 0){
value *= m;
--e;
}
encry=value%n;
printf("the value of encrypted message is :%ld\n",encry);
z=encry;
}
int decryption(int D,int z,int n)
{
long v=1;
int decry;
while(D != 0){
v *= z;
--D;
}
decry=v%n;
printf("the value of decrypted message is :%d\n",decry);
}
int d_sign(int m,int D,int n)
{
long va=1;
int d_sig;
while(D != 0){

DEPARTMENT OF INFORMATION TECHNOLOGY / CLASS- TY / SEM-V / SECURITY LAB / ACADEMIC YEAR-2022-23(ODD) / AAYUSH GALA (14)
K. J. SOMAIYA INSTITUTE OF ENGINEERING AND INFORMATION TECHNOLOGY, SION, MUMBAI-400022

va *= m;
--D;
}
d_sig=va%n;
printf("the value of digital signature is :%d\n",d_sig);
}

DEPARTMENT OF INFORMATION TECHNOLOGY / CLASS- TY / SEM-V / SECURITY LAB / ACADEMIC YEAR-2022-23(ODD) / AAYUSH GALA (14)

You might also like