Advertisement
Guest User

Untitled

a guest
May 29th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.83 KB | None | 0 0
  1. void ModemConnection::telnetMessage(const QString &msg)
  2. {
  3.     tBuffer.append(msg);
  4.    // qDebug() << msg;
  5.     if(!telnetLoggedInState)
  6.     {
  7.         //qDebug() << tBuffer;
  8.         if(msg.contains("Login: ") || msg.contains("Username : "))
  9.             telnet->sendData(user);
  10.         else if(msg.contains("Password: ") || msg.contains("Password : ") || msg.contains("Password")){
  11.             //qDebug() << pass;
  12.             telnet->sendData(pass);
  13.             //This is needed for the fuckig horid comtrend telnet server that doesn't return the prompt
  14.             if(tBuffer.contains("BCM96358 ADSL Router")){
  15.                 status = "Testing log in";
  16.                 //setLoggedInState(true);
  17.                 clearTelnetBuffer();
  18.                 emit modemStatusUpdated();
  19.             }
  20.         }
  21.         if (msg.contains("#") || msg.contains("~")  || msg.contains(">")
  22.             || tBuffer.contains("=>") || tBuffer.contains(">"))
  23.         {
  24.             status = "Logged in";
  25.             setLoggedInState(true);
  26.             clearTelnetBuffer();
  27.             emit modemStatusUpdated();
  28.         }
  29.         if(msg.contains("Login incorrect") || msg.contains("Invalid username/password"))
  30.         {
  31.             setLoggedInState(false);
  32.             status = "Login incorrect";
  33.             emit modemStatusUpdated();
  34.         }
  35.         if(msg.contains("?\nhelp")){
  36.             status = "Logged via Horid Comtrend Hack";
  37.             setLoggedInState(true);
  38.             clearTelnetBuffer();
  39.             emit modemStatusUpdated();
  40.         }
  41.     }
  42.  
  43.     emit telnetBufferUpdated();
  44. }
  45.  
  46.  
  47. void MainWindow::checkModemStatus()
  48. {
  49.     updateStatusBar("modem",modemConnection->getStatus());
  50. //Hack for comtrend routers
  51.     if(modemConnection->getStatus() == "Testing log in"){
  52.         modemConnection->telnet->sendData("help");
  53.     }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement