Advertisement
Guest User

Untitled

a guest
Aug 16th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. <pre>
  2. <?php
  3. set_time_limit(0);
  4.  
  5. if ($f = fopen('/home/alex/Desktop/X/SHIT-FTP.txt', 'r'))
  6. {
  7. $fout = fopen('/tmp/ftpc.txt', 'w');
  8. while (!feof($f))
  9. {
  10. $line = trim(fgets($f));
  11. if (substr($line, -1) == '/')
  12. $line = substr($line, 0, strlen($line)-1);
  13. $parsed = parse_url($line);
  14. if (isset($parsed['host']))
  15. {
  16. $host = $parsed['host'];
  17. $user = $parsed['user'];
  18. $pass = $parsed['pass'];
  19. }
  20. else
  21. {
  22. if (preg_match('/^ftp:\/\/(.+?):(.+?)@\s*([\w\.\-]+):?\d*/', $line, $m) || preg_match('/^(.+?):(.+?)@\s*([\w\.\-]+):?\d*/', $line, $m))
  23. {
  24. $host = $m[3];
  25. $user = $m[1];
  26. $pass = $m[2];
  27. }
  28. else
  29. {
  30. echo "Cannot parse $line\n"; flush();
  31. continue;
  32. }
  33. }
  34. echo "$host:$user:$pass\n"; flush();
  35. fwrite($fout, "$host:$user:$pass\n");
  36. }
  37. fclose($fout);
  38. fclose($f);
  39. }
  40.  
  41. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement