Guest User

AutoIt packet injector

a guest
Mar 8th, 2013
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. #include <string.au3>
  2. Global $sBuffer, $rBuffer
  3. Global $iSize, $iIndex
  4.  
  5. $IP = "127.0.0.1"
  6. TCPStartUp()
  7. $socket = TCPConnect( $IP, 16000)
  8. If $socket = -1 Then MsgBox (0,"TCP","Can't make a connection")
  9.  
  10. Func NewPacket($sValue, $iValue)
  11. Local $sTemp = Hex($sValue)
  12. $sBuffer = ""
  13. $iSize = 0
  14. $sBuffer &= StringLeft(ReverseHex(Hex($sValue)), 4)
  15. $sBuffer &= StringLeft(ReverseHex(Hex($iValue)), 4)
  16. EndFunc ;==>NewPacket
  17.  
  18. Func ReverseHex($sString)
  19. Local $sTemp, $len
  20. For $i = StringLen($sString) + 1 To 1 Step -2
  21. $sTemp &= StringMid($sString, $i, 2)
  22. Next
  23. Return $sTemp
  24. EndFunc ;==>ReverseHex
  25.  
  26. Func AppendByte($sValue)
  27. $sBuffer &= StringRight(Hex($sValue), 2)
  28. $iSize += 1
  29. EndFunc ;==>AppendByte
  30.  
  31. Func GetPacket()
  32. Local $sTemp = "0x"
  33. $sTemp &= StringLeft(ReverseHex(Hex($iSize)), 4)
  34. $sTemp &= $sBuffer
  35. Return $sTemp
  36. EndFunc ;==>GetPacket
Advertisement
Add Comment
Please, Sign In to add comment