1
2
3 """Server Message Block."""
4 from __future__ import print_function
5 from __future__ import absolute_import
6
7 from . import dpkt
8
9
10
11
12 SMB_FLAGS_LOCK_AND_READ_OK = 0x01
13 SMB_FLAGS_BUF_AVAIL = 0x02
14 SMB_FLAGS_CASE_INSENSITIVE = 0x08
15 SMB_FLAGS_CANONICALIZED_PATHS = 0x10
16 SMB_FLAGS_OPLOCK = 0x20
17 SMB_FLAGS_OPBATCH = 0x40
18 SMB_FLAGS_REPLY = 0x80
19
20 SMB_FLAGS2_LONG_NAMES = 0x0001
21 SMB_FLAGS2_EXTENDED_ATTRIBUTES = 0x0002
22 SMB_FLAGS2_SECURITY_SIGNATURES = 0x0004
23 SMB_FLAGS2_COMPRESSED = 0x0008
24 SMB_FLAGS2_SECURITY_SIGNATURES_REQUIRED = 0x0010
25 SMB_FLAGS2_IS_LONG_NAME = 0x0040
26 SMB_FLAGS2_REVERSE_PATH = 0x0400
27 SMB_FLAGS2_EXTENDED_SECURITY = 0x0800
28 SMB_FLAGS2_DFS = 0x1000
29 SMB_FLAGS2_PAGING_IO = 0x2000
30 SMB_FLAGS2_NT_STATUS = 0x4000
31 SMB_FLAGS2_UNICODE = 0x8000
32
33 SMB_STATUS_SUCCESS = 0x00000000
34
35
36 -class SMB(dpkt.Packet):
37 """Server Message Block.
38
39 TODO: Longer class information....
40
41 Attributes:
42 __hdr__ = [
43 ('proto', '4s', b'\xffSMB'),
44 ('cmd', 'B', 0),
45 ('status', 'I', SMB_STATUS_SUCCESS),
46 ('flags', 'B', 0),
47 ('flags2', 'H', 0),
48 ('_pidhi', 'H', 0),
49 ('security', '8s', b''),
50 ('rsvd', 'H', 0),
51 ('tid', 'H', 0),
52 ('_pidlo', 'H', 0),
53 ('uid', 'H', 0),
54 ('mid', 'H', 0)
55 ]
56 """
57
58 __byte_order__ = '<'
59 __hdr__ = [
60 ('proto', '4s', b'\xffSMB'),
61 ('cmd', 'B', 0),
62 ('status', 'I', SMB_STATUS_SUCCESS),
63 ('flags', 'B', 0),
64 ('flags2', 'H', 0),
65 ('_pidhi', 'H', 0),
66 ('security', '8s', b''),
67 ('rsvd', 'H', 0),
68 ('tid', 'H', 0),
69 ('_pidlo', 'H', 0),
70 ('uid', 'H', 0),
71 ('mid', 'H', 0)
72 ]
73
74 @property
77
78 @pid.setter
82
99
100
101 if __name__ == '__main__':
102 test_smb()
103 print('Tests Successful...')
104