Sandboxie Portable

Submit portable freeware that you find here. It helps if you include information like description, extraction instruction, Unicode support, whether it writes to the registry, and so on.
Message
Author
User avatar
lococobra
Posts: 127
Joined: Fri Aug 03, 2007 10:42 am
Location: USA
Contact:

#16 Post by lococobra »

I also used 3.01.

You never actually open kmdutil.exe, you just put it in the folder along with the other Sandboxie files. It's used by the launcher to terminate the Sandboxie service. I'm rather confused how you managed to get a 'missing command' message without ever being able to access the file...

Anyways, that message appears because simply launching the exe means you're not giving it any command line options to use, which for this particular executable... means abort with error.

I'm pretty sure neither the Sandboxie people, or wraithdu would appreciate me creating a completed version of the software (portable + sandboxie + my launcher), but if some random person uploaded it.... I would have no problem checking it to make sure everything's kosher.

User avatar
guinness
Posts: 4118
Joined: Mon Aug 27, 2007 2:00 am
Contact:

#17 Post by guinness »

Okay so it should read ...

Installation goes something like this:
• Download Sandboxie from Here [DONE]
• Download SandboxiePortable from one of the following locations: Mirror1, Mirror2, Mirror3[DONE]
• Extract SandboxiePortable to a location of your choosing[DONE]
• Open the Sandboxie installer with 7zip and extract all files in the root directory to 'App\Sandboxie'[DONE]
• Open the '$PLUGINSDIR' folder from the archive, and extract 'kmdutil.exe' to the same directory.

Instead of extract I moved kmdutil.exe to App\Sandboxie and deleted the folder and contents of $PLUGINSDIR. Plus deleted [NSIS].nsi

• If it's the first time you've done this installation, rename 'Sandboxie_default.ini' to 'Sandboxie.ini' [DONE]

and I converted your Launcher.

Was this correct?

User avatar
lococobra
Posts: 127
Joined: Fri Aug 03, 2007 10:42 am
Location: USA
Contact:

#18 Post by lococobra »

Sounds good, if you get any errors or other problems, PM me and I'll help you get it sorted out.

User avatar
guinness
Posts: 4118
Joined: Mon Aug 27, 2007 2:00 am
Contact:

Truecrypt and Sandboxie

#19 Post by guinness »

I use a batch file to open a .tc file and mount to the driver X:/ then it automatically opens PStart.exe

Code: Select all

TrueCrypt.exe /v [Truecrypt File] /l u /q
start /D u:\ /B /WAIT x:\PStart.exe
TrueCrypt.exe /d X /w /q
Is there a way I can change it to open Sandboxie Portable with PStart contained inside. Therefore when I travel all I have to do is double click on the USB icon, insert my password and voila Sandboxed PStart.

I tried creating a shortcut but it appears that the examples I have found are for the local Sandboxie program, therefore pointing to start.exe and not Launcher.exe

Cheers

User avatar
lococobra
Posts: 127
Joined: Fri Aug 03, 2007 10:42 am
Location: USA
Contact:

#20 Post by lococobra »

Here's what you have to do (in pseudocode)... you figure out the implementation..

Code: Select all

Run TrueCrypt.exe .....
Run SandboxiePortable.exe and wait for it to finish opening
Force kill the Sandboxie control app (or not if you want to leave it running)
Run "Start.exe" (sandboxie program launcher) and send it PStart.exe as the program to start
Upon PStart exit, Run CrashCleanup.exe
Run TrueCrypt.exe close drive
You could also make pstart launch all programs sandboxed by directing them to start.exe and sending the actual program name in the parameters.

User avatar
guinness
Posts: 4118
Joined: Mon Aug 27, 2007 2:00 am
Contact:

Truecrypt & Sandboxie

#21 Post by guinness »

I opted for the second part of your advice. I did think about this whilst typing out my question but felt that for ease sandboxing PStart would be less complex. I am in no way a coder like yourself so after spending hour (4) trying to create a batch file, I decided to edit the .xml file of PStart. I dunno if my concept of using Truecrypt and Sandboxie has been thought of? since searching the internet for help with sandboxie portable is useless

User avatar
lococobra
Posts: 127
Joined: Fri Aug 03, 2007 10:42 am
Location: USA
Contact:

#22 Post by lococobra »

