Skip to content

Commit d283cb1

Browse files
committed
tests: add NETLOGON_LOGON_QUERY unit test
- revert change when parsing NETLOGON_LOGON_QUERY: always use length of MailslotName as a reference
1 parent c8c3a4b commit d283cb1

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

scapy/layers/smb.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -942,7 +942,11 @@ class NETLOGON_LOGON_QUERY(NETLOGON):
942942
fields_desc = [
943943
LEShortEnumField("OpCode", 0x7, _NETLOGON_opcodes),
944944
StrNullField("ComputerName", ""),
945-
PadField(StrNullField("MailslotName", ""), 2),
945+
StrNullField("MailslotName", ""),
946+
ConditionalField(
947+
ByteField("MailslotPad", default=0x00),
948+
lambda pkt: len(pkt.MailslotName) % 2 != 0
949+
),
946950
StrNullFieldUtf16("UnicodeComputerName", ""),
947951
FlagsField("NtVersion", 0xB, -32, _NV_VERSION),
948952
XLEShortField("LmNtToken", 0xFFFF),

test/scapy/layers/ldap.uts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,3 +215,12 @@ pkt = NETLOGON(b'\x13\x00\\\x00\\\x00D\x00C\x001\x00\x00\x00\x00\x00D\x00O\x00M\
215215
assert pkt.NtVersion == 1
216216
assert pkt.UnicodeLogonServer == r"\\DC1"
217217
assert pkt.UnicodeDomainName == "DOMAIN"
218+
219+
= Dissect NETLOGON_LOGON_QUERY - V1+V5+V5EX_WITH_IP
220+
221+
pkt = NETLOGON(b'\x07\x00PC-001\x00\\MAILSLOT\\NET\\GETDC362\x00P\x00C\x00-\x000\x000\x001\x00\x00\x00\x0b\x00\x00\x00\xff\xff\xff\xff')
222+
223+
assert pkt.ComputerName == b"PC-001"
224+
assert pkt.MailslotName == b"\\MAILSLOT\\NET\\GETDC362"
225+
assert pkt.NtVersion == 0x0b
226+
assert pkt.UnicodeComputerName == "PC-001"

0 commit comments

Comments
 (0)