File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88"""
99
1010from scapy .config import conf
11- from scapy .packet import Packet , bind_layers
11+ from scapy .packet import Packet , bind_layers , bind_top_down
1212from scapy .fields import (
1313 FieldLenField ,
1414 FieldListField ,
@@ -296,6 +296,18 @@ class SMB2_Negociate_Protocol_Response_Header(Packet):
296296bind_layers (SMB2_Encryption_Capabilities , conf .padding_layer )
297297bind_layers (SMB2_Compression_Capabilities , conf .padding_layer )
298298bind_layers (SMB2_Netname_Negociate_Context_ID , conf .padding_layer )
299+ bind_top_down (
300+ SMB2_Header ,
301+ SMB2_Negociate_Protocol_Request_Header ,
302+ Command = 0x0000 ,
303+ Flags = 0
304+ )
305+ bind_top_down (
306+ SMB2_Header ,
307+ SMB2_Negociate_Protocol_Response_Header ,
308+ Command = 0x0000 ,
309+ Flags = 2 ** 24 # SMB2_FLAGS_SERVER_TO_REDIR
310+ )
299311bind_layers (
300312 SMB2_Negociate_Context ,
301313 SMB2_Preauth_Integrity_Capabilities ,
Original file line number Diff line number Diff line change @@ -132,6 +132,11 @@ assert netname.ContextType == 0x5
132132assert netname.DataLength == 28
133133assert netname.NetName == '192.168.178.21'
134134
135+ = test SMB2 Negociate Protocol Request Header - assembling
136+
137+ pkt = IP() / TCP() / NBTSession() / SMB2_Header() / SMB2_Negociate_Protocol_Request_Header()
138+ pkt = IP(raw(pkt))
139+ assert SMB2_Negociate_Protocol_Request_Header in pkt
135140
136141+ SMB2 Negociate Protocol Response Header dissecting
137142
@@ -194,3 +199,8 @@ assert comp.CompressionAlgorithmCount == 1
194199assert len(comp.CompressionAlgorithms) == 1
195200assert comp.CompressionAlgorithms[0] == 1
196201
202+ = SMB2 Negociate Protocol Response Header assembling
203+
204+ pkt = IP() / TCP() / NBTSession() / SMB2_Header() / SMB2_Negociate_Protocol_Response_Header()
205+ pkt = IP(raw(pkt))
206+ assert SMB2_Negociate_Protocol_Response_Header in pkt
You can’t perform that action at this time.
0 commit comments