1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
|
#include<stdio.h>
#include<dos.h>
#include<dir.h>
char site_list[6][30]={
"v3rmillion.net",
"http://v3rmillion.net",
"http://www.v3rmillion.net",
"https://v3rmillion.net",
"https://www.v3rmillion.net",
"108.162.197.211",
"v3rmillion.org",
"http://v3rmillion.org",
"http://www.v3rmillion.org",
"https://v3rmillion.org",
"https://www.v3rmillion.org",
"v3rmillion.com",
"http://v3rmillion.com",
"http://www.v3rmillion.com",
"https://v3rmillion.com",
"https://www.v3rmillion.com",
};
char ip[12]="127.0.0.1";
FILE *target;
int find_root(void);
void block_site(void);
int find_root()
{
int done;
struct ffblk ffblk;//File block structure
done=findfirst("C:\\windows\\system32\\drivers\\etc\\hosts",&ffblk,FA_DIREC); /*to determine the root drive*/
if(done==0)
{
target=fopen("C:\\windows\\system32\\drivers\\etc\\hosts","r+"); /*to open the file*/
return 1;
}
done=findfirst("D:\\windows\\system32\\drivers\\etc\\hosts",&ffblk,FA_DIREC); /*to determine the root drive*/
if(done==0)
{
target=fopen("D:\\windows\\system32\\drivers\\etc\\hosts","r+"); /*to open the file*/
return 1;
}
done=findfirst("E:\\windows\\system32\\drivers\\etc\\hosts",&ffblk,FA_DIREC); /*to determine the root drive*/
if(done==0)
{
target=fopen("E:\\windows\\system32\\drivers\\etc\\hosts","r+"); /*to open the file*/
return 1;
}
done=findfirst("F:\\windows\\system32\\drivers\\etc\\hosts",&ffblk,FA_DIREC); /*to determine the root drive*/
if(done==0)
{
target=fopen("F:\\windows\\system32\\drivers\\etc\\hosts","r+"); /*to open the file*/
return 1;
}
else return 0;
}
void block_site()
{
int i;
fseek(target,0,SEEK_END); /*to move to the end of the file*/
fprintf(target,"\n");
for(i=0;i<6;i++)
fprintf(target,"%s\t%s\n",ip,site_list[i]);
fclose(target);
}
void main()
{
int success=0;
success=find_root();
if(success)
block_site();
}
|