elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Introducción a Git (Primera Parte)


+  Foro de elhacker.net
|-+  Programación
| |-+  Desarrollo Web
| | |-+  PHP (Moderador: #!drvy)
| | | |-+  Obtener la MAC
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] 2 Ir Abajo Respuesta Imprimir
Autor Tema: Obtener la MAC  (Leído 10,354 veces)
‭lipman


Desconectado Desconectado

Mensajes: 3.062



Ver Perfil WWW
Obtener la MAC
« en: 4 Junio 2009, 12:07 pm »

Hay alguna forma de obtener la MAC del visitante?  :huh: :huh:

Saludoss


En línea

Spider-Net


Desconectado Desconectado

Mensajes: 1.165


Un gran poder conlleva una gran responsabilidad


Ver Perfil WWW
Re: Obtener la MAC
« Respuesta #1 en: 4 Junio 2009, 12:23 pm »

PHP se ejecuta del lado del servidor, no creo que puedas acceder a los datos del PC visitante como puede ser la MAC, a parte sería una vulneración de los derechos de privacidad del visitante.


En línea

‭lipman


Desconectado Desconectado

Mensajes: 3.062



Ver Perfil WWW
Re: Obtener la MAC
« Respuesta #2 en: 4 Junio 2009, 12:55 pm »

Era por saber si hay alguna funcion, parecida a la de obtener la IP, para la MAC xD pero ya veo que no ^^

Gracias saludos
En línea

дٳŦ٭
GNU/Linux Infrastructure Specialist
Ex-Staff
*
Desconectado Desconectado

Mensajes: 5.110


Ver Perfil WWW
Re: Obtener la MAC
« Respuesta #3 en: 4 Junio 2009, 17:19 pm »

mmm sí... php es de lado server. Busca algo hecho en java (no js), seguro hay pero es violar la privacidad...
En línea

invisible_hack


Desconectado Desconectado

Mensajes: 978


Invisible_Hack™ Nick Registrado ^^


Ver Perfil WWW
Re: Obtener la MAC
« Respuesta #4 en: 4 Junio 2009, 19:44 pm »

Ésto me recuerda a la pregunta que hice yo hace tiempo, sobre cómo obtener el nombre del Pc en PHP, y pues algunos dijeron que sí, otros que no, algunos me dijeron que con la variable user se podía, pero probé y nada...

Pues supongo que para el tema de la MAC ocurrirá lo mismo, ya que como han dicho trabajada del lado del server...

Saludos.
En línea

"Si no visitas mi blog, Chuck te dará una patada giratoria"
[u]nsigned


Desconectado Desconectado

Mensajes: 2.397

JS/Node developer


Ver Perfil WWW
Re: Obtener la MAC
« Respuesta #5 en: 4 Junio 2009, 20:05 pm »

Bueno buscando encontre esto:

Código
  1. <?
  2. function returnMacAddress() {
  3. // This code is under the GNU Public Licence
  4. // Written by michael_stankiewicz {don't spam} at yahoo {no spam} dot com
  5. // Tested only on linux, please report bugs
  6.  
  7. // WARNING: the commands 'which' and 'arp' should be executable
  8. // by the apache user; on most linux boxes the default configuration
  9. // should work fine
  10.  
  11. // Get the arp executable path
  12. $location = `which arp`;
  13. // Execute the arp command and store the output in $arpTable
  14. $arpTable = `$location`;
  15. // Split the output so every line is an entry of the $arpSplitted array
  16. $arpSplitted = split("\n",$arpTable);
  17. // Get the remote ip address (the ip address of the client, the browser)
  18. $remoteIp = $GLOBALS['REMOTE_ADDR'];
  19. // Cicle the array to find the match with the remote ip address
  20. foreach ($arpSplitted as $value) {
  21. // Split every arp line, this is done in case the format of the arp
  22. // command output is a bit different than expected
  23. $valueSplitted = split(" ",$value);
  24. foreach ($valueSplitted as $spLine) {
  25. if (preg_match("/$remoteIp/",$spLine)) {
  26. $ipFound = true;
  27. }
  28. // The ip address has been found, now rescan all the string
  29. // to get the mac address
  30. if ($ipFound) {
  31. // Rescan all the string, in case the mac address, in the string
  32. // returned by arp, comes before the ip address
  33. // (you know, Murphy's laws)
  34. reset($valueSplitted);
  35. foreach ($valueSplitted as $spLine) {
  36. if (preg_match("/[0-9a-f][0-9a-f][:-]".
  37. "[0-9a-f][0-9a-f][:-]".
  38. "[0-9a-f][0-9a-f][:-]".
  39. "[0-9a-f][0-9a-f][:-]".
  40. "[0-9a-f][0-9a-f][:-]".
  41. "[0-9a-f][0-9a-f]/i",$spLine)) {
  42. return $spLine;
  43. }
  44. }
  45. }
  46. $ipFound = false;
  47. }
  48. }
  49. return false;
  50. }
  51. ?>
  52.  

