Sign in to follow this  
Followers 0
dali

Can't automate command line menu driven program

2 posts in this topic

#1 ·  Posted (edited)

Hi.

I've been trying to create an unattended install of DiskCryptor, an open source disk encryption software.

The only thing that can't be configured using command line parameters (to DiskCryptor) is to enable the boot loader to use a keyfile instead of a password.

The command used looks like this:

"C:Program Filesdcryptdccon.exe" -boot -config hd0

That brings up a text menu (in a command prompt) and you can use it to change the config of the boot loader. What I'm trying to is to send this sequence:

1

4

C:Program Filesdcryptkeyfileskeyfile.dat

2

7

7

I want this to work behind a locked desktop, which means that I've been using ConsoleSend to send the keystrokes. If I run it with the deskop open, it works.

If I lock the desktop and run it, this is the result:

1

4

C.+Program Files+dcrypt+keyfiles+keyfile.dat

2 (ignored)

7 (ignored)

7 (ignored)

For some reason the keys that need Shift or AltGr (on a Swedish keyboard) are now "unshifted" and the path to the keyfile is incorrect. The config program then stops and never returns.

I've been trying to use StdinWrite, which can send shifted characters in a locked desktop, but when I start the config program (dccon.exe) via Run, no input seems to reach the program. Basically nothing happens and then AutoIt exits, having completed the script.

This is what I've ended up with:

#include <Constants.au3>

Local $foo = Run("dccon.exe -boot -config hd0", @ScriptDir, @SW_MAXIMIZE, $STDIN_CHILD)
;Local $foo = Run("cmd.exe", @ScriptDir, @SW_MAXIMIZE, $STDIN_CHILD)
Sleep(2000)
StdinWrite($foo, "1" & @CRLF)
Sleep(4000)
StdinWrite($foo, "7" & @CRLF)
Sleep(4000)

; Calling with no 2nd arg closes stream
StdinWrite($foo)

If I only start cmd.exe (the commented line), I can see that 1 and 7 are sent succesfully.

Any ideas?

Edited by dali

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I want this to work behind a locked desktop, which means that I've been using ConsoleSend to send the keystrokes. If I run it with the deskop open, it works.

Sorry, I meant ControlSend. Can't edit original post for some reason.

These are examples of what I've tried:

ControlSend("dccon.exe -boot -config hd0","","","C:Program Filesdcryptkeyfileskeyfile.dat",1)
ControlSend("dccon.exe -boot -config hd0","","","C" & Chr(58) & Chr(92) & "Program Files" & Chr(92) & "dcrypt" & Chr(92) & "keyfiles" & Chr(92) & "keyfile.dat")
ControlSend("dccon.exe -boot -config hd0","","","C{ASC 058}{ASC 092}Program Files{ASC 092}dcrypt{ASC 092}keyfiles{ASC 092}keyfile.dat")

They all work if the desktop is unlocked, all produce "C.+Program..." if the console is locked.

Edited by dali

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