Freeze/Snapshot Sandbox Contents

Ideas for enhancements to the software
shawndion
Posts: 19
Joined: Fri Dec 11, 2009 1:41 pm

Post by shawndion » Mon Oct 03, 2011 9:20 am

Thank you everyone ... now here's the part where it's your job..

I want to know exactly what you need from this tool... as of the Freeze, Backup, Restore, Save Changes, etc.
Abuse of this suggestion... I'm available to work on this for a month..

Keep me busy the less I think the more healty it is for me..

Shawn

P.S: I'm coding this all week I took a week off to get this done right...people need a tool to test and make a blacklist of softwares that cause more harm than good..

P.P.S: Your condolences are welcomed it was the family priest the man thought me gambling and arcades hence my love of computers ... in a instance this man made me who I am today... so if this project works well at least I'll have the opportunity to make him proud..

D1G1T@L
Posts: 577
Joined: Sun Apr 17, 2011 7:40 pm
Location: DefaultBox

Post by D1G1T@L » Mon Oct 03, 2011 8:25 pm

I want to know exactly what you need from this tool... as of the Freeze, Backup, Restore, Save Changes, etc.
Abuse of this suggestion... I'm available to work on this for a month..
Thats a good selection features you thought of there. I would really love to see them in your addon at some point, but I don't want to burden you especially in your state now.

If you can accomplish the cloning functionality that would be great for a start. I can tell you that on this forum, your work will be appreciated and you will gather a following really quickly around here :)

shawndion
Posts: 19
Joined: Fri Dec 11, 2009 1:41 pm

Post by shawndion » Tue Oct 04, 2011 3:12 am

Hi DIGIT@L,
Well in my case it's 3am right now and this is my dedication project. Part of the batch file will contain regdiff to make a patch registry (To go back and from a installation setting) the site is p-nand-q.com/download/regdiff.html (Reason why I'm posting the link is that the author is giving away a python script of his code)

Play with it (Under Sandboxie even) the commands are amazing...

As for the backup script I'm using FC to file compare folders and tskill,taskkill.. the next 3 days I'm tweaking it. The skeleton code is done it's just I want to make this OS specific and because not everyone installs their sandbox as a default I want to be able to have a "Set" configuration file people can modify for their need.

And the reason is simple why I'm dedicating my time to this. Sandboxie is a amazing program that saved me already weeks of re-installations and tons of money (I use regdiff and sanboxie to make ultimate regclean tools) So the least I could do is help the community do the same.

After this is done I'll concentrating on making a userguide as many people keep calling me for help on how to tweak sandboxie.

I'll keep you all posted on the progrress as I seriously want to keep my mind off of things..

Shawn.

oloid

Post by oloid » Fri Oct 07, 2011 12:29 am

Thanks for your efforts shawndion! Though you might not get a proper audience in this thread and this month I'm sure your work will be appreciated down the road. I look forward to testing and using your tools as I'd been planning to create some basic backup/restore batch files along with some pre-prepared 'base' sandboxes with specialized contents (mostly to do with different browsers and multiple configurations and different hosts files). Your scripts should offer greater sophistication and ease than I could have hoped for. That's all for now. God bless.

shawndion
Posts: 19
Joined: Fri Dec 11, 2009 1:41 pm

Post by shawndion » Fri Oct 07, 2011 5:50 am

Thought I wouldn't be able to pull it off this week but here are the batch files you need to work with.
With some settings ajustments and I'll keep on working on them even make a autoit script soon..

So here we go bare in mind this is setup for my DefaultBox but I'll be modifing it acording to everyone needs
But I did want to have something functional for all to understand how it's done.

First Batch file you need is the Initial Backup.

-----------------------------------------------------------------
Backup.bat
-----------------------------------------------------------------
:Backup
taskkill /F /IM SbieCtrl.exe
xcopy c:\Sandbox\%USERNAME%\DefaultBox\*.* c:\Original\Sanboxie\DefaultBox /e /i /h /y
"C:\Program Files\Sandboxie\SbieCtrl.exe" /open
-----------------------------------------------------------------

Note: The taskkill program shut's the process of sandboxie so that you can unlock the reghive.
Should there be a easier way to launch SB let me know

-----------------------------------------------------------------
BackupDiff.bat
-----------------------------------------------------------------
:BackupDiff
taskkill /F /IM SbieCtrl.exe
xcopy c:\Sandbox\%USERNAME%\DefaultBox\*.* c:\Modified\Sanboxie\DefaultBox /e /i /h /y
"C:\Program Files\Sandboxie\SbieCtrl.exe" /open
-----------------------------------------------------------------

-----------------------------------------------------------------
Restore.bat
-----------------------------------------------------------------
:Restore
taskkill /F /IM SbieCtrl.exe
rd /s /q c:\Sandbox\%USERNAME%\DefaultBox\
xcopy c:\Original\Sanboxie\DefaultBox*.* c:\Sandbox\%USERNAME%\DefaultBox\ /e /i /h /y
rem "C:\Program Files\Sandboxie\SbieCtrl.exe" /open
-----------------------------------------------------------------