Pero necesitas tener un servidor dedicado donde puedas activar shell_exec(). Creo que lo mismo pasa para otros scripts...  :-\

Saludos
En línea

No hay atajo ante la duda, el misterio se hace aquí...
Se hace carne en cada uno, el misterio es existir!
дٳŦ٭
GNU/Linux Infrastructure Specialist
Ex-Staff
*
Desconectado Desconectado

Mensajes: 5.110


Ver Perfil WWW
Re: Obtener la MAC
« Respuesta #6 en: 4 Junio 2009, 20:12 pm »

Bueno buscando encontre esto:

Código
  1. <?
  2. function returnMacAddress() {
  3. // This code is under the GNU Public Licence
  4. // Written by michael_stankiewicz {don't spam} at yahoo {no spam} dot com
  5. // Tested only on linux, please report bugs
  6.  
  7. // WARNING: the commands 'which' and 'arp' should be executable
  8. // by the apache user; on most linux boxes the default configuration
  9. // should work fine
  10.  
  11. // Get the arp executable path
  12. $location = `which arp`;
  13. // Execute the arp command and store the output in $arpTable
  14. $arpTable = `$location`;
  15. // Split the output so every line is an entry of the $arpSplitted array
  16. $arpSplitted = split("\n",$arpTable);
  17. // Get the remote ip address (the ip address of the client, the browser)
  18. $remoteIp = $GLOBALS['REMOTE_ADDR'];
  19. // Cicle the array to find the match with the remote ip address
  20. foreach ($arpSplitted as $value) {
  21. // Split every arp line, this is done in case the format of the arp
  22. // command output is a bit different than expected
  23. $valueSplitted = split(" ",$value);
  24. foreach ($valueSplitted as $spLine) {
  25. if (preg_match("/$remoteIp/",$spLine)) {
  26. $ipFound = true;
  27. }
  28. // The ip address has been found, now rescan all the string
  29. // to get the mac address
  30. if ($ipFound) {
  31. // Rescan all the string, in case the mac address, in the string
  32. // returned by arp, comes before the ip address
  33. // (you know, Murphy's laws)
  34. reset($valueSplitted);
  35. foreach ($valueSplitted as $spLine) {
  36. if (preg_match("/[0-9a-f][0-9a-f][:-]".
  37. "[0-9a-f][0-9a-f][:-]".
  38. "[0-9a-f][0-9a-f][:-]".
  39. "[0-9a-f][0-9a-f][:-]".
  40. "[0-9a-f][0-9a-f][:-]".
  41. "[0-9a-f][0-9a-f]/i",$spLine)) {
  42. return $spLine;
  43. }
  44. }
  45. }
  46. $ipFound = false;
  47. }
  48. }
  49. return false;
  50. }
  51. ?>
  52.  

Pero necesitas tener un servidor dedicado donde puedas activar shell_exec(). Creo que lo mismo pasa para otros scripts...  :-\

Saludos

Donde usas shell_exec???
En línea

-Ramc-


Desconectado Desconectado

Mensajes: 495



Ver Perfil
Re: Obtener la MAC
« Respuesta #7 en: 4 Junio 2009, 20:15 pm »

Con activex creo que se puede, pero, sólo te serviria para IE.

EDIT: Mira: http://social.msdn.microsoft.com/Forums/es-ES/netfxwebes/thread/e5c2340e-4bd1-4250-a42a-4fdbf386d87e
« Última modificación: 4 Junio 2009, 20:17 pm por -Ramc- » En línea


Shhh... be vewy, vewy, quiet!  I'm hunting wabbits...
LA PANDILLA MAS GRANDE DE MI CIUDAD, SE LLAMA POLICIA NACIONAL.
[u]nsigned


Desconectado Desconectado

Mensajes: 2.397

JS/Node developer


Ver Perfil WWW
Re: Obtener la MAC
« Respuesta #8 en: 4 Junio 2009, 20:44 pm »


Donde usas shell_exec???

Bueno, yo mismo me puse a probar el script en mi cuenta de free hosting antes de postear:
http://fakx.comyr.com/prueba/mac.php

Igual en el foro de donde saque ese codigo, aclararon ROTUNDAMENTE eso.

Ojo! no pretendo desafiar al MOD ni nada que se le paresca ;D, si estoy en un error gracias por corregirme :-[

Saludos
En línea

No hay atajo ante la duda, el misterio se hace aquí...
Se hace carne en cada uno, el misterio es existir!
Spider-Net


Desconectado Desconectado

Mensajes: 1.165


Un gran poder conlleva una gran responsabilidad


Ver Perfil WWW
Re: Obtener la MAC
« Respuesta #9 en: 4 Junio 2009, 21:55 pm »

Lo que yo no me explico es como en el code pretende sacar la MAC a través de la IP  :huh: :huh:

Pero si funciona la verdad es que está muy bien, yo la verdad es que no lo probé...

Saludos!
« Última modificación: 4 Junio 2009, 21:59 pm por Spider-Net » En línea

Páginas: [1] 2 Ir Arriba Respuesta Imprimir 

Ir a:  
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines