Sign in to follow this  
Followers 0
Fabry

Packetx

26 posts in this topic




since packetX is a activeX (Automation) Object you can explore it using ActiveX/COM Inspector.


Share this post


Link to post
Share on other sites

just have a look at the wow automation thread, at the example posts section.


$a=StringSplit("547275737420796F757220546563686E6F6C75737421","")For $b=1 To UBound($a)+(-1*-1*-1)step(2^4/8);&$b+=1*2/40*µ&Asc(4)Assign("c",Eval("c")&Chr(Dec($a[$b]&$a[$b+1])))''Chr("a")&"HI"Next;time_U&r34d,ths,U-may=get$the&c.l.u.e;b3st-regards,JRSmile;MsgBox(0x000000,"",Eval("c"));PiEs:d0nt+*b3.s4d.4ft3r.1st-try:-)

Share this post


Link to post
Share on other sites

Use search function.

I also believe that the packetx installation comes with a helpfile with vbscript, and language examples.

It isnt too hard to convert it to autoit either, They are pretty similiar when you look at it :3


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

I'm translating from visual basic , the example, but how can I translate this:

CODE
const PktXPacketTypePromiscuous = &H0020

and this:

CODE
If bByte <= &H0F Then sLine=sLine & "0" End If


A lan chat (Multilanguage)LanMuleFile transferTank gameTank 2 an online game[center]L'esperienza è il nome che tutti danno ai propri errori.Experience is the name everyone gives to their mistakes.Oscar Wilde[/center]

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

I finished to translate example "Capture":

#cs ----------------------------------------------------------------------------
    
    AutoIt Version: 3.2.4.9
    Author:         Fabry
    
    Script Function:
    Sniffer fo network
    
#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here
;~ // Constants
#include<String.au3>
Const $PktXPacketTypePromiscuous = 0x0020
Const $PktXLinkType802_3 = 1
Const $PktXLinkType802_5 = 2
Const $PktXLinkTypeFddi = 3
Const $PktXLinkTypeWan = 4
Const $PktXLinkTypeLocalTalk = 5
Const $PktXLinkTypeDix = 6
Const $PktXLinkTypeArcnetRaw = 7
Const $PktXLinkTypeArcnet878_2 = 8
Const $PktXLinkTypeAtm = 9
Const $PktXLinkTypeWirelessWan = 10
Const $PktXModeCapture = 1

; Protocol types
Const $PktXProtocolTypeEthernet = 1
Const $PktXProtocolTypeIp = 2
Const $PktXProtocolTypeUdp = 3
Const $PktXProtocolTypeTcp = 4

;~ // Create PackeX object
Global $oPktX = ObjCreate("PktX.PacketX")
If Not IsObj($oPktX) Then MsgBox(0, "ERROR", "No Object")
$EventObject = ObjEvent($oPktX, "PacketX_")
;~ // Display network adapters
For $i = 1 To $oPktX.Adapters.Count

    If $oPktX.Adapters ($i).IsGood Then
        MsgBox(0, '', "(" & $i & ") " & $oPktX.Adapters ($i).Description)
        PrintAdapter($oPktX.Adapters ($i))
    EndIf
Next

; Select network adapter
$oPktX.Adapter = $oPktX.Adapters ($oPktX.Adapters.Count)

;~ PrintAdapter($oPktX.Adapter)
; Capture buffer parameters
$oPktX.Adapter.BuffSize = 256 * 1024 ; 256 KB
$oPktX.Adapter.BuffMinToCopy = 0

; Hardware filter and capture mode
$oPktX.Adapter.HWFilter = $PktXPacketTypePromiscuous
$oPktX.Adapter.Mode = $PktXModeCapture

; Start capture
$oPktX.Start
$begin = TimerInit()
While TimerDiff($begin) < 60000
    Sleep(1)
WEnd
$oPktX.Stop

PrintStats($oPktX.Adapter)

; Packet event handler
Func PacketX_OnPacket($oPacket)
    PrintHead($oPacket)
    PrintData($oPacket)
EndFunc   ;==>PacketX_OnPacket
Func PrintAdapter($oAdapter)
    ConsoleWrite("Device name is " & $oAdapter.Device & @LF)
    ConsoleWrite("Link type is ")
    Switch $oAdapter.LinkType
        Case $PktXLinkType802_3
            ConsoleWrite("Ethernet (802.3)" & @LF)
        Case $PktXLinkType802_5
            ConsoleWrite("Token Ring (802.5)" & @LF)
        Case $PktXLinkTypeFddi
            ConsoleWrite("FDDI" & @LF)
        Case $PktXLinkTypeWan
            ConsoleWrite("WAN" & @LF)
        Case $PktXLinkTypeLocalTalk
            ConsoleWrite("LocalTalk" & @LF)
        Case $PktXLinkTypeDix
            ConsoleWrite("DIX" & @LF)
        Case $PktXLinkTypeArcnetRaw
            ConsoleWrite("ARCNET (raw)" & @LF)
        Case $PktXLinkTypeArcnet878_2
            ConsoleWrite("ARCNET (878.2)" & @LF)
        Case $PktXLinkTypeAtm
            ConsoleWrite("ATM" & @LF)
        Case $PktXLinkTypeWirelessWan
            ConsoleWrite("NdisWirelessXxx media" & @LF)
        Case Else
            ConsoleWrite("Unknown!" & @LF)
    EndSwitch
    ConsoleWrite("Link speed is " & $oAdapter.LinkSpeed & " bps" & @LF)
;~      Consolewrite( "Network IP addres is " & $oAdapter.NetIP&@LF)
;~    Consolewrite( "Network mask is " & $oAdapter.NetMask&@LF)
    ConsoleWrite("HW address is " & $oAdapter.HWAddress & @LF)
EndFunc   ;==>PrintAdapter

Func PrintHead($oPacket)
    local $type
    Switch $oPacket.Protocol
        Case $PktXProtocolTypeEthernet
        $type='Eth'     
        Case $PktXProtocolTypeIp
        $type='Ip'  
        Case $PktXProtocolTypeUdp
        $type='UDP' 
        Case $PktXProtocolTypeTcp
    $type='TCP' 
    EndSwitch
    ConsoleWrite("----------------------- Packet Header ---------------------" & @LF)
    ConsoleWrite("Original size " & $oPacket.OriginalSize & " bytes" & @LF)
    ConsoleWrite("Capture size " & $oPacket.DataSize & " bytes" & @LF)
    ConsoleWrite("Capture time " & $oPacket.TimeSec & " (number of seconds from 1/1/1970)" & @LF)
    ConsoleWrite("Capture microseconds " & $oPacket.TimeUSec & @LF)
    ConsoleWrite("Capture date " & $oPacket.Date & " (system date and time)" & @LF)
    ConsoleWrite('Protocol: ' & $type & @LF)
    ConsoleWrite('From ' & $oPacket.SourceIpAddress & ':' & $oPacket.Sourceport & ' To ' & $oPacket.DestIpAddress & ':' & $oPacket.DestPort & @LF)
EndFunc   ;==>PrintHead

Func PrintData($oPacket)
    ConsoleWrite("----------------------- Packet Data -----------------------" & @LF)
    Dim $sline = ''
    Local $tline = ''
    For $bByte In $oPacket.Data
        If StringLen($sline) >= 48 Then
            ConsoleWrite($sline & @LF)
            $sline = ""
        EndIf
        If $bByte <= Chr(4) Then
            $tline = $tline & "0"
;~          $sline = $sline & "0"
        EndIf
        $sline = $sline & Hex($bByte, 2) & " "
        $tline = $tline & Hex($bByte, 2) & " "
    Next

    If StringLen($sline) > 0 Then
        Local $wLine = ''
        Local $hesadecimale = StringSplit($tline, ' ')
        For $i = 1 To $hesadecimale[0]
            $wLine &= _HexToString($hesadecimale[$i])
        Next
        ConsoleWrite($sline & @LF)
        ConsoleWrite($wLine & @LF)
    Else
        ConsoleWrite("" & @LF)
    EndIf
EndFunc   ;==>PrintData

Func PrintStats($oAdapter)
    ConsoleWrite("------------------- Capture Statistics --------------------" & @LF)
    ConsoleWrite("Packets received " & $oAdapter.PacketsRecv & @LF)
    ConsoleWrite("Packets lost " & $oAdapter.PacketsLost & @LF)
EndFunc   ;==>PrintStats
Edited by Fabry

A lan chat (Multilanguage)LanMuleFile transferTank gameTank 2 an online game[center]L'esperienza è il nome che tutti danno ai propri errori.Experience is the name everyone gives to their mistakes.Oscar Wilde[/center]

Share this post


Link to post
Share on other sites

C:\capture.au3 (30) : ==> Variable must be of type "Object".: 
For $i = 1 To $oPktX.Adapters.Count 
For $i = 1 To $oPktX^ ERROR

What does this error mean :) ?

Share this post


Link to post
Share on other sites

It means you most likely dont have PacketX installed.


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

Strange, this code allerts you that it doesn't work.

If Not IsObj($oPktX) Then MsgBox(0, "ERROR", "No Object");if is not a object then message, you suould exit

A lan chat (Multilanguage)LanMuleFile transferTank gameTank 2 an online game[center]L'esperienza è il nome che tutti danno ai propri errori.Experience is the name everyone gives to their mistakes.Oscar Wilde[/center]

Share this post


Link to post
Share on other sites

with me the messagebox works as expected.. I don't have packetX installed, so I get this popupbox..

will try later with app installed as I'm interested in this functionality too..

good work Fabry!


Share this post


Link to post
Share on other sites

i got no error.... just 2 msg with OK button.

Share this post


Link to post
Share on other sites

Check out what i made Guys , I'm Selling this program already got 5 versions sold what i need is how to customize the arp packet and send it from within Autoit not just sending a captured arp packet in a file

post-22904-1187119936_thumb.jpg

Share this post


Link to post
Share on other sites

i changed adapter.count() to adapter(1) or something, i had to try a little until i got the right nic.


$a=StringSplit("547275737420796F757220546563686E6F6C75737421","")For $b=1 To UBound($a)+(-1*-1*-1)step(2^4/8);&$b+=1*2/40*µ&Asc(4)Assign("c",Eval("c")&Chr(Dec($a[$b]&$a[$b+1])))''Chr("a")&"HI"Next;time_U&r34d,ths,U-may=get$the&c.l.u.e;b3st-regards,JRSmile;MsgBox(0x000000,"",Eval("c"));PiEs:d0nt+*b3.s4d.4ft3r.1st-try:-)

Share this post


Link to post
Share on other sites

Fabry, Have you figured out how to have it Send packets?

Like, ReSend captured packets?


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

i would like to use this script in a game

i would like to add to my bot script and when someone whisper me something in game...i should do some action

i am interested in this script...but i cant help i am too noob ^^

Share this post


Link to post
Share on other sites

This seems really interesting, but unfortunately I'm getting an error at the start:

==> The requested action with this object has failed.:

For $i = 1 To $oPktX.Adapters.Count

For $i = 1 To $oPktX.Adapters^ ERROR

Is everyone getting this problem? I have packetx installed and everything.

Thanks,

Kurt


Awaiting Diablo III..

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  
Followers 0