Guest User

Untitled

a guest
Jul 22nd, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.98 KB | None | 0 0
  1. #include <windows.h>
  2. #include <winsock.h>
  3. #include <iostream>
  4. #include <stdio.h>
  5. using namespace std;
  6. #define _WIN32_WINNT 0x0501
  7.  
  8. int i;
  9. const int iReqWinsockVer = 2;
  10. WSADATA wsaData;
  11. SOCKET hSocket;
  12. char *sendbuf = "\x4D\x53\x47\x20\x31\x32\x31\x20\x4E\x20\x31\x32\x31\x0D\x0A\x4D\x49\x4D\x45\x2D\x56\x65\x72\x73\x69\x6F\x6E\x3A\x20\x31\x2E\x30\x0D\x0A\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3A\x20\x74\x65\x78\x74\x2F\x70\x6C\x61\x69\x6E\x3B\x20\x63\x68\x61\x72\x73\x65\x74\x3D\x55\x54\x46\x2D\x38\x0D\x0A\x58\x2D\x4D\x4D\x53\x2D\x49\x4D\x2D\x46\x6F\x72\x6D\x61\x74\x3A\x20\x46\x4E\x3D\x53\x65\x67\x6F\x65\x25\x32\x30\x55\x49\x3B\x20\x45\x46\x3D\x3B\x20\x43\x4F\x3D\x30\x3B\x20\x43\x53\x3D\x31\x3B\x20\x50\x46\x3D\x30";
  13.  
  14. int main()
  15. {
  16. struct hostent* HostServer;
  17. if(WSAStartup(MAKEWORD(iReqWinsockVer,0), &wsaData)==0)
  18. {
  19. //Check Version
  20. if (LOBYTE(wsaData.wVersion) >= iReqWinsockVer)
  21. {
  22. //Winsock functions
  23. hSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
  24. if (hSocket==INVALID_SOCKET)
  25. {
  26. cout << "Couldn't create Socket..." << endl;
  27. }
  28. sockaddr_in sockAddr;
  29. sockAddr.sin_family = AF_INET;
  30. sockAddr.sin_port = htons(1863);
  31. sockAddr.sin_addr.S_un.S_addr = inet_addr("65.54.189.76");
  32. connect(hSocket, (sockaddr*)(&sockAddr), sizeof(sockAddr));
  33. if (connect(hSocket, (sockaddr*)(&sockAddr), sizeof(sockAddr))!=0)
  34. {
  35. cout << "Couldn't establish connection..." << endl;
  36. WSACleanup();
  37. }
  38. else
  39. {
  40. while(i != 100)
  41. {
  42. send(hSocket,sendbuf,strlen(sendbuf),0);
  43. i++;
  44. }
  45. }
  46. }
  47. else
  48. {
  49. cout << "Required Winsock version not available..." << endl;
  50. //Required version not avaliable
  51. }
  52.  
  53. //Cleanup...
  54. if (WSACleanup()!=0)
  55. {
  56. //the Cleanup failed...
  57. }
  58. }
  59. else
  60. {
  61. //the startup failed..
  62. }
  63. closesocket(hSocket);
  64. Sleep(5000);
  65. return 0;
  66. }
Add Comment
Please, Sign In to add comment