Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I am trying to find a standalone binary that i can execute from within php to query my servers mac address,
Reason is, i have a standalone app that was written to decrypt a file based on the servers mac addy, and then use the unencrypted data, i dont have access to the source so i can't change the way this works.
The only option i have is to obtain the mac addy on my server and then encrypt the file with the mac so my app can use it correctly, however i cannot seem to get perl scripts to run ifconfig, my host is a free host so i am very limited on some things.
Since the MAC address is not going to change (hopefully) cant you just make up one? Or create a text file similar to ifconfig output and parse it instead of real infconfig output?
Since the MAC address is not going to change (hopefully) cant you just make up one? Or create a text file similar to ifconfig output and parse it instead of real infconfig output?
Hi and thanks for your reply Emerson
The compiled app i want to use actually checks the real mac address itself, during one of its routines, so making one up won't be good enough as it will fail to decrypt, i believe it uses the server mac addy as an aes decrypt/encrypt key
This is also the reason i know it must be possible to query the real mac address, since this app does so
OK, as I said MAC address hopefully won't change. Meaning you do not need to read it out every time using ifconfig. Don't make it up then, use the actual one. Just get it from a text file for instance.
OK, as I said MAC address hopefully won't change. Meaning you do not need to read it out every time using ifconfig. Don't make it up then, use the actual one. Just get it from a text file for instance.
Thanks once more for your reply.
Yeah i see what you mean, only problem i have is obtaining the mac address, which is what i needed the standalone app for to begin with
No response probably means the server has locked out external binaries or perhaps has whitelisted them. Typically, for instance, imagemagick will be available and usually if you do this:
<?php
echo exec('whoami');
">
you'll get a response (usually "apache").
Thing is that ifconfig could be dangerous to the server (security issue) so it and anything that might function like it commonly won't be allowed.
No response probably means the server has locked out external binaries or perhaps has whitelisted them. Typically, for instance, imagemagick will be available and usually if you do this:
<?php
echo exec('whoami');
">
you'll get a response (usually "apache").
Thing is that ifconfig could be dangerous to the server (security issue) so it and anything that might function like it commonly won't be allowed.
I see, thanks for your input once more, i have just run whoami which returns my login username to the server.
I have an external ELF binary running on the server and i believe it is querying the mac address ok, its a shame i do not have the source to this custom written app, so i can remove this "security" feature it has, unfortunately i have lost contact with the code writer. Thus it is theoretically locked to my old host.
I also tried to find ifconfig via google so i could download, but no joy there either.
might give you something. If $output is specified, it is an array returned with all the contents (every line) of output from the command that is executed. I don't think this will work since the simpler form didn't, but you might want to look at it.
might give you something. If $output is specified, it is an array returned with all the contents (every line) of output from the command that is executed. I don't think this will work since the simpler form didn't, but you might want to look at it.
well, you are working on the right track - if the server will let you do it at all. It doesn't appear that it will, but you might try shell_exec with the full path.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.