No no no... that won't work at all. Start.exe will not work unless sandboxie is already initiated, AKA run sandboxieportable.exe

Here's a script that should work for you (compile using autoit) Make sure you change all the file paths to work with your configuration!!!

All you have to do in order to terminate everything/dismount the drive is close PStart.

Code: Select all

#NoTrayIcon
$drive = StringLeft(@AutoItExe, 2)
$volumefile = $drive&"\tc" ;Location of the volume file, in this example it points to PDRIVE:\tc
$password = InputBox("Password", "Please input the unlock code for "&$drive,"","*",225,110)
If ShellExecute($drive&"\PortableApps\True Crypt\TrueCrypt.exe","/v "&$drive&'\tc /l t /p "'&$password&'" /q')=0 Then
	MsgBox(0,"Drive Launcher","Unable to find TrueCrypt.exe")
	Exit
EndIf
If ProcessWaitClose("TrueCrypt.exe",15)=0 Then
	MsgBox(0,"Drive Launcher","TrueCrypt did not close after 15 seconds")
	Exit
EndIf
If ShellExecute("T:\PortableApps\PStart\PStart.exe")=0 Then
	MsgBox(0,"Drive Launcher","Unable to find PStart.exe")
	Exit
EndIf
Sleep(7000)
While ProcessExists("PStart.exe")
	Sleep(2000)
WEnd
ProcessClose("Control.exe")
While ProcessExists("SandboxiePortable.exe")
	Sleep(2000)
WEnd
Sleep(1000)
ShellExecute($drive&"\PortableApps\True Crypt\TrueCrypt.exe","/d t /q")
Exit
In addition, you'll have to do the following from inside pstart.exe

• Right click SandboxiePortable's entry and on the Advanced tab enable autostart on startup
• Edit all programs that you want to sandbox using the following launch scheme...
Application / file path = ..\SandboxiePortable\App\Sandboxie\Start.exe
Command line parameters = "Path to the program you wish to launch"

Example Command line: "\PortableApps\FirefoxPortable\FirefoxPortable.exe"

This script unfortunately relies on a lot of conditions being true for it to function. Here are some ways you can crash this script...

• If TrueCrypt.exe is not found, execution will stop
• If you are already running TrueCrypt.exe when you launch this script, it will time out after 15 seconds and not complete execution
• If PStart.exe is not found, execution will stop
• If there are more than one PStart.exe running, the script will wait until all instances of PStart.exe are closed before continuing
• If there are more than one Control.exe running, the script may not terminate unless it is manually stopped via ctrl+alt+delete
• If there is already a T: drive on the host computer, TrueCrypt will not mount correctly.

EDIT: I'm going to create a more stable script of that and use it on my own drive... I'll put it up here when I'm done with it.

User avatar
guinness
Posts: 4118
Joined: Mon Aug 27, 2007 2:00 am
Contact:

#23 Post by guinness »

Okay thanks for the script, but what you suggested by placing the ..\SandboxiePortable\App\Sandboxie\Start.exe in filepath etc... is what I have been doing as a temp measure,but ideally I would like to Sandboxie Pstart when it opens, so that anything opened in Pstart will automatically be sandboxed. It would be so much easier considering I am changing my Pstart menu every 10 mins. There must be a way to do this. I will use your script suggested (obviously!) changed to what I have :D Thanks

User avatar
lococobra
Posts: 127
Joined: Fri Aug 03, 2007 10:42 am
Location: USA
Contact:

#24 Post by lococobra »

Okay, here's a new version that should actually fix most of your problems..

Please note, this is a bit more developed version, and I designed it around my own needs... so this is how it works..

After you give it your password, it mounts the truecrypt volume to the first availble drive letter. Next it takes a snapshot of all the programs that are running (this will be used later). Then SandboxiePortable is launched. After a 10 second delay it launches pstart (sandboxed)

Once you're done with using your drive, terminate all programs in the sandbox, and close sandboxie. Once SandboxiePortable stops, it will automaticly dismount your drive.

If you have any questions of requests, let me know.

Code: Select all

#include <Array.au3>
#include <Constants.au3>
#NoTrayIcon

;CONFIGURE THESE PATHS!!!

;These files should be on the non-encrypted drive
$TrueCryptVolume = "\TrueCrypt.vol"
$TrueCrpytExe = "\TrueCrypt.exe"

