• 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

    • Yeah, it seemed like a bunch of 2D decal assets to me, so I didn't think it would be a huge issue to replace them. Assuming, of course, that Sony didn't just decide to settle and pay the artist instead. Do we know if that happened?
    • No worries, I wasn't pointing to your post specifically at all. I was talking in general and building upon your idea.
    • This 2TB NVMe Gen4 SSD is priced just $94 and you also get a free 64GB UHS-I memory card by Sayan Sen A few days ago, we reported on Team Group's T-FORCE G50 4TB NVMe SSD that was up for grabs at just $200 thanks to a promo coupon. Sadly, that deal has expired although you can still WD's SN8100 (Gen5) and SN7100 (Gen4) offerings as they are still running the discount. If you don't have the budget for those or are shopping for lower capacity drives then Crucial's T500 Gen4 drive discount is still live, and you can get them for just $125. And while the G50 4TB deal has expired, Team Group is now offering its 2TB model at its lowest ever price and you also get a free Micro SD card with it. The Team Group G50 is also a TLC (triple level cell) NAND flash SSD, and thus the endurance on the T-FORCE SSD is quite good, as it is rated for 1300 TBW (terabytes written) for the 2TB variant. Its MTBF, or Mean Time Between Failure, is claimed at 3,000,000 hours. The operating temperature is 0~70 C. The G50 does not have a dedicated DRAM cache (only the G50 Pro SKUs have it), but since it is based on NVMe version 1.4 which supports HMB (host memory buffer) technology; thus, the drive can use system memory for caching. In terms of performance, Team Group promises sequential read and write speeds of up to 5000 MB/s and 4500 MB/s, respectively. However, the firm does not disclose random throughput metrics. Get the Team Group G50 at the link below (deal is said to be ending in less than 10 hours): Team Group T-FORCE G50 SSD (TM8FFE002T0C129) + Team Group 64GB Elite microSDXC UHS-I U3, V30, A1, Micro SD with SD Adapter, to 100MB/s (TEAUSDX64GIV30A103): $105.99 + $12 off with promo code SSETA665 (Shipped and Sold by Newegg 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.
    • I know what you're getting at, but Microsoft themselves have said that the Xbox Ally specifically disables a bunch of stuff from Windows to improve performance and save 2GB of memory. And that special game mode is coming to Windows 11 next year.
  • Recent Achievements

    • First Post
      Ian_ earned a badge
      First Post
    • Explorer
      JaviAl went up a rank
      Explorer
    • Reacting Well
      Cole Multipass earned a badge
      Reacting Well
    • Reacting Well
      JLP earned a badge
      Reacting Well
    • Week One Done
      Rhydderch earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      646
    2. 2
      ATLien_0
      269
    3. 3
      Michael Scrip
      218
    4. 4
      +FloatingFatMan
      184
    5. 5
      Steven P.
      146
  • Tell a friend

    Love Neowin? Tell a friend!