AutoIt GUI script for Generating RSA Soft Token QR
While we were deploying some new RSA Soft Tokens, I encountered an issue getting the SDTID token file imported on to some users phones that were running older versions of Android. I found the lovely post at http://www.techtips.co.za/generate-qr-code-from-rsa-sdtid-file/ that contains a link and instructions for a Java utility to convert the SDTID file to a QR code that can be scanned into the RSA application on the phones. Works great, though a little command line heavy for our Helpdesk.
So I spent a little time to throw together a little quick and dirty GUI with AutoIT to generate the RSA Soft Token QR code. Well, a little bit longer than quick as it took me a little bit to figure out that the Java file doesn’t like the full path to the input file. Hence the first three lines borrowed from this thread, which returns just the filename.
$sFile = FileOpenDialog("Please select a file", "", "Token File (*.sdtid)") If @error Then Exit $fName = StringRegExpReplace($sFile, "^.*\\", "") #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <WindowsConstants.au3> $Form1_1 = GUICreate("Token Cvt", 174, 208, 192, 114) $Input1 = GUICtrlCreateInput("User", 24, 136, 121, 21) $Button1 = GUICtrlCreateButton("Submit", 48, 168, 75, 25) $Input2 = GUICtrlCreateList("", 24, 24, 121, 97) GUICtrlSetData(-1, "android|iphone|winphone") GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 $user = GUICtrlRead($Input1) $phone = GUICtrlRead($Input2) $options = ' -jar TokenConverter.jar ' & $fName & ' -' & $phone & ' -d 5 -o ' & $User & '.jpg -qr' ShellExecuteWait('java', $options) ShellExecuteWait( $user & ".jpg" ) Exit EndSwitch WEnd
The first three lines are the file selection chunk, followed by the GUI portion that allows you to select the type of phone you’re generating the QR for and to input the users name so that the generated file can be unique. After the submit button is pressed it takes the input and passes it through to the Java app to do the heavy lifting of generating the QR file, after which the file is displayed using your default application for displaying JPG files.
Hopefully can be of use to someone.