Jump to content

Not recognizing file inside an open & mapped TrueCrypt vault.


Recommended Posts

Hi All,

I discovered AutoIT three weeks ago and have been consumed and fascinated by it ever since.

Initially I borrowed bits and pieces of posted scripts and eventually completed a personalised GUI that lets me auto launch a combination of frequently used applications, like a VPN, a Cisco IP ‘phone, Webex meeting centre and so on.

It saves time and I am (was) very pleased with it.

Okay in the long run it hasn’t really saved any time as I have spent weeks learning how to use AutoIT but that has been enjoyable and the time is an investment, right? :D

At that point I had a working script that I was triggering from KeePass but decided that for security reasons it would be better if I could keep it inside a TrueCrypt vault that is in my DropBox folder.

The idea is that immediately after logging onto the machine I have a TrueCrypt window open and enter my secure password.

That in turn opens the vault (C:\Users\UserName\Dropbox\NewCrypt) where my compiled script (GUI.AU3) is located.

At this point I want the script to AutoRun or AutoPlay, but I have been trying for two days now and seem to have got nowhere.

The volume is mounted and the target plainly visible but nothing I try will find the file.

I have tried swapping the executable for a plain text file in case it was the file extension.

Scouring this forum has been really useful until this point, up until now I have really quite enjoyed being stuck on these problems but this one is really bugging me.

So far I have played with AutoRun.inf and associated Regedit hacks, I have tried GPEDIT and scripts using a whole variety of new (to me) Macros and commands - _GetTrueCryptVolume (Guinness wrote a promising script around this but I could not follow it through) –GetMountPath – DriveGetDrive - DriveMapGet- FileExists seemed most promising, but is somehow blind too…

So the question is; can anyone help me please?

How can I auto launch a file that is sitting in an open TrueCrypt vault, mapped as O:\GUI.AU3?

I am running Windows7 enterprise, SP1 x64.

Many thanks.

John

Link to comment
Share on other sites

Welcome, John.

You could try using ShellExecute, which runs a file with it's default launcher (in the case of a .au3 file, it would be AutoIt). That is, assuming that you have AutoIt set to run .au3 files instead of opening them with an editor.

Or you could compile the executable and you could run it with the Run command.

I have a question: what do you mean by "auto launch"? Do you want to run a script at startup or at a specific time? If you compiled your script, you could either add it to your startup folder (in the Start Menu) or run it with Windows' Task Scheduler.

#include <ByteMe.au3>

Link to comment
Share on other sites

Thanks for the welcome Sleepydvdr.

When I said ‘Auto-launch’ I mean for it to execute without needing to be clicked, much as it will from the startup folder.

Yes I do have it as a script and as an exe and did try to run the exe but it was just not seen.

So the executable is in C:UsersjringoDropboxNewCryptGUI.exe (so is the script too), when I launch TrueCrypt it maps that location as O:GUI.exe.

If I copy and paste that path into the RUN box it executes perfectly, but if I try to run it from Autoit the script exits without launching the GUI.

Yes I could put it in the startup folder – maybe that is the way to go – but I figured that as I have hard-coded passwords into the scriptexe it would be safer to keep it in the TC vault.

Also TBH it seems like something that should be possible so I wanted to crack it J

That is part of my addiction with Autoit, I think, trying to make it automate something just because I think it is possible!

Anyway I will look ino the ShellExecute option and see what can do.

Thanks for the input.

John

Link to comment
Share on other sites

What does the script contain that you're trying to run the program with? It might be easier to figure out where the problem is, if we can see what you're trying/have tried to do already and be able to suggest alternate methods. Please post a reproducer script that shows what it is you're running and demonstrates the problem encountered.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Well that cracked it, thank you Sleepydvdr!

After all my messing around all it needed was;

$val = ShellExecuteWait ( "GUI.exe","", "O:" )

Exit

BrewManNH - I love the Icon- I have seen your contributions all over the forums and am slightly embarassed to show you the code but as i am a noob I guess it would be good to have a critique.

I know there is a lot of rubbish in there but it is all new to me.

In time I will work on gettig the passewords out of there.

Anyway here it is;

#include <WindowsConstants.au3>

#include <GuiConstantsEx.au3>

#include <File.au3>

#include <IE.au3>

Global $hGui, $ChkBox[1], $Msg, $WGP

;Create the GUI

