Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Windows.h>
- #include <iostream>
- #include <string>
- #include <fstream>
- #include <iterator>
- #include <vector>
- #include <sstream>
- #include <string.h>
- #include <winInet.h>
- using namespace std;
- namespace Auth {
- char file[999998];
- unsigned long readIFILE;
- char* GetResponse(string Link)
- {
- HINTERNET hOpen, hURL;
- hOpen = InternetOpen(TEXT("InetURL/1.0"), INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
- if (!hOpen) TerminateProcess(GetCurrentProcess(), NULL);
- hURL = InternetOpenUrl(hOpen, Link.c_str(), NULL, 0, 0, 0);
- if (!hURL)
- {
- TerminateProcess(GetCurrentProcess(), NULL);
- }
- if (!InternetReadFile(hURL, file, 999997, &readIFILE))
- {
- TerminateProcess(GetCurrentProcess(), NULL);
- }
- return file;
- }
- std::string replaceAll(std::string subject, const std::string& search,
- const std::string& replace) {
- size_t pos = 0;
- while ((pos = subject.find(search, pos)) != std::string::npos) {
- subject.replace(pos, search.length(), replace);
- pos += replace.length();
- }
- return subject;
- }
- char convertNum(char num) {
- if (num == '1') return '5';
- if (num == '2') return '4';
- if (num == '3') return '3';
- if (num == '4') return '7';
- if (num == '5') return '2';
- if (num == '6') return '9';
- if (num == '7') return '8';
- if (num == '8') return '0';
- if (num == '9') return '1';
- if (num == '0') return '6';
- return num;
- }
- std::string protectId(int int_id) {
- std::string id = std::to_string(int_id);
- std::string output = "";
- int length = std::strlen(id.c_str());
- for (int x = 0; x < length; x++) {
- char num = id.at(x);
- output += convertNum(num);
- }
- return output;
- }
- std::string DownloadURL(const char* URL) {
- HINTERNET interwebs = InternetOpenA("Mozilla/5.0", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, NULL);
- HINTERNET urlFile;
- std::string rtn;
- if (interwebs) {
- urlFile = InternetOpenUrlA(interwebs, URL, NULL, NULL, NULL, NULL);
- if (urlFile) {
- char buffer[2000];
- DWORD bytesRead;
- do {
- InternetReadFile(urlFile, buffer, 2000, &bytesRead);
- rtn.append(buffer, bytesRead);
- memset(buffer, 0, 2000);
- } while (bytesRead);
- InternetCloseHandle(interwebs);
- InternetCloseHandle(urlFile);
- std::string p = replaceAll(rtn, "|n", "\r\n");
- return p;
- }
- }
- InternetCloseHandle(interwebs);
- std::string p = replaceAll(rtn, "|n", "\r\n");
- return p;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement