Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Run .pbk file in my software
Forum Updated to NodeBB v4.3 + New Features

Run .pbk file in my software

Scheduled Pinned Locked Moved Solved General and Desktop
14 Posts 2 Posters 2.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • mrjjM mrjj

    Hi
    That is a data file. I think its a RAS phone book files.
    In older windows, it was handled by
    c:\Windows\system32\Rasdial.exe
    but nowadays there is also
    rasphone -d "VPN connection name"

    In any case, your app cannot just "execute it"
    You need to use native api or QProcess to call a command line to
    do the connection.
    Some also use powerscripts to setup the connection. i seen on google.

    S Offline
    S Offline
    saeidparand
    wrote on last edited by
    #3

    @mrjj Dear friends thanks for your help.
    my software get Username / Password and another L2TP/IPsec VPN connection from JSON and then I must pass these data as a parameter to this .pbk file and software connect to the VPN as automatically.
    If I user QProcess I can run and pass parameters to this .pbk file?

    mrjjM 1 Reply Last reply
    0
    • S saeidparand

      @mrjj Dear friends thanks for your help.
      my software get Username / Password and another L2TP/IPsec VPN connection from JSON and then I must pass these data as a parameter to this .pbk file and software connect to the VPN as automatically.
      If I user QProcess I can run and pass parameters to this .pbk file?

      mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #4

      @saeidparand
      Hi
      You would run rasdial with QProcess , pointing to the pbk file.
      yes. you can give user name and password.
      https://ss64.com/nt/rasdial.html

      However, this is not very secure. It would be easy to replace the
      rasdial.exe with an evil program that would then be able to steal the
      username and password.

      S 3 Replies Last reply
      1
      • mrjjM mrjj

        @saeidparand
        Hi
        You would run rasdial with QProcess , pointing to the pbk file.
        yes. you can give user name and password.
        https://ss64.com/nt/rasdial.html

        However, this is not very secure. It would be easy to replace the
        rasdial.exe with an evil program that would then be able to steal the
        username and password.

        S Offline
        S Offline
        saeidparand
        wrote on last edited by
        #5

        @mrjj said in Run .pbk file in my software:

        ss

        thanks for your description.
        you said this is not more secure.....
        what is your opinion for solving this problem?
        because security is very important for this software.

        1 Reply Last reply
        0
        • mrjjM mrjj

          @saeidparand
          Hi
          You would run rasdial with QProcess , pointing to the pbk file.
          yes. you can give user name and password.
          https://ss64.com/nt/rasdial.html

          However, this is not very secure. It would be easy to replace the
          rasdial.exe with an evil program that would then be able to steal the
          username and password.

          S Offline
          S Offline
          saeidparand
          wrote on last edited by saeidparand
          #6

          @mrjj
          in fact I want to make a VPN connection as L2TP/IPsec in my software background.
          I googled and found , I can use .pbk file and set username / password and host name as parameters in my code.
          How can I handle this problem?
          best regards dear friend.

          1 Reply Last reply
          0
          • mrjjM mrjj

            @saeidparand
            Hi
            You would run rasdial with QProcess , pointing to the pbk file.
            yes. you can give user name and password.
            https://ss64.com/nt/rasdial.html

            However, this is not very secure. It would be easy to replace the
            rasdial.exe with an evil program that would then be able to steal the
            username and password.

            S Offline
            S Offline
            saeidparand
            wrote on last edited by saeidparand
            #7

            @mrjj
            I have Written this code :

            QProcess process;
            QString program = "F:/dev/wrokspace/QT-PROJECTS/sql_DB/L2TP-Connection.pbk";
            //QString program = "C:/Users/m/AppData/Local/NextVPN/NextVPN.exe";
            QStringList arguments = QStringList();
            
            arguments<< "[VPN]";
            arguments<< "MEDIA=rastapi";
            arguments<< "Port=VPN2-0";
            arguments<< "Device=WAN Miniport (IKEv2)";
            arguments<< "DEVICE=vpn";
            arguments<< "PhoneNumber=123456";
            QString user="user";
            QString pass="pass";
            
            arguments<< "rasdial \"VPN\" " +user + " " + pass + " /phonebook:\"" + program ;
            bool ret= process.startDetached(program,arguments);
            qDebug() << arguments;
            qDebug() << ret; ==> return false If I call the L2TP-Connection.pbk but If I call the NextVPN.exe returns true and of course I want run .pbk file in background , but this code open a new wizard.
            

            How can I solve this problem? :(

            1 Reply Last reply
            0
            • mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by mrjj
              #8

              Hi
              I dont know what NextVPN.exe is.
              It might take a parameter to be hidden.
              if not, there is nothing to do about it.

              rasdial is an exe file and normally not an argument so
              not sure i understand what you code tries.
              NextVPN needs other exe to work or why are you give rasdial.exe to next vpn ??

              1 Reply Last reply
              0
              • mrjjM Offline
                mrjjM Offline
                mrjj
                Lifetime Qt Champion
                wrote on last edited by mrjj
                #9

                Hi
                Had to try it.
                alt text

                I took empty pbk file.
                added a connection called MYNAME with the server settings
                and did not store username and password
                then i called it via rasdial
                rasdial MYNAME username password /PHONEBOOK:e:\secret.pbk
                and it just connected without show any dialogs etc.

                S 1 Reply Last reply
                1
                • mrjjM mrjj

                  Hi
                  Had to try it.
                  alt text

                  I took empty pbk file.
                  added a connection called MYNAME with the server settings
                  and did not store username and password
                  then i called it via rasdial
                  rasdial MYNAME username password /PHONEBOOK:e:\secret.pbk
                  and it just connected without show any dialogs etc.

                  S Offline
                  S Offline
                  saeidparand
                  wrote on last edited by
                  #10

                  @mrjj
                  I use this command , unfortunately It doesn't work.
                  It's thrown 623 Error code. even though I use this command in CMD as you wrote.
                  can I use this command in QT
                  system("rasdial ...............")
                  ?

                  1 Reply Last reply
                  0
                  • mrjjM Offline
                    mrjjM Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on last edited by mrjj
                    #11

                    Hi

                    error 623 - System could not find the phone book entry for this connection

                    so i think you are just trying random stuff and hope it works.

                    the MYNAME in my example is the actual name of the connection entry in the phone book.
                    you must match the name you used when you created the entry.

                    you can use QProcess to run it as i did in the cmd prompt.
                    system() also works but its considered bad pratice.
                    besides - QProcess give far better feedback options.

                    make sure all data matches up.
                    both entry name and location of the pbk file.

                    S 2 Replies Last reply
                    1
                    • mrjjM mrjj

                      Hi

                      error 623 - System could not find the phone book entry for this connection

                      so i think you are just trying random stuff and hope it works.

                      the MYNAME in my example is the actual name of the connection entry in the phone book.
                      you must match the name you used when you created the entry.

                      you can use QProcess to run it as i did in the cmd prompt.
                      system() also works but its considered bad pratice.
                      besides - QProcess give far better feedback options.

                      make sure all data matches up.
                      both entry name and location of the pbk file.

                      S Offline
                      S Offline
                      saeidparand
                      wrote on last edited by
                      #12

                      @mrjj
                      I know that error 623 is about phone book , but I am wonder that pbk file is exist and my path I'm sure is correct even all the input parameters are correct I'm sure but I don't know what the CMD thrown this error code.

                      1 Reply Last reply
                      0
                      • mrjjM mrjj

                        Hi

                        error 623 - System could not find the phone book entry for this connection

                        so i think you are just trying random stuff and hope it works.

                        the MYNAME in my example is the actual name of the connection entry in the phone book.
                        you must match the name you used when you created the entry.

                        you can use QProcess to run it as i did in the cmd prompt.
                        system() also works but its considered bad pratice.
                        besides - QProcess give far better feedback options.

                        make sure all data matches up.
                        both entry name and location of the pbk file.

                        S Offline
                        S Offline
                        saeidparand
                        wrote on last edited by
                        #13

                        @mrjj
                        It has solved.
                        thanks for your help.
                        I just copy the .pbk file into this path. windows/system32/rast
                        best regards dear friends

                        mrjjM 1 Reply Last reply
                        2
                        • S saeidparand

                          @mrjj
                          It has solved.
                          thanks for your help.
                          I just copy the .pbk file into this path. windows/system32/rast
                          best regards dear friends

                          mrjjM Offline
                          mrjjM Offline
                          mrjj
                          Lifetime Qt Champion
                          wrote on last edited by
                          #14

                          @saeidparand
                          that is good to hear :)

                          1 Reply Last reply
                          0

                          • Login

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • Users
                          • Groups
                          • Search
                          • Get Qt Extensions
                          • Unsolved