HACKING 120% {Hacking, programmazione, computer & molto altro}

[C/Windows] click

« Older   Newer »
  Share  
vogy
view post Posted on 20/9/2014, 13:03     +1   -1




Sempre per il non conoscere le politiche del forum potrei dire che questo programmino...
'prende un link da una pagina web e ne simula il click da locale'
Nell'esempio raccoglie da sprunge.us il link dela nostra homepage e lo clicca, operazione ripetuta ogni 2 secondi.
Chi vuole capire capisce
CODICE
#include <windows.h>
#include <WinInet.h>
#include <tchar.h>
//#include <stdio.h>

HINTERNET hOpen;
void urlParse(char* url, char** urlText);

int main()
{
       while(1)
       {
   hOpen = InternetOpen("Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Firefox/31.0",
                           INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
   char* urlText;
   urlParse("http://sprunge.us/RXNF", &urlText);
   // printf("%­s",urlText);
   char* click = urlText;
   urlParse(click, &urlText);
   free(urlText);
       Sleep(2*1000);
       }
   return 0;
}

void urlParse(char* url, char** urlText)
{
   HINTERNET hConnect = InternetConnect(hOpen, _T(""),INTERNET_DEFAULT_HTTP_PORT, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 1);
   HINTERNET hOpenUrl = InternetOpenUrl(hOpen, url, NULL, 0, 0, 0);
   if (hOpenUrl)
   {
       char Buffer[4096];
       char szBuffer[1024];
       memset(szBuffer, 0x00, sizeof(szBuffer));
       DWORD bytesRead;

       char* temp = Buffer;
       while (InternetReadFile(hOpenUrl, temp, 1024, &bytesRead) == TRUE && bytesRead > 0)
       {
           temp += bytesRead;
       }
       *temp = '\0';
       *urlText = malloc(strlen(Buffer) + 1);
       strcpy (*urlText, Buffer);
   }
   InternetCloseHandle(hOpenUrl);
   InternetCloseHandle(hConnect);
}
 
Top
0 replies since 20/9/2014, 13:03   78 views
  Share