Jump to content
  • Advertisement
Sign in to follow this  
Rich76

Is there a Windows firewall, which I can access the whitelist with C#?

This topic is 3031 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Without going into detail, I need a Windows firewall, which would allow a local C# application to change allowed incoming remote IPs (whitelist). Is there any thing available (hopefully free)? Thanks

Share this post


Link to post
Share on other sites
Advertisement
In C++ and Vista+ there is an easy solution. http://www.codeproject.com/KB/IP/PacketFilter.aspx.

Share this post


Link to post
Share on other sites
One last question, is it possible to just run the following command line within the application?:

netsh firewall set portopening protocol = ALL port = 7239 name = "Port7239" mode = ENABLED scope = CUSTOM addresses = [IP addresses separated by commas]


Though, the application would need administrative rights..

Share this post


Link to post
Share on other sites
You could create a Windows Service that runs with admin or local system credentials and can call netsh (or do anything else on the system). Combine it with the fact that the service can listen to requests from any application on the machine (or the network, if you so desire, but this is poison for security).

This way, you only need admin credentials to install the service, but not necessarily afterwards.

If you go this route, I recommend using WCF (Windows Communication Foundation) for the interprocess communication. It is very easy to establish protocol-independent links with it and you don't have to write any transport logic yourself.

There is also an API available for Windows Firewall, should you want to program it directly instead of via netsh.

Share this post


Link to post
Share on other sites
Quote:
Original post by Nik02
You could create a Windows Service that runs with admin or local system credentials and can call netsh (or do anything else on the system). Combine it with the fact that the service can listen to requests from any application on the machine (or the network, if you so desire, but this is poison for security).

This way, you only need admin credentials to install the service, but not necessarily afterwards.

If you go this route, I recommend using WCF (Windows Communication Foundation) for the interprocess communication. It is very easy to establish protocol-independent links with it and you don't have to write any transport logic yourself.

There is also an API available for Windows Firewall, should you want to program it directly instead of via netsh.


Excellent. Thank you.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!