Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- use warnings;
- use strict;
- use Socket;
- use POSIX qw(dup2);
- #my $program = "/usr/sbin/telnetd";
- #my @progargs = qw(-h -E /usr/bin/yes);
- my $program = "/usr/sbin/sshd";
- my @progargs = qw(-i);
- socketpair(my $rdr, my $wtr, AF_UNIX, SOCK_STREAM, PF_UNSPEC)
- or die("socketpair");
- close(STDIN);
- close(STDOUT);
- if (dup2(fileno($rdr), 0) == -1) { die("dup2"); }
- if (dup2(fileno($wtr), 1) == -1) { die("dup2"); }
- close($rdr);
- close($wtr);
- exec $program, @progargs or die("exec");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement