Solved Run .pbk file in my software
-
@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.htmlHowever, 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. -
@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. -
@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. -
@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? :(
-
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 ?? -
Hi
Had to try it.
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. -
@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 ...............")
? -
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. -
@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. -
@mrjj
It has solved.
thanks for your help.
I just copy the .pbk file into this path. windows/system32/rast
best regards dear friends -
@saeidparand
that is good to hear :)