Jump to content

wpcap.dll and dllcall ....


realski
 Share

Recommended Posts

;int pcap_findalldevs_ex (char *source, struct pcap_rmtauth *auth, pcap_if_t **alldevs, char *errbuf)

; Create a list of network devices that can be opened with pcap_open().

Data Fields

pcap_if * next

if not NULL, a pointer to the next element in the list; NULL for the last element of the list

char * name

a pointer to a string giving a name for the device to pass to pcap_open_live()

char * description

if not NULL, a pointer to a string giving a human-readable description of the device

pcap_addr * addresses

a pointer to the first element of a list of addresses for the interface

u_int flags

PCAP_IF_ interface flags. Currently the only possible flag is PCAP_IF_LOOPBACK, that is set if the interface is a loopback interface.

i need convert this tu autoit and

read from dllcall

all variable from **alldevs any idea how write this in autouit ?

i try this ..

$errorbuff =""

$auth = DLLStructCreate("int;char[100];char[100]")

$alldevs = DLLStructCreate("ptr", DLLStructGetPtr(DLLStructCreate("ptr;char[100];char[100];ptr;uint")))

DLLCall("wpcap.dll", "int", "pcap_findalldevs_ex", "str", $source, "ptr", DLLStructGetPtr($auth), "ptr", DLLStructGetPtr($alldevs), "str", $errorbuff )

$name2 = DllStructGetData ( $alldevs, 1)

MsgBox(0,$errorbuff, $name2)

hmm dont work .

Link to comment
Share on other sites

Don't use char[100] in the DllStructs, because those are 100 bytes variables. Use a ptr, since it's supposed to be a pointer to a string (those are 4 bytes).

[quote name='Valik' post='301213' date='Jan 31 2007, 10:36 PM']You seem to have a habit of putting things in the wrong place. I feel sorry for any female you attempt to have sex with.[/quote][font="Lucida Sans Unicode"][/font]

Link to comment
Share on other sites

Don't use char[100] in the DllStructs, because those are 100 bytes variables. Use a ptr, since it's supposed to be a pointer to a string (those are 4 bytes).

i need little help plz convert to autoit working script :)

u need only install winpcap library .

Link to comment
Share on other sites

I can't have Autoit here (work). But try replacing the char[100]s with ptrs.

[quote name='Valik' post='301213' date='Jan 31 2007, 10:36 PM']You seem to have a habit of putting things in the wrong place. I feel sorry for any female you attempt to have sex with.[/quote][font="Lucida Sans Unicode"][/font]

Link to comment
Share on other sites

I can't have Autoit here (work). But try replacing the char[100]s with ptrs.

$errorbuff =""

$auth = DLLStructCreate("int;char[100];char[100]")

$alldevs = DLLStructCreate("ptr", DLLStructGetPtr(DLLStructCreate("ptr;ptr;ptr;ptr;uint")))

DLLCall("wpcap.dll", "int", "pcap_findalldevs_ex", "str", $source, "ptr", DLLStructGetPtr($auth), "ptr", DLLStructGetPtr($alldevs), "str", $errorbuff )

$name2 = DllStructGetData ( $alldevs, 1)

MsgBox(0,$errorbuff, $name2)

name2=56 .. hmm

only i need list all variable in **alldevs

Link to comment
Share on other sites

untested and not a working example... but an example of how it may look similar to...

$user = "larry"
$pass = "password"

$pcap_rmtauth = DLLStructCreate("int;char[" & _
            (StringLen($user) + 1) & "];char[" & _
            (StringLen($pass) + 1) & "]")

DLLStructSetData($pcap_rmtauth,2,$user)
DLLStructSetData($pcap_rmtauth,3,$pass)
$pcap_if_next = DLLStructCreate("ptr;char[100];char[100];ptr;uint")

$pcap_if = DLLStructCreate("ptr;char[100];char[100];ptr;uint")
DLLStructSetData($pcap_if,1,DllStructGetPtr($pcap_if_next))

$sockaddr1 = DLLStructCreate("ushort;char[14]")
$sockaddr2 = DLLStructCreate("ushort;char[14]")
$sockaddr3 = DLLStructCreate("ushort;char[14]")
$sockaddr4 = DLLStructCreate("ushort;char[14]")

$pcap_addr_next = DllStructCreate("ptr;ptr;ptr;ptr;ptr")

$pcap_addr = DllStructCreate("ptr;ptr;ptr;ptr;ptr")
DLLStructSetData($pcap_addr,1,DllStructGetPtr($pcap_addr_next))
DLLStructSetData($pcap_addr,2,DllStructGetPtr($sockaddr1))
DLLStructSetData($pcap_addr,3,DllStructGetPtr($sockaddr2))
DLLStructSetData($pcap_addr,4,DllStructGetPtr($sockaddr3))
DLLStructSetData($pcap_addr,5,DllStructGetPtr($sockaddr4))

DLLCall("wpcap.dll","int","pcap_findalldevs_ex","str",$source, _
        "ptr",DllStructGetPtr($pcap_rmtauth), _
        "ptr",DllStructGetPtr($pcap_if), _
        "str","")
lol so big o_O

ok how push all variable from **allowdev to msgbox now ??

next name description address ?

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...