473,412 Members | 2,088 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,412 software developers and data experts.

Finding MAC Address

Hey

any body knows how can i find my system mac address using php.

it's very urgent.....
thanks in advance

Ravindra.Y

May 25 '07 #1
17 11711
At Thu, 24 May 2007 23:02:14 -0700, Ravi let his monkeys type:
Hey

any body knows how can i find my system mac address using php.

it's very urgent.....
thanks in advance

Ravindra.Y
I don't think that's possible directly from PHP.
PEAR has a MAC-address validator (Net-MAC), but that doesn't read out your
HWaddr, it just accepts strings.

On linux you could use exec() with a script wrapping the ifconfig command
and grep for HWadd, or use arp. Script probably needs to run suid

On windows you are looking for ipconfig (XP and up), but I think you need
some additional tool to succesfully spawn OS processes and return output.
The name pstools comes to mind. Not sure if that's correct

Why you would want/need to discover the *server's* MAC address
dynamically is beyond me though.

But I bet there are valid uses for it!
Sh.
May 25 '07 #2
Thanks i used ifconfig it is working fine.

May 25 '07 #3
At Thu, 24 May 2007 23:56:54 -0700, Ravi let his monkeys type:
Thanks i used ifconfig it is working fine.
Yw, could you tell what practical use this has ? Curious!
Sh.
May 25 '07 #4
Our project is a IPPBX system which we want to bind it to a particular
MAC address that will be the server .No other system can use the code..

May 25 '07 #5
Ravi wrote:
Our project is a IPPBX system which we want to bind it to a particular
MAC address that will be the server .No other system can use the code..
Hi Ravi,

I hope you know that the command
ifconfig hw ether XXX
sets a NICs MAC to XXX ;-)

Roy
May 25 '07 #6
I hope you know that the command
ifconfig hw ether XXX
sets a NICs MAC to XXX ;-)

Roy
I used ifconfig -a etch0 from that out put i have taken the mac.

May 25 '07 #7
At Fri, 25 May 2007 00:06:31 -0700, Ravi let his monkeys type:
Our project is a IPPBX system which we want to bind it to a particular
MAC address that will be the server .No other system can use the code..
Don't rely on MAC address to provide a foolproof authentication.
They can easily be changed, and anyone on a network can quite easily
discover the server's MAC address.

Sh
May 25 '07 #8
we will take the mac address from the customer and adding the system
date and time after encrypting it using Md5 keeping it some where else
in my code that to encrypted...

can u find out the logic
JGNvZGVsb2NrX2NvZGU9IklDUnZkWFFnUFdGeWNtRjVLQ2s3RF FvZ1pYaGxZeWdpYVdaamIyNW1hV2NnTFdFZ1pYUm9NQ0lzSkc5 MWRDazdJQTBLSUNSaGNuSWdQU0J6ZEhKeVpYWW9jM1J5ZEc5ck tITjBjbkpsZGlna2IzVjBXekJkS1N3bklDY3BLVHNOQ2lBa1pI UnBiV1VnUFNBaU1qVXdOVEl3TURjeE1UZ3dNRGMzTURRMElqc0 5DaUFrWm5BZ1BTQm1hV3hsS0NKTWFXTmxibU5sTG1SaGRDSXBP dz09IjsgJGNvZGVsb2NrX2NvZGU9c3RyX3JlcGxhY2UoIkAiLC JDQWciLCAkY29kZWxvY2tfY29kZSk7ICRjb2RlbG9ja19jb2Rl PXN0cl9yZXBsYWNlKCIhIiwgIlc1IiwgJGNvZGVsb2NrX2NvZG UpOyAkY29kZWxvY2tfY29kZT1zdHJfcmVwbGFjZSgiKiIsICJD QWdJIiwgJGNvZGVsb2NrX2NvZGUpOyAkY29kZWxvY2tfY29kZT 1iYXNlNjRfZGVjb2RlKCRjb2RlbG9ja19jb2RlKTsgZXZhbCgk Y29kZWxvY2tfY29kZSk7IAo=

This is the actual code

