943,689 Members | Top Members by Rank

Ad:
You are currently viewing page 1 of this multi-page discussion thread
Feb 8th, 2008
0

How to get mac address with input ip address

Expand Post »
Hi All,
How can i get mac address from other computers with input ip address?

Please helps
Best Regards...
Similar Threads
Reputation Points: 37
Solved Threads: 7
Junior Poster in Training
Estella is offline Offline
99 posts
since Jan 2008
Feb 8th, 2008
3

Re: How to get mac address with input ip address

use this api function estella :
vb Syntax (Toggle Plain Text)
  1. Private Declare Function inet_addr Lib "wsock32.dll" (ByVal s As String) As Long
  2. Private Declare Function SendARP Lib "iphlpapi.dll" (ByVal DestIp As Long, ByVal ScrIP As Long, pMacAddr As Long, PhyAddrLen As Long) As Long
  3. Private Declare Sub CopyMemory Lib "kernel32.dll" Alias "RtlMoveMemory" (dst As Any, src As Any, ByVal bcount As Long)
Reputation Points: 1182
Solved Threads: 392
Posting Sensei
Jx_Man is offline Offline
3,138 posts
since Nov 2007
Feb 8th, 2008
0

Re: How to get mac address with input ip address

That's excellent, I've wondered how that was done.
(rep added)
Last edited by jonifen; Feb 8th, 2008 at 5:45 pm.
Reputation Points: 13
Solved Threads: 17
Junior Poster
jonifen is offline Offline
152 posts
since Nov 2007
Feb 8th, 2008
0

Re: How to get mac address with input ip address

thx for the reply jx_man, but i really newbie in this. may i get some ex code please???

Best Regards...
Reputation Points: 37
Solved Threads: 7
Junior Poster in Training
Estella is offline Offline
99 posts
since Jan 2008
Feb 8th, 2008
4

Re: How to get mac address with input ip address

Try This following Code :
vb Syntax (Toggle Plain Text)
  1. Option Explicit
  2.  
  3. Private Const No_ERROR = 0
  4.  
  5. Private Declare Function inet_addr Lib "wsock32.dll" (ByVal s As String) As Long
  6. Private Declare Function SendARP Lib "iphlpapi.dll" (ByVal DestIp As Long, ByVal ScrIP As Long, pMacAddr As Long, PhyAddrLen As Long) As Long
  7. Private Declare Sub CopyMemory Lib "kernel32.dll" Alias "RtlMoveMemory" (dst As Any, src As Any, ByVal bcount As Long)
  8.  
  9. Private Function GetRemoteMACAddress(ByVal sRemoteIP As String, sRemoteMacAddress As String) As Boolean
  10. Dim dwRemoteIp As Long
  11. Dim pMacAddr As Long
  12. Dim bpMacAddr() As Byte
  13. Dim PhyAddrLen As Long
  14. Dim cnt As Long
  15. Dim tmp As String
  16.  
  17. dwRemoteIp = inet_addr(sRemoteIP)
  18. If dwRemoteIp <> 0 Then
  19. PhyAddrLen = 6
  20. If SendARP(dwRemoteIp, 0&, pMacAddr, PhyAddrLen) = No_ERROR Then
  21. If pMacAddr <> 0 And PhyAddrLen <> 0 Then
  22. ReDim bpMacAddr(0 To PhyAddrLen - 1)
  23. CopyMemory bpMacAddr(0), pMacAddr, ByVal PhyAddrLen
  24. For cnt = 0 To PhyAddrLen - 1
  25. If bpMacAddr(cnt) = 0 Then
  26. tmp = tmp & "00-"
  27. Else
  28. tmp = tmp & Hex$(bpMacAddr(cnt)) & "-"
  29. End If
  30. Next
  31.  
  32. If Len(tmp) > 0 Then
  33. sRemoteMacAddress = Left$(tmp, Len(tmp) - 1)
  34. GetRemoteMACAddress = True
  35. End If
  36.  
  37. Exit Function
  38. Else
  39. GetRemoteMACAddress = False
  40. End If
  41. Else
  42. GetRemoteMACAddress = False
  43. End If
  44. Else
  45. GetRemoteMACAddress = False
  46. End If
  47. End Function
  48.  
  49. Private Sub btnGetMac_Click()
  50. Dim sRemoteMacAddress As String
  51. If Len(txtIpAddress.Text) > 0 Then
  52. If GetRemoteMACAddress(txtIpAddress.Text, sRemoteMacAddress) Then
  53. lblMacAddress.Caption = sRemoteMacAddress
  54. Else
  55. lblMacAddress.Caption = "(SendARP call failed)"
  56. End If
  57. End If
  58. End Sub
Actually this code can use as hacking tool, so use this code carefully friend.

It seems like this pic :
Name:  MAC Address.bmp
Views: 5181
Size:  127.7 KB
Last edited by Jx_Man; Feb 8th, 2008 at 11:08 pm. Reason: Pic attach
Reputation Points: 1182
Solved Threads: 392
Posting Sensei
Jx_Man is offline Offline
3,138 posts
since Nov 2007
Feb 9th, 2008
0

Re: How to get mac address with input ip address

Wow, Thx a lot Jx_Man. this a wonderful code.
Reputation Points: 37
Solved Threads: 7
Junior Poster in Training
Estella is offline Offline
99 posts
since Jan 2008
Feb 9th, 2008
1

Re: How to get mac address with input ip address

you're welcome.
happy coding and once again careful with the code.
Reputation Points: 1182
Solved Threads: 392
Posting Sensei
Jx_Man is offline Offline
3,138 posts
since Nov 2007
Feb 12th, 2008
1

Re: How to get mac address with input ip address

wonderful code...
Reputation Points: 34
Solved Threads: 1
Light Poster
Neji is offline Offline
28 posts
since Feb 2008
May 20th, 2009
0

Re: How to get mac address with input ip address

AMAZING... that's all i can say.. ^^
Reputation Points: 10
Solved Threads: 0
Newbie Poster
batsam is offline Offline
1 posts
since May 2009
May 23rd, 2009
0

Re: How to get mac address with input ip address

Get MAC and IP addresses into your C# or any .NET programs by this DLL (download from this Link)

http://www.fileupyours.com/view/2466...ress%20DLL.zip

The program module DLL in this link is written in C# to provide the programmer the easiest method to find the MAC and the IP addresses of the PC, laptop or server. Download the ZIP file and extract DLL (6 Kb) and the PDF explaining how to add this DLL into your program. You dont have to define any field or any program module in your development environment. Just add the DLL file into the references in Visual Studio Solution Browser. Read the PDF file, everything is explained there, so easy, just few lines and all the network adapter MAC and IP addresses are in your program.

By Omer IRKAD omer.irkad@hotmail.com

Get MAC and IP addresses into your C# or any .NET programs by this DLL (download from this Link)

http://www.fileupyours.com/view/2466...ress%20DLL.zip
Reputation Points: 10
Solved Threads: 0
Newbie Poster
omer.irkad is offline Offline
1 posts
since May 2009

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Who has the database open?
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Refresh MS Treeview





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC