Splash Posted May 9, 2010 Share Posted May 9, 2010 (edited) expandcollapse popup;Author: Splash ;Web: http://meadiciona.com.br/cemim ;Required: ;#include <Process.au3> ;#include "Winpcap.au3" ;Description ;Try to find a device with internet connection avaliable. ;Parameters ;None. ;Return Value ;Sucess: Device number. ;Error: False. Func _FindDevice() $device_number = 0 $connection = False $pcap = _PcapSetup() $devices = _PcapGetDeviceList() While $connection == False and $device_number < Ubound($devices) $capture = _PcapStartCapture($devices[$device_number][0], "icmp and dst host google.com", 1, 65536, 524288, 0) _RunDos("ping google.com") $packet = _PcapGetPacket($capture) If IsArray($packet) Then If ($packet[2] > 0) Then $connection = True _PcapStopCapture($capture) _PcapFree() Return $device_number EndIf EndIF _PcapStopCapture($capture) $device_number = $device_number + 1 WEnd Return False EndFuncYou can get WinPcap Autoit UDF here:http://opensource.grisambre.net/pcapau3/ Edited May 9, 2010 by Splash Automatic Update UDF - IP Address UDF - WinPcap AutoIt _FindDevice()[font="Verdana"][size="2"]AutoIt Spanish/Brasil/World community!!![/size][/font]Use you wanna a dot.tk domain please use my link: Link to comment Share on other sites More sharing options...
logmein Posted May 9, 2010 Share Posted May 9, 2010 (edited) Thanks for translate it to AutoIt! WinPCap is a very helpful tool. Edited May 9, 2010 by logmein [font=arial, helvetica, sans-serif][s]Total USB Security 3.0 Beta[/s] | [s]Malware Kill[/s] | Malware Scanner | Screen Hider | Locker | Matrix Generator[s]AUTO-SYNC 1.0 | MD5 Hash Generator | URL Checker | Tube Take [/s]| Random Text[/font] Link to comment Share on other sites More sharing options...
Yorn Posted May 10, 2010 Share Posted May 10, 2010 I don't think he made the UDF, he just came up with a neat way of finding an active network device using the WinPcap UDF. This could come in handy if you wanted your program to wait till an Internet connection was available, for example. Link to comment Share on other sites More sharing options...
SeF Posted May 11, 2010 Share Posted May 11, 2010 Nossa! Estava realmente precisando disto Splash! Depois testarei. Por enquanto, muito obrigado! ----- Thanks! Link to comment Share on other sites More sharing options...
phr3n1c Posted March 20, 2012 Share Posted March 20, 2012 I think this is my first post but it's worth it: Thanks! 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