Page 1 of 1

embedded perl interpreter in cmd.exe

Posted: Wed Apr 18, 2012 11:25 pm
by HansH
I have been playing with the cmd.exe and I am using it under windows (sorry)
This worked so well, that I started extending it.

I posted some general modifications on bugzilla, but I didn't do that with some others, because I don't know if it is in the context of the cmd.exe in the reactos project.

So what I did is that I extended the default cmd.exe with:
- a hook for a different fileread function
- a hook to be able to add custom commands
- a hook for intercepting file execution
- added an integrated (embedded) perl interpreter

Now with those adaptions I can excute any .cmd or .pl script or use perl inside a .cmd script
for example:

Code: Select all

@echo off
set var1=123
perlcall :plfunc
echo %var1%
goto end

:plfunc
  print "we are in perl !\n";
  $ENV{var1}=234;

1;

:END
Another extention is that I can execute encrypted scripts with it. But.... I can't publish the code of that specific fileread function because then anyone can build a new cmd.exe which just displays the code, in effect making the whole encryption useless..

I have put the version without the encrypt/decrypt function on my website ( http://www.atbas.org/pcmd )
The zip file contains the full project and sourcecode as well as a precompiled basic cmd.exe and the pcmd.exe which will execute perl and cmd code and an example test.cmd and test.pl

I am still trying to figure out how I also can hand out a (binary) version of the pcmd.exe which supports encryption without breaking the GPL license... Basicly it is the same code as in the pcmd project, only the plc_fn function differs.

Any comments/suggestions are welcome..

Re: embedded perl interpreter in cmd.exe

Posted: Thu Apr 19, 2012 8:45 pm
by Z98
The embedded perl interpreter is probably overkill.

Posted: Sat Apr 21, 2012 1:59 pm
by hto
I can't publish the code of that specific fileread function because then anyone can build a new cmd.exe which just displays the code, in effect making the whole encryption useless..
Why? Publish the code, just do not put a decription key in it. Keep the key in the registry or in some configuration file.