;These files should be on the encrypted drive
$MainSandboxieFolder = ":\PortableApps\SandboxiePortable\"
$SandboxiePortableExe = "SandboxiePortable.exe"
$PStartExe = ":\PortableApps\PStart\PStart.exe"

;END OF CONFIGURATION

$alphabet = StringSplit("abcdefghijklmnopqrstuvwxyz","")
$drives = DriveGetDrive("ALL")
$drives = _ArrayToString($drives,"",1)
$drives = StringRegExpReplace($drives, "[ :]", "")&"b"
For $i = 1 to 26
	If StringInStr($drives,$alphabet[$i])=0 Then
		$FDL = $alphabet[$i]
		ExitLoop
	EndIf
Next
If StringLen($FDL)<>1 Then
	MsgBox(0,"Drive Launcher","There are no free drive letters!")
	Exit
EndIf
$drive = StringLeft(@AutoItExe, 2)
$volumefile = $drive&$TrueCryptVolume
$password = InputBox("Password", "Please input the unlock code","","*",225,110)
$TCPID = Run($drive&$TrueCrpytExe&" /v "&$volumefile&" /l "&$FDL&' /p "'&$password&'" /q')
If StringLen($TCPID)<3 Then
	MsgBox(0,"Drive Launcher","Problem encountered while launching TrueCrypt.exe")
	Exit
EndIf
If ProcessWaitClose($TCPID,20)=0 Then
	MsgBox(0,"Drive Launcher","TrueCrypt did not close after 20 seconds")
	Exit
EndIf
Sleep(1000)
$temp = ProcessList()
$snapshot = ""
For $i = 1 to $temp[0][0]
	$snapshot=$snapshot&" "&$temp[$i][1]
Next
Run($FDL&$MainSandboxieFolder&$SandboxiePortableExe,$FDL&$MainSandboxieFolder)
$installed = 0
While $installed < 2
	$installed = 0
	$svc = Run("sc query SbieSvc","","",$STDOUT_CHILD)
	$drv = Run("sc query SbieDrv","","",$STDOUT_CHILD)
	$line=StringSplit(StdoutRead($svc),@CRLF)
	If $line[$line[0]-5]<>"The specified service does not exist as an installed service." Then $installed = $installed + 1
	$line=StringSplit(StdoutRead($drv),@CRLF)
	If $line[$line[0]-5]<>"The specified service does not exist as an installed service." Then $installed = $installed + 1
	Sleep(1000)
WEnd
Run($FDL&$MainSandboxieFolder&"App\Sandboxie\Start.exe"&" "&$FDL&$PStartExe)
ProcessWaitClose("Control.exe")
Run($FDL&$MainSandboxieFolder&"App\Sandboxie\KmdUtil stop SbieSvc")
Run($FDL&$MainSandboxieFolder&"App\Sandboxie\KmdUtil stop SbieDrv")
ProcessWaitClose("SandboxiePortable.exe")

Func OnAutoItExit()
	$temp = ProcessList()
	Dim $closelist[20]
	For $i = 1 to $temp[0][0]
		If StringInStr($snapshot,$temp[$i][1])=0 Then
			ProcessClose($temp[$i][1])
			ProcessWaitClose($temp[$i][1])
		EndIf
	Next
	Sleep(8000)
	ShellExecute($drive&$TrueCrpytExe,"/d "&$FDL&" /q")
EndFunc
EDIT: I tweaked the script so that sandboxie launches very fast now, also added a section to help kill the sandboxie service/driver so now closing sandboxie should be very fast.

User avatar
guinness
Posts: 4118
Joined: Mon Aug 27, 2007 2:00 am
Contact:

#25 Post by guinness »

I have checked again and again but it seems that it won't compile. I kept everything the same apart from editing the variables at the start of the .au3

Code: Select all

$TCPID = Run($drive&$TrueCrpytExe&" /v "&$volumefile&" /l "&$FDL&' /p "'&$password&'" /q') 
The code above states that the file can't be found so I have no idea what I did wrong?
Also another question I deleted :

Code: Select all

$alphabet = StringSplit("abcdefghijklmnopqrstuvwxyz","")
$drives = DriveGetDrive("ALL")
$drives = _ArrayToString($drives,"",1)
$drives = StringRegExpReplace($drives, "[ :]", "")&"b"
For $i = 1 to 26
   If StringInStr($drives,$alphabet[$i])=0 Then
      $FDL = $alphabet[$i]
      ExitLoop
   EndIf