May 25 '07 #9
On May 25, 5:24 am, Ravi <Ravindrayep...@gmail.comwrote:
can u find out the logic
JGNvZGVsb2NrX2NvZGU9IklDUnZkWFFnUFdGeWNtRjVLQ2s3RF FvZ1pYaGxZeWdpYVdaamIyNW1 hV2NnTFdFZ1pYUm9NQ0lzSkc5MWRDazdJQTBLSUNSaGNuSWdQU 0J6ZEhKeVpYWW9jM1J5ZEc5ck tITjBjbkpsZGlna2IzVjBXekJkS1N3bklDY3BLVHNOQ2lBa1pI UnBiV1VnUFNBaU1qVXdOVEl3T URjeE1UZ3dNRGMzTURRMElqc05DaUFrWm5BZ1BTQm1hV3hsS0N KTWFXTmxibU5sTG1SaGRDSXBP dz09IjsgJGNvZGVsb2NrX2NvZGU9c3RyX3JlcGxhY2UoIkAiLC JDQWciLCAkY29kZWxvY2tfY29 kZSk7ICRjb2RlbG9ja19jb2RlPXN0cl9yZXBsYWNlKCIhIiwgI lc1IiwgJGNvZGVsb2NrX2NvZG UpOyAkY29kZWxvY2tfY29kZT1zdHJfcmVwbGFjZSgiKiIsICJD QWdJIiwgJGNvZGVsb2NrX2NvZ GUpOyAkY29kZWxvY2tfY29kZT1iYXNlNjRfZGVjb2RlKCRjb2R lbG9ja19jb2RlKTsgZXZhbCgk Y29kZWxvY2tfY29kZSk7IAo=

This is the actual code
Base64 encoding is not encryption. Your code is:

$codelock_code="$out =array();
exec("ifconfig -a eth0",$out);
$arr = strrev(strtok(strrev($out[0]),' '));
$dtime = "250520071180077044";
$fp = file("Licence.dat");";
$codelock_code=str_replace("@","CAg", $codelock_code);
$codelock_code=str_replace("!", "W5", $codelock_code);
$codelock_code=str_replace("*", "CAgI", $codelock_code);
$codelock_code=base64_decode($codelock_code);
eval($codelock_code);

You may want to reconsider your approach.

May 25 '07 #10
Ravi wrote:
we will take the mac address from the customer and adding the system
date and time after encrypting it using Md5 keeping it some where else
in my code that to encrypted...

can u find out the logic
JGNvZGVsb2NrX2NvZGU9IklDUnZkWFFnUFdGeWNtRjVLQ2s3RF FvZ1pYaGxZeWdpYVdaamIyNW1hV2NnTFdFZ1pYUm9NQ0lzSkc5 MWRDazdJQTBLSUNSaGNuSWdQU0J6ZEhKeVpYWW9jM1J5ZEc5ck tITjBjbkpsZGlna2IzVjBXekJkS1N3bklDY3BLVHNOQ2lBa1pI UnBiV1VnUFNBaU1qVXdOVEl3TURjeE1UZ3dNRGMzTURRMElqc0 5DaUFrWm5BZ1BTQm1hV3hsS0NKTWFXTmxibU5sTG1SaGRDSXBP dz09IjsgJGNvZGVsb2NrX2NvZGU9c3RyX3JlcGxhY2UoIkAiLC JDQWciLCAkY29kZWxvY2tfY29kZSk7ICRjb2RlbG9ja19jb2Rl PXN0cl9yZXBsYWNlKCIhIiwgIlc1IiwgJGNvZGVsb2NrX2NvZG UpOyAkY29kZWxvY2tfY29kZT1zdHJfcmVwbGFjZSgiKiIsICJD QWdJIiwgJGNvZGVsb2NrX2NvZGUpOyAkY29kZWxvY2tfY29kZT 1iYXNlNjRfZGVjb2RlKCRjb2RlbG9ja19jb2RlKTsgZXZhbCgk Y29kZWxvY2tfY29kZSk7IAo=

This is the actual code
You miss the point. What happens if I set my mac address to be the
same? If your server is available to the internet, it's mac address is
available. And that means I can change it on my system.

Mac addresses are NOT useful for security.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
May 25 '07 #11
At Fri, 25 May 2007 02:24:46 -0700, Ravi let his monkeys type:
we will take the mac address from the customer and adding the system
date and time after encrypting it using Md5 keeping it some where else
in my code that to encrypted...

