Jump to content

How to get mac from broadcast response


vortex91
 Share

Recommended Posts

Some help please with UDPRecv from help file array 0 1 2 give you ip, port, data But i also would like to get the MAC address of the responding clients.

Im basicly sending a broadcast to clients which respond back with proper data. I would like to save the data of all responding clients based on mac. I clearly see the MAC in the wireshark. But the data received is not in the array of UDPRecv. Is there a work around for this?

thank you

Link to comment
Share on other sites

It doesn't appear, from reading the help file, that that is returned by UDPRecv. You will have to use another method to get the MAC address.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

It doesn't appear, from reading the help file, that that is returned by UDPRecv. You will have to use another method to get the MAC address.

Im open to suggestions. Below is sample code

UDPStartup()

$Broadcast=UdpOpen("255.255.255.255", 69, 3)

if @Error <> 0 Then

Msgbox(0,"",@error)

Exit

EndIf

$n = BinaryToString ("0x01")

UDPSend ($Broadcast,"DATA" & $n )

;UDPCloseSocket($socket)

;$socket=UDpBind($g_IP,$g_port)

While 1

$data = UDPRecv($Broadcast, 200, 3)

If $data <> "" Then

MsgBox(0, "UDP DATA", $data[0], 1)

FileWrite( $data[1], $data[0])

EndIf

;sleep(100)

Wend

Func OnAutoItExit()

UDPCloseSocket($Socket)

UDPShutdown()

EndFunc

Link to comment
Share on other sites

WireShark is not autoit.

Perhaps you should have the clients send their respective MAC

along with the data.

I understand that wireshark is not autoit. I would love to have the clients send that data. Except I'm not in control of the clients code base :) Im looking for a work around for this using autoit.

thanx

Link to comment
Share on other sites

http://bit.ly/RFpKhz

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Thanx for that now point to me any of the results that answer my questions. NONE i alreayd googled it and read 100 posts. Im looking for the MAC of the client connected to my broadcast response. The info is in layer 3. I just want to know how to access it via autoit.

Really? None of them helped? How about the sixth link listed? Which has post in it with a function that gives you a MAC address from the IP address. You get the IP address from the UDPRecv function, use that with that function to retrieve the MAC address from the machine.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Really? None of them helped? How about the sixth link listed? Which has post in it with a function that gives you a MAC address from the IP address. You get the IP address from the UDPRecv function, use that with that function to retrieve the MAC address from the machine.

Your not reading my post properly i think. Im trying to get the MAC of the client responding to my broadcast not the mac of the PC my script is running on.

Link to comment
Share on other sites

Did you even TRY the script? Did you even READ the post of mine you quoted?

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Did you even TRY the script? Did you even READ the post of mine you quoted?

Yes this sends out an ARP after the discovery to each discovered IP to retreive the MAC. There must be a better way of handling this from broadcast instead of sending a 2nd ARP to each discovered IP. The data is clearly present in the response to the broadcast. There must be some way of retreiving it.

Edited by vortex91
Link to comment
Share on other sites

What makes you so sure of that?

Any tcp or udp communication between 2 devices has the source/dest mac info in layer 2. You can run wireshark. So basicly if you have incomming connection and your getting the data than you can find out the mac of the the sender. As an example run the scrip i posted above. You must have client which will respond. Than in wireshark look at the incomming and outgoing.

Link to comment
Share on other sites

I'm wondering if the reason you see so much information in Wireshark is because of WinPcap, and not because it's visible to the machine natively.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

I'm wondering if the reason you see so much information in Wireshark is because of WinPcap, and not because it's visible to the machine natively.

Winpcap and wireshark do not add the raw binary data packets. The work around you mentioned earlier does work and I did read it in my search. The issue is that since autoit does provide broadcast flag in the UDPSend than than it should give the user the ability to parse the broadcast response as well. Sending out ARP to each IP discovered is a work around. Using winpcap is also an option which i will use for now. However it would be nice to have the option be native to autoit. From reading post it seems like the broadcast flag to udpsend was introduced not too long ago. I assume the feature im looking for is not very complex and did open up a feature request. http://www.autoitscript.com/trac/autoit/ticket/2257

For now ill use one of the 2 work around's you guys mentioned.

thank you

Link to comment
Share on other sites

I never suggested that they added the data to the stream, I said it's possible that it's visible to Wireshark because WinPcap allows the network card to read that information from the network data that normally wouldn't be capturable from it without the NPF system driver.

Windows Packet Capture (WinPcap)

WinPcap is the Windows version of the libpcap library; it includes a driver to support capturing packets.

Wireshark uses this library to capture live network data on Windows.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

I never suggested that they added the data to the stream, I said it's possible that it's visible to Wireshark because WinPcap allows the network card to read that information from the network data that normally wouldn't be capturable from it without the NPF system driver.

I get what your saying. Using any variant of C you can extract that info. I just assumed there was some flag I was missing in autoit. But it seems like its just not available native in AutoIT. So i added a feature request. Thanks for your input and feedback.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...