$hGui = GUICreate("Johnny Ringos Menu", 150, 275, -1, -1, $WS_OVERLAPPEDWINDOW)

;Top windows & Radio Buttons

GUICtrlCreateGroup("Presets:", 5, 20, 140, 75)

GUICtrlSetResizing(-1, BitOr($GUI_DOCKALL, $GUI_DOCKALL, $GUI_DOCKRIGHT)); <- Set the resizing for the control

$Radio10 = GUICtrlCreateRadio("Office", 20, 40, 70)

GUICtrlSetResizing(-1, BitOr($GUI_DOCKTOP, $GUI_DOCKVCENTER, $GUI_DOCKMENUBAR))

guictrlsetstate(-1,$gui_checked)

$Radio11 = GUICtrlCreateRadio("Home", 20, 60, 70)

GUICtrlSetResizing(-1, BitOr($GUI_DOCKTOP, $GUI_DOCKVCENTER, $GUI_DOCKMENUBAR))

guictrlsetstate(-1,$gui_unchecked)

$Radio12 = GUICtrlCreateRadio("All", 90, 40, 50)

GUICtrlSetResizing(-1, BitOr($GUI_DOCKTOP, $GUI_DOCKVCENTER, $GUI_DOCKMENUBAR))

guictrlsetstate(-1,$gui_unchecked)

$Radio13 = GUICtrlCreateRadio("None", 90, 60, 50)

GUICtrlSetResizing(-1, BitOr($GUI_DOCKTOP, $GUI_DOCKVCENTER, $GUI_DOCKMENUBAR))

guictrlsetstate(-1,$gui_unchecked)

;Launch Button

GUICtrlSetState(-1, $GUI_UNCHECKED)

$Save = GUICtrlCreateButton("LAUNCH",5, 210, 140, 55)

GUICtrlSetResizing(-1, BitOr($GUI_DOCKAUTO, $GUI_DOCKAUTO, $GUI_DOCKAUTO))

GUICtrlSetState(-1, $GUI_CHECKED)

;Create the tickboxes

$AnyConn = GUICtrlCreateCheckbox("AnyConnect", 25, 120, 125, 15)

GUICtrlSetResizing(-1, BitOr($GUI_DOCKAUTO, $GUI_DOCKAUTO, $GUI_DOCKAUTO)); <- Set the resizing for the control

guictrlsetstate(-1,$gui_unchecked)

$CIPC = GUICtrlCreateCheckbox("Cisco IP 'phone", 25, 140, 125, 15)

GUICtrlSetResizing(-1, BitOr($GUI_DOCKAUTO, $GUI_DOCKAUTO, $GUI_DOCKAUTO)); <- Set the resizing for the control

guictrlsetstate(-1,$gui_unchecked)

$Webex = GUICtrlCreateCheckbox("Webex Meetings", 25, 160, 125, 15)

GUICtrlSetResizing(-1, BitOr($GUI_DOCKAUTO, $GUI_DOCKAUTO, $GUI_DOCKAUTO)); <- Set the resizing for the control

guictrlsetstate(-1,$gui_checked)

$Truecrypt = GUICtrlCreateCheckbox("TrueCrypt", 25, 180, 125, 15)

GUICtrlSetResizing(-1, BitOr($GUI_DOCKAUTO, $GUI_DOCKAUTO, $GUI_DOCKAUTO)); <- Set the resizing for the control

guictrlsetstate(-1,$gui_unchecked)

GUISetState();Make GUI visible

While 1 ;Here is where we use the radio button selection to tick or untick boxes

$msg = GUIGetMsg()

Select

Case $msg = $Radio10 = $GUI_CHECKED ; i.e. Office is selected

GUICtrlSetState($CIPC,$GUI_UNCHECKED)

GUICtrlSetState($AnyConn,$GUI_UNCHECKED)

GUICtrlSetState($Webex,$gui_checked)

GUICtrlSetState($Truecrypt,$GUI_UNCHECKED)

Case $msg = $Radio11 = $GUI_CHECKED ; i.e. Home is selected

GUICtrlSetState($CIPC,$GUI_UNCHECKED); Office selected

GUICtrlSetState($AnyConn,$gui_checked)

GUICtrlSetState($Webex,$gui_checked)

GUICtrlSetState($Truecrypt,$GUI_UNCHECKED)

