現在一些小軟件,控制更新的方法一般都是HTTP讀文件,判斷讀到的文本是否等於版本號
或者判斷QQ昵稱,網盤昵稱等等。
以上都有自己的缺點,這裡推薦一個DNS控制軟件更新的後門,防ddos。
#include <Winsock2.h>
#include <Urlmon.h>
#pragma comment(lib,"Urlmon.lib")
#pragma comment (lib,"ws2_32.lib")
int main()
{
int err = 0;
char szIP[100] = {0};
char strServer[100] = {0};
WORD wVersionRequested = 0;
WSADATA wsaData = {0};
struct hostent* phe = NULL;
strcpy(strServer,"www.baidu.com");
wVersionRequested = MAKEWORD(1,1); //0x0101
WSAStartup(wVersionRequested,&wsaData);
phe = gethostbyname(strServer);
if (NULL != phe)
{
char ** ppAddr = phe->h_addr_list ;
for (;*ppAddr != NULL ;ppAddr ++)
{
strcpy(szIP,inet_ntoa(*(LPIN_ADDR)*(ppAddr)));
//printf("%s\n",szIP);
}
}
WSACleanup();
if(strcmp(szIP,"1.0.3.1")) //可以寫軟件版本號 自己發揮
{
::MessageBox(NULL,"檢測到更新","",MB_OK);
ShellExecute(NULL,"open","http://www.baidu.com/gengxin.asp",NULL,NULL,SW_SHOW);
ExitProcess(0);
}
return 0;
}