|Syntactic Confectionery Delight|
Re: Encrypting source code :(by RonW (Parson)
|on Jan 04, 2019 at 22:42 UTC||Need Help??|
A PAR file is a Zip file. The executable created by pp is a self-extracting Zip file with an auto-run feature.
In theory (I haven't tested this), you could create a PAR with pp, unzip it to a temporary location, then re-zip it with a password. Make sure the new Zip file has the extension .par
Then do: pp -o myprog myscript.par
If that works the way I think it does, pp will do something like cat extractor myscript.par >myprog
(On MS Windows, it would be something like copy /b extractor.exe+myscript.par myprog.exe)
Assuming that works AND the extractor supports encrypted Zip files, running myprog will ask for the password needed to decrypt myscript.par then extract and run normally.
If that doesn't work, you can use 7zip to create encrypted, self extracting archives. I don't recall the details, but there are options to specify the extractor to use (you want the "installer extractor") and the command you want the extractor to run. You will need to unzip your PAR file before creating the self-extracting archive, otherwise it will be the PAR file that gets extracted and not the files inside it.
(Note: The "installer extractor" doesn't actually install anything. It expects the command you tell it to run to do the actual installing. In your case, the command will be to run your program. After your program exits, the extractor will delete the files it created during the extraction phase.)