Jump to content

password protected program launcher


 Share

Recommended Posts

this program provides an easy way to run programs from a truecrypt volume. good for shared computers where you would like to be able to save passwords in your browser or have an email client that is inaccessible to others. 

i originally started this because i wanted to save passwords in firefox at work and not have anyone else be able to launch firefox with my saved passwords/logins/history etc etc. that was pretty much the launch function.

by default it mounts to drive letter X.

by default it mounts the volume "C:volumelaunch.tc" in that directory.

those can be changed on lines 227 and 228 respectively.

installation:

put the Launcher.exe wherever you want.

install truecrypt

make a volume whatever size you want

put it in: C:volume

name it: launch.tc

install programs in the truecrypt volume

put shortcuts to the program in the root of the truecrypt volume

 

screenshot:

launcher.jpg?noCache=1383255469

EXE, icon and source provided in attached zip.

enjoy!

#cs
written in autoit V3
written by rogerrabbitsclone

requires truecrypt to be installed
truecrypt arguments must be in the correct order. see link for details:
http://www.truecrypt.org/docs/command-line-usage

IF YOU CHANCGE THINGS BE MINDFULL OF THE QUOTES YOU'RE CHANGING. autoit getts pissy when you mix single and double quotes. 

NOTE ON PASSWORD: for some reason truecrypt CLI doesnt approve of passwords with spaces. i think i will have to eliminate the AutoIt
password box all together and just let the truecrypt PW box run. 

you must make a truecrypt volume and install your programs in it. put a shortcut for each program in the root of the truecrypt volume. 
if your programs need special commands when they launch, put that in the shortcut. IE for firefox to load a profile from the volume
you have to put it in like this X:\Programs\Firefox\App\Firefox\firefox.exe -profile X:\Programs\Firefox\Data\profile
HOWEVER, using portable apps usually fixes this. 

by default it mounts to drive letter X.
by default it mounts the volume "C:\volume\launch.tc" in that directory.
those can be changed on lines 227 and 228 respectively.
############################################################################
installation:
put the Launcher.exe wherever you want.
install truecrypt
make a volume whatever size you want
put it in: C:\volume\
name it: launch.tc
install programs in the truecrypt volume
put shortcuts to the program in the root of the truecrypt volume
#############################################################################
TODO: make GUI prettier----WRITE IN ERROR HANDLING----make GUI minimize to tray----fix placeholder button to not look ugly

#ce
TraySetState(2)
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
#include <File.au3>

