I have a CLI application, its a Checkpoint VPN CLI utility called “trac”.
it can be run in a following way:
trac connect -s yourSite.com
then it prompts for an input, first for the username:
C:Program Files (x86)CheckPointEndpoint Connect>trac connect -s mySite.com
Connecting to mySite...............
Detecting Proxy Configuration...............
Resolving site name...............
Detecting site connectivity...............
GetAuthInfoStep...............
Challenge: username <cursor stays after the word "username" and awaits input of a username>
Then if you entered a username and pressed Enter, it continues to run and produces the following output:
C:Program Files (x86)CheckPointEndpoint Connect>trac connect -s mySite.com
Connecting to mySite...............
Detecting Proxy Configuration...............
Resolving site name...............
Detecting site connectivity...............
GetAuthInfoStep...............
Challenge: username**[email protected]** // bold text is what I entered
Connecting to site...............
Policy on gateway has changed...............
Detecting Proxy Configuration...............
Resolving site name...............
Retrieving site information...............
Checking if a client update is available...............
GetAuthInfoStep...............
Connecting to site...............
Challenge: password: <cursor again stays after the word "password" and awaits input and Enter press>
So, what I need is to learn if there is a way to code a bat script that will:
- run this command.
- when the application asks for username the script is gonna enter the username and press enter.
- when the application asks for password the script is gonna enter the password and press enter.
Trying to automate my everyday VPN login at work, but for now all I found in the internets was “how to login to a website”, and none of the questions resemble mine.
I tried something like this:
cd C:Program Files (x86)CheckPointEndpoint Connect
echo username & echo password| trac connect -s mySite.com
pause
It produces the following output:
C:Program Files (x86)CheckPointEndpoint Connect>echo usernam & echo password| trac connect -s mySite.com
username
password
Connecting to mySite...............
Detecting Proxy Configuration...............
Resolving site name...............
Detecting site connectivity...............
GetAuthInfoStep...............
Challenge: usernameConnecting to site...............
Policy on gateway has changed...............
Detecting Proxy Configuration...............
Resolving site name...............
Retrieving site information...............
Checking if a client update is available...............
GetAuthInfoStep...............
Connecting to site...............
Challenge: password: <and then stays here forever, not reacting to my keyboard input, only reacts to CTRL+C and asks if I want to stop the batch script>
Any hints how I can do that? Thx in advance!
R3VAN is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.