I was kinda lazy today so I wrote a "useless" bit of code.... ;)
So those are two very small C programs release and renew.
Release will dump IP and cut all internet connections.
Renew will renew IP and enable connections.
How does it work?
The original CMD script is very simple :
ipconfig / release followed by ipconfig / renew and exit.
This is use to renew ip…. but here I will be using it to cut connections.
So the release program creates a .bat file when executed in the same folder where it is located
–now if you double click on this lets call it test.bat file it will cut all ip configurations.
To renew ip you ether change the test.bat files code which for now is:
now if you put renew in the place of release and run the file again it will renew IP and connection, and this is exactly what renew.exe does.
Got to remember release and renew only create, write or edit the test.bat file but don’t do changes to cmd, for that you need to run the .bat file.
****Just for fun
Here is the code :
FILE* fopen(const char* new_file, const char* w);
int main(int argc, char *argv)
FILE* new_file = NULL;
new_file = fopen(“test.bat” , “w+”);
if(new_file != NULL)
//write and read
fputs(“@echo off\nIpconfig/release\n”, new_file);
printf(“Can’t open file — test.txt”);
renew is same thing only command changed to renew.
Here you will find those two files….link