You are on page 1of 70

1

INDEX

COMPUTER NETWORKS LAB


1. Implement the data link layer framing methods such as character, character
stuffing and bit stuffing.
2. Implement on a data set of characters the three CRC polynomials CRC 12,
CRC 16 and CRC CCIP.
3. Implement Dijkstra s algorithm to compute the Shortest path thru a graph.
4.. Take a 64 bit playing text and encrypt the same using DES algorithm.

INFORMATION SECURITY LAB


1.Working with Sniffers for monitoring network communication (Ethereal).
2.Using NMAP for ports monitoring.
DATAWAREHOUSING AND DATAMINING LAB
1. Analyzing data in different views of relation contact-lenses
2. Write details on the table Weather. Nominal and class play classified on
outlook attribute.
3. Describe preprocessing details on the table Iris relation and visualize all
details based on class class .
4. Generate Association rules for the relation Weather. Nominal on any three
attributes
5. Generate Association rules for the relation Soybean on any three attributes

COMPUTER NETWORKS LAB


1 PROGRAM SPECIFICATION:
Program to implement bit stuffing.

ALGORITHM:
Step 1: Start
Step 2: Read the bit string to be transmitted in 0s and 1s.
Step 3: For stuffing process, append at begin and end of the string.
Step 4: Check the string whether it has five consecutive 1s except the appending
string.
Step 5: If yes, insert 0 bit as stuff in the next bit else transmit the next bit.
Step 6: Continue this process until the completion of string.
Step 7: Stuffed data is obtained.
Step 8: Now destuffing process, remove the appended string at start and end
of string.
Step 9: Check the stuffed string again whether it has five consecutive 1s.
Step 10: If yes then remove the next bit i.e. do not transmit the next bit else
transmit the data.
Step 11: Continue this process until the last bit of string.
Step 12: Original bit data has been obtained.
Step 13: Stop

PROGRAM:
#include<stdio.h>
main()
{
int a[50],b[50],i,j,count=0,n,c[]={0,1,1,1,1,1,1,0};
clrscr();
printf("Enter the length of the string:\n");
scanf("%d",&n);
printf("Enter the string:\n");
for(i=0;i<n;i++)
scanf("%d",&a[i]);
j=0;
/* Stuffing */
for(i=0;i<8;i++)
{
b[j]=c[i];
j++;
}
for(i=0;i<n;i++)
{
if(a[i]==1)
{
b[j]=a[i];
count++;
if(count==5)
{
b[j]=a[i];
j++;
b[j]=0;
count=0;
}
j++;
}
else
{
b[j]=a[i];
j++;
count=0;
}
}
for(i=0;i<8;i++)
{
b[j]=c[i];
j++;

}
n=j;
printf("The frame after bit stuffing is:\n");
for(i=0;i<n;i++)
printf("%d",b[i]);
printf("\n");
/*Destuffing*/
count=j=0;
for(i=8;i<n-8;i++)
{
if(b[i]==1)
{
a[j]=b[i];
count++;
if(count==5)
{
i++;
count=0;
}
j++;
}
else
{
a[j]=b[i];
j++;
count=0;
}
}
printf("The destuffed data is:\n");
for(i=0;i<j;i++)
printf("%d",a[i]);
getch();
}

INPUT1:
Enter the length of the string:
15
Enter the string:
1
1
1
1
1
1
1
0
0
1
1
1
1
1
1
OUTPUT1:
The frame after bit stuffing is:
011111101111101100111110101111110
The destuffed data is:
111111100111111
INPUT2:
Enter the length of the string:
8
Enter the string:
1
1
1
1
1
1
1
1
OUTPUT 2:
The frame after bit stuffing is:
0111111011111011101111110
The destuffed data is:
11111111

1b)PROBLEM SPECIFICATION:
Program to implement character stuffing.
ALGORITHM:
Step 1: Start
Step 2: Read the character string to be transmitted in upper case.
Step 3: For stuffing process, append at begin with DLE STX as starting
flag byte and end with DLE ETX as ending flag byte of the string.
Step 4: Check the string whether it has DLE, STX, and ETX.
Step 5: If yes then insert the string DLE before the character else transmit
the next character
Step 6: Continue this process until the completion of string.
Step 7: Stuffed data is obtained.
Step 8: Now destuffing process, remove the appended string at start and
end of string.
Step 9: Check the stuffed string again whether it has DLE, STX, and
ETX.
Step 10: If yes then remove the string DLE that is encountered first else
transmit the data.
Step 11: Continue this process until the last character of string.
Step 12: Original data has been obtained.
Step 13: Stop

PROGRAM:
#include<stdio.h>
#include<conio.h>
main()
{
char a[30],b[30],c[30];
inti,j,n,m;
clrscr();
printf("\tSTUFFING:\n");
printf("\nEnter the string in upper case:\n");
scanf("%s",&a);
n=strlen(a);
b[0]='D';
b[1]='L';
b[2]='E';
b[3]=' ';
b[4]='S';
b[5]='T';
b[6]='X';
b[7]=' ';
j=8;i=0;
while(i<n)
{
if((a[i]=='D'&&a[i+1]=='L'&&a[i+2]=='E')||(a[i]=='S'&&a[i+1]=='T'&&a[i+2]=='
X')||(a[i]=='E'&&a[i+1]=='T'&&a[i+2]=='X'))
{
b[j]='D';
b[j+1]='L';
b[j+2]='E';
j=j+3;
}
b[j]=a[i];
i++;
j++;
}
b[j]=' ';
b[j+1]='D';
b[j+2]='L';
b[j+3]='E';
b[j+4]=' ';
b[j+5]='E';
b[j+6]='T';
b[j+7]='X';
b[j+8]='\0';

printf("Frames after stuffing:\n");


printf("%s",b);
printf("\n\n\tDESTUFFING:\n");
m=strlen(b);
printf("\nFrames after destuffing:\n");
i=0,j=0;
while(i<8)
i++;
while(i<m-8)
{
if((b[i]=='D'&&b[i+1]=='L'&&b[i+2]=='E')||(b[i]=='S'&&b[i+1]=='T'&&b[i+2]=
='X')||(b[i]=='E'&&b[i+1]=='T'&&b[i+2]=='X'))
{
i=i+3;
c[j]=b[i];
}
else
c[j]=b[i];
j++;
i++;
}
c[j]='\0';
printf("%s",c);
getch();
}

INPUT1:
STUFFING:
Enter the string in upper case:
ETXWITHSTXCANDLE
OUTPUT1:
Frames after stuffing:
DLE STX DLEETXWITHDLESTXCANDLEDLE DLE ETX
DESTUFFING:
Frames after destuffing:
ETXWITHSTXCANDLE
INPUT2:
STUFFING:
Enter the string in upper case:
STXETX
OUTPUT2:
Frames after stuffing:
DLE STX DLESTXDLEETX DLE ETX
DESTUFFING:
Frames after destuffing:
STXETX

10

2) PROGRAM SPECIFICATION:
Program to implement CRC-12.
ALGORITHM:
Step 1: Start
Step 2: Let r be the degree of G(x). Append r bits to the low order end
of the frame. So it now contains M+r bits and corresponds to the polynomial
XM(X).
Step 3: Divide the bit string corresponding to G(x) into the bit string
corresponding to xM(X) using Modulo 2 division.
Step 4: Subtract the remainder from the bit string corresponding to XM(X)
using Modulo 2 subtraction. The result is checksummed frame to be transmitted
call its polynomial T(X).
Step 5: Stop

11

PROGRAM:
#include<string.h>
#include<stdio.h>
#define crc 12
main()
{
char pola1[39],pola2[30],ch[2]="";
int ad=0,i=0,j=0,mp[crc+1],pp1[10],pp2[10],gp[crc+1],rm[crc+1],p1,p2,k;
clrscr();
printf("Enter the message polynomial(in the \"x7+x4+...\" form):\n ");
gets(pola1);
for(i=0,p1=0;i<strlen(pola1);i++)
if(pola1[i]>='0'&&pola1[i]<='9')
{
ch[0]=pola1[i];
ch[1]=pola1[i+1];
if(pola1[i+1]>='0'&&pola1[i+1]<='9')
i++;
pp1[p1++]=atoi(ch);
}
printf("Enter the generator polynomial(in the \"x7+x4+...\" form):\n ");
gets(pola2);
for(i=0,p2=0;i<strlen(pola2);i++)
if(pola2[i]>='0'&&pola2[i]<='9')
{
ch[0]=pola2[i];
ch[1]=pola2[i+1];
if(pola2[i+1]>='0'&&pola2[i+1]<='9')
i++;
pp2[p2++]=atoi(ch);
}
if((pp1[0]+pp2[0])<=crc)
{
ad=pp1[0];
j=0;
for(i=ad;i>=0;i--)
{
if(i==pp1[j]&&j<p1)
{
mp[ad-i]=1;

12

j++;
}
else
mp[ad-i]=0;
}
for(j=ad+1;j<=(ad+pp2[0]);j++)
mp[j]=0;
ad=pp2[0];
k=0;
for(i=ad;i>=0;i--)
{
if(i==pp2[k]&&k<p2)
{
gp[ad-i]=1;
k++;
}
else
gp[ad-i]=0;
}
printf("the message bit string is:\n ");
for(i=0;i<j;i++)
printf("%d",mp[i]);
printf("\nthe generator bit string is:\n ");
for(i=0;i<=ad;i++)
printf("%d",gp[i]);
printf("\n\nThe message to be transmitted is:\n ");
for(i=0;i<=ad;i++)
rm[i]=mp[i];
k=0;
while(1)
{
if(rm[0]==1&&k<=(j-(ad+1)))
{
for(i=0;i<=ad;i++)
{
if(rm[i]==gp[i])
rm[i]=0;
else
rm[i]=1;
}
if(rm[0]==0&&k<(j-(ad+1)))

13

do
{
for(p1=0;p1<ad;p1++)
rm[p1]=rm[p1+1];
rm[p1]=mp[i+k];
k++;
}while(rm[0]==0&&k<(j-(ad+1)));
}
else
{
k=j-ad;
for(i=1;i<=ad;i++)
mp[k++]=rm[i];
for(i=0;i<j;i++)
printf("%d",mp[i]);
printf("\nthe CHECK SUM is:\n ");
for(i=1;i<=ad;i++)
printf("%d",rm[i]);
break;
}
}
}
else
printf("INVALID GENERATOR POLONOMIAL........");
getch();
}

14

Output 1:
Enter the message polynomial(in x7+x4+ form):
X0
Enter the message polynomial(in x7+x4+ form):
X12+x10+x2
The message bit string is:
1
The message bit string before adding checksum is:
1000000000000
The generator bit string is:
1010000000100
The message to be transmitted is:
1010000000100
The CHECK SUM is:
010000000100

Output 2:
Enter the message polynomial(in x7+x4+ form):
X10+X8+X6+X5+X3+X1
Enter the message polynomial(in x7+x4+ form):
X2+X0
The message bit string is:
10101101010
The message bit string before adding checksum is:
1010110101000
The generator bit string is:
101
The message to be transmitted is:
1010110101011
The CHECK SUM is:
11

15

3) PROBLEM SPECIFICATION:
Program to implement Dijkastra Shortest path routing algorithm.

ALGORITHM:
Step1: Enter the number of nodes of the subnet and the node names.
Step2: Enter the cost between each and every node in the subnet.
Step3: Enter the source node and destination node for the subnet.
Step4:Calculate the shortest distance from source node to every other
nodes.
Step5: Print the shortest distance from source node to destination.
Step6: Print the path from source to destination.

16

PROGRAM:
#include<stdio.h>
#include<conio.h>
void main()
{
intar[20][20],n,i,j,k,s,c,spd[10];
charst[20],spn[10];
charspath[10];
clrscr();
printf("Enter the number of nodes:\n");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("Enter node %d name:\n",i);
scanf("%s",&st[i]);
}
for(i=0;i<n;i++)
{
for(j=i;j<n;j++)
{
if(i==j)
{
ar[i][j]=0;
}
else
{
printf("Enter cost between %c and %c:\n",st[i],st[j]);
scanf("%d",&ar[i][j]);
ar[j][i]=ar[i][j];
}
}
}
printf("\n Enter starting and Ending nodes:");
scanf("%d %d",&s,&c);
for(k=0;k<n;k++)
{
printf(" %c",st[k]);
}
for(i=0;i<n;i++)

17

{
printf(" ");
printf("\n%c",st[i]);
for(j=0;j<n;j++)
{
printf(" ");
printf("%d",ar[i][j]);
}
}
for(i=0;i<n;i++)
spd[i]=0;
i=0;
while(i!=n)
{
for(j=0;j<n;j++)
{
if(ar[i][j]!=0&&(spd[j]>ar[i][j]+spd[i]||spd[j]==0))
{
spd[j]=spd[i]+ar[i][j];
spn[j]=st[i];
}
}
i++;
}
printf("\nThe shortest distance is %d",spd[c]);
spath[0]=st[c];
for(i=c,j=1;spn[i]!=st[0];)
{
spath[j]=spn[i];
for(k=0;k<n;k++)
if(spn[i]==st[k])
break;
i=k;
j++;
}
printf("\n Shortest path is %c",st[0]);
for(i=j-1;i>=0;i--)
{
printf("%c",spath[i]);
}
getch();
}

18

