APM: Invoking a shell
Brian Michalk
michalk at awpi.com
Thu Mar 20 20:52:38 CST 2003
Wayne Walker showed a way to have an interactive shell in a CGI.
I need an (insecure) access to the shell via a perl script.
I tried:
my $pid = open2($rdrfh, $wtrfh, '/bin/sh');
But that didn't work.
I'm taking input from a socket and sending it to bash, and returning the
results to the socket, basically just like a telnet session would look.
Why not use telnet you say? I can't get it to work that way with winsock.
Now, I can do this:
46 my $cmd = <$fh>;
47 print "Command: $cmd";
48 $results = `$cmd`;
49 $fh->send($results);
Works as advertized, but the shell exits immediately, and commands issued do
not remain permanent, even if I do a command with an '&' at the end.
Brian Michalk <http://www.michalk.com>
Life is what you make of it ... never wish you had done something.
Aviator, experimental aircraft builder, motorcyclist, SCUBA diver
musician, home-brewer, entrepreneur and mostly single
More information about the Austin
mailing list