| 447 | |
| 448 | |
| 449 | class NTLM_Header(Packet): |
| 450 | name = "NTLM Header" |
| 451 | fields_desc = [ |
| 452 | StrFixedLenField("Signature", b"NTLMSSP\0", length=8), |
| 453 | LEIntEnumField( |
| 454 | "MessageType", |
| 455 | 3, |
| 456 | { |
| 457 | 1: "NEGOTIATE_MESSAGE", |
| 458 | 2: "CHALLENGE_MESSAGE", |
| 459 | 3: "AUTHENTICATE_MESSAGE", |
| 460 | }, |
| 461 | ), |
| 462 | ] |
| 463 | |
| 464 | @classmethod |
| 465 | def dispatch_hook(cls, _pkt=None, *args, **kargs): |
| 466 | if cls is NTLM_Header and _pkt and len(_pkt) >= 10: |
| 467 | MessageType = struct.unpack("<H", _pkt[8:10])[0] |
| 468 | if MessageType == 1: |
| 469 | return NTLM_NEGOTIATE |
| 470 | elif MessageType == 2: |
| 471 | return NTLM_CHALLENGE |
| 472 | elif MessageType == 3: |
| 473 | return NTLM_AUTHENTICATE_V2 |
| 474 | return cls |
| 475 | |
| 476 | |
| 477 | # Sect 2.2.2.5 |
no test coverage detected