Click here to Skip to main content
Click here to Skip to main content

An Easy Firewall Application

By , 9 Oct 2003
 

Sample Image - firewallpapi.jpg

Introduction

When I published my articles about firewall development, I received some e-mails about how to develop a complete firewall solution using the methods described. With this tool I want to give these users an easy example of packet filtering utility.

In this solution I have used Packet Filtering API for Microsoft Windows 2000 and above. I have developed a MFC class wrapper for this API. With this class, I make a simple MFC application that allows a user to set filter rules in local interfaces.

If you want to know more about Packet Filtering API, you can read my article Packet Filtering in .NET. Feel free to e-mail me if you want to know more about this application.

Update history

  • October 6, 2003.- Initial release. Version 1.0.
  • October 9, 2003.- Added support for "default action". Version 1.1.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Jesus Oliva
Chief Technology Officer
Spain Spain
Member
To summarize: learn, learn, learn... and then try to remember something I.... I don't Know what i have to remember...
 
http://www.olivacorner.com

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
QuestionNot working on win7!!!memberMember 907371830 Jun '12 - 12:52 
Hello! did anyone manage to make it work on win7? i wandering if i can use this app to block wirrelles network access on a pc. Thanks!
QuestionWindows7membercarlito_brigante29 Oct '11 - 1:18 
In win7 it not work, what should be changed to work in win7?
GeneralMy vote of 1mvpDave Kreskowiak11 Oct '11 - 3:35 
Nice app, but as an article that is supposed to teach people how you did this, it sucks. You've got no discussion of anything at all.
QuestionWorks in XP and not Win7memberMember 776618018 Jun '11 - 16:32 
Works in XP and not Win7. Any suggestions?
GeneralCan't drop the income packet!!memberpku200929 Dec '08 - 0:15 
Your application is excellent! Thank you very much! But I would like to ask anyone how can drop the income packet??
 
今天没有时间,以后再写吧。

Questionimp plzzzz help memembervivekpandey264 Dec '08 - 7:25 
how i can block my internet access through my c# windows application
lang C#
platform .net
OS xp
AnswerRe: imp plzzzz help mememberDhaann21 Feb '09 - 21:37 
Not possible. You can't write a firewall in c#, I'm sorry
GeneralFirewall inoperative in this situationmemberAlGeorge29 Feb '08 - 10:05 
Hi when I run the sample no ports are being displayed under winxp any idea what could cause this as I cannot see anyone else here has the same problem?
GeneralRe: Firewall inoperative in this situationmemberAlGeorge29 Feb '08 - 10:16 
Sorry, I simply checked out the demo, not source. Was expecting it to signal as ports were accessed but in fact it blocks/passes according to the rules. What I am after is some form of port sniffer I guess thank you.
GeneralSample in VB.NetmemberMember 428824426 Feb '08 - 3:11 
Is there any firewall application in Vb.net... Similar to firewallPapi
GeneralFltdefs.h and Iphlpapi.hmemberMember 14612587 Dec '07 - 2:09 
Where can I find these files?
Thanks
GeneralPlease tell me whymemberMD842 Jul '07 - 22:03 
when I use the function
"DWORD result = filterDriver.WriteIo(ADD_FILTER, &pf, sizeof(pf));"
When debug, it show some error:
Error 9 error C2065: 'METHOD_BUFFERED' : undeclared identifier
Error 10 error C2065: 'FILE_WRITE_ACCESS' : undeclared identifier
Error 11 error C3861: 'CTL_CODE': identifier not found
Can you tell me why and the way to solve this problems. Thanks
 
AS84

GeneralRe: Please tell me whymemberManuel Soler (ModMa)4 Sep '07 - 11:21 
umm, why this topic songs me?? :S
you must install the m$crosoft driver kit (DDK) & register for good in visual studio Wink | ;)
QuestionApplication name?memberChemically Yours20 Jun '07 - 20:06 
Is there any way to get the application name which trying to access the particular port blocked by us?
 
Waqas Hussain Siddiqui
Chemically Yours
 
"Tum takalluf ko bhe ikhlas samajhtey ho faraz
Hota nahi dost har hath milaney wala"

Questionmfc application design?memberarefix8 Feb '07 - 20:40 
hi ive downloaded this article source code
but i cant find any file that can show the form of this application(the design)
i want to check what button triggers what method
can anyone help me please?
GeneralCan't load DLL in other computermemberiManiac2 Feb '07 - 0:43 
H1, I'm writting application on C# and It Can't load this LIB in Other computers,but on my All Ok.Could you tell me how to correct it?
GeneralWindows 98memberArkadiusz z Krakowa20 Dec '06 - 4:49 
Can you give me some tips how to make firewall that works on win98?
 
Arek
Generalport filtering on LANmembertasleem1438 Aug '06 - 1:25 
hi i want to close only the http traffic i tried to use this application for that purpose but it did no do so,
i m using windoes 2000 server and on LAN.i m supplying my adress as the src and 0 on desitnation but it did not block any traffic.
when i use all maans 0 and option drop then it closes all things like netowrk,internet etc which i dont want.
i only want to block the internet traffic. had u tested that application and worked fine or what i m doing wrong? i will be thankful to you.
 
Tasleem Arif

Generalcannt Filter portmembertasleem1438 Aug '06 - 0:39 
hi all i had tested this application on windows 2000,and on LAN i want to block outgoing traffic but it allows the website to open
i dont know what i m doing wrong i m giving my computer ip as the src ip and desitnation adress in 0 with mask 0 and but it still open the site what is wrong m i giving wrong adress or what.
when i use the option of all it works fine block everything but not filtering some port or ip.
 
Tasleem Arif

GeneralIf you know...memberRalph Varjabedian29 Mar '06 - 21:14 
Hi,
 
Thank you for this wonderful article, it really is very beneficial.
 
I wonder if you can tell me what is the best way to send ethernet packets. I was using WinPCap to send packets but it is very slow (up to 1 second delay between the call to send and the actual send).
 
If am going all over the internet but I can not see the best way nor can I find samples on this topic.
 
If you can help me, that would be great.
Thanks.
 
Ralph Varjabedian
Software Engineer
Generalfor linux firewall designmemberabhikamune4 Mar '06 - 6:14 
sir,
i am final year computer sci. student.i want to implement firewall in linux.pls please help me.guide me how i got detail information about linux firewall.pls help me....
thanks.

 
hi
GeneralRe: for linux firewall designmemberBrad Bruce4 Mar '06 - 7:20 
Check out http://www.routerdesign.com/[^]
 
There are links to Linux distributions focusing on routing / firewalls, as well as a showcase of what others have done.

GeneralRe: for linux firewall designmemberAmit45123 Jul '07 - 23:51 
Sir,
Please tell me detail about linux firewall design
GeneralFirewall in vnisual c++memberthe_enginer20 Feb '06 - 3:34 
i need program with code by visual c++ about packet filtering API(easy firewall)
Questionhow to drop packetmembereltaweel29 Jun '05 - 1:47 
i made aprogram to capture packets using winsock2 ...for each packet received ,parse its header and check its source and destination ips with rules exist in the database
My program is attached to the access database using (ODBC)...if the crossponding action is deny then i have to drop the packet befor its reached to the browser for dispalying....
 

i want a function to do that working with winsock2 API....HELP me plzz....
i write the prog in vc++.
 
thank u very much..
 
haitham

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web04 | 2.6.130523.1 | Last Updated 10 Oct 2003
Article Copyright 2003 by Jesus Oliva
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid