==================================================
=      	    Gurgen Alaverdian 07.2000            =
=	  www.gurgensvbstuff.com/ps.htm          =
=	     gurgen@bellatlabtic.net             =
=            -->Paranoia Scriptter<--            =
=	          Version 1.0.0                  =
==================================================
Supported OS: Win98/WinNT/Win2000/WinXP


Updates:
--------
05.08.2002 - The bug, where script files sized over 32k could not encrypted was fixed. 
12.08.2002 - Script password protection was added.


Files:
------
PrnScr.exe - Scripts Encoder.
pscrun.exe - Encoded Scripts Interpreter.

Overview:
---------
Use "Paranoia Scripter" if you wish some degree of protection to those precious 
scripts you spent hours creating. PS works with scripts hosted by WSH, Shell and 
Perl, but I assume it might work with other hosts such as Winbatch. PS encodes 
script literally; therefore it cannot be used for encoding script within web pages 
(.asp, .html). As with any encode/encrypt technology, there is no guaranty that 
the code cannot be broken. But for the average user it would be a hard task. In 
addition to hiding the content of your script PS protects the integrity and 
prevents any modifications to the script code. Both executables are written in VB. 
If you have access to the VB design environment you can modify the encryption and 
signature strings making them unique for your version. Email me for the code.   

The package contains 2 executables:

PrnScr.exe
----------
- a GUI application is used to encode your scripts. Regardless
of a script type you are encoding the final product will have ".eyt"
extension. Before hitting encode make sure you supplied correct
interpreter, options for it and script arguments if there are any to apply.
Following interpreters are default (in case you did not supply them).

WSH - CScript.exe
Perl - Perl.exe
Shell - %COMSPEC% - regardless.

****************************************************************************
Note: 	For the security reasons you can not specify interpreter at run-time. 
	So if you with to run the same script with "Cscript" and  "Wscript", you 
	have to create 2 different ".eyt" Scripts.
****************************************************************************

The time stamp protects integrity of the script. If the encoded script was
opened and saved (even without any modification) after you encode it (plus 2 minutes), 
the interpreter will refuse to run it raising an error.

You can give your encoded script any name, however when script is decoded at runtime
it will run under the *original* script name.  

Password protection prevents non-authorized person from running the script.  
Best suited for running scripts interactively. You can now encode sensitive
information in an encoded text files and protect them with password. 


pscrun.exe
----------
- a Console application to host PS scripts. The best way to use, is to
drop it into the system folder or any other folder in the system path.
Use an /A switch to create file association. Optionally you may want to include
".eyt" extention to the PATHEXT environment variable to be able to run scripts 
directly.

The syntax is as following:

pscrun.exe [script] [Optional: /P:[Pass] /D:[folder] /T:n /SA:[Arguments]]
pscrun.exe [script] /E [Optional: /P:[Pass] /D:[folder] [/M|/H] /S /SA:[Arguments]]
pscrun.exe /A+|/-A [Optional: /Q]" 

[script]     - Path to .eyt script. If running from current directory, script 
	   	name only is OK. Do NOT enclose 'broken' path in quotes.
/P:[Pass]    - Password. If omitted and script is protected, you get prompted.
/D:[folder]  - Run script in the specified folder. If omitted script will be 
		running in the folder the ".eyt" script is started.
/E 	     - Run Script in an external console.
/S 	     - Do not close console after script execution. This switch will 
	       be ignored if running encoded Batch files.
/M 	     - Run script minimized. Not valid with /S switch.
/H 	     - Run script hidden. Not valid with /S. 
/SA:[Args]   - Additional script arguments. This is your chance to include 
	       dynamic script arguments. Include any number separated by a space.
	       This switch must be a last in the chain.
/T:n 	     - Terminate after "n" seconds. Not valid with /E switch.
/A+ 	     - Associate ".eyt" file extension with pscrun.exe.
/A- 	     - Remove file association.
/Q           - Create or Remove association silently.


The PS will pass "errorlevel" from your script to the console. However it will not
pass any variables that are set in batch files. In addition to that, PS returns 
internal errors so they can be captured if an encoded script is started within another
batch file. The PS should properly handle stdin\stdout stream and the screen can 
be captured with standard script language related tools (For loop in batch,
StdIn/StdOut functions in WSH scripts ...). For the list of errors run "pcsrun" from
the command line.

**************************************************************************************
Limitations: During runtime the decoded scripts are not physically present at the 
	     location of the ".eyt" script you are running. Therefore it is not 
	     advisable to explicitly revile a script location. Consider the following: 
	     You need to pipe an output of the command to the text file which is located
	     in the same folder as your encoded batch script:
	
	     ipconfig >%~dp0ip.txt :: - Most certainly will fail (you will not find ip.txt).
             ipconfig >ip.txt      :: - Properly drops ip.txt to the ".eyt" location.

	     This limit applies to the scripts running from the network (UNC path).
	     You may want to use pushd/popd to overcome the limitation.
***************************************************************************************

Note: Although it should not be hard (for the experienced of course) to find where the 
      decoded scripts are actually running, only batch files do survive until the end
      of the execution (could not overcome the shell limit, but they are killed thereafter).
      WSH and Perl scripts are destroyed in a split second right after they started. 
***************************************************************************************


This is an evaluation product. Please report all the "bugzzz" you've discovered.
Any "bright" ideas or feedbacks are welcomed as well.
Happy Coding! 


