Hallo stagetwo,
Ich versuche in AutoIt ein Silkroadcapacity tool, im aufbau von Drew Benton's clientless. (out to date)
In dem Script connecte ich zum bsp auf EliteSro 1, bekomme aber dauernt nur das Packet 5000 wieder.
Eigentlich müsste ich noch Packete senden, dass ich connectet bin bzw. connecten soll.
Die localität und version müsste man ja senden via tcpsend.
Hier ist mal der Code:
C
- #include <Date.au3>
- #include <string.au3>
- #include <ComboConstants.au3>
- #include <GUIConstantsEx.au3>
- #include <WindowsConstants.au3>
- #include <EditConstants.au3>
- #include <StaticConstants.au3>
- #include <GUIListBox.au3>
- #include <GuiEdit.au3>
- Global $PACKETOPCODE = 0
- Global $PACKETDATA = 0
- Global $TYPEPK = "[S->C]"
- Global $ip = "31.192.104.161"
- Global $globalSendBuffer = ""
- Global $globalSendSize = 0
- Global $LOGPKNUM = 0
- Global $NUM = 0
- Global $FILENAME = "packetLog.txt"
- Global $LOGSTART = "Packet logger started! @ " & _NowTime(5)
- Global $LOGEND = "Packet logger ended! @ " & _NowTime(5)
- #region ### START Koda GUI section ### Form=
- $FORM1 = GUICreate("Trolling", 811, 400, -1, -1)
- $LOGLIST = GUICtrlCreateEdit("", 8, 8, 641, 390, BitOR($ES_AUTOVSCROLL, $WS_VSCROLL, $ES_READONLY))
- GUICtrlSetBkColor($LOGLIST, 16777215)
- $GROUP1 = GUICtrlCreateGroup("Status", 656, 8, 145, 129)
- $LABEL1 = GUICtrlCreateLabel("Waiting for Proxy", 664, 32, 127, 17)
- $LABEL2 = GUICtrlCreateLabel("Logged Packets: " & $LOGPKNUM, 664, 56, 127, 17)
- $BUTTON1 = GUICtrlCreateButton("Connect to Proxy", 664, 104, 129, 25)
- $BUTTON6 = GUICtrlCreateButton("Clean log window", 664, 150, 129, 40)
- GUISetState(@SW_SHOW)
- #endregion ### END Koda GUI section ###
- While 1
- $MSG = GUIGetMsg()
- Switch $MSG
- Case $GUI_EVENT_CLOSE
- FileWriteLine($FILENAME, $LOGEND)
- Exit
- Case $BUTTON1
- TCPStartup()
- Global $SOCKET = TCPConnect($ip, 15779);GUICTRLREAD($INPUT1))
- If $SOCKET = -1 Then
- GUICtrlSetData($LABEL1, "Cannot connect to Proxy")
- GUICtrlSetColor($LABEL1, 16711680)
- Else
- GUICtrlSetData($LABEL1, "Connected to Proxy!")
- GUICtrlSetColor($LABEL1, 308228)
- GUICtrlSetState($BUTTON1, $GUI_DISABLE)
- START()
- EndIf
- Case $BUTTON6
- GUICtrlSetData($LOGLIST, "")
- EndSwitch
- WEnd
- Func GetPacket()
- Return _HexToString($globalSendBuffer)
- EndFunc ;==>GetPacket
- Func START()
- FileWriteLine($FILENAME, $LOGSTART)
- While 1
- UPDATEGUI()
- $PACKETSIZE = TRYREADWORD($SOCKET)
- If @error == 0 Then
- Global $PACKETOPCODE = READWORD($SOCKET)
- Global $PACKETSECURITY = READWORD($SOCKET)
- Global $PACKETDATA = READARRAY($SOCKET, Dec($PACKETSIZE))
- ConsoleWrite('[' & $PACKETOPCODE & '] ' & $PACKETDATA & @CRLF)
- If $PACKETSECURITY = 1 Then
- Global $TYPEPK = "[C->S]"
- SHOWCS()
- Else
- Global $TYPEPK = "[S->C]"
- SHOWSC()
- EndIf
- EndIf
- WEnd
- EndFunc ;==>START
- Func SHOWCS()
- If $PACKETDATA <> "" Then
- FileWriteLine("buffer_log.txt", TCPRecv($SOCKET, 10000) & @CRLF)
- $LOGPKNUM += 1
- GUICtrlSetData($LABEL2, "Logged Packets: " & $LOGPKNUM)
- $OUTPUT = $TYPEPK & " [" & $PACKETOPCODE & "]" & @CRLF & $PACKETDATA & @CRLF & @CRLF
- _GUICtrlEdit_AppendText($LOGLIST, $OUTPUT)
- EndIf
- EndFunc ;==>SHOWCS
- Func SHOWSC()
- If $PACKETDATA <> "" Then
- FileWriteLine("buffer_log.txt", TCPRecv($SOCKET, 10000) & @CRLF)
- $LOGPKNUM += 1
- GUICtrlSetData($LABEL2, "Logged Packets: " & $LOGPKNUM)
- $OUTPUT = $TYPEPK & " [" & $PACKETOPCODE & "]" & @CRLF & $PACKETDATA & @CRLF & @CRLF
- _GUICtrlEdit_AppendText($LOGLIST, $OUTPUT)
- EndIf
- EndFunc ;==>SHOWSC
- Func UPDATEGUI()
- $MSG = GUIGetMsg()
- Switch $MSG
- Case $GUI_EVENT_CLOSE
- FileWriteLine($FILENAME, $LOGEND)
- Exit
- Case $BUTTON1
- TCPStartup()
- Global $SOCKET = TCPConnect($ip, 15779)
- If $SOCKET = -1 Then
- GUICtrlSetData($LABEL1, "Cannot connect to Proxy")
- GUICtrlSetColor($LABEL1, 16711680)
- Else
- GUICtrlSetData($LABEL1, "Connected to Proxy!")
- GUICtrlSetColor($LABEL1, 308228)
- GUICtrlSetState($BUTTON1, $GUI_DISABLE)
- $FILENAME = "PacketLog.txt"
- FileWriteLine($FILENAME, "Packet logger started!")
- START()
- EndIf
- Case $BUTTON6
- GUICtrlSetData($LOGLIST, "")
- EndSwitch
- EndFunc ;==>UPDATEGUI
- Func TRYREADWORD($SOCKET)
- $HB = TCPRecv($SOCKET, 1)
- If $HB == "" Then
- SetError(-3)
- Return 0
- EndIf
- $LB = TCPRecv($SOCKET, 1)
- While $LB == ""
- UPDATEGUI()
- If @error Then
- SetError(-2)
- Return 0
- EndIf
- $LB = TCPRecv($SOCKET, 1)
- If @error Then
- SetError(-1)
- Return 0
- EndIf
- WEnd
- SetError(0)
- Return Hex(Binary($LB) & Binary($HB))
- EndFunc ;==>TRYREADWORD
- Func READARRAY($SOCKET, $COUNT)
- $DATA = ""
- For $I = 1 To $COUNT Step 1
- UPDATEGUI()
- If @error Then
- SetError(-2)
- Return 0
- EndIf
- $DATA = $DATA & READBYTE($SOCKET)
- If @error Then
- SetError(-1)
- Return 0
- EndIf
- Next
- Return $DATA
- EndFunc ;==>READARRAY
- Func READWORD($SOCKET)
- $HB = TCPRecv($SOCKET, 1)
- While $HB == ""
- UPDATEGUI()
- If @error Then
- SetError(-2)
- Return 0
- EndIf
- $HB = TCPRecv($SOCKET, 1)
- If @error Then
- SetError(-1)
- Return 0
- EndIf
- WEnd
- $LB = TCPRecv($SOCKET, 1)
- While $LB == ""
- UPDATEGUI()
- If @error Then
- SetError(-2)
- Return 0
- EndIf
- $LB = TCPRecv($SOCKET, 1)
- If @error Then
- SetError(-1)
- Return 0
- EndIf
- WEnd
- Return Hex(Binary($LB) & Binary($HB))
- EndFunc ;==>READWORD
- Func READBYTE($SOCKET)
- $LB = TCPRecv($SOCKET, 1)
- While $LB == ""
- UPDATEGUI()
- If @error Then
- SetError(-2)
- Return 0
- EndIf
- $LB = TCPRecv($SOCKET, 1)
- If @error Then
- SetError(-1)
- Return 0
- EndIf
- WEnd
- Return Hex(Binary($LB))
- EndFunc ;==>READBYTE