Sign in to follow this  
Followers 0
savj14

OpenVPN and AutoIt

6 posts in this topic

#1 ·  Posted (edited)

Not sure if anything like this has been done in AutoIt, but after doing some searching I didn't find anything. What I want to do is setup an Unattended/Silent Install of OpenVPN. And then have an AutoIt GUI to handle Connecting and Disconnecting. Somewhat like a Cisco VPN Client, but obviously less complex.

The Install Package I have is customized to fit my needs already and I can share the Howto on this. So the first thing I need to figure out I guess is how OpenVPN handles Connecting/Disconnecting.

Is anyone interested in helping out with this? I figure we can share code back and forth and have a group effort here.

Edited by savj14

Share this post


Link to post
Share on other sites



I am trying to make a portable (USB Flash drive) version of OpenVPN that will:

1 install the TAP interface

2 open a vpn connection as per parameters in an xml file

3 I want a value in the xml file to optionally launch an outside application after connection is established

4 the application will then create and run an executable on the hard drive of the system (this executable monitors for when the flash drive has been removed, then it remove all traces of openvpn and delete itself.)

Thats it!

i am moving along rather slowly but as of now i can fully install and uninstall openvpn and ive created functions for it. The only thing that i cant figure out how to do is to somehow differentiate the tap interface that this script will create from any possible tap interfaces already installed on teh system, wouldnt want to remove something important...

Im gonna need either a little help or more time with the xml part.

Share this post


Link to post
Share on other sites

Not sure if anything like this has been done in AutoIt, but after doing some searching I didn't find anything. What I want to do is setup an Unattended/Silent Install of OpenVPN. And then have an AutoIt GUI to handle Connecting and Disconnecting. Somewhat like a Cisco VPN Client, but obviously less complex.

The Install Package I have is customized to fit my needs already and I can share the Howto on this. So the first thing I need to figure out I guess is how OpenVPN handles Connecting/Disconnecting.

Is anyone interested in helping out with this? I figure we can share code back and forth and have a group effort here.

YES - I am looking to do the following:

Install OpenVPN with a not-very-secure initial certificate/config, start service

Install uVNC, install as service, start service, set admin options (password...)

Have AutoIT ask for a code, then send the code over the not-very-secure VPN to a server that links the activation code to a user account, then generates and sends the secure certificates to the user. Remove the initial VPN config/certificates, install the correct ones, then restart the OpenVPN service.

So, I'm new to AutoIT, but I know UltraVNC and OpenVPN well, and PHP/Linux (LAMP) very very well. Mine is more complicated than what you wanted, but if we can generate your code, I can do mine.

My plan for the OpenVPN install so far is to have AutoIT include the installers, start the OpenVPN installer, hide the window, and chose all of the options as fast as possible. Basically like the start of the Notepad example, where it starts the program, then adds text to a certain area.

The reason for this - I run a small IT service company in Minnesota. I would really like a very simple installer for my new clients to download that would do all of this, so that I can securely communicate with them over the VPN. Eventually I may include an Adobe Air app that works like a IM client, but more securely and will tie into my ticket tracking system on my VPN server.

I'll post what I have when I actually have something, but if you've worked on this, can you send me what you have? Either post or PM me. I probably won't post all of the code here for security reasons, but I'll at least get the OpenVPN stuff online publicly.

~Luck

Share this post


Link to post
Share on other sites

Not sure if anything like this has been done in AutoIt, but after doing some searching I didn't find anything. What I want to do is setup an Unattended/Silent Install of OpenVPN. And then have an AutoIt GUI to handle Connecting and Disconnecting. Somewhat like a Cisco VPN Client, but obviously less complex.

The Install Package I have is customized to fit my needs already and I can share the Howto on this. So the first thing I need to figure out I guess is how OpenVPN handles Connecting/Disconnecting.

Is anyone interested in helping out with this? I figure we can share code back and forth and have a group effort here.

Following the Notepad example, here's a bit of code:

; OpenVPN client setup v1
dim $ver = "2.0.9"
run("openvpn-setup.exe")

WinWaitActive("OpenVPN "&ver&"  Setup","Welcome to the OpenVPN");NOTICE the double space after the version! I.E. "  " not " "
Send("!n")
WinWaitActive("OpenVPN "&$ver&"  Setup","Press Page Down to see the rest of the agreement.")
Send("!a")
WinWaitActive("OpenVPN "&$ver&"  Setup","Choose Components")
Send("!n")
WinWaitActive(OpenVPN "&$ver&"  Setup","Choose Install Location")
Send("!i")

This works if you have a zip file with the complied exe and a renamed openvpn install exe. I'm working on including it in a single exe, too.. I hate zip files for stuff like this!

Share this post


Link to post
Share on other sites

Not sure if anything like this has been done in AutoIt, but after doing some searching I didn't find anything. What I want to do is setup an Unattended/Silent Install of OpenVPN. And then have an AutoIt GUI to handle Connecting and Disconnecting. Somewhat like a Cisco VPN Client, but obviously less complex.

The Install Package I have is customized to fit my needs already and I can share the Howto on this. So the first thing I need to figure out I guess is how OpenVPN handles Connecting/Disconnecting.

Is anyone interested in helping out with this? I figure we can share code back and forth and have a group effort here.

; OpenVPN client setup v1
; Need to see if OpenVPN installed - Uninstall if already installed. 
dim $ver = "2.0.9"
run("openvpn-setup.exe","",@SW_MINIMIZE)
WinWait("OpenVPN "&$ver&"  Setup","Welcome to the OpenVPN")
ControlSend("OpenVPN "&$ver&"  Setup","Welcome to the OpenVPN","[CLASS:Button; INSTANCE:2]","!n")
ControlSend("OpenVPN "&$ver&"  Setup","Press Page Down to see the rest of the agreement.","[CLASS:Button; INSTANCE:2]","!a")
ControlSend("OpenVPN "&$ver&"  Setup","Choose Components","[CLASS:Button; INSTANCE:2]","!n")

;; Uncomment this to actually install!
ControlSend("OpenVPN "&$ver&"  Setup","Choose Install Location","[CLASS:Button; INSTANCE:2]","!i")




; That installs OpenVPN as default (all options). Need to remove start menu folders and desktop icons. Also, add a GUI!

WinSetState("OpenVPN "&$ver&"  Setup","",@SW_RESTORE);To show install progress, if desired... 

dim $windowxp = 0
dim $windowvista = 0
Do
    $windowxp = WinExists("Hardware Installation","TAP-Win32 Adapter V8")
    $windowvista = WinExists("OpenVPN "&$ver&"  Setup","Installation Complete")
Until $windowvista = 1 Or $windowxp = 1
if $windowxp = 1 Then
;Doesn't always come up - Find a workaround! Loop maybe???
    WinWait("Hardware Installation","TAP-Win32 Adapter V8")
    dim $ret = ControlSend("Hardware Installation","TAP-Win32 Adapter V8","[CLASS:Button; INSTANCE:1]","{SPACE}")
EndIf
ControlSend("OpenVPN "&$ver&"  Setup","Installation Complete","[CLASS:Button; INSTANCE:2]","!n")
; Need to uncheck (if checked) the View Readme radio box... 
WinActivate("OpenVPN "&$ver&"  Setup","Completing the OpenVPN")
ControlCommand("OpenVPN "&$ver&"  Setup","Completing the OpenVPN","[CLASS:Button; INSTANCE:4]","UnCheck","")
ControlSend("OpenVPN "&$ver&"  Setup","Completing the OpenVPN","[CLASS:Button; INSTANCE:2]","!f")

Share this post


Link to post
Share on other sites

Hey - i am looking into the same thing... creating a custom frontend for openvpn.

Does anyone has a similar script? - if one wants to share.. would be great.. so i do not start it from scratch.

Maybe we can also put it somewhere.. on github so anyone can use it.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0