Académique Documents
Professionnel Documents
Culture Documents
of
Network Firewalls
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
Rule Based
Firewall
RULE BASED
Rule Based
Incoming Data
Outgoing
Data
Rule
Based
Allow or Deny
Process
Incoming
Data
CODING
FIREWALL
LOGIN:
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);
}
}
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();
}
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.
THANK YOU