1. #include <iostream>
  2. #include <fstream>
  3. #include <string>
  4. #include <boost/asio.hpp>
  5. #include <boost/lexical_cast.hpp>
  6.  
  7. using namespace std;
  8. using boost::lexical_cast;
  9. using namespace boost::asio::ip;
  10. int main()
  11. {
  12. ifstream file("cookie");
  13. string cookie;
  14. file >> cookie;
  15.  
  16. if (file.is_open() == false)
  17. {
  18. cout << "Keine Kekse keine Arme :/" << endl;
  19. return 0;
  20. }
  21.  
  22.  
  23. cout << "Let's see..." << endl;
  24. string tanga;
  25. tanga = "GET / HTTP/1.0\r\n";
  26. tanga += "Host: www.losefriends.de\r\n";
  27. tanga += "Cookie: " + cookie + "\r\n";
  28.  
  29. tcp::iostream page( "www.losefriends.de", "http" );
  30. page << tanga << "\r\n" << flush;
  31.  
  32.  
  33. string response = lexical_cast<string>( page.rdbuf() );
  34. size_t pos0 = response.find( "Kontoguthaben:" );
  35. size_t pos1 = response.find( "Bonuslose:", pos0);
  36. size_t pos2 = response.find( "Dein Tagesumsatz:", pos1);
  37. size_t pos3 = response.find( "Platz&nbsp;&nbsp;&nbsp;" );
  38. size_t pos4 = response.find( "mit", pos3 );
  39.  
  40. pos0 += 24;
  41. pos1 += 20;
  42. pos2 += 25;
  43. pos3 += 24;
  44. pos4 += 7; // der muss noch 3 Zeichen weiter springen
  45.  
  46. size_t pend0 = response.find( " ", pos0 );
  47. size_t pend1 = response.find( " ", pos1 );
  48. size_t pend2 = response.find( " ", pos2 );
  49. size_t pend3 = response.find( "&", pos3 ); // der endet bei " " und nicht bei " "
  50. size_t pend4 = response.find( " ", pos4 ); // dafuer endet der dann bei " "
  51.  
  52. string score0;
  53. score0 = lexical_cast<string>( response.substr( pos0, pend0-pos0 ));
  54. string score1;
  55. score1 = lexical_cast<string>( response.substr( pos1, pend1-pos1 ));
  56. string score2;
  57. score2 = lexical_cast<string>( response.substr( pos2, pend2-pos2 ));
  58. string score3;
  59. score3 = lexical_cast<string>( response.substr( pos3, pend3-pos3 ));
  60. string score4;
  61. score4 = lexical_cast<string>( response.substr( pos4, pend4-pos4 ));
  62.  
  63. cout << "Kontoguthaben: \t\t" << score0 << endl;
  64. cout << "Bonuslose: \t\t" << score1 << endl;
  65. cout << "Dein Tagesumsatz: \t" << score2 << endl;
  66. cout << "Dein Rang: \t\t" << score3 << endl; // der brauchte noch einen tab mehr damits passt =)
  67. cout << "Punkte: \t\t" << score4 << endl; // der auch, muss ja schoen aussesehen
  68. }