[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Can a website detect a persons mac address?

Posted on 2006-05-12
14
Medium Priority
?
395 Views
Last Modified: 2010-04-20
What info can the collect about site viewers?
0
Comment
Question by:gharnett
  • 6
  • 3
10 Comments
 
LVL 18

Expert Comment

by:Sam Panwar
ID: 16672433
No its not possible to get mac address through the website. It means you can search the computer and website or explorer have not right about it .

But try these may be

1.
First you can use Gethostbyaddr() to get remote host's name
then you can use Netbios()(setting ncb.command =ncbstat)
then you can get the mac address of remote host's net adapter

2.You cannot do this without platform-specific code which is off-topic here.
The C language does not provide networking support
3. Mac address of the remote connected machine

command promt>

arp ? then enter

run this

3.C program for Mac address

#include <stdio.h>

int main(void)
{
        char mac_address[257];

        printf("Enter the MAC address of the remote computer: ");
        fflush(stdin);

        fgets(mac_address,sizeof(mac_address), stdin);
        if (mac_address[strlen(mac_address) - 1] == '\n')
                mac_address[strlen(mac_address) - 1] = 0;

        printf("The MAC address of the remote computer is %s\n",
               mac_address);

        return 0;

}

5.Try: 'nbtstat -A <IP>' or 'nbtstat -a computername' (note, the -A and -a
are case sensitive). For example, if the 95's name is MyPC and its IP is
192.168.1.10, you might use either of the following:

  nbtstat -a MyPC

  nbtstat -A 192.160.1.10
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 16677443
> Can a website detect a persons mac address?
only if you manage to use malware (JavaScript, ActiveX, etc.) on the client which is able to read the NIC sesstings
0
 

Author Comment

by:gharnett
ID: 16762606
Abs_jaipur

Thanks,


How would I use that program you gave if I were a webmaster?


0
Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

 
LVL 18

Expert Comment

by:Sam Panwar
ID: 16765933
Hi,

You can use in your website and your webserver support these mime type.
0
 
LVL 18

Accepted Solution

by:
Sam Panwar earned 400 total points
ID: 16977470
Hi,

Use the ffollowing script in your webpage : ITS 100% show the MAC address I tested it.

But you have the permission on the server for run this script otherwise you get error.


-------------------------------------------------script----------------------------------------------------------
Option Compare Text
Option Explicit On
Option Strict On

Partial Class _Default
    Inherits System.Web.UI.Page

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        Label1.Text = ""
        For Each mac As String In GetMac()
            Label1.Text += mac + ", "
        Next
    End Sub

    Public Function GetMac() As List(Of String)

        Dim nic() As NetworkInterface
        Dim mac As New List(Of String)
        Dim add As PhysicalAddress

        If NetworkInterface.GetIsNetworkAvailable Then
            nic = NetworkInterface.GetAllNetworkInterfaces

            For Each ni As NetworkInterface In nic
                add = ni.GetPhysicalAddress
                mac.Add(BitConverter.ToString(add.GetAddressBytes))
            Next
        End If

        Return mac

    End Function

End Class

-------------------------------------------------------------------------------------------------------------------
0
 
LVL 18

Expert Comment

by:Sam Panwar
ID: 16977482
this is asp.net script
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 16977761
<political-ethical>
RomMod, if posting such harmless code is illegal (while uncle Sam violates human rights, and people's privarcy all over the world), it would probably be time to totally blacklist EE. Keep in mind that the code is "malware" (in my definition just like JavaScript) and will not be executed on a properly configured browser ;-)
Please undelete the comments or inform responsible EE people (netminder, Wes).
@~/
</political-ethical>

BTW, the asnser to the initial question has alreday be given: NO

---- this comment may be deleted afterwords, could do it  myself, but won't put on my PE hat ...
0
 
LVL 18

Expert Comment

by:Sam Panwar
ID: 16978312
Hi- ahoffmann -

HAve see my code its not political-ethical .

Just define it with my code its not harmful
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 16979011
Abs_jaipur, my comment was for the moderators, I don't see a problem with your code (as long as not run on my machine:-))
0
 
LVL 18

Expert Comment

by:Sam Panwar
ID: 16980970
Hi -RomMod & ahoffmann -

Ok sorry for it. And thank you for restore my post.

This is not harmful code and anyone can't run this without permisssion.

0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A web service (http://en.wikipedia.org/wiki/Web_service) is a software related technology that facilitates machine-to-machine interaction over a network. This article helps beginners in creating and consuming a web service using the ColdFusion Ma…
What You Need to Know when Searching for a Webhost Provider
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question