Advertisement
CrazIIZen

Untitled

May 8th, 2017
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.42 KB | None | 0 0
  1. #include <Windows.h>
  2. #include <iostream>
  3. #include <string>
  4. #include <fstream>
  5. #include <iterator>
  6. #include <vector>
  7. #include <sstream>
  8. #include <string.h>
  9. #include <winInet.h>
  10. using namespace std;
  11.  
  12. namespace Auth {
  13. char file[999998];
  14. unsigned long readIFILE;
  15.  
  16. char* GetResponse(string Link)
  17. {
  18. HINTERNET hOpen, hURL;
  19. hOpen = InternetOpen(TEXT("InetURL/1.0"), INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
  20.  
  21. if (!hOpen) TerminateProcess(GetCurrentProcess(), NULL);
  22.  
  23. hURL = InternetOpenUrl(hOpen, Link.c_str(), NULL, 0, 0, 0);
  24. if (!hURL)
  25. {
  26. TerminateProcess(GetCurrentProcess(), NULL);
  27. }
  28.  
  29. if (!InternetReadFile(hURL, file, 999997, &readIFILE))
  30. {
  31. TerminateProcess(GetCurrentProcess(), NULL);
  32. }
  33. return file;
  34. }
  35.  
  36. std::string replaceAll(std::string subject, const std::string& search,
  37. const std::string& replace) {
  38. size_t pos = 0;
  39. while ((pos = subject.find(search, pos)) != std::string::npos) {
  40. subject.replace(pos, search.length(), replace);
  41. pos += replace.length();
  42. }
  43. return subject;
  44. }
  45.  
  46. char convertNum(char num) {
  47. if (num == '1') return '5';
  48. if (num == '2') return '4';
  49. if (num == '3') return '3';
  50. if (num == '4') return '7';
  51. if (num == '5') return '2';
  52. if (num == '6') return '9';
  53. if (num == '7') return '8';
  54. if (num == '8') return '0';
  55. if (num == '9') return '1';
  56. if (num == '0') return '6';
  57. return num;
  58. }
  59.  
  60. std::string protectId(int int_id) {
  61. std::string id = std::to_string(int_id);
  62. std::string output = "";
  63. int length = std::strlen(id.c_str());
  64. for (int x = 0; x < length; x++) {
  65. char num = id.at(x);
  66. output += convertNum(num);
  67. }
  68. return output;
  69. }
  70.  
  71.  
  72.  
  73. std::string DownloadURL(const char* URL) {
  74. HINTERNET interwebs = InternetOpenA("Mozilla/5.0", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, NULL);
  75. HINTERNET urlFile;
  76. std::string rtn;
  77. if (interwebs) {
  78. urlFile = InternetOpenUrlA(interwebs, URL, NULL, NULL, NULL, NULL);
  79. if (urlFile) {
  80. char buffer[2000];
  81. DWORD bytesRead;
  82. do {
  83. InternetReadFile(urlFile, buffer, 2000, &bytesRead);
  84. rtn.append(buffer, bytesRead);
  85. memset(buffer, 0, 2000);
  86. } while (bytesRead);
  87. InternetCloseHandle(interwebs);
  88. InternetCloseHandle(urlFile);
  89. std::string p = replaceAll(rtn, "|n", "\r\n");
  90. return p;
  91. }
  92. }
  93. InternetCloseHandle(interwebs);
  94. std::string p = replaceAll(rtn, "|n", "\r\n");
  95. return p;
  96. }
  97. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement