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

 

 


Tema destacado: Recuerda que debes registrarte en el foro para poder participar (preguntar y responder)


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación General
| | |-+  .NET (C#, VB.NET, ASP) (Moderador: kub0x)
| | | |-+  Alguna forma de cambiar la MAC de la tarjeta de RED?
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: Alguna forma de cambiar la MAC de la tarjeta de RED?  (Leído 3,709 veces)
TrashAmbishion


Desconectado Desconectado

Mensajes: 756


Ver Perfil
Alguna forma de cambiar la MAC de la tarjeta de RED?
« en: 24 Octubre 2017, 22:40 pm »

Hola,

Encontre un codigo que supuestamente lo cambia pero no funciona, supongo que en Windows XP si pero para Windows 7 en adelante no, alguna sugerencia.

Saludos

Código
  1.  
  2. Imports System.Management
  3.  
  4. Public Class Form1
  5.    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  6.        FillNetworkAdapters()
  7.    End Sub
  8.  
  9.    Private Sub FillNetworkAdapters()
  10.        Dim mc As System.Management.ManagementClass
  11.        Dim mo As ManagementObject
  12.        mc = New ManagementClass("Win32_NetworkAdapterConfiguration")
  13.        Dim moc As ManagementObjectCollection = mc.GetInstances()
  14.        For Each mo In moc
  15.            If mo.Item("IPEnabled") = True Then
  16.                Dim strAdapter As String
  17.                strAdapter = mo.Item("Caption").ToString().Substring(11)
  18.  
  19.                combo_network.Items.Add(strAdapter)
  20.            End If
  21.        Next
  22.    End Sub
  23.  
  24.    Private Function GetMACAddress(ByVal Adapter As String) As String
  25.        Dim mc As System.Management.ManagementClass
  26.        Dim mo As ManagementObject
  27.        mc = New ManagementClass("Win32_NetworkAdapterConfiguration")
  28.        Dim moc As ManagementObjectCollection = mc.GetInstances()
  29.        For Each mo In moc
  30.            If mo.Item("IPEnabled") = True Then
  31.                Dim strAdapter As String
  32.                strAdapter = mo.Item("Caption").ToString().Substring(11)
  33.                If strAdapter = Adapter Then
  34.                    Return mo.Item("MacAddress").ToString()
  35.                End If
  36.            End If
  37.        Next
  38.    End Function
  39.  
  40.  
  41.    Private Sub combo_network_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles combo_network.SelectedIndexChanged
  42.        label_mactext.Text = GetMACAddress(combo_network.SelectedItem.ToString)
  43.    End Sub
  44.  
  45.    Private Function DoPadding(ByVal x As String) As String
  46.        Dim Ret As String
  47.        Dim z As Integer
  48.  
  49.        Ret = x
  50.        If Len(x) < 4 Then
  51.            For z = 1 To 4 - Len(x)
  52.                Ret = "0" & Ret
  53.            Next
  54.        End If
  55.  
  56.        Return Ret
  57.    End Function
  58.  
  59.  
  60.    Private Sub ShowRestart()
  61.        Dim res As MsgBoxResult = MsgBox("Your MAC Address has been
  62. changed. In order to make the changes take effect, either restart your
  63. computer or enable and disable the changed Network Adapter.",
  64. MsgBoxStyle.Information)
  65.  
  66.  
  67.    End Sub
  68.  
  69.    Private Function GetRoot(ByVal Adapter As String) As String
  70.        Dim regKey As Microsoft.Win32.RegistryKey
  71.        Dim i As Integer = 0
  72.  
  73.        Do
  74.            Dim Root As String = "SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\"
  75.            Dim Last As String = DoPadding(i)
  76.            regKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(Root & Last, True)
  77.  
  78.            Try
  79.                Dim cAdapter As String = regKey.GetValue("DriverDesc").ToString()
  80.                If cAdapter = Adapter Then
  81.                    Return Root & Last
  82.                End If
  83.            Catch
  84.                Exit Do
  85.            End Try
  86.            i += 1
  87.        Loop
  88.  
  89.  
  90.    End Function
  91.  
  92.  
  93.    Private Function IsOkay() As Boolean
  94.        If mac_text.Text = "" Then
  95.            MsgBox("You didn't enter a MAC Address", MsgBoxStyle.Critical)
  96.            Return False
  97.        End If
  98.  
  99.        Dim ed As String = mac_text.Text.Replace(":", "")
  100.  
  101.        If ed.Length <> 12 Then
  102.            MsgBox("A MAC Address must have a length of 12", MsgBoxStyle.Critical)
  103.            Return False
  104.        End If
  105.  
  106.        Try
  107.            If combo_network.SelectedItem.ToString = "" Then
  108.                MsgBox("No Network Adapter selected", MsgBoxStyle.Critical)
  109.                Return False
  110.            End If
  111.        Catch
  112.            MsgBox("No Network Adapter selected", MsgBoxStyle.Critical)
  113.            Return False
  114.        End Try
  115.  
  116.  
  117.        Dim noerror As Boolean = True
  118.        Dim i As Integer
  119.        For i = 0 To ed.Length - 1
  120.            If IsHex(ed.Substring(i, 1)) = False Then
  121.                MsgBox("MAC Address in wrong format", MsgBoxStyle.Critical)
  122.                Return False
  123.            End If
  124.        Next
  125.  
  126.        Return True
  127.    End Function
  128.  
  129.  
  130.    Private Function IsHex(ByVal l As String) As Boolean
  131.        Dim table As String = "0123456789ABCDEF"
  132.        Dim i As Integer
  133.        For i = 0 To table.Length - 1
  134.            If l = table.Substring(i, 1) Then
  135.                Return True
  136.            End If
  137.        Next
  138.        Return False
  139.    End Function
  140.  
  141.  
  142.    Private Sub bt_defaultmac_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt_defaultmac.Click
  143.        If IsOkay() = False Then
  144.            Exit Sub
  145.        End If
  146.        Dim regKey As Microsoft.Win32.RegistryKey
  147.        Dim Addr As String = GetRoot(combo_network.SelectedItem.ToString())
  148.        regKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(Addr, True)
  149.  
  150.        Try
  151.            regKey.DeleteValue("NetworkAddress")
  152.        Catch
  153.            'Do NOTHING
  154.        End Try
  155.        ShowRestart()
  156.    End Sub
  157.  
  158.    Private Sub bt_update_Click(sender As Object, e As EventArgs) Handles bt_update.Click
  159.        If IsOkay() = False Then
  160.            Exit Sub
  161.        End If
  162.        Dim regKey As Microsoft.Win32.RegistryKey
  163.        Dim Addr As String = GetRoot(combo_network.SelectedItem.ToString())
  164.        regKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(Addr, True)
  165.  
  166.        regKey.SetValue("NetworkAddress", mac_text.Text.Replace(":", ""))
  167.        ShowRestart()
  168.    End Sub
  169. End Class
  170.  
  171.  


En línea

DarK_FirefoX


Desconectado Desconectado

Mensajes: 1.263


Be the change you wanna see in te world


Ver Perfil
Re: Alguna forma de cambiar la MAC de la tarjeta de RED?
« Respuesta #1 en: 2 Noviembre 2017, 17:35 pm »

A mi conocimiento, creo que depende del driver de la tarjeta de red. En mi experiencia he podido cambiarla en Windows XP, al parecer los drivers para ese sistema operativo no tienen esa protección.

Nota: nunca he probado con una tarjeta ethernet, lo he hecho con tarjetas para conexiones wi-fi. Aunque debería seguir el mismo principio


En línea

TrashAmbishion


Desconectado Desconectado

Mensajes: 756


Ver Perfil
Re: Alguna forma de cambiar la MAC de la tarjeta de RED?
« Respuesta #2 en: 4 Noviembre 2017, 07:49 am »

Hola,

Pues si funciona fue un error al parecer del sistema estaba mareado disculpa la demora.

Saludos
En línea

DarK_FirefoX


Desconectado Desconectado

Mensajes: 1.263


Be the change you wanna see in te world


Ver Perfil
Re: Alguna forma de cambiar la MAC de la tarjeta de RED?
« Respuesta #3 en: 21 Noviembre 2017, 18:51 pm »

Se me olvidó comentarte que tienes que Deshabilitar el dispositivo y vovlerlo a Habilitar. Quizas fue por eso que dices que "el sistema estaba mareado" y quizas se actualizo el cambio al reiniciar la PC. Salu2s
En línea

TrashAmbishion


Desconectado Desconectado

Mensajes: 756


Ver Perfil
Re: Alguna forma de cambiar la MAC de la tarjeta de RED?
« Respuesta #4 en: 21 Noviembre 2017, 20:35 pm »

Hola,

Gracias por el detalle, pues nada hace dias que habia resuelto se me paso por completo responder aqui.

Pues la MAC si se puede cambiar sin problema alguno en cualquier Windows PERO:

Si es un adaptador NO WIRELESS todo va super

Si se trata de un adaptador wireless ya la cosa cambia supongo que a partir del Windows 7 se introdujo una protección para esto, estuve Googleando y no encontre algun paper al respecto supongo que para evitar el MAC SPOOFING de esta forma. Aclarar que puedes cambiarlo pero tienes que setear el 2do caracter de la MAC con algunos predefinidos un 2 o D no recuerdo ahora bien y estoy trabajando..  :-X

Si alguien sabe mas sobre esto y si hay alguna forma de burlar esa protección...

Saludos
En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
Hay alguna forma de cambiar la imagen del cursor desde Batch?
Scripting
z3nth10n 8 4,924 Último mensaje 4 Febrero 2013, 20:48 pm
por z3nth10n
Existe alguna función o alguna forma para contar archivos/ficheros .txt
Programación C/C++
gibranini 3 3,615 Último mensaje 8 Octubre 2014, 07:34 am
por milx86
¿hay alguna forma de detectar tarjeta de red en modo monitor/promiscuo?
Seguridad
Platanito Mx 1 3,214 Último mensaje 4 Septiembre 2017, 23:08 pm
por AlbertoBSD
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines