1

I have to use VPN app to login to our corporate network (Pulse Secure). It is very cumbersome and breaks connection every few hours and asks for password again and again. There is no way to save name/pass in that app.

I have managed to write an AutoIt script that does initial login. But it does not work stable on my win7 and it does not reconnect automatically. Moreover it is not secure as the password is there in plain text. Unfortunately I was not able to implement master-pass scheme - provided Autoit functions simply did not work (or I am being too lazy to investigate).

I am using RoboForm for web forms filling - maybe it is capable of automatic windows form filling and submission? Or any other software (LastPass?) is capable of:

  • Detect that particular window has been activated (by window class or caption or both)
  • Automatically fill fields in that windows and press button

My autoit script for pulse secure:

#include <Constants.au3>

;
; AutoIt Version: 3.0
; Language:       English
; Platform:       Win9x/NT
; Author:         AKA
;
; Script Function:
;   Connects Pulse Secure.

;#AutoIt3Wrapper_Run_Debug_Mode=Y

; kill existing
ProcessClose ( "pulse.exe" )
;Sleep(2000)

Run("C:\Program Files (x86)\Common Files\Juniper Networks\JamUI\Pulse.exe")

;splash bypass
WinWaitActive("[TITLE:Splash; CLASS:JamShadowClass]")
WinWaitNotActive("[TITLE:Splash; CLASS:JamShadowClass]")

;get main window active
Local $hWnd = WinWaitActive("[TITLE:Pulse Secure; CLASS:JamShadowClass]")

;connect
ControlClick($hWnd, "", "[TEXT:Connect; CLASSNN:JAM_BitmapButton8]")

;AutoItSetOption("SendKeyDelay", 400)

;wait connect window
Local $hWnd = WinWaitActive("[TITLE:Connect to: KB; CLASS:JamShadowClass]")
Send("password")
Send("{ENTER}")


WinWaitNotActive("[TITLE:Connect to: KB; CLASS:JamShadowClass]")

WinClose("[TITLE:Pulse Secure; CLASS:JamShadowClass]")
  • You say "But it does not work stable on my win7 and it does not reconnect automatically" so run if more often as a scheduled task to confirm it something does NOT exist then do connect actions again... or find something that does exist if the connection drops to then do the connection again. Restrict who can access this machine until you figure out how to encrypt the password. You could run your same working code but add some check logic at the front to see if it needs to run connect logic or else end, so check every 5-10 minutes, run or don't run, end and check again later... – Pimp Juice IT Sep 19 '16 at 22:38
  • Maybe check into using... AutoItSetOption ("MouseCoordMode", 0) or see if it'd help any for Window clicks... I also always use the #RequireAdmin up top too... Look into ControlSend as well... plus look into If WinExists() and / or If Not WinExists() functions for checking if something does or does not need to run... Just quick ideas for things I've used that do run successful to do something when it runs and I'm not on the machine... it's solid for me.... just quick ideas though but your logic looks good too... – Pimp Juice IT Sep 19 '16 at 22:45
  • @Homey_D_Clown_IT: thank you, I will try your suggestions. The problem I am facing is I cannot determine correctly current connection state between these: disconnected; connected, not logged; connected and logged. There is a particular window with button with no text (icon only). – Anton Krouglov Sep 21 '16 at 11:33
  • When you get a chance, copy the Summary detail to a comment that this window has in it when looking that over with the Au3Info_x64.exe, etc. tool. I'm curious what meta data is available for this Window. – Pimp Juice IT Sep 21 '16 at 11:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.