Next
If StringLen($FDL)<>1 Then
   MsgBox(0,"Drive Launcher","There are no free drive letters!")
   Exit
EndIf 
I have changed nothing apart from the folder/file locations, oh and included the two files Array.au3 and Constants.au3 at the root of the non encrypted drive, I tried both variations of placing them in a folder named "Includes" and then just as they are at the root, neither fixed the problem of mounting the Truecrypt.

ALSO>>>>

and opted to assigning $FDL to the permanent drive letter of T. Would this be the correct procedure?
I truly appreciate you helping me as Autoit is a new language that I am not to familiar with.

User avatar
lococobra
Posts: 127
Joined: Fri Aug 03, 2007 10:42 am
Location: USA
Contact:

#26 Post by lococobra »

1. Try putting this in somewhere at the beginning (after all the variables are declared)

Code: Select all

MsgBox(0,"TC Run String",$drive&$TrueCrpytExe&" /v "&$volumefile&" /l "&$FDL&' /p "'&$password&'" /q')
The file path problem should be easy to fix once you see what it is.

2. As for the drive letter, I would encourage you to use the system I designed. What if you use this on a computer where T: is not available? If you really don't want to use this though... you can replace the code you stated with the following:

Code: Select all

$FDL = "T"
Yeah, I probably should have thrown the colon on there for constancy... but I'm not going to fix it until I have some bigger update to do... oh well.

3. As for the files Array.au3 and Constants.au3, if you use Aut2Exe, those files are included in the produced exe... no need to make an includes folder or anything like that.

perwhis
Posts: 29
Joined: Wed Oct 22, 2008 12:50 pm

#27 Post by perwhis »

Digging up an old post, but wanted to share I have updated the launcher for Sandboxie portable, so that the sanboxes automatically are put in a subfolder to the main program.

The Autoit-code I use is:

Code: Select all

#NoTrayIcon
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=sandboxie.com.ico
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_UseAnsi=y
#AutoIt3Wrapper_Res_Comment=Launcher for sandboxes in application directory
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
$SIni=@ScriptDir&"\Data\INI\Sandboxie.ini" 
$boxloc=@ScriptDir&"\Sandbox\%SANDBOX%" 
If IniWrite($SIni, "GlobalSettings", "FileRootPath", $boxloc) <> 1 Then 
   $perm = FileGetAttrib($SIni) 
   MsgBox(16,"IniWrite Failed!","Unable to write new settings to Sandboxie.ini"&@CRLF&"File permissions: "&$perm) 
Else 
   Sleep(100) 
   ShellExecute("SandboxiePortable.exe") 
EndIf

The binary can be downloaded at http://www.mediafire.com/?sharekey=81ee ... b9a8902bda

The binary shall be put in the same directory as SandboxiePortable.exe.

User avatar
guinness
Posts: 4118
Joined: Mon Aug 27, 2007 2:00 am
Contact:

#28 Post by guinness »

Yeh very old post! I will have a try with your script. I made one myself since I use the sandboxie on my USB drive.

perwhis
Posts: 29
Joined: Wed Oct 22, 2008 12:50 pm

#29 Post by perwhis »

Well, sorry for digging up an old post. Maybe it is not of any use any more, but since I recently discovered Sandboxie, I decided to just update the script, I found earlier in the post, with current links.

If anyone have a much more developed version of it, or can give an option to the Sandboxie for trying out software, then I'll be happy to take part of that. (Portable VirtualBox I have, and unfortunately JauntPE triggers false virus warnings on my computer, so they are no good solutions for me. I use Regshot when checking software, but don't know an easy way to restore the computer when the Registry has been written to.)

User avatar
lococobra
Posts: 127
Joined: Fri Aug 03, 2007 10:42 am
Location: USA
Contact:

#30 Post by lococobra »

Arrr... who be disturbing my grave?!

Have you seen this? http://sandboxie.com/phpbb/viewtopic.php?t=2299

I forget how I even packaged the thing in this thread but I'm not about to go read through it lol, but I know that's what I based my stuff on.

By the way, for reading the registry file that sandboxie creates, you can use this: http://www.mitec.cz/wrr.html (I don't think that program is portable)

Good luck :)

Post Reply