0

I want to get client machine mac address so that user cannot be able to log in from other computer. I am new to PPAPI and has tried below code in C to get mac address. It require conio.h header file that PPAPI lib doesn't contain. i also added this file externally but no help. any idea

{
/* Copyright (c) 2013 The Chromium Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#include "ppapi_simple/ps_main.h"

#ifdef SEL_LDR
#define example_main main
#endif

int example_main(int argc, char* argv[]) {
  /* Use ppb_messaging to send "Hello World" to JavaScript. */
    FILE *fp;
    printf("Hello before system.\n");
    system ("ipconfig/all>D://macid.txt");
printf("Hello before file open.\n");
fp=fopen("D://macid.txt","r");
printf("Hello before if.\n");
if(fp!=NULL)  
    {  
        printf("Hello before while.\n");
        char line[128];  
        while(fgets(line,sizeof line,fp)!=NULL)  
        {  
            printf("Hello in while.\n");
            char *nwln=strchr(line,'\n');  
            char *ptr;  
            if(nwln!=NULL)  
            *nwln='\0';  
            ptr=strstr(line,"Physical Address");  
            if(ptr!=NULL)  
            {  
                printf("Hello in iff.\n");
                printf("hello : %s\n",ptr);  
                break;  
            }  
        }  
    }  

printf("Hello World STDOUTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT.\n");
printf("Hello Deepesh Jain.\n");

/* Use ppb_console send "Hello World" to the JavaScript Console. */
fprintf(stderr, "Hello World STDERR.\n");
return 0;
}

/*
* Register the function to call once the Instance Object is initialized.
* see: pappi_simple/ps_main.h
*
* This is not needed when building the sel_ldr version of this example
* which does not link against ppapi_simple.
*/
#ifndef SEL_LDR
PPAPI_SIMPLE_REGISTER_MAIN(example_main)
#endif

}

1 Answers1

1

Are you trying to do this for a web app, or for an extension? In general, PPAPI and NaCl don't offer more APIs than what the traditional web platform does, so if you're going for a web app then you can't get access to the MAC address. In an extension you may have access to more APIs, such as the hostname which was recently added.

The web platform does have other mechanisms to identify users, such as cookies, but these are under the user's control and may be evicted.

JF Bastien
  • 6,673
  • 2
  • 26
  • 34
  • I want to do this for a web app. Because web app doesn't allow to get client machine mac address that's why I want to make a plugin which will call every time when the log in page is loaded. – Dipesh Jain Nov 05 '14 at 07:06
  • This is not entirely true. Chrome extension is able to call executable file, i.e. exe or bat file on Windows, by Native message. In this way, chrome extension can get any information like MAC, CPU, BIOS information. https://developer.chrome.com/extensions/nativeMessaging – BurnetZhong May 09 '18 at 11:26