You are on page 1of 14

Performance Modeling and Analysis of

Network Firewalls
MODULES DESCRIPTION
FIREWALL
Firewall
Rule Based
Access or Deny
Firewall:
Normally Firewall is the first line Defence for our system. It goanna be the defence our
system from outside hacker. Firewall having usually some rules to protect our system from
outside .If the bytes form outside it will go to the firewall if it rule is matched then only firewall
allow the outside information to inside otherwise if do not match it wont support that outside
information to send inside.
Rule Based
Current system user going to protect his so he going to take percussion he going to maintain the
Firewall for the first defence system. In the Firewall user going to Config the both needed data
and unwanted data. So user can maintain or put some restrict to the incoming and outgoing data.
For incoming data means he can protect the DDOS attack from the outside user. Outgoing data
from your system you put some restriction to the user for using you system to internet
Access or Deny:
In this module after considering with Firewall rule based or match the incoming or outgoing
packet with rule based then the take desired action depending upon the rule. If the rules are based
to block the repeated request giving user.

MODULE DIAGRAM

FIREWALL
Firewall

Rule Based

RULE BASED

Rule Based
Incoming Data

ACCESS AND DENY

Outgoing Data

Rule Based
Incoming Data

Allow or Deny Process

CODING

FIREWALL
LOGIN:
FIREWALL:
private void btnLogin_Click(object sender, RoutedEventArgs e)
{
app.FirewallCondition = "Offline";
if (scon.GetConnection(txtUserName.Text, txtUserPassword.Password))
{
MessageBox.Show("Sucessfully Login","LOGIN
SUCESSFULLY",MessageBoxButton.OK,MessageBoxImage.Information);
FWD.Show();
this.Close();
}
else
{
MessageBox.Show("Please Verify UserName and Password","LOGIN
FAILED",MessageBoxButton.OK,MessageBoxImage.Error);
}
}

public bool GetConnection(string Usrnm,string usrpass)


{
if (BLLconn.LoginProcedure(Usrnm, usrpass))
{
return true;
}
else
{
return false;
}
}
public void Connection()

{
try
{
conn = new SqlConnection("Data Source=SPIRO35\\SQLEXPRESS;Initial
Catalog=Firewall;User Id=sa;Password=boss");
}
catch (Exception ex)
{
throw;
}
}
public bool LoginProcedure(string UN, string UP)
{
try
{
Connection();
conn.Open();
cd = new SqlCommand("UserLogin_Procedure", conn);
cd.CommandType = CommandType.StoredProcedure;
cd.Parameters.AddWithValue("@UserName", UN);
cd.Parameters.AddWithValue("@UserPassword ", UP);
dr = cd.ExecuteReader();
return dr.Read();
}
catch (Exception ex)
{
throw;
}
finally
{
if (conn != null)
{
conn.Close();
}
}
}
RULE BASED:

#region DLL import for using Console Application in WPF


[DllImport("Kernel32")]
public static extern void AllocConsole();
[DllImport("Kernel32")]
public static extern void FreeConsole();
#endregion
public void ProcessMethod()
{
AllocConsole();
Console.ForegroundColor = ConsoleColor.White;
ipAddress = IPAddress.Any;
listener = new TcpListener(ipAddress, 3000);
listener.Start();
Console.WriteLine("Server is running");
Console.WriteLine("Listening to IPAddress " + listener + "Listening on port " + port);
Console.WriteLine("Waiting for connections...");

try
{
while (m == true)
{
s = listener.AcceptSocket();
s.SendBufferSize = 8912;
ForcheckingIP =
IPAddress.Parse(((IPEndPoint)s.RemoteEndPoint).Address.ToString());
app.CheckIP = ForcheckingIP.ToString();
app.CheckProt = port;
if (sqlcon.CheckFirewallRuleList(app.CheckIP, app.CheckProt))
{
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("Access Granted to IP"+"--"+ForcheckingIP+"--"+"and
Port"+"--"+port+"--"+"for Communication");
byte[] b = new byte[1024 * 50000];
int k = s.Receive(b);

Console.Write("Received:-");
for (int i = 0; i <= k; i++)
{
#region Verify Normal USer
if (m1 < 200000)
{
Console.ForegroundColor = ConsoleColor.Yellow;
Console.Write(Convert.ToChar(b[i]));
if (i == k)
{
}
else
{
}
public bool CheckFirewallRuleList(string ip,int port )
{
return BLLconn.CheckingWithFirewallRule(ip,port);
}
public bool CheckingWithFirewallRule(string IP,int port)
{
try{
Connection();
conn.Open();
cd = new SqlCommand("CheckingFirewallRule",conn);
cd.CommandType = CommandType.StoredProcedure;
cd.Parameters.AddWithValue("@IPAddress",IP);
cd.Parameters.AddWithValue("@Port",port);
dr = cd.ExecuteReader();
return dr.Read();
}
catch (Exception ex)
{
throw;
}
finally
{
if (conn != null)
{

conn.Close();
}
}
}
private void button1_Click(object sender, RoutedEventArgs e)
{
if (txtUsername.Text == "User" && txtpassword.Password == "User")
{
ct.Show();
this.Hide();
}
else
{
MessageBox.Show("Please Verify Username nad Password","Login
Failed",MessageBoxButton.OK,MessageBoxImage.Error);
}
}
ACCESS OR DENY
public void Work()
{
AllocConsole();
try
{
TcpClient client = new TcpClient();
foreach (IPAddress ip in ht.AddressList)
app.IPAddress = ip.ToString();
IPEndPoint serverEndPoint= new IPEndPoint(IPAddress.Parse("192.168.0.35"),
port12);
client.Connect(serverEndPoint);
}
NetworkStream clientStream = client.GetStream();
ASCIIEncoding encoder = new ASCIIEncoding();
for (int j = 0; j < 20; j++)
{
try
{

byte[] buffer = encoder.GetBytes(Convert.ToString(Console.ReadLine()));


clientStream.Write(buffer, 0, buffer.Length);
clientStream.Flush();
}
catch (Exception ex)
{
Console.WriteLine("Heloo PAcket Loss" + client.SendBufferSize);
Console.WriteLine("Sorry Packets Send By Getting Loss Because Remote
endpoint Not Responding You");
Console.WriteLine("Want to Exsit y/n");
string s=Convert.ToString(Console.ReadLine());
if (s == "y")
{
FreeConsole();
}
else
{
Work();
}
}
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
Console.WriteLine("Want to Exsit y/n");
string s = Convert.ToString(Console.ReadLine());
if (s == "y")
{
FreeConsole();
}
else
{
Work();
}
}

DATABASE TABLE:
User Name:

In this table are two column, the columns are username, userpassword. These two columns are
used to store the user details and used to provide the data to the authentication process. The all
column are nvarchar data type.

Firewall List:

Firewall list table are used to store the all firewall details. These table have four column, these
column get the firewall details and store the database. This rules are used to communicate to
another user.

All Table:

This table are used to get the all table list in the database. It have one column the column name is
table name and data type is nvarchar. This table used to manage the all database.

SNAP SHOTS
FIREWALL

LOGIN:

In this module the user give the user name and password, if the username and password are
verified. The user are authenticated user then allow to communicate to another user. Username
and password are incorrect then they provided the error message.

This module are display the overall explanation of the firewall. These are provided the
details of firewall process. If click to next button then provide the another some details about the
firewall.

This is used to provide the all database table details. They used to get user value and store to the
separate database. When we want that time they provide the store information

RULE BASED

This module provide the all firewall rule. These rules based they communicate the one
user to another user. The firewall rules are provided by user then check the ip address and port
number, If the ip address and port number is same then only allow to sharing the data.

ACCESS AND DENY

This is used to allow communicate one user to the another user. The rules are matched
then waiting for another user request. The another user connect then the data to be sharing .

You might also like