fixtures

package
v0.0.0-...-5c79d48 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 15, 2024 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// PreLogin is an example Pre-Login request packet from the protocol spec:
	//
	// https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-tds/9420b4a3-eb9f-4f5e-90bd-3160444aa5a7
	PreLogin = []byte{
		0x12, 0x01, 0x00, 0x2F, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1A, 0x00, 0x06, 0x01, 0x00, 0x20,
		0x00, 0x01, 0x02, 0x00, 0x21, 0x00, 0x01, 0x03, 0x00, 0x22, 0x00, 0x04, 0x04, 0x00, 0x26, 0x00,
		0x01, 0xFF, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xB8, 0x0D, 0x00, 0x00, 0x01,
	}

	// Login7 is an example Login7 request packet from the protocol spec:
	//
	// https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-tds/ce5ad23f-6bf8-4fa5-9426-6b0d36e14da2
	Login7 = []byte{}/* 144 elements not displayed */

	// MalformedPacketTest is an RPC Request malformed packet.
	MalformedPacketTest = []byte{}/* 144 elements not displayed */

	// AllHeadersSliceWithTransactionDescriptor is a ALL_HEADERS data stream
	// header containing the TransactionDescriptor data. It is required for
	// SQLBatch and RPC packets.
	//
	// https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-tds/e17e54ae-0fac-48b7-b8a8-c267be297923
	AllHeadersSliceWithTransactionDescriptor = []byte{
		0x16, 0x00, 0x00, 0x00,
		0x12, 0x00, 0x00, 0x00,
		0x02, 0x00,

		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
		0x00, 0x00, 0x00, 0x00,
	}

	// FieldCollation definition for data parameters. Using "raw collation" is
	// ok for testing because the server is not processing it.
	//
	// https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-tds/3d29e8dc-218a-42c6-9ba4-947ebca9fd7e
	FieldCollation = []byte{0x00, 0x00, 0x00, 0x00, 0x00}
)

Functions

func GenerateBatchQueryChunkedPacket

func GenerateBatchQueryChunkedPacket(chunks int, query string) [][]byte

GenerateBatchQueryChunkedPacket split a batch query into multiple network packets.

func GenerateBatchQueryPacket

func GenerateBatchQueryPacket(query string) []byte

GenerateBatchQueryPacket generates a final SQLBatch with the provided query.

func GenerateCustomRPCCallPacket

func GenerateCustomRPCCallPacket(procName string) []byte

GenerateCustomRPCCallPacket generates a packet containing a custom RPC call with an empty integer parameter.

func GenerateExecuteSQLRPCChunkedPacket

func GenerateExecuteSQLRPCChunkedPacket(chunks int, query string) [][]byte

GenerateExecuteSQLRPCChunkedPacket slipt a RPC Call into multiple network packets.

func GenerateExecuteSQLRPCPacket

func GenerateExecuteSQLRPCPacket(query string) []byte

GenerateExecuteSQLRPCPacket generates a RPC call packet containing a single parameter (NVARCHARTYPE).

func GenerateExecuteSQLRPCPacketNTEXT

func GenerateExecuteSQLRPCPacketNTEXT(query string) []byte

GenerateExecuteSQLRPCPacketNTEXT generates a RPC call packet containing a single parameter (NTEXT).

func GeneratePacketHeader

func GeneratePacketHeader(packetType byte, packetStatus byte, length int, seq int) []byte

GeneratePacketHeader generates a packet header based on the specified parameters.

func RPCClientPartiallyLength

func RPCClientPartiallyLength(procName string, length uint64, chunks uint64) []byte

RPCClientVariableLength returns a RPCCLientRequest packet containing a partially Length-prefixed Bytes request, as described here: https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-tds/3f983fde-0509-485a-8c40-a9fa6679a828

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL