Jump to content

Derpitis

New Members
  • Posts

    6
  • Joined

  • Last visited

Everything posted by Derpitis

  1. The PHP file does catch the input from the user and save it right when I try. And I already knew PHP is at fault because I can launch the exe manually a thousand times and it never fails or hangs. I ghetto fix'd this for the time being where I created a windows task to just run the exe every 120 seconds. So it'll open the exe, the exe reads the txt file and outputs it into the games chat. So I guess it's resolved but not properly and it's not all that great, just because using PHP's methods of launching the exe decides to hang it. No idea why.
  2. Yeah the same thing happens with exec, passthru etc, all methods of launching the exe. The exe launches according to task manager but uses 3.5mb memory flat, every time. (when it should use around 7.5mb) it never changes how much memory it uses when it hangs after being told to launch by PHP. Oh I've also tried running apache in user mode, instead of as SYSTEM. Same deal so I know its not a permissions/user interaction problem. For now I solved it by making a windows task to open the exe every 2 minutes but this isnt ideal as I would prefer it to jsut open the moment the PHP writes to the text file.
  3. I've now re-written the exe thinking maybe that was the issue and moved off of AHK onto C#, the issue still occures where when PHP launches the exe it doesn't work. PHP code. <html> <head><title>PHP Get Send</title></head> <body> <?php $var = $_GET['input']; $myfile = fopen("yell.txt", "w"); $txt = "::yell {$var}"; fwrite($myfile, $txt); fclose($myfile); shell_exec("yell.bat"); ?> </body> </html> C# Code using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Runtime.InteropServices; namespace WindowsFormsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } [DllImport("user32.dll")] public static extern Int32 SetForegroundWindow(int hWnd); [DllImport("user32.dll")] public static extern int FindWindow(string lpClassName, string lpWindowName); private void BringToFront(string className, string CaptionName) { SetForegroundWindow(FindWindow(className, CaptionName)); } public System.Timers.Timer MyTimer { get; set; } int counter; private void Form1_Load(object sender, EventArgs e) { MyTimer = new System.Timers.Timer(); MyTimer.Interval = 1000; MyTimer.Elapsed+=new System.Timers.ElapsedEventHandler(myTimer_Elapsed); MyTimer.Start(); System.IO.StreamReader myFile = new System.IO.StreamReader("c:\\wamp\\www\\yell.txt"); string text = myFile.ReadToEnd(); BringToFront("SunAwtFrame", "UltimateScape | Dagonoth"); SendKeys.Send(text); SendKeys.Send("{enter}"); } void myTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { if (++counter == 5) { System.Windows.Forms.Application.Exit(); } } } }
  4. Ive removed the the need for the exe to be passed a variable and the exe still hangs... strange <html> <head><title>PHP Get Send</title></head> <body> <?php $var = $_GET['input']; $myfile = fopen("yell.txt", "w"); $txt = "{$var}"; fwrite($myfile, $txt); fclose($myfile); exec("test2.exe"); ?> </body> </html> The exe now just reads from the text file and types it out. But launching it from php make sit hang. heres the exe code. WinWait, UltimateScape | Dagonoth, IfWinNotActive, UltimateScape | Dagonoth, , WinActivate, UltimateScape | Dagonoth, WinWaitActive, UltimateScape | Dagonoth, FileRead, text, yell.txt Send, {SHIFTDOWN};;{SHIFTUP}yell{SPACE}%text%{ENTER} exit
  5. Not that it matters but this is the exe it's just an autohotkey exe. %text% = %1% WinWait, UltimateScape | Dagonoth, IfWinNotActive, UltimateScape | Dagonoth , WinActivate, UltimateScape | Dagonoth WinWaitActive, UltimateScape | Dagonoth Send, {SHIFTDOWN};;{SHIFTUP}yell{SPACE}%text%.{ENTER} And that works flawlessly outside of PHP compiled to an exe
  6. I'm trying to take info from $_GET and pass it along to an exe file that needs 1 argument supplied to it, and used the input from $_GET to be that argument but it's executing the .exe and NOT passing the variable, it then hangs the .exe till I end process. index form for sending: <form action="/test.php" method="get"> <input type="text" name="input" /> <input type="submit" value=" OK " /> the php script that it sends to. <html> <head><title>PHP Get Send</title></head> <body> <?php $var = $_GET['input']; $x = shell_exec("test.exe ".$var); echo $x; ?> </body> </html> I can't figure this out, at all. It just refuses to properly execute the exe with the variable sent. I can do it from command prompt, etc, a bat file, but soon as i try and do it from PHP it hangs the exe and doesn't send the variable. Please do not post about "You aren't sanitizing your inputs" just to get free karma/reputation or whatever this site uses, obviously this is made purely for debugging why this doesn't work. I got dozens of replies on stack overflow and none of which were about my issue, just people farming positive rep by all saying "sanitize your exec!!!!!!!" The process opens and just hangs there not doing anything till I end the process.
×
×
  • 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.