Jump to content

Executing ELF file with exec()


Bunsly

Recommended Posts

Hey guys!

My current employer contracted someone to create a script for him. (The script itself is to create a serial number for a piece of software) It's just a PHP script that executes a file and retrieves its output.

Now I've never worked with exec() in PHP, and I don't have a reliable environment to test it in. I compiled apache2 and php 5.0.4 and set them to run on a Macintosh (10.3.9) in the office, but I'm sure I've missed some crucial setup stage (mainly, I'm missing php.ini. I did a php -i | grep php.ini to find it, and it says it is in /etc/, but when I look in my PHP/etc folder, only pear.conf is there!). PHP and apache both appear to be working fine, though.

 

When I try and run the PHP script that executes the .ELF file, I get a blank page. Is this because I'm running it in OS X?  should I be running it in Linux?

Also, I don't know how to Enable exec() on my server, or to see if it's enabled. Basically, I just need someone to walk me through the basics of this. The script and executable SHOULD work fine because the contractor got it working fine.

Below is the script, and attached is the executable.

Thanks! :3

 

<?php

/*
inUID = 456890
inSerialNumUID = 123456
inMachineID_s = &6dA-8P@K-Xsq
*/

$p1 = "456890";
$p2 = "123456";
$p3 = "\&6dA-8P@K-Xsq";

exec("./create_activation_code.elf $p1 $p2 $p3", $output);

foreach ($output as $output_str)
{
echo $output_str."<br>";
}

?>

 

[attachment deleted by admin]

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.