Newer
Older
WSSSnoop / inject.php
0xRoM on 6 Jul 2023 1 KB Initial commit
  1. <?php
  2. // Set the file path
  3. $dataSendFilePath = 'data_send';
  4. $dataRecvFilePath = 'data_recv';
  5.  
  6. // Check if the payload parameter is set
  7. if (isset($_REQUEST['response'])) {
  8. $response = $_REQUEST['response'];
  9. file_put_contents($dataRecvFilePath, $response);
  10. file_put_contents($dataSendFilePath, '');
  11. die();
  12. }
  13.  
  14. // Check if the "payload" parameter exists in the request
  15. if (isset($_REQUEST['payload'])) {
  16. // Get the payload value
  17. $payload = $_REQUEST['payload'];
  18.  
  19. // Acquire an exclusive lock on the "data_send" file
  20. $sendFile = fopen('data_send', 'w');
  21. if (flock($sendFile, LOCK_EX)) {
  22. // Write the payload to the "data_send" file
  23. fwrite($sendFile, $payload);
  24.  
  25. // Release the lock and close the file
  26. flock($sendFile, LOCK_UN);
  27. fclose($sendFile);
  28. } else {
  29. // Failed to acquire the lock
  30. die('Failed to write payload to data_send file.');
  31. }
  32. }
  33.  
  34. // Check if the "data_recv" file contains data
  35. while (true) {
  36. $dataRecv = file_get_contents('data_recv');
  37. // Check if the file contains data
  38. if (!empty($dataRecv)) {
  39. // Display the data
  40. echo $dataRecv;
  41. file_put_contents($dataRecvFilePath, '');
  42. file_put_contents($dataSendFilePath, '');
  43. // Exit the loop
  44. break;
  45. }
  46. // Wait for a second before checking again
  47. sleep(1);
  48. }
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57. ?>
Buy Me A Coffee