Jump to content
Sign in to follow this  

WinPcap AutoIt _FindDevice()

Recommended Posts

;Author: Splash
;Web: http://meadiciona.com.br/cemim

;#include <Process.au3>
;#include "Winpcap.au3"

;Try to find a device with internet connection avaliable.


;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
                Return $device_number

        $device_number = $device_number + 1

    Return False

You can get WinPcap Autoit UDF here:



Edited 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:

Share this post

Link to post
Share on other sites

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.

Share this post

Link to post
Share on other sites

Nossa! Estava realmente precisando disto Splash! :idea:

Depois testarei. Por enquanto, muito obrigado! :(


Thanks! :)

Share this post

Link to post
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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...