OUTPUT:
Enter the number of nodes:
6
Enter node 0 name:
a
Enter node 1 name:
b
Enter node 2 name:
c
Enter node 3 name:
d
Enter node 4 name:
e
Enter node 5 name:
f
Enter cost between a and b:
5
Enter cost between a and c:
7
Enter cost between a and d:
1
Enter cost between a and e:
3
Enter cost between a and f:
2
Enter cost between b and c:
8
Enter cost between b and d:
4
Enter cost between b and e:
6
Enter cost between b and f:
9
Enter cost between c and d:
1
Enter cost between c and e:
5
Enter cost between c and f:
8
Enter cost between d and e:
3
Enter cost between d and f:
2
Enter cost between e and f:
1

19

Enter starting and Ending nodes:b f


a b c d e f
a 0 5 7 1 3 2
b 5 0 8 4 6 9
c 7 8 0 1 5 8
d 1 4 1 0 3 2
e 3 6 5 3 0 1
f 2 9 8 2 1 0
The shortest distance is 25700
Shortest path is add

20

4) PROBLEM SPECIFICATION:
Program to implement Data Encryption Standard.
ALGORITHM:
Step 1: START
Step 2: Enter the 8 bit plain text and 10 bit key.
Step 3: The given key is divided into two halves one left and the other right
and the halves are applied to the left shift.
Step 4: The given plain text is also divided into two halves and right half is
applied to Expansion table.
Step 5: The plain text is then xor with the key.
Step 6: Now the value is applied to the substitution boxes.
Step 7: Now the permutation is applied.
Step 8: The obtained value is xor with the left half of plain text and this
becomes the Right half for the next DES and the right half becomes left half
for next DES.
Step 9: Now the cipher text is taken and the plain text is
generated. By the process which is exactly opposite to
the process of Encryption
Step10: STOP

21

PROGRAM:
#include<stdio.h>
#include<conio.h>
#include<math.h>
static char a[10],pp[10],z[10],k[10],ak[10],rp[10],
static char bk[10],k1[10],k2[10],ap[10],bp[10];
static char k1[10],b[10],rk[10],x[10],ax[10],c[10],s[10],tem[10],p10[10];
char i,j,s0[4][4],s1[4][4],kk[10],rr[10],bp1[10];
int y1,y2;
xor(char d,char d1)
{
if(d==d1)
return('0');
else
return('1');
}
lr(char x[],int x1)
{
for(i=0;i<5;i++)
z[i]=x[i];
for(i=0;i<4;i++)
x[i]=z[i+1];
x[i]=z[0];
x1--;
if(x1!=0)
lr(x,x1);
}
key()
{
a[0]=bk[0];
a[1]=ak[2];
a[2]=bk[1];
a[3]=ak[3];
a[4]=bk[2];
a[5]=ak[4];
a[6]=bk[4];
a[7]=bk[3];
}

22

ep()
{
b[0]=bp[3];
b[1]=bp[0];
b[2]=bp[1];
b[3]=bp[2];
b[4]=bp[1];
b[5]=bp[2];
b[6]=bp[3];
b[7]=bp[0];
}
ss(char e,char f)
{
if((e=='0')&&(f=='0'))
return(0);
if((e=='0')&&(f=='1'))
return(1);
if((e=='1')&&(f=='0'))
return(2);
if((e=='1')&&(f=='1'))
return(3);
}
s1s(char m)
{
if(m=='0')
{
kk[0]='0';kk[1]='0';
}
if(m=='1')
{
kk[0]='0';kk[1]='1';
}
if(m=='2')
{
kk[0]='1';kk[1]='0';
}
if(m=='3')
{
kk[0]='1';kk[1]='1';
}
}

23