Note: To restore a Original backup that you did. Warning this removes the DefaultBox folder
before re-copying the files into it.

-----------------------------------------------------------------
sbtool.bat (This batch calls the others needed to run)
-----------------------------------------------------------------
@echo off
REM ------------------------------------------------------------
REM Sandboxie Backup / Restore / What Has Changed Tool
REM ------------------------------------------------------------

Subst L: C:\Original\Sandboxie\DefaultBox
Subst M: C:\Modified\Sandboxie\DefaultBox

Call MakeFolders.bat
Call OriginalCompare.bat
Call ModifiedCompare.bat
Call getreg.bat
Subst L: /D
Subst M: /D
Echo Done...

Pause

-----------------------------------------------------------------
MakeFolders.bat
-----------------------------------------------------------------

@echo off
REM ------------------------------------------------------------
REM Sandboxie Backup / Restore / What Has Changed Tool
REM ------------------------------------------------------------

Set Original=L:
Set Modified=M:

dir /s /b /ad "%Modified%" > C:\ModFolder.txt

for /F "tokens=*" %%* in (c:\ModFolder.txt) do call :Foldersub %%*
Goto :EOF

:Foldersub
Set Folder=%*
Set Folder=%Folder:~3%
Echo %Folder% >>C:\flist.txt
MD "C:\Different\%Folder%"

-----------------------------------------------------------------
OriginalCompare.bat
-----------------------------------------------------------------
@echo off
REM ------------------------------------------------------------
REM Sandboxie Backup / Restore / What Has Changed Tool
REM ------------------------------------------------------------

REM DEFINE YOUR OWN LETTERS HERE THESES ARE EXAMPLES

Set Original=L:
Set Modified=M:

dir /a-d /s /b "%Original%" > C:\Original.txt

for /F "tokens=*" %%* in (c:\Original.txt) do call :Originalsub %%*
Goto :EOF

:Originalsub
set One=%*
set Two=%*
set Two=%Modified%%Two:~2%
set Three=%Two:~3%
If EXIST "%Two%" fc /b "%One%" "%Two%" |find /i "no differences" >Nul
SET VALUE=%ERRORLEVEL%
IF %VALUE% == 1 echo f |xcopy "%Two%" "C:\Different\%Three%" /H /Y /V >Nul
if NOT EXIST "%Two%" Echo The File located in %TWO% Has been deleted from Original Location. >> C:\DeletedList.txt

-----------------------------------------------------------------


-----------------------------------------------------------------
ModifiedCompare.bat
-----------------------------------------------------------------
@Echo off
REM ------------------------------------------------------------
REM Sandboxie Backup / Restore / What Has Changed Tool
REM ------------------------------------------------------------

REM DEFINE YOUR OWN LETTERS HERE THESES ARE EXAMPLES

Set Original=L:
Set Modified=M:

dir /a-d /s /b "%Modified%" > C:\Modified.txt

for /F "tokens=*" %%* in (c:\Modified.txt) do call :Modifiedsub %%*
Goto :EOF

:Modifiedsub
set One=%*
set Two=%*
set Two=%Original%%Two:~2%
set Three=%Two:~3%
If EXIST "%Two%" fc /b "%One%" "%Two%" |find /i "no differences" >nul
SET VALUE=%ERRORLEVEL%
IF %VALUE% == 1 echo f |xcopy "%One%" "C:\Different\%Three%" /H /Y /V >nul
IF NOT EXIST "%Two%" echo f |xcopy "%One%" "C:\Different\%Three%" /H /Y /V >Nul

-----------------------------------------------------------------
GetReg.bat (This will collect the registry changes and place them in a reg file for you)
-----------------------------------------------------------------
REM CHANGE Sandbox_Compaq_Owner_DefaultBox FOR YOUR SANDBOX MOUNTED LOCATION

REG LOAD HKEY_USERS\Sandbox_Compaq_Owner_DefaultBox L:\RegHive
REG EXPORT HKEY_USERS\Sandbox_Compaq_Owner_DefaultBox Original.reg
REG UNLOAD HKEY_USERS\Sandbox_Compaq_Owner_DefaultBox
REG LOAD HKEY_USERS\Sandbox_Compaq_Owner_DefaultBox M:\RegHive
REG EXPORT HKEY_USERS\Sandbox_Compaq_Owner_DefaultBox Modified.reg
REG UNLOAD HKEY_USERS\Sandbox_Compaq_Owner_DefaultBox

REM REGDIFF can be downloaded at http://www.p-nand-q.com/download/regdiff.html
regdiff modified.reg original.reg -d Changes.reg

-=-=-=-=-=-=-=-=--=-=-=--=-=-=-=--=-=-=-=-=-=--

I'll be merging all these batch files together over the weekend to make it easier to understand.
I'll be documenting it but I wanted to post a preview version of the script.
I'll be working on this all week-end to clean it up and make it more user friendly.
Shawn

oloid

Post by oloid » Fri Oct 07, 2011 9:44 am

Looking good, but I need to mention that SbieCtrl.exe is the GUI and doesn't even need to run (see shell options), thus your taskkill command would not shut down a running sandbox.

I suspect you should use a command like this instead:

start /wait "C:\Program Files\Sandboxie\Start.exe" /box:TestBox /terminate

See:

http://www.sandboxie.com/index.php?StartCommandLine (stop)

http://ss64.com/nt/start.html (/wait)


Also, your batch skills are over my head but the doubled "set Two=" lines in :Modifiedsub and :Originalsub look like they might be a harmless copy/paste mistake. I dunno, you decide.

I haven't used it and don't know it's limitations but I'm wondering if the SET command could be used to make customizing the batch files easier for the end user (though not for you). Imagining a set of SETs at the top of the file to define box names and paths and everything.

oloid

Post by oloid » Fri Oct 07, 2011 10:15 am

Oops, please ignore me. Reviewing, I see you've already stated that you're preparing SET commands for easy customization. Also, by only thinking along one track (processes running in a sandbox) I failed to remember that you'd already stated that closing SbieCtrl.exe (with taskkill) is needed to unlock the reghive. Even so, I suppose the "terminate" command would be good to run first as precaution. I'm sorry. I'm tired. Please don't take offense. I'll shut up now.

shawndion
Posts: 19
Joined: Fri Dec 11, 2009 1:41 pm

Post by shawndion » Fri Oct 07, 2011 3:07 pm

@oloid

I'll fix up the taskkill to work better so no worries It's just that I was up for over 48 hours of insomnia so I didn't get a chance to document properly and with the proper SET commands and merging it all to one it will be easier to understand so don't worry about it..

As for your question about the %Two% varablie I'll explain it now.

set Two=%*
set Two=%Modified%%Two:~2%

The first Two grabs the Variable that beeing sent by the for loop call the second one what it does is that it deletes the first 2 characters (Ie: L: in this case) and replaces it with the drive letter of the Modified M:

But don't worry about it I'll get it cleaned up and documented so that we all can improve on the code and have something we'll all enjoy.

Shawn

shawndion
Posts: 19
Joined: Fri Dec 11, 2009 1:41 pm

Post by shawndion » Sun Oct 09, 2011 3:53 pm

Sorry for taking so long in regards to making it all in one file but I want this batch file to run with the least amount of user intervention.

Pasted Bellow is a code that will grab the sandbox names and use them as a variable so that you don't have to type it in everytime you want to switch a sandbox to backup.

But we're getting there I merged all the batches in one now I'm just optimizing it to get all the values so that you don't have to type them in.

I'm also adding a Transpose Module (This will copy 1 sandbox to another great for MMORPG type of installations)

The next step is a Sandboxie.ini Editor.
Shawn

Sample Output

C:\WINDOWS>test
Sandbox Choices (Up to 20 Sandboxes)
01.DefaultBox
02.NetObjectsFusionX
03.LineageII
04.OnlineGameDownloader
05.NoWebTest
06.HelpMaker
07.FireFox
08.
09.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.

Code :
@echo off
set /a counter=0
find "[" c:\Windows\Sandboxie.ini >c:\report.txt
find /V " " C:\report.txt >c:\nospace.txt
find /V "_" C:\nospace.txt >c:\no_.txt
find "[" c:\no_.txt >c:\report.txt

for /F "tokens=*" %%* in (c:\Report.txt) do call :Originalsub %%*
goto :End

:Originalsub
set str=%*
if "%str%"== "---------- C:\NO_.TXT" goto :eof
if "%str%"== "[GlobalSettings]" goto :eof
set /a counter+=1
set str=%str:~1,-1%
set Box%counter%=%str%
goto :eof

:End
Echo Sandbox Choices (Up to 20 Sandboxes)

Echo 01. %box1%
Echo 02. %box2%
Echo 03. %box3%
Echo 04. %box4%
Echo 05. %box5%
Echo 06. %box6%
Echo 07. %box7%
Echo 08. %box8%
Echo 09. %box9%
Echo 10. %box10%
Echo 11. %box11%
Echo 12. %box12%
Echo 13. %box13%
Echo 14. %box14%
Echo 15. %box15%
Echo 16. %box16%
Echo 17. %box17%
Echo 18. %box18%
Echo 19. %box19%
Echo 20. %box20%

tzuk
Sandboxie Founder
Sandboxie Founder
Posts: 16076
Joined: Tue Jun 22, 2004 12:57 pm

Post by tzuk » Mon Oct 10, 2011 4:15 am

Looks like you're making progress shawndion, nice. To follow up on an earlier suggestion from D1G1T@L, I think you should post the documentation into a new topic in the Contributed Utilities forum, so that new forum can become the "home topic" for this utility.
tzuk

shawndion
Posts: 19
Joined: Fri Dec 11, 2009 1:41 pm

We're Moving to Contributed Utilities...

Post by shawndion » Mon Oct 10, 2011 4:53 am


Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest