DIGIT-ARC read-only archive · snapshot: July 23, 2026

Firewall : which language to use ?

22 posts · originally from https://geek.digit.in/community/threads/firewall-which-language-to-use.135137/

S
sinoop_joy Original post #1
Dec 17, 2010 at 10:56 PM
I would like to do Firewall(the one like COMODO) as my final year project.

The thing is i have read that it is not possible using C#. Is that so ?
I cant use Java too ?
How about Visual C++ ?

Any other suitable languages ?
arpanmukherjee1
Dec 19, 2010 at 1:02 PM
all 3 langs have the ability to do so.

java and .net framework have classes that provide high level control

u must know the algos of networking and socket programing.

built a packet filter in java once
S
Dec 20, 2010 at 12:00 AM
Can you provide me any details or a link to a sample program ?

I read that we need to program in kernel mode so we cannot use C# for that..
So you are saying that there is no problem with dat rite ?
What will these classes do to program ? Will they make the program execute in kernel mode ?
arpanmukherjee1
Dec 20, 2010 at 10:23 PM
elementary socket programming :: How to C# Socket programming

we need to program in kernel mode so we cannot use C# for that.
now where did u read THAT ???

see :: C# does Shell, Part 1 - CodeProject

what i think u want to say is that u cannot access ring 0

more info on rings :: Ring (computer security) - Wikipedia, the free encyclopedia

that is also not correct

see:: ProcessStartInfo Class

Process Class (System.Diagnostics)

*www.codeproject.com/KB/cs/Execute_Command_in_CSharp.aspx

and yes u need to invoke the "net" dos command :: MS-DOS net command help

u may also be interested to look at Net Tools

i think now u realize the extent of .net and capability of C#

ask if u want to know more..
S
Dec 22, 2010 at 8:35 PM
firewall application - C# says so
arpanmukherjee1
Dec 23, 2010 at 6:34 PM
^^^ everything in that thread is correct.

you have to write unmanaged code in C# that is not governed by .net

u must take help of WinPcap and libPcap. the former a sniffer and latter a dropper
nobody expects u to write device drivers, just use them

one thing, if u seriously want to do such projects a LOT of research on ur part is required
S
Dec 24, 2010 at 9:46 PM
I'm ready to do research. I actually want to do something like this to become better familiar with the language. But i'm doing this as part of my curriculum so i have to consider the mark part too. I will get approximately 3-4 months for doing this project.
Can you help me ?
A
Dec 25, 2010 at 9:24 AM
Nice post. I was wondering how to build such kind of software.
well one more doubt, after writing those code for that software how to transform it into .exe so that it looks like the software we use?
arpanmukherjee1
Dec 25, 2010 at 10:34 AM
I'm ready to do research. I actually want to do something like this to become better familiar with the language. But i'm doing this as part of my curriculum so i have to consider the mark part too. I will get approximately 3-4 months for doing this project.
Can you help me ?

sure. i will post code fragments from my java project. u can convert it to C#

AFA u know what u r doing and can explain the algo be sure that u will be give above 90% marks

3-4 mths time is short, even if u know the lang. prefer doing it in the lang u know very well. if the lang is not known u will loose time coding functions that may already exist.

google up algos and look at the flow

i would highly recommend this book : Sybex CCNA Cisco Certified Network Associate Study Guide 2nd Edition 0782126472 download free

go through the index and find topics relevent to ur proj eg.
IP address resolution
VLAN
packet filter
packet structure etc

well one more doubt, after writing those code for that software how to transform it into .exe so that it looks like the software we use?

Visual Studio Professional edition supports Setup Projects that will create such setups.

also u can use Inno (free) at : *www.jrsoftware.org/isdl.php
A
Dec 25, 2010 at 11:33 AM
That is to do with software. Any other way to do it manually?
arpanmukherjee1
Dec 25, 2010 at 8:23 PM
That is to do with software. Any other way to do it manually?

of course u can...

but why not use something that is already out there and accepted as commercial standard ??
A
Dec 26, 2010 at 9:29 AM
The reason behind is that I want to learn this from scratch. So if you please tell me the way to do it.
S
Dec 26, 2010 at 9:53 AM
sure. i will post code fragments from my java project. u can convert it to C#

i would highly recommend this book : Sybex CCNA Cisco Certified Network Associate Study Guide 2nd Edition 0782126472 download free

go through the index and find topics relevent to ur proj eg.
IP address resolution
VLAN
packet filter
packet structure etc

Thank u..
I'l be beginning soon.. Will let you know.
How can i contact you ?

BTW, how will VLAN b needed 4 my project ?
We had a Internetworking nd Computer networking theory n lab in the last semester. So i know the basics of networking.

And about the language, i did my mini project in c#. But it was a small one compared to this one. A sofware similar to Disclib. It was entirely different one.
I dont know the network monitoring part of any language,though i got the belief that i can catch up. And of course i got someone to help me now..:)

You did firewall in Java ?
arpanmukherjee1
Dec 26, 2010 at 8:43 PM
Thank u..
I'l be beginning soon.. Will let you know.
How can i contact you ?

here on the forum itself. let others know of the progress and problem alike...

BTW, how will VLAN b needed 4 my project ?.

it will be when u design a packet filter, which u will... eventually..

We had a Internetworking nd Computer networking theory n lab in the last semester. So i know the basics of networking.

i know. i also know that programming structure provided by book is a big zero.

And about the language, i did my mini project in c#. But it was a small one compared to this one. A sofware similar to Disclib. It was entirely different one.

thats good. but learning never stops.

I dont know the network monitoring part of any language,though i got the belief that i can catch up. And of course i got someone to help me now..:)

there is always google to help u out and others and yes .. me

You did firewall in Java ?

no. i did "packet filtering" in java. firewall is a "configurable" packet filter and includes other algos/functions like heuristic search and support for encrytion like IPsec etc

The reason behind is that I want to learn this from scratch. So if you please tell me the way to do it.

no need 4 me tell u its done before

please read the articles in a sequential fashion ::

1> Writing A Good Setup For Your Applications - CodeProject
2> dotNetInstaller - Setup Bootstrapper for .NET Application - CodeProject
3> Enhanced .NET Bootstrap Setup - CodeProject

also Wix tutorial ::

4> Creating an installer using Wix v3.0, Votive, and Visual Studio 2005/2008 - CodeProject
5> Creating an installer using Wix v3.0, Votive, and Visual Studio 2005/2008 - Part 2, the GUI - CodeProject
S
Feb 19, 2011 at 11:02 AM
Hey can you give me that code f your java project ?

How can i make my program start in kernel mode ?
funkysourav
Feb 19, 2011 at 12:08 PM
hey i have got a wild idea
How about you join the Comodo Forums
there are a bunch of crazy but very helpful guys there
tell them that you are a student and ask them to help you
maybe you'll get lucky(someone might help you with the tricks of the trade)

else there are many open source firewall projects at source forge
SourceForge.net: Open Source Firewall For Windows - Develop
Express Open Source Firewall Project » Download
align yourself with one and learn with the help of other developers

BTW
Great project
all the best
S
Feb 19, 2011 at 12:39 PM
@funkysourav :
Thanks 4 d links and suggestions.
I sent a mail 2 comodo team asking about the language they use. Bt no reply :-(
Nyway wil check the forum...
funkysourav
Feb 19, 2011 at 1:00 PM
join the forum
and stay active there
you'll meet many helpful people there
heck even the COMODO CEO Melih sometimes talks and chats with end users on the forum
I think your best bet is there forum
don't ask for help not just yet
take your time, build reps and contacts
and present your problem as a hobby or student project
they will help you for sure

its not like they will be sharing Rocket Science Confidential secrets with you
but they will direct your path for sure
But it will take some time
S
Mar 1, 2011 at 8:08 PM
Finally, i decided to modify the project a little bit.
I decided to do the controlling of Windows firewall to do the task. And started coding. Bt the problem is when i try to turn off the firewall using code , my program gets stopped and windows firewall is not turned off.. What could be the problem ?


I used this code...

Code:
Type NetFwMgrType = Type.GetTypeFromProgID("HNetCfg.FwMgr", false); 
INetFwMgr mgr = (INetFwMgr)Activator.CreateInstance(NetFwMgrType);
mgr.LocalPolicy.CurrentProfile.FirewallEnabled = false;



and i get this error.. I tried running the exe as administrator. Bt then too it is not happening.

*img535.imageshack.us/img535/561/capturewc.jpg
funkysourav
Mar 1, 2011 at 10:21 PM
try running with admin privileges
maybe that will work
also lookup "iptables" the linux firewall
S
Mar 2, 2011 at 8:15 PM
try running with admin privileges
maybe that will work

i already tried that.. :sad:
I tried running the exe as administrator. Bt then too it is not happening.


---------- Post added 02-03-2011 at 10:17 AM ---------- Previous post was 01-03-2011 at 10:56 PM ----------

where can i get the C# code of these ?

Using Windows Firewall with Advanced Security (Windows)

All are C++ or VB codes... :?


Can anyone convert this to C# code ?

Turning the Firewall Off (Windows)