Advertisement
Guest User

Untitled

a guest
Jan 20th, 2019
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4. $descriptorspec = array(
  5. 0 => array("pipe", "r"), // // stdin est un pipe où le processus va lire
  6. 1 => array("pipe", "w"), // stdout est un pipe où le processus va écrire
  7. 2 => array("file", "/tmp/error-output.txt", "a") // stderr est un fichier
  8. );
  9.  
  10. $cwd = '/tmp';
  11. $env = array();
  12.  
  13. $process = proc_open('/root/Desktop/get_flag', $descriptorspec, $pipes, $cwd, $env);
  14.  
  15. if (is_resource($process)) {
  16.  
  17. fwrite($pipes[0], eval('return '.explode(":", stream_get_contents($pipes[1]))[1].';'));
  18.  
  19. fclose($pipes[0]);
  20.  
  21. echo stream_get_contents($pipes[1]);
  22. fclose($pipes[1]);
  23.  
  24. $return_value = proc_close($process);
  25.  
  26. echo "La commande a retourné $return_value\n";
  27. }
  28. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement