• 0

[Apache, EXE] How to run EXE through APACHE using alias! HELP


Question

Hey guys can I ask for some good old help please?

What it is I want to be able to run say a console application, through my webserver on apache.

I know it a secruity hole so I ask how do I first of all set up apache to allow .EXE to run, and then how to do it so say a .EXE will disgause(sorry for spelling) itself as say a .SOB. So I call something like blah.com/send.SOB.

this is currently the code i have For a test console app(written in delphi)

program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils,
  ShellAPI,
  windows;

var
  S: array[0..255] of char;
begin

  windows.GetEnvironmentVariable('QUERY_STRING',@S[0], 255);

  writeln('<html><body>');
  writeln('Query=');
  writeln(s);
  Writeln('</ br>Executed</body></html>');
  shellexecute(0,'open','notepad', nil, nil, SW_SHOWNORMAL);
end.

I've Tried this on a mate custom built server application, and all he dose is a simple config edit such as this

[.exe]
CodeBase=

[.snd]
CodeBase=c:\www\localhost\Project2.exe

So all that basically does is will run the .exe on the server but if a .snd is called it will run the code above.

I know this is not as easy on apache thats is where i ask you for help how do i achive this?

thanks Matt

4 answers to this question

Recommended Posts

  • 0

Not sure you can disguise the executables as .sob files unless, as Antaris also suggested, you make a wrapper script. The script would actually be written in Perl or PHP (or any other server-side scripting language) and that would be responsible for executing the .exe file and capturing the output from it.

If you just want to have .exe files run and the STDOUT returned to Apache this should do what you want. Note I've made this only work in the named directory to give you a little bit of security. At least then you can specify which .exe files should be run by putting them in the specified folder.

ScriptAlias /path/in/browser "C:/path/to/executables/"

<Directory "C:/path/to/executables/">
	AllowOverride None
	Options ExecCGI
	AddHandler cgi-script .exe
</Directory>

Note that any .exe file you start this way will run as the user that Apache also runs as. If you have Apache installed as a system service on windows, the .exe files and any processes they start will run as SYSTEM and will not by default be able to interact with the current user session unless you change the Apache service to allow interaction with the desktop.

  • 0

sorry only just read this i tried that and i now get this error

  Quote
Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator,_________ and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

from just running this peice of delphi code

program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils, ShellAPI, windows;

begin
  ShellExecute(0, nil, 'c:\windows\notepad.exe', 'c:\windows\general.txt', nil, SW_SHOWMAXIMIZED);

end.

any idea?

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • Amazon Deals: Samsung Q990F Q900F Q800F 2025 Dolby Atmos soundbars with wireless subwoofers by Sayan Sen While separate AV receivers with hi-fi speakers are generally the preferred way to listed to music and watch movies/shows by audiophiles, the more general folks often prefer soundbars instead as they offer a capable all in one solution that is still plenty good. Currently Nakamichi is running discounts on multiple products from its Dragaon lineup as well as its Shockwafe model. If you are looking for more options to choose from Samsung has its Q-series products at lowest prices (purchase links towards the end of article). Q990F The flagship Q990F is an 11.1.4 system and the single subwoofer unit on it houses two opposite-facing 8-inch subwoofer drivers. Thus, together they move around the same amount of air as a single 12-inch subwoofer unit. In addition to increasing the bass by +3 dB, dual opposing drivers are also said to help reduce vibrations of the subwoofer cabinet by cancelling out the resonance. Samsung also says that the bass is "AI-optimized" but we are not sure if it actually helps or if it's just a buzz term here. Aside from the bass, dialogue in movies is the second most important thing, and Samsung claims great vocal clarity from its front speakers thanks to AVA (Active Voice Amplifier) Pro feature that is said to detect noise disturbances and amplify dialogue to make it more audible over such surrounding noises. Q900F Feature wise the Q900F is similar to the 990F model except it has fewer channels and it is a 7.1.2 setup. Finally the Q800F is a 5.1.2 system and it has a passive radiator instead of the additonal subwoofer driver unit. Get the Samsung Q series soundbars at the links below: Samsung Q990F 11.1.4ch Wireless Dolby Atmos, Q-Symphony, Game Mode Pro, Adaptive Sound (HW-Q990F, 2025): $1497.99 (Shipped and Sold by Amazon US) Samsung HW-Q900F 7.1.2 ch Wireless Dolby Atmos, Q-Symphony: $997.99 (Shipped and Sold by Amazon US) Samsung Q800F 5.1.2ch Q Series Soundbar + Subwoofer, Wireless Dolby Atmos, Q-Symphony, Game Mode Pro, Smart Integration (HW-Q800F, 2025): $697.99 (Shipped and Sold by Amazon US) This Amazon deal is US-specific and not available in other regions unless specified. If you don't like it or want to look at more options, check out the Amazon US deals page here. Get Prime (SNAP), Prime Video, Audible Plus or Kindle / Music Unlimited. Free for 30 days. As an Amazon Associate, we earn from qualifying purchases.
    • They are shifting into AI now. Don't you see?
  • Recent Achievements

    • One Month Later
      Helen Shafer earned a badge
      One Month Later
    • One Month Later
      ambani880 earned a badge
      One Month Later
    • Week One Done
      ambani880 earned a badge
      Week One Done
    • First Post
      artistro08 earned a badge
      First Post
    • First Post
      paul29 earned a badge
      First Post
  • Popular Contributors

    1. 1
      +primortal
      498
    2. 2
      ATLien_0
      223
    3. 3
      Michael Scrip
      196
    4. 4
      Xenon
      160
    5. 5
      +FloatingFatMan
      138
  • Tell a friend

    Love Neowin? Tell a friend!