You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$bodyBytes=$pack[8..($pack.Length-1-1-1)] # Ignore Null Character at 1) at Packet Empty String Terminator 2) end of Packet Body
109
-
@{
110
-
Id= BytesToInt32 $IdBytes
111
-
Type= BytesToInt32 $typeBytes
112
-
Body=$enc.GetString($bodyBytes)
113
-
IdBytes=$IdBytes
114
-
TypeBytes=$typeBytes
115
-
BodyBytes=$bodyBytes
108
+
if ($pack.Length-ge10) {
109
+
$IdBytes=$pack[0..3]
110
+
$typeBytes=$pack[4..7]
111
+
$bodyBytes=$pack[8..($pack.Length-1-1)] # Ignore Null Character at 1) at Packet Empty String Terminator 2) end of Packet Body
112
+
@{
113
+
Id= BytesToInt32 $IdBytes
114
+
Type= BytesToInt32 $typeBytes
115
+
Body=$enc.GetString($bodyBytes)
116
+
IdBytes=$IdBytes
117
+
TypeBytes=$typeBytes
118
+
BodyBytes=$bodyBytes
119
+
}
116
120
}
117
121
}
118
122
functionAuth {
@@ -131,13 +135,17 @@ function SourceRcon {
131
135
$answer=''
132
136
while ($true) {
133
137
try {
134
-
# Read the Size of packet
138
+
# Read the size of packet
135
139
$rPack= ReceivePacket 4
136
140
if (!$rPack.Length) { return }
137
141
$size= BytesToInt32 $rPack
138
-
$rPack= ReceivePacket $size
142
+
if ($size-eq0) {
143
+
# No more packets to read from socket. E.g. 'exit'
144
+
break
145
+
}
139
146
140
147
# Now read the packet
148
+
$rPack= ReceivePacket $size
141
149
$response= ParsePacket $rPack
142
150
if ($response['ID'] -eq$packetID_MultipackDummy) {
143
151
# At the end of a multiple-packet response, the dummy empty packet is finally mirrored, followed by another RESPONSE_VALUE packet containing 0x0000 0001 0000 0000 in the packet body field.
0 commit comments