Jump to content

Boxerman

Members
  • Posts

    275
  • Joined

  • Last visited

Everything posted by Boxerman

  1. Fixed the issue: Adding [[ \"$-\" != *i* ]] && echo '\n' before the Powershell command fixed this issue. Thanks for all the help and i hope my fix helps someone one day!
  2. Anyone got advise?
  3. Any advise on what one would do to work around this issue? OR is there another way?
  4. New code: $stream = ssh2_exec($connection, $runCMD); stream_set_blocking($stream, true); echo stream_get_contents($stream); Still just stays at refreshing its so confusing, im sorry all...
  5. How would one work out if stream is the correct one?
  6. But with the new code provided with the feof in, it does exactly the same?
  7. When i revert back to my old code i get an output if the user exists (full stack trace of what i need), if i create a new user, it only shows part of the stack trace (i presume related to the value of 1 needing to be increased?) but if its set above on, it just gets stuck on refreshing and never returns anything, yet the script does exactly what its suppose to (powershell wise). Hopefully this makes sense.
  8. Thanks! however, the page is not outputting (its still refreshing) but when i check AD i see the new user account has been created!? This is confusing me, so much, im sorry!
  9. Thanks for the reply, im looking at your suggestion, but im getting the following: Warning: fread() expects parameter 1 to be resource, null given in /srv/www/htdocs/newuserphp/test.php on line 31 Notice: Undefined variable: buffer in /srv/www/htdocs/newuserphp/test.php on line 31 any advise?
  10. Hi guys, Tricky one to explain here so first sorry if i do not provide everything. The below script is set to create a new user by passing PHP variables into a powershell script. The powershell has been tested manually and works perfectly: //cmd to run $runCMD = "powershell -Command './MasterScript.ps1 -ucr -udn \"$user\" -pas \"$pass\" -loc \"$loc\"'"; // exec a command and return a stream $stream = ssh2_exec($connection, $runCMD); // force PHP to wait for the output stream_set_blocking($stream, true); // read the output into a variable $data = ''; while($buffer = fread($stream, 4096)) { $data .= $buffer; } // close the stream fclose($stream); // print the response echo $data; As you can see the fread leagth is set to 4096, the webpage just sits at refreshing but never compeletes, however the the user gets created, but the page does not return the echo'ed $data (it doesn't display anything it is just sitting at refreshing the page). If i set this to 1, it works as expected, however does not show the full stack trace (completed output which contains the username generated which is what i need to get. I have tried setting this to 2 but it just keeps waiting for the script to finish, but i can confirm i see the users. So this doesnt appear to be a powershell issue, more of a php code issue. Can anyone see a mistake in the above? Let me know if you require any more information.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.