Case $msg = $Radio12 = $GUI_CHECKED ;With All selected

GUICtrlSetState($CIPC,$GUI_CHECKED)

GUICtrlSetState($AnyConn,$GUI_CHECKED)

GUICtrlSetState($Webex,$GUI_CHECKED)

GUICtrlSetState($Truecrypt,$GUI_CHECKED)

Case $msg = $Radio13 = $GUI_CHECKED ;With NONE selected

GUICtrlSetState($CIPC,$gui_UNchecked)

GUICtrlSetState($AnyConn,$gui_UNchecked)

GUICtrlSetState($Webex,$gui_UNchecked)

GUICtrlSetState($Truecrypt,$gui_UNchecked)

EndSelect

If $msg = -3 Then Exit ;GUI Closed?

If $msg = $Save Then ;lAUNCH button has been pressed, so next we check to see what has been ticked

EndIf

;Here is where we report the active tickboxes

If $msg = $Save Then

If GUICtrlRead($AnyConn) = $GUI_CHECKED Then

Run("C:Program Files (x86)CiscoCisco AnyConnect Secure Mobility Clientvpnui.exe")

sleep(4000)

WinWaitActive("")

ControlClick("", "", "[iD:1313]")

WinWaitActive("Cisco AnyConnect | 4.81.165.130")

ControlSend("Cisco AnyConnect | 4.81.165.130", "", "[CLASSNN:Edit2]", "password")

ControlClick("Cisco AnyConnect | 4.81.165.130", "", "[iD:1016]")

;MsgBox(0,"","AnyConnect Office selected")

EndIf

EndIf

If $msg = $Save Then

If GUICtrlRead($CIPC) = $GUI_CHECKED Then

Send("#r")

sleep(1000)

send("C:Program Files (x86)Cisco SystemsCisco IP Communicatorcommunicatork9.exe")

Send("{Enter}")

winwait ("Communicator - Exception Error")

ControlClick("Communicator - Exception Error", "", "[iD:2]")

;Exit

;MsgBox(0,"","CIPC Office selected")

EndIf

EndIf

If $msg = $Save Then

If GUICtrlRead($Webex) = $GUI_CHECKED Then

$oIE = _IECreate ("https://emeeting.themeetingson.com")

Send("08005551234")

Send("{TAB }")

Send("1234567")

Send("{TAB }")

Send("1234")

Send("{TAB }")

Send("{TAB }")

Send("{Enter}")

;MsgBox(0,"","Webex Office selected")

EndIf

EndIf

If $msg = $Save Then

If GUICtrlRead($Truecrypt) = $GUI_CHECKED Then

Run(@ComSpec & " /c " & 'truecrypt /v C:UsersjringoDropboxIMcrypt /lx /a /p password/e /b', "", @SW_HIDE)

;MsgBox(0,"","Truecrypt Office selected")

EndIf

EndIf

WEnd

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

While 2

$Msg = GUIGetMsg()

Switch $Msg

Case $GUI_EVENT_CLOSE

Exit

Case $ChkBox[0] To $ChkBox[uBound($ChkBox) - 1]

$WGP = WinGetPos($hGui)

If GUICtrlRead($Msg) = $GUI_CHECKED Then

ReDim $ChkBox[uBound($ChkBox) + 1]

$ChkBox[uBound($ChkBox) - 1] = GUICtrlCreateCheckbox("Add another checkbox", 5, ((UBound($ChkBox) - 1) * 25) + 5, 125, 15)

GUICtrlSetResizing(-1, BitOr($GUI_DOCKTOP, $GUI_DOCKLEFT, $GUI_DOCKSIZE)) ; <- Set the resizing for the control

If UBound($ChkBox) - 1 >= 2 Then GUICtrlSetState($ChkBox[uBound($ChkBox) - 3], $GUI_DISABLE)

WinMove($hGui, "", Default, Default, Default, $WGP[3] + 25)

Else

GUICtrlDelete($ChkBox[uBound($ChkBox) - 1])

If UBound($ChkBox) - 1 >= 2 Then GUICtrlSetState($ChkBox[uBound($ChkBox) - 3], $GUI_ENABLE)

ReDim $ChkBox[uBound($ChkBox) - 1]

WinMove($hGui, "", Default, Default, Default, $WGP[3] - 25)

EndIf

EndSwitch

WEnd

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...