How to get mac address with input ip address

Thread Solved

Join Date: Jan 2008
Posts: 97
Reputation: Estella is an unknown quantity at this point 
Solved Threads: 6
Estella's Avatar
Estella Estella is offline Offline
Junior Poster in Training

How to get mac address with input ip address

 
0
  #1
Feb 8th, 2008
Hi All,
How can i get mac address from other computers with input ip address?

Please helps
Best Regards...
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 2,641
Reputation: Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light 
Solved Threads: 245
Jx_Man's Avatar
Jx_Man Jx_Man is offline Offline
Posting Maven

Re: How to get mac address with input ip address

 
3
  #2
Feb 8th, 2008
use this api function estella :
  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)
Never tried = Never Know
So, Please do something before post your thread.
* PM Asking will be ignored *
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 140
Reputation: jonifen is an unknown quantity at this point 
Solved Threads: 15
jonifen jonifen is offline Offline
Junior Poster

Re: How to get mac address with input ip address

 
0
  #3
Feb 8th, 2008
That's excellent, I've wondered how that was done.
(rep added)
Last edited by jonifen; Feb 8th, 2008 at 5:45 pm.
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 97
Reputation: Estella is an unknown quantity at this point 
Solved Threads: 6
Estella's Avatar
Estella Estella is offline Offline
Junior Poster in Training

Re: How to get mac address with input ip address

 
0
  #4
Feb 8th, 2008
thx for the reply jx_man, but i really newbie in this. may i get some ex code please???

Best Regards...
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 2,641
Reputation: Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light 
Solved Threads: 245
Jx_Man's Avatar
Jx_Man Jx_Man is offline Offline
Posting Maven

Re: How to get mac address with input ip address

 
3
  #5
Feb 8th, 2008
Try This following Code :
  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 :
MAC Address.bmp
Last edited by Jx_Man; Feb 8th, 2008 at 11:08 pm. Reason: Pic attach
Never tried = Never Know
So, Please do something before post your thread.
* PM Asking will be ignored *
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 97
Reputation: Estella is an unknown quantity at this point 
Solved Threads: 6
Estella's Avatar
Estella Estella is offline Offline
Junior Poster in Training

Re: How to get mac address with input ip address

 
0
  #6
Feb 9th, 2008
Wow, Thx a lot Jx_Man. this a wonderful code.
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 2,641
Reputation: Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light 
Solved Threads: 245
Jx_Man's Avatar
Jx_Man Jx_Man is offline Offline
Posting Maven

Re: How to get mac address with input ip address

 
1
  #7
Feb 9th, 2008
you're welcome.
happy coding and once again careful with the code.
Never tried = Never Know
So, Please do something before post your thread.
* PM Asking will be ignored *
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 25
Reputation: Neji is an unknown quantity at this point 
Solved Threads: 1
Neji's Avatar
Neji Neji is offline Offline
Light Poster

Re: How to get mac address with input ip address

 
1
  #8
Feb 12th, 2008
wonderful code...
Reply With Quote Quick reply to this message  
Join Date: May 2009
Posts: 1
Reputation: batsam is an unknown quantity at this point 
Solved Threads: 0
batsam batsam is offline Offline
Newbie Poster

Re: How to get mac address with input ip address

 
0
  #9
May 20th, 2009
AMAZING... that's all i can say.. ^^
Reply With Quote Quick reply to this message  
Join Date: May 2009
Posts: 1
Reputation: omer.irkad is an unknown quantity at this point 
Solved Threads: 0
omer.irkad omer.irkad is offline Offline
Newbie Poster

Re: How to get mac address with input ip address

 
0
  #10
May 23rd, 2009
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
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC