Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

[VB.NET] Display MAC Address From Enterd Local Machines IP



Description:
Code
This Displays MAC Address, add 1 textbox call it MacLocalIPAddressBox and one label called MACAddressDisplayLabel. Then all you need to do is add the code below
and add local machines ip addresss ie 192.168.1.1 then press the button and the label will display the mac address for each local machines ip.

Declarations:
Code
Declare Function SendARP Lib "iphlpapi.dll" Alias "SendARP" (ByVal DestIP As Int32, ByVal SrcIP As Int32, ByVal pMacAddr() As Byte, ByRef PhyAddrLen As Int32) As Int32

Code:
Code
Public Shared Function GetMac(ByVal ipAddr As String) As String

        Dim macAddress As String = String.Empty
        Try
            Dim destIP As Net.IPAddress = Net.IPAddress.Parse(ipAddr)
            Dim IP() As Byte = destIP.GetAddressBytes()
            Dim IPInt As Int32 = BitConverter.ToInt32(IP, 0)
            Dim mac() As Byte = New Byte(5) {}
            SendARP(IPInt, 0, mac, mac.Length)
            macAddress = BitConverter.ToString(mac, 0, mac.Length)
        Catch ex As Exception
            Debug.Write(ex.Message)
        End Try
        Return macAddress

End Function

Usage:
Code
Private Sub button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1.Click

Me.MACAddressDisplayLabel.Text = GetMac(Me.MacLocalIPAddressBox.Text)
End Sub

I Hope This helped you all.

-NathanE

PHP & .NET Contributor.
Thanks, do you know how to scan a network and get ip's and computer names in vb.net?

Thanks
(Jun 26, 2010 11:08 PM)g1ll1s Wrote:  Thanks, do you know how to scan a network and get ip's and computer names in vb.net?

Thanks

I don't fully understand what you are asking but, you can scan an ip for open ports. but you can not get computer information unless that computer send that info to you via (using) RATs, Keyloggers and RootKits.
PHP & .NET Contributor.
Well, what I mean is this:

Click button 1, then it retrieves all the computers (Internal) ip's that are on your LAN and writes them to a label.

Like a network scanner.
(Jun 26, 2010 11:15 PM)g1ll1s Wrote:  Well, what I mean is this:

Click button 1, then it retrieves all the computers (Internal) ip's that are on your LAN and writes them to a label.

Like a network scanner.

Well in that case that might actually be possible. ill look into that.

looks like i forund my next project 😁

-NathanE
PHP & .NET Contributor.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Shell] by samir50Sep 24, 2018 12:33 PM 3 262 Sep 24, 2018 12:33 PM
Last Post: ɩᴄᴀʀᴜȿ ᴌוᴠᴇѕ™
[Python] by Blackshield_realMay 13, 2018 03:21 AM 0 63 May 13, 2018 03:21 AM
Last Post: Blackshield_real
[Python] by anoniminTRApr 29, 2018 05:01 AM 4 126 Apr 29, 2018 05:01 AM
Last Post: anoniminTR