added: fixed mssql service

This commit is contained in:
2026-04-12 02:01:45 -04:00
parent 20fba18711
commit f8bb134d70

View File

@@ -88,11 +88,19 @@ class MSSQLProtocol(asyncio.Protocol):
while len(self._buf) >= 8: while len(self._buf) >= 8:
pkt_type = self._buf[0] pkt_type = self._buf[0]
pkt_len = struct.unpack(">H", self._buf[2:4])[0] pkt_len = struct.unpack(">H", self._buf[2:4])[0]
if pkt_len < 8:
_log("unknown_packet", src=self._peer[0], pkt_type=hex(pkt_type))
self._transport.close()
self._buf = b""
return
if len(self._buf) < pkt_len: if len(self._buf) < pkt_len:
break break
payload = self._buf[8:pkt_len] payload = self._buf[8:pkt_len]
self._buf = self._buf[pkt_len:] self._buf = self._buf[pkt_len:]
self._handle_packet(pkt_type, payload) self._handle_packet(pkt_type, payload)
if self._transport.is_closing():
self._buf = b""
break
def _handle_packet(self, pkt_type: int, payload: bytes): def _handle_packet(self, pkt_type: int, payload: bytes):
if pkt_type == 0x12: # Pre-login if pkt_type == 0x12: # Pre-login