NIDS Report
NIDS Report
NIDS Report
ACKNOWLEDGEMENT
INTRODUCTION
6
1.1 INTRODUCTION
SYSTEM ANALYSIS
PHASE
9
DESIGN PHASE
12
• Action
• Intrusion
• Modal
• Traffic
• Sniffing
• Detection
• Reports
13
Main modules are sub divided into small parts, called sub
modules and the details regarding these modules are as
follows.
TRAFFIC - IP Request
Port Scanning
Ping Machine
Login Form
Using this form the administrator can login to
the application.
Locking Form
Using this form the administrator can lock the
application from the unauthorized users.
17
Control redundancy.
Ease of use.
Data independence.
Accuracy and integrity.
Avoiding inordinate delays.
Recovery form failure.
Privacy and security.
Performance.
There are 6 major steps in design process. The
first 5 steps are usually done on paper and finally the design is
implemented.
Table structure:
Table number: 1
Title : Administrator Login
Table Name : Login
Description : The table stores in the login user ID and the
password for the authorization checking. It is used both during
login and locking.
Constraint : The user ID is the primary key.
Table Number: 2
Title : Intruder Registration Details
Table name : Intruder
Description : The details of already known intruders
Constraints : The intcode is the primary key, Ipaddress Not
Null.
Table number: 3
Table Number: 4
Title : The Intrusion block details
USER
NIDS DATABASE
23
Level 1
Change
password
Intcode
Add/delete
intruder Intruder
register
Modcod
Set/delete e
model Model
Detipaddr
View Intruder
reports Detection
24
REQUIREMENTS
25
ADO.NET COMPONENTS
A S P. N E T
ASP.NET is a unified Web development platform
that provides the services necessary to build enterprise-
class Web applications. While ASP.NET is largely syntax
compatible with Active Server Pages (ASP), it also
provides a new programming model and infrastructure that
allows creating a powerful new class of applications.
ASP.NET is fully supported by the .NET Framework,
allowing one to
ASP.NET ARCHITECTURE
33
SOAP
In
Serialization te
rn
Serialization
et
Proxy Invocation
DEVELOPMENT
PHASE
38
5.1 Source code
Class1
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
namespace kgptc
{
class Class1
{
SqlConnection con = new SqlConnection(@"Data
Source=.\SQLEXPRESS;AttachDbFilename=D:\jaseela\kgptc\kgptc
\login.mdf;Integrated Security=True;User Instance=True");
public int nonquery(String s)
{
int i=0;
con.Open();
try
{
}
39
catch
{
}
con.Close();
return str;
}
}
Class2
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
namespace kgptc
{
class Class2
{
public static string s1;
public static string s2;
}
}
40
Login Form
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
namespace kgptc
{
public partial class login : Form
{
public login()
{
InitializeComponent();
}
label3.Text = "";
try
{
PacketXLib.PacketXClass pkt = new
PacketXLib.PacketXClass();
pkt.Start();
pkt.Stop();
}
catch
{
MessageBox.Show("Please install Both
'WinPcap' and 'PacketX' softwares or Check your network
connection ", "Error");
System.Environment.Exit(0);
}
f.Show();
string i = "";
string j = "";
i = db1.scalar("select loginname from registry
where loginname='" + textBox1.Text + "'");
j = db1.scalar("select password from registry
where password='" + textBox2.Text + "'");
if (i != "" && j != "")
{
mainmenu f = new mainmenu();
f.Show();
42
this.Hide();
}
else
{
if (i == "" || j == "")
{
label3.Text = "";
label3.Text = " Incorrect username or
password";
label3.Enabled = true;
textBox1.Text = "";
textBox2.Text = "";
textBox1.Focus();
else
if (j == "")
{
textBox2.Text = "";
label3.Text = " Incorrect password";
label3.Enabled = true;
}
}
Class2.s1 = i;
Class2.s2 = j;
}
}
}
43
Main form
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace kgptc
{
public partial class mainmenu : Form
{
public mainmenu()
{
InitializeComponent();
}
f.ShowDialog();
}
}
44
private void
registrationIPToolStripMenuItem_Click(object sender,
EventArgs e)
{
intrder_reg f = new intrder_reg();
f.MdiParent = this;
f.Show();
private void
alterRemoveToolStripMenuItem_Click(object sender, EventArgs
e)
{
intruder_modi f = new intruder_modi();
f.MdiParent = this;
f.Show();
}
private void
registrationToolStripMenuItem_Click(object sender, EventArgs
e)
{
model_reg f = new model_reg();
f.MdiParent = this;
f.Show();
}
private void
alterRemoveToolStripMenuItem1_Click(object sender, EventArgs
e)
{
private void
portScanningToolStripMenuItem_Click(object sender, EventArgs
e)
{
portscan f = new portscan();
f.MdiParent = this;
f.Show();
}
private void
tCPSniffingToolStripMenuItem_Click(object sender, EventArgs
e)
{
tcpsniffing f = new tcpsniffing();
f.MdiParent = this;
f.Show();
private void
uDPSniffingToolStripMenuItem_Click(object sender, EventArgs
e)
{
udpsniffing f = new udpsniffing();
f.MdiParent = this;
f.Show();
}
private void
allSniffingToolStripMenuItem_Click(object sender, EventArgs
e)
{
allsniffing f = new allsniffing();
f.MdiParent = this;
f.Show();
46
private void
intruderDetailsToolStripMenuItem_Click(object sender,
EventArgs e)
{
Class1 db = new Class1();
DataTable dt = new DataTable();
dt = db.table("select * from intruder");
intruder_det f = new intruder_det();
f.MdiParent = this;
f.print(dt);
f.Show();
}
private void
modelDetailsToolStripMenuItem_Click(object sender, EventArgs
e)
{
private void
registrationDetailsToolStripMenuItem_Click(object sender,
EventArgs e)
{
Class1 db = new Class1();
DataTable dt = new DataTable();
dt = db.table("select * from detect");
detection_det f = new detection_det();
f.MdiParent = this;
f.print(dt);
f.Show();
private void
registrationToolStripMenuItem_Click_1(object sender,
EventArgs e)
{
model_reg f = new model_reg();
f.MdiParent = this;
f.Show();
}
47
private void
alterRemoveToolStripMenuItem1_Click_1(object sender,
EventArgs e)
{
}
}
Registration Form
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace kgptc
{
public partial class registration : Form
{
public registration()
{
InitializeComponent();
}
string s = "";
if (radioButton1.Checked == true)
s = "male";
48
else
s = "female";
if (textBox2.Text != textBox3.Text)
{
textBox2.Text = "";
textBox3.Text = "";
MessageBox.Show("Password mismatch,re
enter");
textBox2.Focus();
}
else
{
l = db.nonquery("insert into registry
values('" + textBox4.Text + "','" + s + "','" +
richTextBox1.Text + "','" + dateTimePicker1.Value + "','" +
textBox5.Text + "','" + comboBox1.Text + "','" +
textBox1.Text + "','" + textBox6.Text + "','" +
textBox2.Text + "','" + comboBox2.Text + "','" +
textBox7.Text + "')");
if (l > 0)
{
MessageBox.Show("Congragulations!!");
}
else
MessageBox.Show("error");
}
}
string s = "";
if (radioButton1.Checked == true)
s = "male";
else
s = "female";
if (textBox2.Text != textBox3.Text)
{
textBox2.Text = "";
textBox3.Text = "";
49
MessageBox.Sh ow("Password mismatch,re
enter");
textBox2.Focus();
}
else
{
l = db.nonquery("insert into registry
values('" + textBox4.Text + "','" + s + "','" +
richTextBox1.Text + "','" + dateTimePicker1.Value + "','" +
textBox5.Text + "','" + comboBox1.Text + "','" +
textBox1.Text + "','" + textBox6.Text + "','" +
textBox2.Text + "','" + comboBox2.Text + "','" +
textBox7.Text + "')");
if (l > 0)
{
MessageBox.Show("Congragulations!!");
}
else
MessageBox.Show("error");
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace kgptc
{
public partial class frgt_password : Form
50
{
public frgt_password()
{
InitializeComponent();
}
this.Close();
}
}
Lock form
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
51
using System.Text;
using System.Windows.Forms;
namespace kgptc
{
public partial class Form5 : Form
{
public Form5()
{
InitializeComponent();
}
textBox1.Focus();
}
}
else
{
i = db1.scalar("select loginname from
registry where loginname='" + textBox1.Text + "' ");
j = db1.scalar("select password from
registry where password='" + textBox2.Text + "'");
if (i == "" || j == "")
{
MessageBox.Show("Invalid user name or
password");
}
else
{
this.ControlBox = true;
vistaButton1.Enabled = true;
label1.Visible = false;
}
}
textBox1.Text = "";
textBox2.Text = "";
}
}
}
Security form
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
53
namespace kgptc
{
public partial class password_change : Form
{
public password_change()
{
InitializeComponent();
}
private void vistaButton2_Click(object sender,
EventArgs e)
{
if (textBox1.Text == "" || textBox2.Text == ""
|| textBox3.Text == "" || textBox4.Text == "")
{
MessageBox.Show("Please fill all fields");
return;
}
if (i == "")
{
MessageBox.Show("Invalid user Id or
Password");
textBox1.Text = "";
textBox2.Text = "";
textBox3.Text = "";
textBox4.Text = "";
textBox1.Focus();
}
else
{
if (textBox3.Text != textBox4.Text)
{
MessageBox.Show("Password
Mismatch,Re-enter");
textBox3.Text = "";
textBox4.Text = "";
}
else
{
j = db1.nonquery("update registry
set password='" + textBox3.Text + "' where loginname='" +
textBox1.Text + "'");
54
if (j > 0)
MessageBox.Show("Password
Changed !!");
else
MessageBox.Show("Password
changing failed,Retry");
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
}
}
Intruder Registration
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace kgptc
{
public partial class intrder_reg : Form
{
55
public intrder_reg()
{
InitializeComponent();
}
string k = "";
int s = 0;
try
{
k = db.scalar("select code from intruder
where code='" + textBox1.Text + "'");
if (k != "")
{
MessageBox.Show("Intruder code Already
Exist");
}
else
{
56
if (textBox1.Text == "" ||
textBox2.Text == "" || textBox3.Text == "")
{
MessageBox.Show("Please fill all
fields");
}
else
{
s = db.nonquery("insert into
intruder values('" + textBox1.Text + "','" + textBox2.Text
+ "','" + textBox3.Text + "','" + dateTimePicker1.Value +
"')");
if (s > 0)
{
MessageBox.Show("saved");
}
else
MessageBox.Show("error");
}
}
dt = db.table("select * from intruder");
dataGridView1.DataSource = dt;
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
string k = "";
57
int s = 0;
try
{
k = db.scalar("select code from intruder
where code='" + textBox1.Text + "'");
if (k != "")
{
MessageBox.Show("Intruder code Already
Exist");
}
else
{
if (textBox1.Text == "" ||
textBox2.Text == "" || textBox3.Text == "")
{
MessageBox.Show("Please fill all
fields");
}
else
{
s = db.nonquery("insert into
intruder values('" + textBox1.Text + "','" + textBox2.Text
+ "','" + textBox3.Text + "','" + dateTimePicker1.Value +
"')");
if (s > 0)
{
MessageBox.Show("saved");
}
else
MessageBox.Show("error");
}
}
dt = db.table("select * from intruder");
dataGridView1.DataSource = dt;
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
Intruder modification
58
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace kgptc
{
public partial class intruder_modi : Form
{
public intruder_modi()
{
InitializeComponent();
}
}
}
try
{
textBox2.Text = dt.Rows[0][1].ToString();
textBox3.Text = dt.Rows[0][2].ToString();
DateTime d = DateTime.Parse(dt.Rows[0]
[3].ToString());
dateTimePicker1.Value = d;
}
catch
59
{
}
}
if (comboBox1.Text == "")
{
MessageBox.Show("Please select Intruder
Code");
}
else
{
j = db.nonquery("update intruder set
ipaddress='" + textBox2.Text + "',intdes='" + textBox3.Text
+ "',regdate='" + dateTimePicker1.Value + "' where code='"
+ comboBox1.Text + "'");
textBox2.Text = "";
textBox3.Text = "";
if (j > 0)
MessageBox.Show("Intruder Updated !!");
else
MessageBox.Show("Updation
Failed,Retry");
}
}
int j = 0;
if (comboBox1.Text == "")
{
MessageBox.Show("Please select Intruder
Code");
}
else
{
60
if (MessageBox.Show("Are you
sure", "Deletion", MessageBoxButtons.YesNo) ==
DialogResult.Yes)
{
}
else
{
this.Close();
}
}
}
}
Model Registration
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
61
namespace kgptc
{
public partial class model_reg : Form
{
public model_reg()
{
InitializeComponent();
}
string k = "";
int s = 0;
k = db.scalar("select mcode from model where
mcode='" + textBox1.Text + "'");
if (k != "")
{
MessageBox.Show("Model code Already Exist");
}
else
{
if (textBox1.Text == "" || textBox2.Text ==
"")
{
62
MessageBo x.Show("Please fill all
fields");
}
else
{
s = db.nonquery("insert into model
values('" + textBox1.Text + "','" + dateTimePicker1.Value +
"','" + textBox2.Text + "')");
if (s > 0)
{
MessageBox.Show("saved");
}
else
MessageBox.Show("error");
}
}
dt = db.table("select * from model");
dataGridView1.DataSource = dt;
}
}
}
Model modification
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace kgptc
{
public partial class model_modi : Form
{
public model_modi()
{
InitializeComponent();
}
{
63
}
}
}
private void vistaButton1_Click(object sender,
EventArgs e)
{
Class1 db = new Class1();
int j = 0;
if (comboBox1.Text == "")
{
MessageBox.Show("Please select Model Code");
}
else
{
j = db.nonquery("update model set pattern='"
+ textBox2.Text + "',rdate='" + dateTimePicker1.Value + "'
where mcode='" + comboBox1.Text + "'");
textBox2.Text = "";
if (j > 0)
64
MessageBo x.Show("Model Updated !!");
else
MessageBox.Show("Updation
Failed,Retry");
}
int j = 0;
if (comboBox1.Text == "")
{
MessageBox.Show("Please select Model Code");
}
else
{
if (MessageBox.Show("Are you sure",
"Deletion", MessageBoxButtons.YesNo) == DialogResult.Yes)
{
if (j > 0)
{
MessageBox.Show("Model deleted");
DataTable dt = new DataTable();
dt = db.table("select * from model
where mcode='" + comboBox1.Text + "'");
try
{
textBox2.Text = dt.Rows[0]
[2].ToString();
DateTime d =
DateTime.Parse(dt.Rows[0][1].ToString());
dateTimePicker1.Value = d;
}
catch
{
}
}
else
MessageBox.Show("Deletion
failed,Retry");
}
65
else
{
this.Close();
}
}
}
Detect
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using PacketXLib;
using System.Diagnostics;
namespace kgptc
{
public partial class detect : Form
{
public detect()
{
InitializeComponent();
Load += Detect_Load;
FormClosed += detect_FormClosed;
}
PacketXClass pkt = new PacketXClass();
string protocol;
string s;
Class1 db = new Class1();
int i;
66
int j;
DataTable dt=new DataTable();
private void OnPacket1(PacketXLib.Packet pPacket)
{
ListViewItem mitem = default(ListViewItem);
int ippresent = 2;
mitem =
listView1.Items.Add(pPacket.SourceIpAddress.ToString());
mitem.SubItems.Add(pPacket.SourcePort.ToString(
));
mitem.SubItems.Add(pPacket.DestIpAddress.ToStri
ng());
mitem.SubItems.Add(pPacket.DestPort.ToString());
if ((pPacket.Protocol ==
PacketXLib.PktXProtocolType.PktXProtocolTypeTCP))
{
protocol = "TCP";
}
else if ((pPacket.Protocol ==
PacketXLib.PktXProtocolType.PktXProtocolTypeUDP))
{
protocol = "UDP";
}
else if ((pPacket.Protocol ==
PacketXLib.PktXProtocolType.PktXProtocolTypeEthernet))
{
protocol = "Ethernet";
}
else
{
protocol = "Unknown Protocol";
}
try
{
DataTable dt = new DataTable();
dt = db.table("select * from intruder where
ipaddress='" + pPacket.SourceIpAddress.ToString() + "'");
if(dt.Rows.Count>0)
{
ListViewItem mlist1;
mlist1 =
listView2.Items.Add(pPacket.SourceIpAddress.ToString());
mlist1.SubItems.Add(pPacket.Date.ToShor
tDateString());
mlist1.SubItems.Add(pPacket.Date.TimeOf
Day.ToString());
mlist1.SubItems.Add(protocol);
mlist1.SubItems.Add("Existing IP");
67
i =db.nonquery( "insert into
detect values('" + pPacket.SourceIpAddress.ToString() +
"','" + pPacket.Date.ToShortDateString() + "','" +
pPacket.Date.TimeOfDay.ToString() + "','" + protocol +
"','Existing')");
}
else
{
ippresent = 0;
}
}
catch
{
}
if ((ippresent == 0))
{
Array marray = null;
marray = pPacket.DataArray;
char datachar = '\0';
string datastring = "";
string patternmatch = "";
datastring = "";
for (i = 0; i <= marray.GetUpperBound(0); i++)
{
datachar =
Convert.ToChar(marray.GetValue(i));
if ((datachar > 65 & datachar < 122))
{
datastring = datastring +
Convert.ToChar(datachar);
}
else
{
datastring = datastring +
datachar.ToString();
}
}
try
{
s = db.scalar("select pattern from model");
}
}
}
catch
{
}
}
}
try
{
pkt.Stop();
}
catch
{
}
}
}
}
Data mining
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using PacketXLib;
namespace kgptc
{
public partial class datamining : Form
{
public datamining()
{
InitializeComponent();
}
70
string[] collector = new string[90001];
int count = 0;
int i;
i = 0;
while ((i < marray.GetUpperBound(0)))
{
datachar =
Convert.ToChar(marray.GetValue(i));
if ((datachar > 65 & datachar < 122))
{
datastring = datastring + datachar;
}
else
{
datastring = datastring +
Convert.ToInt32(datachar).ToString();
}
i = (i + 1);
}
collector[count] = datastring;
count = count + 1;
}
private void datamining_Load(object sender,
EventArgs e)
{
pkt.OnPacket += this.OnPacket;
try
{
pkt.Start();
}
catch
{
MessageBox.Show("Adapter is Already Started
Or Invalid Data Adapter ");
}
}
Iprequest
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using PacketXLib;
using System.IO;
using System.Net;
namespace kgptc
{
public partial class iprequest : Form
{
public iprequest()
{
InitializeComponent();
Load += iprequest_Load;
FormClosed += iprequest_FormClosed;
}
string strtip;
string endip;
string strtport;
string endport;
PacketXClass pkt = new PacketXClass();
public void OnPacket(Packet packet)
{
strtip = packet.SourceIpAddress.ToString();
endip = packet.DestIpAddress.ToString();
strtport = packet.SourcePort.ToString();
endport = packet.DestPort.ToString();
if ((radioButton1.Checked))
{
try
{
if ((strtip.Equals(textBox1.Text)))
{
73
ListV iewItem list1 =
default(ListViewItem);
list1 = listView1.Items.Add(strtip);
list1.SubItems.Add(strtport);
list1.SubItems.Add(endip);
list1.SubItems.Add(endport);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
if ((radioButton1.Checked))
{
try
{
if ((endip.Equals(textBox1.Text)))
{
ListViewItem list1 =
default(ListViewItem);
list1 = listView1.Items.Add(strtip);
list1.SubItems.Add(strtport);
list1.SubItems.Add(endip);
list1.SubItems.Add(endport);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
try
{
pkt.Start();
}
catch
{
MessageBox.Show("Adapter is Already
Started Or Invalid Data Adapter ");
75
}
}
catch
{
MessageBox.Show("Entered IPAddress is
invalid,Re-enter");
textBox1.Text = "";
textBox1.Focus();
}
}
76
Portscan
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Diagnostics;
using System.Windows.Forms;
using PacketXLib;
using System.Net;
using System.IO;
using System.Threading;
namespace kgptc
{
public partial class portscan : Form
{
public portscan()
{
InitializeComponent();
}
int StartPort;
int EndPort;
int CurrPort;
public bool allport;
PacketXClass pkt = new PacketXClass();
System.Net.Sockets.TcpClient tcpscan = new
System.Net.Sockets.TcpClient();
}
//public void a()
//{
// this.BeginInvoke(new aa(port));
//}
//public void port()
//{
// if (textBox1.Text == "")
// {
// MessageBox.Show("Please specify the IP
Address");
// textBox1.Focus();
// return;
// }
// try
// {
// IPAddress hostIPAddress =
IPAddress.Parse(textBox1.Text);
// textBox4.Clear();
// if ((allport))
// {
// StartPort = 1;
// EndPort = 65530;
// }
// else
// {
// try
// {
// if ((int.Parse(textBox2.Text) < 1
| int.Parse(textBox3.Text) > 65530) | (textBox2.Text == "")
| (textBox3.Text == ""))
// {
// MessageBox.Show("Please enter
the ports between 1 and 65530 ");
// return;
// }
// }
// catch
// {
78
// MessageBox.Show("Please Enter
All Fields");
// textBox1.Focus();
// return;
// }
// StartPort =
Convert.ToInt32(textBox2.Text);
// EndPort =
Convert.ToInt32(textBox3.Text);
// }
// progressBar1.Value = 0;
// progressBar1.Maximum = EndPort -
StartPort + 1;
// CurrPort = StartPort;
// while ((CurrPort <= EndPort))
// {
// try
// {
// tcpscan.Connect(textBox1.Text,
CurrPort);
// textBox4.AppendText("Port " +
CurrPort + " open" + "\n\r");
// }
// catch
// {
// textBox4.AppendText("Port " +
CurrPort + " closed" + "\n\r");
// }
// progressBar1.PerformStep();
// CurrPort = (CurrPort + 1);
// }
// }
// catch
// {
// MessageBox.Show("Entered IPAddress is
invalid,Re-enter");
// textBox1.Text = "";
// textBox1.Focus();
// }
//}
//delegate void aa();
//Thread th;
private void vistaButton1_Click(object sender,
EventArgs e)
{
//th = new Thread(a);
//th.Start();
//this.BeginInvoke(new aa(port));
if (textBox1.Text == "")
{
79
MessageBox.Sh ow("Please specify the IP
Address");
textBox1.Focus();
return;
}
try
{
IPAddress hostIPAddress =
IPAddress.Parse(textBox1.Text);
textBox4.Clear();
if ((allport))
{
StartPort = 1;
EndPort = 65530;
}
else
{
try
{
if ((int.Parse(textBox2.Text) < 1 |
int.Parse(textBox3.Text) > 65530) | (textBox2.Text == "") |
(textBox3.Text == ""))
{
MessageBox.Show("Please enter
the ports between 1 and 65530 ");
return;
}
}
catch
{
MessageBox.Show("Please Enter All
Fields");
textBox1.Focus();
return;
}
StartPort =
Convert.ToInt32(textBox2.Text);
EndPort =
Convert.ToInt32(textBox3.Text);
}
progressBar1.Value = 0;
progressBar1.Maximum = EndPort - StartPort
+ 1;
CurrPort = StartPort;
while ((CurrPort <= EndPort))
{
try
{
tcpscan.Connect(textBox1.Text,
CurrPort);
80
textBox4.AppendText("Port " +
CurrPort + " open" + "\n\r");
}
catch
{
textBox4.AppendText("Port " +
CurrPort + " closed" + "\n\r");
}
progressBar1.PerformStep();
CurrPort = (CurrPort + 1);
}
}
catch
{
MessageBox.Show("Entered IPAddress is
invalid,Re-enter");
textBox1.Text = "";
textBox1.Focus();
}
this.Close();
//pkt.IsRunning = false;
}
}
81
Pingmachine
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Net;
using System.Diagnostics;
using System.IO;
namespace kgptc
{
public partial class ping_machine : Form
{
public ping_machine()
{
InitializeComponent();
}
try
{
IPAddress hostIPAddress =
IPAddress.Parse(textBox1.Text);
richTextBox1.Text = "";
try
{
}
catch
{
MessageBox.Show("Entered IPAddress is
invalid,Re-enter");
textBox1.Text = "";
textBox1.Focus();
}
try
{
Process process2 = new Process();
process2.StartInfo.FileName = "cmd.exe";
process2.StartInfo.Arguments = "/C
tracert " + this.textBox1.Text + " > c:/tra.txt ";
process2.StartInfo.WindowStyle =
ProcessWindowStyle.Hidden;
process2.StartInfo.CreateNoWindow =
true;
process2.Start();
process2.WaitForExit(50000);
if (!process2.HasExited)
{
process2.Kill();
}
process2.Close();
}
}
catch
{
MessageBox.Show("Entered IPAddress is invalid,Re-
enter");
textBox1.Text = "";
textBox1.Focus();
}
}
TCP sniffing
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using PacketXLib;
namespace kgptc
{
public partial class tcpsniffing : Form
{
public tcpsniffing()
{
InitializeComponent();
Load += tcpsniffing_Load;
FormClosed += tcpsniffing_FormClosed;
}
PacketXClass pkt = new PacketXClass();
public void OnPacket(Packet ppacket)
{
if ((ppacket.Protocol ==
PacketXLib.PktXProtocolType.PktXProtocolTypeTCP))
{
ListViewItem litem = default(ListViewItem);
litem =
listView1.Items.Add(ppacket.SourceIpAddress.ToString());
litem.SubItems.Add(ppacket.SourcePort.ToStr
ing());
litem.SubItems.Add(ppacket.DestIpAddress.To
String());
litem.SubItems.Add(ppacket.DestPort.ToStrin
g());
}
}
private void listView1_SelectedIndexChanged(object
sender, EventArgs e)
{
}
85
private void button3_Click(object sender,
EventArgs e)
{
}
}
UDP Sniffing
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using PacketXLib;
namespace kgptc
{
public partial class udpsniffing : Form
{
public udpsniffing()
{
InitializeComponent();
Load += udpsniffing_Load;
FormClosed += udpsniffing_FormClosed;
87
}
PacketXClass pkt = new PacketXClass();
public void OnPacket(Packet ppacket)
{
if ((ppacket.Protocol ==
PacketXLib.PktXProtocolType.PktXProtocolTypeUDP))
{
ListViewItem litem = default(ListViewItem);
litem =
listView1.Items.Add(ppacket.SourceIpAddress.ToString());
litem.SubItems.Add(ppacket.SourcePort.ToStr
ing());
litem.SubItems.Add(ppacket.DestIpAddress.To
String());
litem.SubItems.Add(ppacket.DestPort.ToStrin
g());
}
}
private void label1_Click(object sender, EventArgs
e)
{
AllSniffing
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using PacketXLib;
namespace kgptc
{
public partial class allsniffing : Form
{
public allsniffing()
{
InitializeComponent();
Load += allsniffing_Load;
FormClosed += allsniffing_FormClosed;
}
try
{
pkt.Stop();
}
catch
{
}
Close();
}
}
}
}
92
IntruderDetails
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
namespace kgptc
{
public partial class intruder_det : Form
{
public intruder_det()
{
InitializeComponent();
}
public void print(DataTable dt)
{
CrystalReport1 cr = new CrystalReport1();
cr.SetDataSource(dt);
crystalReportViewer1.ReportSource = cr;
}
private void intruder_det_Load(object sender,
EventArgs e)
{
}
}
}
93
ModaiDetails
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace kgptc
{
public partial class model_det : Form
{
public model_det()
{
InitializeComponent();
}
public void print(DataTable dt)
{
CrystalReport2 cr = new CrystalReport2();
cr.SetDataSource(dt);
crystalReportViewer1.ReportSource = cr;
}
private void model_det_Load(object sender, EventArgs
e)
{
}
}
}
94
Detectiondetails
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace kgptc
{
public partial class detection_det : Form
{
public detection_det()
{
InitializeComponent();
}
public void print(DataTable dt)
{
CrystalReport3 cr = new CrystalReport3();
cr.SetDataSource(dt);
crystalReportViewer1.ReportSource = cr;
}
private void crystalReportViewer1_Load(object
sender, EventArgs e)
{
}
}
}
95
5. SYSTEM IMPLEMENTATION
SYSTEM TESTING
98
SYSTEM TESTING
TYPES OF TESTING
• Unit Testing
• Integration Testing
• Validation Testing
• Output Testing
• User Acceptance Testing
UNIT TESTING
Here we test each module individually and integrate the
overall system. We got seven modules including the help
module starting from action, registration or we say the updation
99
of databases or the dangerous contents and its live detection
the to some of the friendly network tools to the reports. This
will work individually for the accomplishment of the network
intrusion and also the detection process. Here we already
tested each unit separately and we got a successful answer for
it. Each unit shows its own individuality, as it is network based
software it will accomplishes its mission on well connected
networked computers.
INTEGRATION TESTING
Data can be lost across an interface, one module
can have an adverse effect on the other sub-functions, when
combined may not produce the desired functions. Integrated
testing is the systematic testing to uncover the errors within the
interface. This testing is done by inputting necessary values
and data in the sequential order form action module to the
report. As data of one unit is needed for the working of the
other, for example we register IP Addresses in IP Registration
module and the live detection module uses this registered value
for the matching of the incoming IPs. The need for integrated
system is to find the overall system performance.
VALIDATION TESTING
At the culmination of the black box testing, software
is completely assembled as a package. Interfacing errors have
been uncovered and correct and final series of test, i.e.,
validation test begins. Validation test van is defined with a
simple definition that validation succeeds when the software
functions in a manner that can be reasonably accepted by the
customer.
OUTPUT TESTING
After performing validation testing, the next step is
output testing of the proposed system. Since the system cannot
be useful if it does not produce the required output. Asking the
user about the format in which the system is required tests the
output displayed or generated by the system under
consideration. Here for the working of the software we need to
100
install winPcap and packetX softwares for its working,
these will create a better environment for the software to dull in
perfectly on as windows OS. And still need a well established
LAN connection for the working, for a single system it looks
useless and crazy. Here the output format is considered in two
ways. One is on screen format and another one is printed
format. The output format on the screen is found to be
corrected as the format was designed in the system phase
according to the user needs. As for the hard copy the output
comes according to the specification requested by the user.
Here the output testing does not result in any correction in the
system. Taking various kinds of data plays a vital role in
system testing. After preparing the test data, system under
study is tested using the test data. While testing, errors are
again uncovered and corrected by using the above steps and
corrections are also noted for future use. The system has been
verified and validated by running test data and live data.
First the system is tested with some sample test data
that are generated with the knowledge of the possible range of
values that are required to hold by the fields. The system runs
successfully for the given test data and for the live data.
USER ACCEPTANCE TESTING
User acceptance testing of the system is the key
factor for the success of any system. As we have created an
easy interface it is easy to use. Only tough portion is the
information to be entered should be perfect and has only one
kind of user that’s the Administrator.
The system under consideration is tested for user
acceptance by constantly keeping in touch with prospective
system at the time of development and making change
whenever required. This is done with regard to the input screen
design and output screen design.
101
FUTURE
ENHANCEMENT
102
F UT U R E E N H A N C E M E N T
CONCLUSION
104
CONCLUSION
BIBLIOGRAPHY
106
BIBLIOGRAPHY
1. WWW.MICROSOFT.COM
2. WWW.VISUALSTUDIONET.COM
3. WWW.GOOGLE.COM
4. NETWORK SECURITY AND CRYPTOGRAPHY.