;~ main function
func main()
      Global $prognames = _FileListToArray($drive_letter & ":\", "*.lnk", 1)
      Global $howmanyprogs = ubound($prognames)
      If Mod($howmanyprogs, 2) = 0 Then
               _arrayadd ($prognames, "")
            EndIf
    
    Opt("GUIOneventmode", 1)
    Opt("GUIResizeMode", 1)
    
;~  this finds the longest name for resizing of the GUI window
    $longest = 1
    For $g = 1 To $prognames[0]
        $name = StringTrimRight($prognames[$g], 4)
        $len = StringLen($name)
        if $len > $longest Then
            $longest = $len
        EndIf
     Next

      
    $fromleft = $longest * 6 + 10
    $GUIwidth = $longest * 6 * 2 + 10 ;this is the width of the GUI window
    $GUIheight = $howmanyprogs * 32 / 2 + 40  ;this is the height of the GUI window
    if $GUIwidth < 170 Then
        $GUIwidth = 170
     EndIf
    if $GUIheight < 100 Then
        $GUIheight = 100
     EndIf
    GUICreate ("TPL", $GUIwidth, $GUIheight)

;~  These control the built in windows functions of the window
    GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents")
    GUISetOnEvent($GUI_EVENT_MINIMIZE, "SpecialEvents")
    GUISetOnEvent($GUI_EVENT_RESTORE, "SpecialEvents")
    
    $firstrow = $howmanyprogs / 2 ;this determines the for loop of the left column
    $secondrow = $firstrow + 1 ;this determines the for loop of the right column
    


;~  this is the left column
    $height1 = 40
    $height2 = 40
    For $I = 1 To $firstrow
        local $x
        $name = StringTrimRight($prognames[$I], 4)
        GUICtrlCreateButton ($name, 5, $height1)
        GUIctrlsetonevent(-1, "launch") 
        $height1 = $height1 + 30
    Next

    ;~ this is the right column
    For $I = $secondrow To $howmanyprogs
        local $y
        $name = StringTrimRight($prognames[$I], 4)
        GUICtrlCreateButton ($name, $fromleft, $height2)
        GUICtrlSetOnEvent(-1, "launch")
        $height2 = $height2 + 30
        
    Next
    
   ;~open profile directory
    $putwhere = $guiwidth / 2
    guictrlcreatebutton("OPEN PROFILE", $putwhere, 2)
    GUICtrlSetOnEvent(-1, "tcdir")
    
   ;~shut all programs down and end program
    $putwhere = 0
    guictrlcreatebutton("LOCKDOWN", $putwhere, 2)
    GUICtrlSetOnEvent(-1, "endprogram")
    
    GUISetState(@sw_show)
    While 1
        sleep (10)
    WEnd
    
EndFunc
 
;~ opens the truecrypt volume
Func opentc()
   $count = 4
   While 1
      $pass = InputBox ("Enter password", "Please enter your password to open you profile","","*", 150, 150)
      ;msgbox(1, "", "-"&$pass&"-")
      if @error = 1 Then
         ;make log file here
         Exit
      EndIf
      ShellExecuteWait('"C:\Program Files\TrueCrypt\TrueCrypt.exe"', '/lx /p ' & $pass & ' /q /s /v ' & $volume_location)
      if DriveStatus($drive_letter & ":\") == "READY" Then ;how to close
         ShellExecuteWait('"C:\Program Files\TrueCrypt\truecrypt.exe"', '/dx /q /s /w')
         Exit
      Else
         $count = $count - 1
         MsgBox (16, "Wrong password", "You have " & $count & " more attempts until the account is logged off. This is brians firefox profile with his saved passwords. Please do not open unless you are him. ")
      EndIf

      if $count == 0 Then
             ;shuts down the system if the password try count goes past 3
         ;shutdown(0)
         Exit
      EndIf
   WEnd
EndFunc

;~ these are the built in windows functions to control the window
Func SpecialEvents()
    Select
        Case @GUI_CtrlId == $GUI_EVENT_MINIMIZE
        Case @GUI_CtrlId == $GUI_EVENT_RESTORE
        Case @GUI_CtrlId == $GUI_EVENT_CLOSE
            endprogram()
            Exit
    EndSelect
EndFunc
 
;~ opens the TC directory
func tcdir()
    $swfdir = ("X:\")
    ShellExecute ($swfdir)
EndFunc
 
;~ kills all progs and dismounts
func endprogram()
      $howmanyprogs = $howmanyprogs - 1
      For $I = 1 To $howmanyprogs
         $name = StringTrimRight($prognames[$I], 4)
         $prognames[$I] = $name & ".exe"
      Next
   $lastinarray = ubound($prognames)
   if $prognames[$howmanyprogs] == "" then 
      _arraydelete ($prognames, $howmanyprogs)
   EndIf
   
      For $I = 1 To $howmanyprogs
         ProcessClose($prognames[$I])
      Next
   ShellExecuteWait('"C:\Program Files\TrueCrypt\truecrypt.exe"', '/dx /q /s /w')
   exit
   
EndFunc

;~ launches the programs
Func launch($name)
    for $q = 1 to $prognames[0]
        $name = StringTrimRight($prognames[$q], 4)
        $buttonname = GUIctrlread(@gui_ctrlid)
        if $buttonname == $name Then
            $buttonname = $buttonname & ".lnk"
            shellexecute ("X:\" & $buttonname)
            ExitLoop
        EndIf       
    next
EndFunc
 
;~ password prompt and TC mount
func pword()
   While 1
   $pass = InputBox ("Enter password", "Please enter your password to unlock firefox","","*", 150, 150)
   if @error = 1 Then
      ;make log file here
      Exit
   EndIf
   ShellExecuteWait('"C:\Program Files\TrueCrypt\TrueCrypt.exe"', '/lx /p ' & $pass & ' /q /s /v ' & $volume_location)
   if DriveStatus($drive_letter & ":\") == "READY" Then 
      ExitLoop
   Else
      $count = $count - 1
      MsgBox (16, "Wrong password", "You have " & $count & " more attempts until the account is logged off. This is brians firefox profile with his saved passwords. Please do not open unless you are him. ")
   EndIf

   if $count == 0 Then
          ;shuts down the system if the password try count goes past 3
      shutdown(0)
      Exit
      EndIf
   WEnd
EndFunc

 
$drive_letter = 'X' ;specify the drive letter. you can change the drive letter here
$volume_location = 'C:\volume\launch.tc' ;truecrypt volume with your profile. you can change this here.
pword()
main()

TC Prog Launcher.zip

Edited by RogerRabbitsClone
<--a good way to start you day
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...