Pwsmooth1 Posted January 25, 2015 Posted January 25, 2015 (edited) i"m trying to get the mac address of the router im connected to. and put it into a input box. can anyone help with this? Edited January 25, 2015 by Pwsmooth1 [color=rgb(0,0,0);font-family:Lato, Arial, Helvetica, sans-serif;font-size:16px;]Baseball is the only field of endeavor where a man can succeed three times out of ten and be considered a good performer.[/color]
Moderators SmOke_N Posted January 25, 2015 Moderators Posted January 25, 2015 Plenty of examples on the forum, what have you tried? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
funkey Posted January 27, 2015 Posted January 27, 2015 expandcollapse popupGlobal Const $INADDR_NONE = 0xffffffff Global $sIP_Remote = "192.168.1.1" $sMAC = _SendARP(@IPAddress1) ConsoleWrite("Local MAC address (" & @IPAddress1 & "): " & $sMAC & @LF) $sMAC = _SendARP($sIP_Remote) ConsoleWrite("Remote MAC address (" & $sIP_Remote & "): " & $sMAC & @LF) Func _SendARP($DestIP) Local $DestAddress = _inet_addr($DestIP) If $DestAddress = $INADDR_NONE Then Return SetError(1, 0, "INVALID_IP_ADDRESS") Local $tMacAddr = DllStructCreate("BYTE[8]") Local $aRet = DllCall("Iphlpapi.dll", "DWORD", "SendARP", "ULONG", $DestAddress, "ULONG", 0, "struct*", $tMacAddr, "ULONG*", 8) Local $sMAC = "" Switch $aRet[0] Case 0 For $i = 1 To $aRet[4] - 1 $sMAC &= Hex(DllStructGetData($tMacAddr, 1, $i), 2) & "-" Next $sMAC &= Hex(DllStructGetData($tMacAddr, 1, $i), 2) Return $sMAC Case 31 Return SetError(2, $aRet[0], "ERROR_GEN_FAILURE") Case 87 Return SetError(3, $aRet[0], "ERROR_INVALID_PARAMETER") Case 1784 Return SetError(4, $aRet[0], "ERROR_INVALID_USER_BUFFER") Case 67 Return SetError(5, $aRet[0], "ERROR_BAD_NET_NAME") Case 1168 Return SetError(6, $aRet[0], "ERROR_NOT_FOUND") EndSwitch EndFunc ;==>_SendARP Func _inet_addr($sIP) Local $aRet = DllCall("ws2_32.dll", "ULONG", "inet_addr", "str", $sIP) Return $aRet[0] EndFunc ;==>_inet_addr Programming today is a race between software engineers striving tobuild bigger and better idiot-proof programs, and the Universetrying to produce bigger and better idiots.So far, the Universe is winning.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now