can u find out the logic
JGNvZGVsb2NrX2NvZGU9IklDUnZkWFFnUFdGeWNtRjVLQ2s3RF FvZ1pYaGxZeWdpYVdaamIyNW1hV2NnTFdFZ1pYUm9NQ0lzSkc5 MWRDazdJQTBLSUNSaGNuSWdQU0J6ZEhKeVpYWW9jM1J5ZEc5ck tITjBjbkpsZGlna2IzVjBXekJkS1N3bklDY3BLVHNOQ2lBa1pI UnBiV1VnUFNBaU1qVXdOVEl3TURjeE1UZ3dNRGMzTURRMElqc0 5DaUFrWm5BZ1BTQm1hV3hsS0NKTWFXTmxibU5sTG1SaGRDSXBP dz09IjsgJGNvZGVsb2NrX2NvZGU9c3RyX3JlcGxhY2UoIkAiLC JDQWciLCAkY29kZWxvY2tfY29kZSk7ICRjb2RlbG9ja19jb2Rl PXN0cl9yZXBsYWNlKCIhIiwgIlc1IiwgJGNvZGVsb2NrX2NvZG UpOyAkY29kZWxvY2tfY29kZT1zdHJfcmVwbGFjZSgiKiIsICJD QWdJIiwgJGNvZGVsb2NrX2NvZGUpOyAkY29kZWxvY2tfY29kZT 1iYXNlNjRfZGVjb2RlKCRjb2RlbG9ja19jb2RlKTsgZXZhbCgk Y29kZWxvY2tfY29kZSk7IAo=

This is the actual code
You can make a contest out of this topic, but it won't get you further. I
think you are reinventing a broken wheel. A simple session based script
with a login and a decent password scheme beats your 'security' by miles.

Starting something based on wrong assumptions is called a mistake. All
people make mistakes.
Smart people learn from them and know when to abandon their original idea.
Stubbornly holding on to a flawed concept is no mistake, it's just plain
dumb.

Be smart, toss out the (time+MAC+whatevernon-random-stuff)-seeded
authentication gizmo and start afresh.

Sh.

May 25 '07 #12
On May 25, 4:32 pm, Matt <mbkauf...@gmail.comwrote:
On May 25, 5:24 am, Ravi <Ravindrayep...@gmail.comwrote:
can u find out the logic
JGNvZGVsb2NrX2NvZGU9IklDUnZkWFFnUFdGeWNtRjVLQ2s3RF FvZ1pYaGxZeWdpYVdaamIyNW1 hV2NnTFdFZ1pYUm9NQ0lzSkc5MWRDazdJQTBLSUNSaGNuSWdQU 0J6ZEhKeVpYWW9jM1J5ZEc5ck tITjBjbkpsZGlna2IzVjBXekJkS1N3bklDY3BLVHNOQ2lBa1pI UnBiV1VnUFNBaU1qVXdOVEl3T URjeE1UZ3dNRGMzTURRMElqc05DaUFrWm5BZ1BTQm1hV3hsS0N KTWFXTmxibU5sTG1SaGRDSXBP dz09IjsgJGNvZGVsb2NrX2NvZGU9c3RyX3JlcGxhY2UoIkAiLC JDQWciLCAkY29kZWxvY2tfY29 kZSk7ICRjb2RlbG9ja19jb2RlPXN0cl9yZXBsYWNlKCIhIiwgI lc1IiwgJGNvZGVsb2NrX2NvZG UpOyAkY29kZWxvY2tfY29kZT1zdHJfcmVwbGFjZSgiKiIsICJD QWdJIiwgJGNvZGVsb2NrX2NvZ GUpOyAkY29kZWxvY2tfY29kZT1iYXNlNjRfZGVjb2RlKCRjb2R lbG9ja19jb2RlKTsgZXZhbCgk Y29kZWxvY2tfY29kZSk7IAo=
This is the actual code

Base64 encoding is not encryption. Your code is:

$codelock_code="$out =array();
exec("ifconfig -a eth0",$out);
$arr = strrev(strtok(strrev($out[0]),' '));
$dtime = "250520071180077044";
$fp = file("Licence.dat");";
$codelock_code=str_replace("@","CAg", $codelock_code);
$codelock_code=str_replace("!", "W5", $codelock_code);
$codelock_code=str_replace("*", "CAgI", $codelock_code);
$codelock_code=base64_decode($codelock_code);
eval($codelock_code);

You may want to reconsider your approach.

You r right but
How u decrypted that??? base64_decode is not working. Can you tell me
how can i fix it to a particular system.

May 25 '07 #13
On May 25, 9:45 am, Ravi <Ravindrayep...@gmail.comwrote:
You r right but
How u decrypted that??? base64_decode is not working. Can you tell me
how can i fix it to a particular system.
Again, it wasn't encrypted. Base64 is an encoding, NOT encryption.
base64_decode() will reverse it. Attempting to encrypt your code in
order to keep your methods secret is almost sure to fail without a
very solid background in cryptography.

IMO, the entire approach is flawed, as others have noted. Check out
the other posts and heed their advice.

May 25 '07 #14
Ok people my assumption was wrong... Matt can u tell me how u decode
it because i tryied but base64_decode() function is showing nothing. i
used codelock software for this. But now i don't want to use it any
more i wnat to do it myself with a fresh logic...

any suggestion or help to do it....

Ravi

May 26 '07 #15
>Our project is a IPPBX system which we want to bind it to a particular
>MAC address that will be the server .
The term for this is Defective By Design. It probably violates a
Microsoft patent.

Oh, yes, you do know that many servers have multiple MAC addresses,
don't you?
>No other system can use the code..
It doesn't matter how much you encrypt the code: you have to include
the key to the code along with the code, assuming that the *AUTHORIZED*
server can actually use it (Letting the authorized server actually
use the code is probably a very bad idea). There's this outfit
called the AACS that tries to design copy-protection schemes for
HD-DVD. They failed, so they changed the key. The new key was
cracked very quickly, even before the DVDs with the new key got
released.

You really think you can do better? I'll give you a few hints:
- Don't distribute it.
- Don't even write it in the first place.
- Destroy all the copies of it.

May 26 '07 #16
>You miss the point. What happens if I set my mac address to be the
>same? If your server is available to the internet, it's mac address is
available. And that means I can change it on my system.
No, the MAC address of my server is available to machines on my
local LAN, and perhaps the first ISP router at their end of a DSL
line or cable modem. It is *NOT* available to most machines on the
internet. The MAC address *your* computer sees for most every
machine on the internet is likely to be the closest router of your
ISP, or that of a router in your home. If you have a dialup modem
line, you might not see a MAC address at all.

However, it probably doesn't matter. In order for the code to check
the MAC address to be run on the server, it has to be in unencrypted
form on the server. So whatever encryption you use, you also have
to include the key.
>Mac addresses are NOT useful for security.
Definitely agree here. You can easily change your MAC address to be
anything you want.
May 26 '07 #17
On May 26, 2:59 am, Ravi <Ravindrayep...@gmail.comwrote:
Ok people my assumption was wrong... Matt can u tell me how u decode
it because i tryied but base64_decode() function is showing nothing. i
used codelock software for this. But now i don't want to use it any
more i wnat to do it myself with a fresh logic...

any suggestion or help to do it....

Ravi
You can decode it with any base64 decoder. Try the one at
http://www.opinionatedgeek.com/dotne.../Base64Decode/ for
example.

I can't stress enough how much you should listen to what the other
posters are saying. The problem isn't the *software* that you are
using to obfuscate your code. The problem is that this is not a good
design for securing an application. Code obfuscation is only a way to
make it harder for people to figure out your code, but it won't stop a
talented hacker. It might not even stop a novice hacker. In fact, it
will probably encourage them to explore your code further.

So, don't try to obfuscate, hide or encrypt the code for security
purposes. Rather, use established security mechanisms that properly
authenticate users or systems. Mechanisms such as passwords and
certificates, when used properly, are wonderful means to accomplish
this.

May 27 '07 #18

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Picture Dots | last post by:
Ok - I want to check a string for @ in it (Im checking to see if a string that should contain an email holds a @ ) How would I go about this? preg_match? ereg? strstr?Examples? Also - how...
2
by: Antitax | last post by:
I have a database with more than 800 adress records Some of the are similar because some letters in the street adress for example are not identical, altough they point to the same adress. Does...
9
by: Lauren Wilson | last post by:
Hi Folks, We've been using Crypto ++32 to control licensed access to our widely distributed Access 2K app. Unfortunately, Sampson Multimedia appears to be out of business. Does anyone out...
2
by: FR3AK | last post by:
Hi. does anyone have any idea of how to find the mac address of a remote networking device? I've worked with WMI and it works fine as long as the target machine is a Windows computer, however,...
1
by: | last post by:
Hello, I'm keping myself busy here by investigating the world of LDAP and Active Directory. I have an application which allows users from the system to be selected from a list box and as a...
2
by: Lad | last post by:
Did anyone try to find out a regular expression for finding an email address in a text? Thank you for the reply L.
11
by: axlq | last post by:
Does anyone have a favored way of finding the geographic location of a user's IP address, so that a php script can include content relevant to that location? Reverse-lookup of the hostname isn't...
17
by: abhimanyu.v | last post by:
Hi Guys, I have one doubt. The test program is given below. It uses two way of finding out the offset of a variable in structure. I executed the program and found the same result. My question...
5
by: Timothy Grant | last post by:
On Tue, Aug 5, 2008 at 2:50 PM, David York <davideyork@gmail.comwrote: I'm not sure what you are trying to accomplish. The machine I'm typing this on has a 192.168.x.x number. The router that...
275
by: Astley Le Jasper | last post by:
Sorry for the numpty question ... How do you find the reference name of an object? So if i have this bob = modulename.objectname() how do i find that the name is 'bob'
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.