p1(char x[])
{
ax[0]=x[1];
ax[1]=x[3];
ax[2]=x[2];
ax[3]=x[0];
}
sos()
{
rk[0]=k[2];
rk[1]=k[4];
rk[2]=k[1];
rk[3]=k[6];
rk[4]=k[3];
rk[5]=k[9];
rk[6]=k[0];
rk[7]=k[8];
rk[8]=k[7];
rk[9]=k[5];
printf("\n rearranged key:");
for(i=0;i<5;i++)
{
ak[i]=rk[i];
printf("%3c",rk[i]);
}
for(i=5,j=0;i<10;i++,j++)
{
bk[j]=rk[i];
printf("%3c",rk[i]);
}
lr(ak,1);
lr(bk,1);
printf("\n key1;");
key();
for(i=0;i<8;i++)
{
k1[i]=a[i];
printf("%3c",a[i]);
}

24

lr(ak,2);
lr(bk,2);
key();
printf("\n key2:");
for(i=0;i<8;i++)
{
k2[i]=a[i];
printf("%3c",a[i]);
}
}
prg(char p[])
{
rp[0]=p[1];
rp[1]=p[5];
rp[2]=p[2];
rp[3]=p[0];
rp[4]=p[3];
rp[5]=p[7];
rp[6]=p[4];
rp[7]=p[6];
printf("\n rearranged plain text:");
for(i=0;i<8;i++)
printf("%3c",rp[i]);
for(i=0;i<4;i++)
ap[i]=rp[i];
for(i=4,j=0;i<8;i++,j++)
bp[j]=rp[i];
ep();
printf("\n e/p:");
for(i=0;i<8;i++)
{
bp[i]=b[i];
printf("%3c",bp[i]);
}
printf("\n xor;");
for(i=0;i<8;i++)
{
c[i]=xor(bp[i],k1[i]);
printf("%3c",c[i]);
}

25

[0][0]='1';
s0[0][1]='0';
s0[0][2]='3';
s0[0][3]='2';
s0[1][0]='3';
[1][1]='2';
s0[1][2]='1';
[1][3]='0';
s0[2][0]='0';
s0[2][1]='2';
s0[2][2]='1';
s0[2][3]='3';
s0[3][0]='3';
s0[3][1]='1';
s0[3][2]='3';
s0[3][3]='2';
s1[0][0]='0';
s1[0][1]='1';
s1[0][2]='2';
s1[0][3]='3';
s1[1][0]='2';
s1[1][1]='0';
s1[1][2]='1';
s1[1][3]='3';
s1[2][0]='3';
s1[2][1]='0';
s1[2][2]='1';
s1[2][3]='0';
s1[3][0]='2';
s1[3][1]='1';
s1[3][2]='0';
s1[3][3]='3';
y1=ss(c[0],c[3]);
=ss(c[1],c[2]);
s1s(s0[y1][y2]);
for(i=0;i<2;i++)
s[i]=kk[i];
y1=ss(c[4],c[7]);
y2=ss(c[5],c[6]);
s1s(s1[y1][y2]);
for(i=0,j=2;i<2;i++,j++)
s[j]=kk[i];

26

p1(s);
printf("\n p4:");
for(i=0;i<4;i++)
{
s[i]=ax[i];
printf("%3c",s[i]);
}
for(j=0;j<4;j++)
{
rp[j]=xor(s[j],ap[j]);
}
for(i=0;i<4;i++)
{
bp[i]=rp[i];
bp1[i]=rp[i];
}
for(i=4,j=0;i<8;i++,j++)
ap[j]=rp[i];
ep();
printf("\n e/p:");
for(i=0;i<8;i++)
{
bp[i]=b[i];
printf("%3c",bp[i]);
}
printf("\n xor:");
for(i=0;i<8;i++)
{
c[i]=xor(bp[i],k2[i]);
printf("%3c",c[i]);
}
y1=ss(c[0],c[3]);
y2=ss(c[1],c[2]);
s1s(s0[y1][y2]);
for(i=0;i<2;i++)
s[i]=kk[i];
y1=ss(c[4],c[7]);
y2=ss(c[5],c[6]);
(s1[y1][y2]);
for(i=0,j=2;i<2;i++,j++)
s[j]=kk[i];
p1(s);

27

printf("\n p4:");
for(i=0;i<4;i++)
{
s[i]=ax[i];
printf("%3c",s[i]);
}
printf("\n IP inverse;");
for(i=0;i<4;i++)
{
rp[i]=xor(s[i],ap[i]);
printf("%3c",rp[i]);
}
for(j=0,i=4;i<8;j++,i++)
{
rp[i]=bp1[j];
printf("%3c",rp[i]);
}
rr[0]=rp[3];
rr[1]=rp[0];
rr[2]=rp[2];
rr[3]=rp[4];
rr[4]=rp[6];
rr[5]=rp[1];
rr[6]=rp[7];
rr[7]=rp[5];
printf("\n cipher text:");
for(i=0;i<8;i++)
printf("%3c",rr[i]);
for(i=0;i<8;i++)
{
tem[i]=k1[i];
k1[i]=k2[i];
k2[i]=tem[i];
}
}
main()
{
intch,na;
clrscr();
do

28

{
printf("\nenterur choice:");
printf("1-->encryption 2-->decryption 3-->exit:");
scanf("%d",&ch);
switch(ch)
{
case 1: printf("enter 8 bit plain text:");
scanf("%s",&p10);
printf("enter 10 bit key:");
scanf("%s",&k);
na='2';
sos();
prg(p10);
break;
case 2: if(na!='2')
printf("\n decryption is not possible without
encryption");
else
prg(rr);
break;
case 3: exit();
}
}
while(ch<3);
getch();
}

29

OUTPUT 1:
Enter ur choice:
1encryption 2decryption 3exit:1
Enter 8 bit plain text: 11100010
Enter the 10 bit key: 0011001010
Rearranged key: 1 0 0 1 1 0 0 1 0 0
Key 1:0 1 1 10 1 10 0
Key 2:0 1 0 0 0 0 1 0
Rearranged plain text:1 0 1 1 0 0 0 1
e/p : 1 0 0 0 0 0 1 0
xor: 1 1 1 1 0 1 1 0
p4: 0 1 1 1
e/p:0 1 1 0 1 0 0 1
xor: 0 0 1 0 1 0 1 1
p4: 0 1 0 0
IP inverse: 0 1 0 1 1 1 0 0
Cipher text: 1 0 0 1 0 1 0 1
OUTPUT 2:
Enter ur choice:
1encryption 2decryption 3exit:1
Enter 8 bit plain text: 10101010
Enter the 10 bit key: 0101010101
Rearranged key: 0 0 1 0 1 1 0 0 1 1
Key 1:0 0 0 1 1 0 1 1
Key 2:0 1 0 1 1 0 0
Rearranged plain text:0 0 1 1 0 0
e/p : 1 0 0 1 0 1 1 0
xor: 1 0 0 0 1 1 0 1
p4: 0 0 0 0
e/p:1 0 0 1 0 1 1 0
xor: 0 0 1 1 1 0 1 0
p4: 0 0 0 1
IP inverse: 0 0 1 0 0 0 1 1
Cipher text: 0 0 1 0 1 0 1 0

30

INFORMATIONSECURITY ( JNTU )
S.N
o
1
2

Name of the program


Working with Sniffers for monitoring network
communication (Ethereal).
Using NMAP for ports monitoring.

31

AIM: Working with Sniffers for monitoring network communication


(Ethereal).
Algorithm:
Step1:Start
Step2:Declare the following functions
void Handle_ICMP(char *,int)
void Handle_IGMP(char *,int)
void Handle_TCP(char *,int)
void Handle_UDP(char *,int)
Step3:declaring pointer of type ip header
void Handle_IP(char *buf)
Step4:declaring a structure which holds ip address
struct iphdr *ip_hdr
struct in_addr in
FILE *fp
Step5:Read ctl,len
Step6:ip_hdr=(struct iphdr * )(buf+14)
Step7:fp=fopen("./output/ip.txt","a")
Step8:if(!fp)
perror("fopen")
exit(1)
Step9:output(fp,"\t -------------------------------\n")
Step10:system("date>> ./output/ip.txt")
output(fp,"type of service : %d\n",ip_hdr->tos)
output(fp,"protocol id is %d\n",ip_hdr->protocol)
output(fp,"total len %d\n",ntohs(ip_hdr->tot_len))
output(fp,"fragment offset %d\n",ntohs(ip_hdr->frag_off))
Step11: storing ip address in
Step12: struct in_addr so that we can use inet_ntoa to convert
the same into ascii string
in.s_addr=ip_hdr->saddr
fprintf(fp,"source address is %s\n",inet_ntoa(in))
Step13:
in.s_addr=ip_hdr->daddr
Step14:
output(fp,"destination address is %s\n",inet_ntoa(in))
output(fp,"\t --------------------------------\n")

32

Step15:

ctl=ip_hdr->protocol

Step16:

The following statement is used to calculate the combined


length of data link header and ip header
len=(ip_hdr->ihl<<2)+14

Step17:

The following switch statement can be used to invoke


appropriate handle function based on protocol id found
in ip header
switch(ctl)
case ICMP
Handle_ICMP(buf,len);
break
case IGMP:
Handle_IGMP(buf,len);
break
case TCP
Handle_TCP(buf,len);
break
case UDP
Handle_UDP(buf,len);
break
fclose(fp)
This file is a part of sniffer, a packet capture utility and
Network monitor.
void Handle_IP(char *)
void Handle_ARP(char *)
void Handle_RARP(char *)
declaring a structure which hold link level header information
int main()
struct sockaddr_ll sa
pointer for ethernet header
struct ethhdr *eth_hdr
int sockfd,sl,retval,ctl
char buf[2000],*hadd
FILE *fp;
The following system call creates raw socket which captures
all protocols
sockfd=socket(PF_PACKET,SOCK_RAW,htons(ETH_P_ALL));

Step18:

Step19:

Step20:

Step21:

33

Step22:

Step23:
Step24:

Step25:

if(sockfd<0)
perror("socket")
fp=fopen("./output/ether.txt","a")
if(!fp)
perror("fopen")
setvbuf(fp,NULL,_IONBF,0)
The following infinite while loop is used to continuously
capture packets and afterwards the packet will be passed
to appropriate handler
while(1)
sl=sizeof(struct sockaddr_ll);
retval=recvfrom(sockfd,buf,2000,0,(struct sockaddr *)&sa,&sl)
if(retval==-1)
perror("recvfrom")
eth_hdr=(struct ethhdr *) buf
output(fp,"\t ----------------------------\n")
system("date>>./output/ether.txt")
hadd=ether_ntoa((struct ether_addr *)eth_hdr->h_source)
fprintf(fp,"source ethernet address is %s\n",hadd)
hadd=ether_ntoa((struct ether_addr *)eth_hdr->h_dest)
fprintf(fp,"destination ethernet address is %s\n",hadd)
fprintf(fp,"packet protocol id is %x\n",ntohs(eth_hdr->h_proto))
fprintf(fp,"\t ----------------------------\n")
ctl=ntohs(eth_hdr->h_proto)
switch(ctl)
case 0x0800:
print("received IP packet\n")
Handle_IP(buf)
break
case 0x0806
print("received ARP packet\n")
Handle_ARP(buf)
break
case 0x8035
print("received RARP packet\n")
Handle_RARP(buf)
break
fclose(fp)

34

Step26:

Step27:

Step28:

Step29:

Step30:

This file is a part of sniffer, a packet capture utility and


Network Monitor
void Handle_ARP(char *buf)
declared pointer of type arp header
struct ether_arp *arp_hdr
struct in_addr in
char *hadd
FILE *fp
In the following statement we're adjusting the offset so
arp header pointer points to currect location
arp_hdr=(struct ether_arp *) (buf+14)
fp=fopen("./output/arp.txt","a")
if(!fp)
perror("fopen")
print(fp,"\t --------------------------------\n")
system("date>> ./output/arp.txt")
print(fp,"hardware type : %u\n",ntohs(arp_hdr->ea_hdr.ar_hrd))
print(fp,"protocol type : %u\n",ntohs(arp_hdr->ea_hdr.ar_pro))
printf(fp,"hardware length : %d\n",arp_hdr->ea_hdr.ar_hln)
print(fp,"protocol length : %d\n",arp_hdr->ea_hdr.ar_pln)
print(fp,"operation code : %u\n",ntohs(arp_hdr->ea_hdr.ar_op))
hadd=ether_ntoa((struct ether_addr *)arp_hdr->arp_sha)
print(fp,"sender hardware address : %s\n",hadd)
bcopy(arp_hdr->arp_spa,&in.s_addr,4)
print(fp,"sender protocol address : %s\n",inet_ntoa(in))
bcopy(arp_hdr->arp_tpa,&in.s_addr,4)
print(fp,"target protocol address : %s\n",inet_ntoa(in))
print(fp,"\t ---------------------------------\n")
fclose(fp)
This file is a part of sniffer, a packet capture utility and
Network Monitor
void Handle_RARP(char *buf)
declaring a pointer of type arp header
struct ether_arp *rarp_hdr
struct in_addr in
char *hadd
FILE *fp

35

Step31:

The following statement can be used to adjust offset so that


arp header points to currect location
rarp_hdr=(struct ether_arp *) (buf+14)
fp=fopen("./output/rarp.txt","a")
if(!fp)
perror("fopen")
print(fp,"\t -----------------------------------\n")
system("date>> ./output/rarp.txt")
print(fp,"hardware type : %u\n",ntohs(rarp_hdr->ea_hdr.ar_hrd))
print(fp,"protocol type : %u\n",ntohs(rarp_hdr->ea_hdr.ar_pro))
print(fp,"hardware length : %d\n",rarp_hdr->ea_hdr.ar_hln)
print(fp,"protocol length : %d\n",rarp_hdr->ea_hdr.ar_pln)
print(fp,"operation code : %u\n",ntohs(rarp_hdr->ea_hdr.ar_op))
hadd=ether_ntoa((struct ether_addr *)rarp_hdr->arp_sha)
print(fp,"sender hardware address : %s\n",hadd)
bcopy(rarp_hdr->arp_spa,&in.s_addr,4)
print(fp,"sender protocol address : %s\n",inet_ntoa(in))
hadd=ether_ntoa((struct ether_addr *)rarp_hdr->arp_tha)
print(fp,"target harware address : %s\n",hadd)
print(fp,"\t ------------------------------------\n")
fclose(fp)

Step32:

This file is a part of a sniffer, a packet capture utility


and Network monitor

Step33:
Step34:

Step35:

void Handle_ICMP(char *,int)


void Handle_IGMP(char *,int)
void Handle_TCP(char *,int)
void Handle_UDP(char *,int)
void Handle_IP(char *buf)
declaring pointer of type ip header
struct iphdr *ip_hdr
declaring a structure which holds ip address
struct in_addr in
FILE *fp
int ctl,len
In the following statement we're adjusting the offset so that
ip pointer can point to currect location

36

fp=fopen("./output/ip.txt","a")
if(!fp)
perror("fopen")
print(fp,"\t -------------------------------\n")
system("date>> ./output/ip.txt")
print(fp,"type of service : %d\n",ip_hdr->tos)
print(fp,"protocol id is %d\n",ip_hdr->protocol)
print(fp,"total len %d\n",ntohs(ip_hdr->tot_len))
print(fp,"fragment offset %d\n",ntohs(ip_hdr->frag_off))
Step36:

In the following statement we're storing ip address in


struct in_addr so that we can use inet_ntoa to convert
the same into ascii string
in.s_addr=ip_hdr->saddr
print(fp,"source address is %s\n",inet_ntoa(in))
in.s_addr=ip_hdr->daddr
print(fp,"destination address is %s\n",inet_ntoa(in))
print(fp,"\t --------------------------------\n")
ctl=ip_hdr->protocol

Step37:

The following statement is used to calculate the combined


length of data link header and ip header
len=(ip_hdr->ihl<<2)+14

Step38:

The following switch statement can be used to invoke


appropriate handle function based on protocol id found
in ip header
switch(ctl)
case ICMP:
Handle_ICMP(buf,len);
break;
case IGMP:
Handle_IGMP(buf,len);
break;
case TCP:
Handle_TCP(buf,len);
break;

37

case UDP:

Step39:

Step40:

Step41:

Step 42:

Handle_UDP(buf,len);
break;
This file is part of sniffer, a packet capturing utility and
Network Monitor
void Handle_ICMP(char *buf,int len)
declaring pointer of type icmp header
struct icmphdr *icmp_hdr
FILE *fp
fp=fopen("./output/icmp.txt","a")
if(!fp)
perror("icmp.fopen")
The following header is used to adjust offset so that icmp header
can point to currect location
icmp_hdr=(struct icmphdr *) (buf+len);
print(fp,"\t --------------------------------\n")
system("date>> ./output/icmp.txt")
print(fp,"message type : %d\n",icmp_hdr->type)
print(fp,"sub-code : %d\n",icmp_hdr->code)
print(fp,"\t --------------------------------\n")
void Handle_IGMP(char *buf,int len)
declaring pointer of type igmp header
struct igmp *igmp_hdr
declaring a structure to store ip address
struct in_addr in
FILE *fp
igmp_hdr=(struct igmp *) (buf+len)
fp=fopen("./output/igmp.txt","a")
if(!fp)
perror("igmp.fopen")
print(fp,"\t ---------------------------------\n")
system("date>> ./output/igmp.txt")
print(fp,"igmp type : %d\n",igmp_hdr->igmp_type)

Step43:

Storing ip address in struct in_addr so that we can


execute inet_ntoa() to retreive the same in string
format
in.s_addr=igmp_hdr->igmp_group.s_addr;
print(fp,"igmp group : %s\n",inet_ntoa(in)
print(fp,"\t ---------------------------------\n")

38

Step44:

Step45:

void Handle_TCP(char *buf,int len)


struct tcphdr *tcp_hdr; // declaring a pointer of type tcp header
FILE *fp
fp=fopen("./output/tcp.txt","a")
if(!fp)
perror("tcp.fopen")
The following statement is used to adjust the offset so that
tcp header pointer can point to currect location
tcp_hdr=(struct tcphdr *) (buf+len)
print(fp,"\t ----------------------------------\n")
system("date>> ./output/tcp.txt")
print(fp,"source port no : %u\n",ntohs(tcp_hdr->source))
print(fp,"destination port no : %u\n",ntohs(tcp_hdr->dest))
print(fp,"seq number : %lu\n",ntohl(tcp_hdr->seq))
print(fp,"ack number : %lu\n",ntohl(tcp_hdr->ack_seq))
print(fp,"window size : %u\n",ntohs(tcp_hdr->window))
print(fp,"\t ----------------------------------\n")

Step 46:

Step47:

Step48:

declaring a pointer of type udp header


void Handle_UDP(char *buf,int len)
struct udphdr *udp_hdr
FILE *fp
fp=fopen("./output/udp.txt","a")
if(!fp)
perror("udp.fopen")
The following statement is used to adjust the offset so that
udp header can point to currect location
udp_hdr=(struct udphdr*) (buf+len)
print(fp,"\t ----------------------------------\n")
system("date>>./output/udp.txt")
print(fp,"source port no : %u\n",ntohs(udp_hdr->source))
print(fp,"destination port no : %u\n",ntohs(udp_hdr->dest))
print(fp,"header length : %u\n",ntohs(udp_hdr->len))
print(fp,"\t ----------------------------------\n")
Stop

39

RESULT:

Fri Jul 16 20:03:51 IST 2004


-------------------------------hardware type : 1
protocol type : 2048
hardware length : 6
protocol length : 4
operation code : 1
sender hardware address : 0:2:44:10:f6:41
sender protocol address : 192.168.100.5
target protocol address : 192.168.100.254
--------------------------------Fri Jul 16 20:03:52 IST 2004
-------------------------------hardware type : 1
protocol type : 2048
hardware length : 6
protocol length : 4
operation code : 1
sender hardware address : 0:2:44:10:f6:41
sender protocol address : 192.168.100.5
target protocol address : 192.168.100.254
--------------------------------Fri Jul 16 20:03:53 IST 2004
-------------------------------hardware type : 1
protocol type : 2048
hardware length : 6
protocol length : 4
operation code : 1
sender hardware address : 0:2:44:10:f6:41
sender protocol address : 192.168.100.5
target protocol address : 192.168.100.254
--------------------------------Fri Jul 16 20:03:55 IST 2004
--------------------------------

40

hardware type : 1
protocol type : 2048
hardware length : 6
protocol length : 4
operation code : 1
sender hardware address : 0:2:44:10:f6:41
sender protocol address : 192.168.100.5
target protocol address : 192.168.100.254
--------------------------------Fri Jul 16 20:03:56 IST 2004
-------------------------------hardware type : 1
protocol type : 2048
hardware length : 6
protocol length : 4
operation code : 1
sender hardware address : 0:2:44:10:f6:41
sender protocol address : 192.168.100.5
target protocol address : 192.168.100.254
--------------------------------Fri Jul 16 20:03:57 IST 2004
-------------------------------hardware type : 1
protocol type : 2048
hardware length : 6
protocol length : 4
operation code : 1
sender hardware address : 0:2:44:10:f6:41
sender protocol address : 192.168.100.5
target protocol address : 192.168.100.254
--------------------------------Fri Jul 16 20:03:59 IST 2004
-------------------------------hardware type : 1
protocol type : 2048
hardware length : 6
protocol length : 4
operation code : 1
sender hardware address : 0:2:44:10:f6:41
sender protocol address : 192.168.100.5
target protocol address : 192.168.100.254

41

-------------------------------Fri Jul 16 20:04:00 IST 2004


-------------------------------hardware type : 1
protocol type : 2048
hardware length : 6
protocol length : 4
operation code : 1
sender hardware address : 0:2:44:10:f6:41
sender protocol address : 192.168.100.5
target protocol address : 192.168.100.254
--------------------------------Fri Jul 16 20:04:01 IST 2004
-------------------------------hardware type : 1
protocol type : 2048
hardware length : 6
protocol length : 4
operation code : 1
sender hardware address : 0:2:44:10:f6:41
sender protocol address : 192.168.100.5
target protocol address : 192.168.100.254
--------------------------------Fri Jul 16 20:04:03 IST 2004
-------------------------------hardware type : 1
protocol type : 2048
hardware length : 6
protocol length : 4
operation code : 1
sender hardware address : 0:2:44:10:f6:41
sender protocol address : 192.168.100.5
target protocol address : 192.168.100.254
--------------------------------Fri Jul 16 20:04:04 IST 2004
-------------------------------hardware type : 1
protocol type : 2048
hardware length : 6
protocol length : 4
operation code : 1

42

sender hardware address : 0:2:44:10:f6:41


sender protocol address : 192.168.100.5
target protocol address : 192.168.100.254
--------------------------------Fri Jul 16 20:04:05 IST 2004
-------------------------------hardware type : 1
protocol type : 2048
hardware length : 6
protocol length : 4
operation code : 1
sender hardware address : 0:2:44:10:f6:41
sender protocol address : 192.168.100.5
target protocol address : 192.168.100.254
--------------------------------Fri Jul 16 20:04:07 IST 2004
-------------------------------hardware type : 1
protocol type : 2048
hardware length : 6
protocol length : 4
operation code : 1
sender hardware address : 0:2:44:10:f6:41
sender protocol address : 192.168.100.5
target protocol address : 192.168.100.254
--------------------------------Fri Jul 16 20:04:08 IST 2004
-------------------------------hardware type : 1
protocol type : 2048
hardware length : 6
protocol length : 4
operation code : 1
sender hardware address : 0:2:44:10:f6:41
sender protocol address : 192.168.100.5
target protocol address : 192.168.100.254
--------------------------------Fri Jul 16 20:04:22 IST 2004
-------------------------------hardware type : 1
protocol type : 2048
hardware length : 6

43

protocol length : 4
operation code : 1
sender hardware address : 0:50:bf:d8:48:a1
sender protocol address : 192.168.100.2
target protocol address : 192.168.100.1
--------------------------------Fri Jul 16 20:04:22 IST 2004
-------------------------------hardware type : 1
protocol type : 2048
hardware length : 6
protocol length : 4
operation code : 2
sender hardware address : 0:2:44:10:f6:47
sender protocol address : 192.168.100.1
target protocol address : 192.168.100.2

44

AIM: Using NMAP for ports monitoring.


ALGORITHM
Nmap features include:
Ping Sweeping- Identifying computers on a network, for example listing the
computers which respond to pings, or which have a particular port open
Port Scanning - Enumerating the open ports on one or more target computers
OS Detection - Remotely determining the operating system and some hardware
characteristics of network devices.
Nmap command line prompt:
C:\nmap> nmap -sP 192.168.0.10
Well-Known Ports:
Ports numbered 0 to 1023 are considered well known (also called standard ports)
and are assigned to services by the IANA (Internet Assigned Numbers Authority).
Here are a few samples:
21 FTP
80 HTTP
110 POP
Table:Scans available through nmap:
Scan Type

Switch

Description

TCP connect() scan

-sT

The most basic form of scanning. This


opens a connection to every
potentially interesting port on the
target machine.

TCP SYN scan

-sS

The "half-open" scan. This scan sends


a TCP SYN packet as though it is
trying to open the connection. If it
receives a SYN-ACK response, it
sends an immediate RST to shut down

45

Scan Type

Switch

Description
the connection. Because this scan
doesn't open the connection, it is less
likely to be logged.

Stealth FIN

-sF

This scan attempts to pass through


packet filters by sending a TCP FIN
packet.

Xmas Tree

-sX

This scan attempts to pass through


packet filters by
sending a
packet with FIN, URG, and PUSH
flags set.

Null

-sN

This scan attempts to pass through


packet filters by sending a packet
without any flags turned on.

Ping

-sP

This limits the scan to only conducting


a ping sweep to look for connected
systems. It does not do port scans.

UDP scan

-sU

This sends 0 byte UDP packets to each


port on the target machine(s).

ACK scan

-sA

This scan is used to help check packet


filters. An ACK packet with random
acknowledgment
and
sequence
numbers is sent. If nothing is returned,
the port is marked as filtered.

List scan

-sL

Simply lists targets to scan.

FTP bounce scan

-b <ftp relay host> This scan relives a historical foible of


FTP servers. Older FTP servers were
able to serve bounced FTP sessions;
that is, they connected to another host
to deliver data to you. By providing a
relay
host
in
the
format
username:password@server:port, you

46

Scan Type

Switch

Description
can use this FTP bounce (mis)feature
to scan ports that might otherwise be
protected.

Nmap command line prompt:


C:\nmap> nmap -sT 192.168.0.10
Pros:
Fast
Easy to implement
Accurate
Cons:
Easily detected
Traceable
Nmap command line prompt:
C:\nmap> nmap -sS 192.168.0.10
Pros:
Fast
Accurate
Fairly easy to implement
Harder to trace than the TCP connect port-scan method

Cons:
Not totally stealthy
Easily blocked

47

Nmap command line prompt:


C:\nmap> nmap -sF 192.168.0.7
Pros:
Fairly fast
Easy to implement
Stealthy to a certain extent

Cons:
Inaccurate with certain operating systems
Nmap command line prompt:
C:\nmap> nmap -sX 192.168.0.7
Nmap command line prompt:
C:\nmap> nmap -sN 192.168.0.7
Pros:
Fairly fast
Easy to implement
Stealthy to a certain extent
Cons:
Works only with UNIX and some other operating systems
Nmap command line prompt:
C:\nmap> nmap -sU 192.168.0.10
Nmap command line prompt:
C:\nmap> nmap -sA 68.46.234.161
Nmap command line prompt:
C:\nmap> nmap -sA 68.46.234.161

48

Option
-P0

-f

-v

-oN <logfile>
-oM <logfile>
--resume
<logfile&;
-iL <logfile>
-g
<portnumber>
-p <port
range>

Explanation
Tells nmap not to ping hosts before
scanning. (This is used to scan hosts that
sit behind packet filters that don't allow
ICMP traffic.)
Causes nmap to fragment its scanning
packets, making it more difficult to
block the scan with packet filters.
Puts nmap into verbose mode, causing it
to display much more information about
what it's doing.
Writes output into a human readable
logfile.
Writes output into a machine-parsable
logfile.
Resumes an incomplete scan from a
logfile.
Causes nmap to read input from a logfile
instead of really scanning a host.
Allows you to define the port nmap uses
as its source port.
Allows you to define the range of ports
nmap will scan. If no range is given,
nmap will scan all the ports listed in its
own services file. A range of ports can
be given in the following format: -p 2030,79,6000-6010.

Test Data:
Valid Data Set:

IP address

Invalid Data Set:

Invalid IP address

Limiting Data Set:

Not applicable

Result:
Nmap command line prompt:
C:\nmap> nmap -O www.hackingmobilephones.com
Nmap command line prompt for TCP SYN Scan:

49

Ex: c:\nmap> nmap -sS www.hackingmobilephones.com


Interesting ports on corp2.net4india.com (202.71.129.91):
Not shown: 1673 filtered ports
PORT

STATE SERVICE

7/tcp closed echo


13/tcp closed daytime
21/tcp open ftp
25/tcp open smtp
53/tcp closed domain
80/tcp open http

110/tcp closed pop3


113/tcp closed auth
123/tcp closed ntp
143/tcp closed imap
366/tcp closed odmr
433/tcp closed nnsp
443/tcp closed https
610/tcp closed npmp-local
626/tcp closed unknown
631/tcp closed ipp
1433/tcp closed ms-sql-s
1434/tcp closed ms-sql-m
3306/tcp open mysql
5900/tcp closed vnc
6000/tcp closed X11

50

6001/tcp closed X11:1


6002/tcp closed X11:2
7938/tcp closed lgtomapper
# Nmap run completed at Sat Nov 24 11:21:58 2007 -- 1 IP address (1 host up)
scanned in 242.562 seconds
Nmap command line prompt for OS Detection
C:\nmap> nmap -O www.hackingmobilephones.com
Ex: c:\nmap> nmap -oN op.txt -O www.hackingmobilephones.com
Interesting ports on corp2.net4india.com (202.71.129.91):
Not shown: 1673 filtered ports
PORT

STATE SERVICE

7/tcp closed echo


13/tcp closed daytime
20/tcp closed ftp-data
21/tcp open ftp
25/tcp open smtp
53/tcp closed domain
80/tcp open http
110/tcp closed pop3
113/tcp closed auth
123/tcp closed ntp
199/tcp closed smux
366/tcp closed odmr
433/tcp closed nnsp
443/tcp closed https
626/tcp closed unknown

51

631/tcp closed ipp


1433/tcp closed ms-sql-s
1434/tcp closed ms-sql-m
5800/tcp closed vnc-http
5900/tcp closed vnc
6000/tcp closed X11
6001/tcp closed X11:1
6002/tcp closed X11:2
7938/tcp closed lgtomapper
Device type: general purpose
Running: OpenBSD 3.X
OS details: OpenBSD 3.6 x86 with pf "scrub in all"
Uptime: 28.341 days (since Sat Oct 27 02:20:14 2007)
OS detection performed. Please report any incorrect results at
http://insecure.org/nmap/submit/ .
# Nmap run completed at Sat Nov 24 10:31:00 2007 -- 1 IP address (1 host up)
scanned in 264.500 seconds

52

DATAWAREHOUSING AND DATAMINING LAB


1. Analyzing data in different views of relation contact-lenses
2. Write details on the table Weather. Nominal and class play classified
on outlook attribute.
3. Describe preprocessing details on the table Iris relation and visualize all
details based on class
i. class .
4. Generate Association rules for the relation Weather. Nominal on any
three attributes
5. Generate Association rules for the relation Soybean on any three
attributes

Experiment: 1
Aim: To analyze the data in contact-lenses data base and visualize it in different ways.
Description:
Step1: Click on the weka 3.6 option then it gives weka GUI chooser window as shown
below:.

53
Step2: In that window, click on explorer option then weka explorer window will be
displayed as shown below:

Step3: The contact-lenses relation has 24 instances and 5 attributes. The records in the contactlenses relation are shown below:

54

Case1: Analyzing age attribute based on the class contact-lenses


Step1: select the attribute age.
Step2: select contact-lenses as class attribute .The age details and its graph is as follows:

55
Case2: Analyze Spectacle-prescript attribute based on the class contact-lenses
Step1: select the attribute Spectacle-prescript
Step2: select contact-lenses as a class attribute. The Spectacle-prescript details and its graph
is as follows:

Case3: Analyzing Astigmation attribute based on the classcontact-lenses


Step1: select the attribute astigmation
Step2: select contact-lenses as a class attribute. The astigmationdetails and its graph is as follows

56
Case4: Analyze Tear-prod-rate attribute based on the class contact-lenses
Step1: select the attribute Tear-prod-rate
Step2: select contact-lenses as a class attribute. The Tear-prod-rate details and its
graph is as follows:

Case5: Analyze contact lences attribute based on the class contact-lenses


Step1: select the attribute Contact-lenses
Step2: select contact-lenses as a class attribute. The graph is as follows

57

Experiment-2
Aim: Write details on the table Weather. Nominal and class play classified on outlook
attribute.
Description:
Step1: Click on the weka 3.6 option then it gives weka GUI chooser window as shown
below:.

Step2: In that window, click on explorer option then weka explorer window will be
displayed as
shown
below:

www.jntuworld.com

58
8

Step3: The Weather. Nominal relation has 14 instances and 5 attributes. The records in the
Weather. Nominal relation is shown below:

Case1: Analyzing outlook attribute based on the class play


Step1: select the attribute outlook.
Step2: select play as class attribute .The outlook details and its graph is as follows:

59

Case2: Analyze Temperature attribute based on the class play


Step1: select the attribute Temperature
Step2: select play as a class attributes. The Temperature details and its graph is as follows:

Case3: AnalyzingHumidy attribute based on the classplay


Step1: select the attribute Humidy
Step2: select play as a class attributes. The Humidy details and its graph is as follows

60

Case4: Analyze windy attribute based on the class contact-lenses


Step1: select the attribute windy
Step2: select play as a class attributes. The windy details and its graph is as follows:

Case5: Analyzeplay attribute based on the classplay


Step1: select the attribute play
Step2: select play as a class attributes. The play details and its graph is as follows:

61
Experiment-3
Aim: Describe preprocessing details on the table Iris relation and visualize all details based on
class
class .
Description:
Step1: Click on the weka 3.6 option then it gives weka GUI chooser window as shown
below:

62
Step2: In that window, click on explorer option then weka explorer window will be
displayed as
shown below:

Case1: Analyzing Sepal length attribute based on the class class


Step1: select the attribute Sepal length.
Step2: select class as class attribute .The Sepal length details and its graph is as follows :

14

63
Case2: Analyze sepal width attribute based on the class class
Step1: select the attribute sepal width
Step2: select class as a class attributes. The sepal width details and its graph is as follows:

Case3: Analyzing Petal length attribute based on the classclass


Step1: select the attribute Petal length
Step2: select class as a class attributes. The Petal length details and its graph is as
follows

64

Case4: AnalyzePetal-width attribute based on the class class


Step1: select the attribute Petal-width
Step2: select class as a class attributes. The Petal-width details and its graph is as
follows:

65

Case5: Analyze class attribute based on the class class


Step1: select the attribute class
shown
below:
Step2: select class as a class attributes. The class details and its graph is as
follows:

66
Experiment-4
Aim: Generate Association rules for the relation Weather. Nominal on any three
attributes
Description:
Step1: Click on the weka 3.6 option then it gives weka GUI chooser window as shown
below:

Step2: In that window, click on explorer option then weka explorer window will be
displayed as

67
Step3: In that window, click on the open file option and select data folder and then select
the Weather. Nominal relation for the data analyzation
Step4: On that window click Associate tab. In that click choose and select apriori. The
window is display as shown below

19

68
Step5: click on the start button. Then the output is displayed as follows
output:

69
Experiment-5

o&Naidu
College of
engineering

Aim: Generate Association rules for the relation Soybean on any three
attributes
Description:
Step1: Click on the weka 3.6 option then it gives weka GUI chooser window as shown
follows:.

Step2:In that window ,click on explorer option then weka explorer window will be
displayed as shown below :

70
Step3: In that window ,click on the open file option and select data folder and then select the
Soybean relation for the data analyzation
Step4: On that window click Associate tab. In that click choose and select apriori. The window is
display as shown below

Step5: click on the start button. Then the output is displayed as follows
Output:

You might also like