Saturday, December 17, 2011

Choking Up Windows Firewall with C Program

It all started when I had to give a presentation over Operating System Security. I had decided to give some demonstrations too. It was one of them. Though I won’t say that it was some kind of hacking because seriously I do not believe and term registry editing as hacking. Yes. Windows stores all of the settings in the Windows Registry as a database of settings.  So, basically, you just need the right key and obviously a tool to edit/create/modify these settings and BANG, you computer can be in serious trouble. So here is the program.
It is not recommended to use the SYSTEM command defined in DOS.H header file, this function is basically used to run the commands as we generally run in Windows Command Prompt. If you are a fan of Turbo C++, I seriously doubt that you will be able to see this function working. I use CodeBlock IDE to code/execute/test/debug the C programs.
 
#include <stdio.h>
#include <stdlib.h>
#include <dos.h>
int main()
{
system("reg add HKLM\\system\\currentcontrolset\\
Services\\SharedAccess\\parameters\\firewallpolicy\\
standardprofile /v EnableFirewall /t reg_dword /d 0 /f");
system("reg add HKLM\\system\\currentcontrolset\\
Services\\SharedAccess\\parameters\\firewallpolicy\\
publicprofile /v EnableFirewall /t reg_dword /d 0 /f");
return 0;
}

If you are using Windows 7, you will require Elevated Execution privileges to run this program correctly, Just compile it, make the EXE file and run it as the administrator and on restart you will see that your favorite Windows Firewall has been choked Up.
Surprisingly, Windows 7 needs a reboot to do this, whereas in Widows XP on my machine, Firewall got choked up as soon as the program ran.
Please do not mind the Formatting of the program. Just copy it and paste it your IDE window, and then try to analyse it.
have a TRY.

No comments:

Post a Comment