in reply to Blending perl and C (two approaches)

You could try opening a pipe to the perl executable and feeding it the decrypted program line by line. Once you close the pipe, perl will compile and run the code you feed it and it will never have existed as a file anywhere. This trivial example works for me on Win32, and only uses POSIX calls:

#include <stdio.h> #include <stdlib.h> char* prog = "\ #! perl\n\ use strict;\n\ $\\ = qq[\\n]; \n\ $|=1;\n\ print qq[hello world];\n\ print for 1 .. 10;\n\ "; char* cmd = "/perl/bin/perl.exe"; int main( void ) { FILE* pipe; if( !( pipe = _popen( cmd, "wt" ) ) ) { fprintf( stderr, "Failed to create pipe\n" ); exit( -1 ); } fprintf( pipe, prog ); close( pipe ); flushall(); return 0; }

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"Too many [] have been sedated by an oppressive environment of political correctness and risk aversion."

Replies are listed 'Best First'.
Re^2: Blending perl and C (two approaches)
by Anonymous Monk on Oct 29, 2007 at 06:14 UTC
    Surely this would be vulnerable to a man in the middle attack? Just replace system Perl with a recording proxy socket...
      recording proxy socket... sounds super sexy!
        What is it? I googled "recording proxy socket..." and your comment came up as the top item! I thought you'd like to know that.
        I'll start looking around for information on this, but if you can send some hints this way they would be apreciated. (Thx)