SandelPerieanu Posted October 18, 2006 Share Posted October 18, 2006 Func _GetMacAddress($_phisycaladdress) Local $chk_1 = StringReplace($_phisycaladdress, '.', '') / 1 If @extended <> 3 Or $chk_1 < 1 Then Return '' Local $chk_2 = StringSplit($_phisycaladdress, '.', 1) For $idx_chk = 1 To $chk_2[0] If ($chk_2[$idx_chk] / 1) < 0 or ($chk_2[$idx_chk] / 1) > 255 Then Return '' Next Local $_buf = '' Local $_pid = Run('nbtstat -a ' & $_phisycaladdress, '', @SW_HIDE, 2) Do $_buf &= StdoutRead($_pid) Until @error If StringReplace($_buf, 'MAC Address = ', '') <> $_buf Then $chk_3 = StringSplit($_buf, 'MAC Address = ', 1) Return StringReplace(StringReplace($chk_3[2], @CR, ''), @LF, '') EndIf Return '' EndFunc ;==>_GetMacAddress MsgBox(0, '', _GetMacAddress('192.168.0.1')) Link to comment Share on other sites More sharing options...
Valik Posted October 18, 2006 Share Posted October 18, 2006 Moved to Scripts & Scraps where it belongs. Link to comment Share on other sites More sharing options...
Richard Robertson Posted October 18, 2006 Share Posted October 18, 2006 Why is there no description of your function? What does it do? Link to comment Share on other sites More sharing options...
Schlumpf Posted October 18, 2006 Share Posted October 18, 2006 It seems to be something like this:Func _GetMACFromIP($sIP) Local $MAC, $MACSize Local $i, $s, $r, $iIP $MAC = DllStructCreate("byte[6]") $MACSize = DllStructCreate("int") DllStructSetData($MACSize, 1, 6) $r = DllCall("Ws2_32.dll", "int", "inet_addr", "str", $sIP) $iIP = $r[0] $r = DllCall("iphlpapi.dll", "int", "SendARP", "int", $iIP, "int", 0, "ptr", DllStructGetPtr($MAC), "ptr", DllStructGetPtr($MACSize)) $s = "" For $i = 0 To 5 If $i Then $s = $s & ":" $s = $s & Hex(DllStructGetData($MAC, 1, $i + 1), 2) Next Return $s EndFunc ;==>_GetMACFromIPoÝ÷ Ù8b²²Ø^0uÚÞ²ÊjrI©©æ®¶sdgVæ2ôvWDÔ4g&öÔb33c·4 Æö6Âb33c´Ô2Âb33c´Ô56¦P Æö6Âb33c¶Âb33c·2Âb33c·"Âb33c¶ b33c´Ô2ÒFÆÅ7G'V7D7&VFRgV÷C¶'FU³eÒgV÷C² b33c´Ô56¦RÒFÆÅ7G'V7D7&VFRgV÷C¶çBgV÷C² FÆÅ7G'V7E6WDFFb33c´Ô56¦RÂÂb b33c·"ÒFÆÄ6ÆÂgV÷Cµw3%ó3"æFÆÂgV÷C²ÂgV÷C¶çBgV÷C²ÂgV÷C¶æWEöFG"gV÷C²ÂgV÷C·7G"gV÷C²Âb33c·4 b33c¶Òb33c·%³Ð b33c·"ÒFÆÄ6ÆÂgV÷C¶ÇæFÆÂgV÷C²ÂgV÷C¶çBgV÷C²ÂgV÷Cµ6VæD%gV÷C²ÂgV÷C¶çBgV÷C²Âb33c¶ÂgV÷C¶çBgV÷C²ÂÂgV÷C·G"gV÷C²ÂFÆÅ7G'V7DvWEG"b33c´Ô2ÂgV÷C·G"gV÷C²ÂFÆÅ7G'V7DvWEG"b33c´Ô56¦R b33c·2ÒgV÷C²gV÷C° f÷"b33c¶ÒFòP bb33c¶FVâb33c·2Òb33c·2fײgV÷C³¢gV÷C° b33c·2Òb33c·2fײWFÆÅ7G'V7DvWDFFb33c´Ô2ÂÂb33c¶²Â" æW@ &WGW&âb33c·0¤VæDgVæ2³ÓÒfwCµôvWDÔ4g&öÔ ¢b33c´ÒçWD&÷gV÷C²gV÷C²ÂgV÷C´FG&W73¢gV÷C²¢b33c´Ô2ÒôvWDÔ4g&öÔb33c´¤×6t&÷CÂgV÷C²gV÷C²ÂgV÷C´Ô3¢gV÷C²f×´5$Äbfײb33c´Ô2!! THIS FUNKTION ISN'T WRITTEN BY ME !! [CENTER]Sorry for my bad English... ;)[/CENTER] Link to comment Share on other sites More sharing options...
SandelPerieanu Posted October 19, 2006 Author Share Posted October 19, 2006 It seems to be something like this: Func _GetMACFromIP($sIP) Local $MAC, $MACSize Local $i, $s, $r, $iIP $MAC = DllStructCreate("byte[6]") $MACSize = DllStructCreate("int") DllStructSetData($MACSize, 1, 6) $r = DllCall("Ws2_32.dll", "int", "inet_addr", "str", $sIP) $iIP = $r[0] $r = DllCall("iphlpapi.dll", "int", "SendARP", "int", $iIP, "int", 0, "ptr", DllStructGetPtr($MAC), "ptr", DllStructGetPtr($MACSize)) $s = "" For $i = 0 To 5 If $i Then $s = $s & ":" $s = $s & Hex(DllStructGetData($MAC, 1, $i + 1), 2) Next Return $s EndFunc ;==>_GetMACFromIP oÝ÷ Ù8b²²Ø^0uÚÞ²ÊjrI©©æ®¶sdgVæ2ôvWDÔ4g&öÔb33c·4¢Æö6Âb33c´Ô2Âb33c´Ô56¦P¢Æö6Âb33c¶Âb33c·2Âb33c·"Âb33c¶¢b33c´Ô2ÒFÆÅ7G'V7D7&VFRgV÷C¶'FU³eÒgV÷C²¢b33c´Ô56¦RÒFÆÅ7G'V7D7&VFRgV÷C¶çBgV÷C²¢FÆÅ7G'V7E6WDFFb33c´Ô56¦RÂÂb¢b33c·"ÒFÆÄ6ÆÂgV÷Cµw3%ó3"æFÆÂgV÷C²ÂgV÷C¶çBgV÷C²ÂgV÷C¶æWEöFG"gV÷C²ÂgV÷C·7G"gV÷C²Âb33c·4¢b33c¶Òb33c·%³Ð¢b33c·"ÒFÆÄ6ÆÂgV÷C¶ÇæFÆÂgV÷C²ÂgV÷C¶çBgV÷C²ÂgV÷Cµ6VæD%gV÷C²ÂgV÷C¶çBgV÷C²Âb33c¶ÂgV÷C¶çBgV÷C²ÂÂgV÷C·G"gV÷C²ÂFÆÅ7G'V7DvWEG"b33c´Ô2ÂgV÷C·G"gV÷C²ÂFÆÅ7G'V7DvWEG"b33c´Ô56¦R¢b33c·2ÒgV÷C²gV÷C°¢f÷"b33c¶ÒFòP¢bb33c¶FVâb33c·2Òb33c·2fײgV÷C³¢gV÷C°¢b33c·2Òb33c·2fײWFÆÅ7G'V7DvWDFFb33c´Ô2ÂÂb33c¶²Â"¢æW@¢&WGW&âb33c·0¤VæDgVæ2³ÓÒfwCµôvWDÔ4g&öÔ ¢b33c´ÒçWD&÷gV÷C²gV÷C²ÂgV÷C´FG&W73¢gV÷C²¢b33c´Ô2ÒôvWDÔ4g&öÔb33c´¤×6t&÷CÂgV÷C²gV÷C²ÂgV÷C´Ô3¢gV÷C²f×´5$Äbfײb33c´Ô2 !! THIS FUNKTION ISN'T WRITTEN BY ME !! don't work for me this! result only 00:00:00:00:00:00 Link to comment Share on other sites More sharing options...
Schlumpf Posted October 19, 2006 Share Posted October 19, 2006 ?¿ It works for me. You have to enter your LAN-IP. [CENTER]Sorry for my bad English... ;)[/CENTER] Link to comment Share on other sites More sharing options...
FeReNGi Posted October 19, 2006 Share Posted October 19, 2006 don't work for me this!result only 00:00:00:00:00:00you can use also @ipadress1 ServicesPE|LoadVMDK Link to comment Share on other sites More sharing options...
sb1920alk Posted September 26, 2008 Share Posted September 26, 2008 @Schlumpf This is useful to me. Thank you for posting it even if you didn't write it. Link to comment Share on other sites More sharing options...
DEFROG Posted November 26, 2008 Share Posted November 26, 2008 @SchlumpfThis is useful to me. Thank you for posting it even if you didn't write it.Same here, good stuff. Thanks to the writer and to Schlumpf for posting it. Link to comment Share on other sites More sharing options...
jennico Posted March 11, 2009 Share Posted March 11, 2009 (edited) thx !long time looking for this stuff.both scripts are working.the first one by psandu.ro : you have to check $_buf before splitting. on a non-english system the report is different and therefore the extraction of the MAC Address must be adapted.very nice !j.Edit: the second script (_GetMACFromIP) is waaaaaaay faster (about factor 100 !), and you don't need to check the spelling ! Edited March 12, 2009 by jennico Spoiler I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.Don't forget this IP: 213.251.145.96 Link to comment Share on other sites More sharing options...
FreeBeing Posted August 16, 2010 Share Posted August 16, 2010 Thank you very much for that script Link to comment Share on other sites More sharing options...
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