![]() |
|
Get your MAC(Media Access Control) using VB.Net - Printable Version +- Sinisterly (https://sinister.li) +-- Forum: Coding (https://sinister.li/Forum-Coding) +--- Forum: Visual Basic & .NET Framework (https://sinister.li/Forum-Visual-Basic-NET-Framework) +--- Thread: Get your MAC(Media Access Control) using VB.Net (/Thread-Get-your-MAC-Media-Access-Control-using-VB-Net) |
Get your MAC(Media Access Control) using VB.Net - zosoftnet - 08-15-2013 Get your Media Access Control (Machine Address) using your own program. What I really means is 100% Virus free program. You can either use the program which I already compiled or Copy the Source code and build your own application and use that. ![]() Download the binary file : http://www.zosoftnet.com/wp-content/uploads/2012/03/MAC-Address.zip PHP Code: Imports System.Management
Imports System.Net
Public Class Form1
Dim mos As ManagementObjectSearcher
Dim moc As ManagementObjectCollection
Dim mo As ManagementObject = Nothing
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
Try
Try
TextBox1.Clear()
mos = New ManagementObjectSearcher("select * from Win32_NetworkAdapter where Name='" + ComboBox1.SelectedItem.ToString() + "'")
moc = mos.Get()
If (moc.Count > 0) Then
For Each mo In moc
TextBox1.Text = mo.Item("MACAddress").ToString
Next
End If
Catch ex As Exception
End Try
Try
TextBox2.Clear()
mos = New ManagementObjectSearcher("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = 'TRUE'")
moc = mos.Get
If moc.Count > 0 Then
For Each mo In moc
TextBox2.Text = mo.Item("DNSHostName").ToString
Next
End If
Catch ex As Exception
End Try
Try
'Extract IP address
Dim local As IPHostEntry
local = Dns.GetHostByName(TextBox2.Text)
Dim ip As IPAddress
TextBox3.Clear()
For Each ip In local.AddressList
If TextBox3.Text = "" Then
TextBox3.Text = ip.ToString
Else
TextBox3.Text = TextBox3.Text & " / " & ip.ToString
End If
Next
Catch ex As Exception
End Try
Try
TextBox4.Clear()
'SubNet Mask
If moc.Count > 0 Then
TextBox4.Text = mo.Item("IPSubnet")(0)
End If
Catch ex As Exception
End Try
Try
TextBox5.Clear()
mos = New ManagementObjectSearcher("SELECT * FROM Win32_NetworkClient WHERE Status = 'OK'")
moc = mos.Get
If moc.Count > 0 Then
For Each mo In moc
TextBox5.Text = mo.Item("Caption").ToString
Next
End If
Catch ex As Exception
End Try
Catch ex As Exception
Finally
mo.Dispose()
mos.Dispose()
moc.Dispose()
End Try
End Sub
Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
Try
If MsgBox("Are you sure you want to exit?", MsgBoxStyle.YesNo, "Close?") = MsgBoxResult.No Then
e.Cancel = True
Else
e.Cancel = True
ClosingTimer.Enabled = True
End If
Catch ex As Exception
End Try
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
TextBox1.Clear()
mos = New ManagementObjectSearcher("SELECT * FROM Win32_NetworkAdapter Where AdapterType='Ethernet 802.3'")
moc = mos.Get
For Each mo In moc
ComboBox1.Items.Add(mo.Item("Name").ToString)
Next
Catch ex As Exception
MsgBox("Error : " & ex.ToString, MsgBoxStyle.Exclamation, "")
Finally
End Try
End Sub
Private Sub Form1_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseClick
Try
If e.Button = Windows.Forms.MouseButtons.Right Then
ContextMenuStrip1.Show(Me, Me.Cursor.Position.X - 250, Me.Cursor.Position.Y - 250)
End If
Catch ex As Exception
End Try
End Sub
Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click
Me.Close()
End Sub
Private Sub AboutToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AboutToolStripMenuItem.Click
Try
MsgBox("This Application is designed and Programmed by : " & vbCrLf & "Mr. Vanlalruata Hnamte" & vbCrLf & "Copyrighted © ZoSoft Network 2011", MsgBoxStyle.Information, "About")
Catch ex As Exception
End Try
End Sub
Private Sub ClosingTimer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClosingTimer.Tick
Try
Me.Opacity = Me.Opacity - 0.1
If Me.Opacity <= 0 Then End
Catch ex As Exception
End Try
End Sub
End Class
RE: Get your MAC(Media Access Control) using VB.Net - ViolentReality - 08-15-2013 The thing with using your MAC address, it's easily spoofable. Not like HWID where it's just by chance that 2 of your users have the same address. Thanks for sharing. RE: Get your MAC(Media Access Control) using VB.Net - Eternity - 08-15-2013 (08-15-2013, 06:05 PM)ViolentReality Wrote: The thing with using your MAC address, it's easily spoofable. You can "Change"(Virtually) both easily. RE: Get your MAC(Media Access Control) using VB.Net - zosoftnet - 08-16-2013 (08-15-2013, 07:53 PM)Eternity Wrote:(08-15-2013, 06:05 PM)ViolentReality Wrote: The thing with using your MAC address, it's easily spoofable. I agree with you...MAC address can be changed easily....best is still with the CPU ID !!! I had never come across with any successful CPU ID changer.. RE: Get your MAC(Media Access Control) using VB.Net - Eternity - 08-16-2013 (08-16-2013, 02:46 PM)zosoftnet Wrote:(08-15-2013, 07:53 PM)Eternity Wrote:(08-15-2013, 06:05 PM)ViolentReality Wrote: The thing with using your MAC address, it's easily spoofable. http://a-i-soft.blogspot.no/2012/04/i-soft-cpu-id-changer-v10.html Everything is changeable. |