| 1 |
# Copyright (c) 2003-2016 CORE Security Technologies |
| 2 |
# |
| 3 |
# This software is provided under under a slightly modified version |
| 4 |
# of the Apache Software License. See the accompanying LICENSE file |
| 5 |
# for more information. |
| 6 |
# |
| 7 |
# Author: Alberto Solino (@agsolino) |
| 8 |
# |
| 9 |
# Description: |
| 10 |
# SMB 2 and 3 Protocol Structures and constants [MS-SMB2] |
| 11 |
# |
| 12 |
|
| 13 |
from impacket.structure import Structure |
| 14 |
|
| 15 |
# Constants |
| 16 |
|
| 17 |
# SMB Packet |
| 18 |
SMB2_PACKET_SIZE = 64 |
| 19 |
|
| 20 |
# SMB Commands |
| 21 |
SMB2_NEGOTIATE = 0x0000 # |
| 22 |
SMB2_SESSION_SETUP = 0x0001 # |
| 23 |
SMB2_LOGOFF = 0x0002 # |
| 24 |
SMB2_TREE_CONNECT = 0x0003 # |
| 25 |
SMB2_TREE_DISCONNECT = 0x0004 # |
| 26 |
SMB2_CREATE = 0x0005 # |
| 27 |
SMB2_CLOSE = 0x0006 # |
| 28 |
SMB2_FLUSH = 0x0007 # |
| 29 |
SMB2_READ = 0x0008 # |
| 30 |
SMB2_WRITE = 0x0009 # |
| 31 |
SMB2_LOCK = 0x000A # |
| 32 |
SMB2_IOCTL = 0x000B # |
| 33 |
SMB2_CANCEL = 0x000C # |
| 34 |
SMB2_ECHO = 0x000D # |
| 35 |
SMB2_QUERY_DIRECTORY = 0x000E # |
| 36 |
SMB2_CHANGE_NOTIFY = 0x000F |
| 37 |
SMB2_QUERY_INFO = 0x0010 # |
| 38 |
SMB2_SET_INFO = 0x0011 |
| 39 |
SMB2_OPLOCK_BREAK = 0x0012 |
| 40 |
|
| 41 |
# SMB Flags |
| 42 |
SMB2_FLAGS_SERVER_TO_REDIR = 0x00000001 |
| 43 |
SMB2_FLAGS_ASYNC_COMMAND = 0x00000002 |
| 44 |
SMB2_FLAGS_RELATED_OPERATIONS = 0x00000004 |
| 45 |
SMB2_FLAGS_SIGNED = 0x00000008 |
| 46 |
SMB2_FLAGS_DFS_OPERATIONS = 0x10000000 |
| 47 |
SMB2_FLAGS_REPLAY_OPERATION = 0x80000000 |
| 48 |
|
| 49 |
# SMB Error SymLink Flags |
| 50 |
SYMLINK_FLAG_ABSOLUTE = 0x0 |
| 51 |
SYMLINK_FLAG_RELATIVE = 0x1 |
| 52 |
|
| 53 |
# SMB2_NEGOTIATE |
| 54 |
# Security Modes |
| 55 |
SMB2_NEGOTIATE_SIGNING_ENABLED = 0x1 |
| 56 |
SMB2_NEGOTIATE_SIGNING_REQUIRED = 0x2 |
| 57 |
|
| 58 |
# Capabilities |
| 59 |
SMB2_GLOBAL_CAP_DFS = 0x01 |
| 60 |
SMB2_GLOBAL_CAP_LEASING = 0x02 |
| 61 |
SMB2_GLOBAL_CAP_LARGE_MTU = 0x04 |
| 62 |
SMB2_GLOBAL_CAP_MULTI_CHANNEL = 0x08 |
| 63 |
SMB2_GLOBAL_CAP_PERSISTENT_HANDLES = 0x10 |
| 64 |
SMB2_GLOBAL_CAP_DIRECTORY_LEASING = 0x20 |
| 65 |
SMB2_GLOBAL_CAP_ENCRYPTION = 0x40 |
| 66 |
|
| 67 |
# Dialects |
| 68 |
SMB2_DIALECT_002 = 0x0202 |
| 69 |
SMB2_DIALECT_21 = 0x0210 |
| 70 |
SMB2_DIALECT_30 = 0x0300 |
| 71 |
SMB2_DIALECT_WILDCARD = 0x02FF |
| 72 |
|
| 73 |
# SMB2_SESSION_SETUP |
| 74 |
# Flags |
| 75 |
SMB2_SESSION_FLAG_BINDING = 0x01 |
| 76 |
SMB2_SESSION_FLAG_IS_GUEST = 0x01 |
| 77 |
SMB2_SESSION_FLAG_IS_NULL = 0x02 |
| 78 |
SMB2_SESSION_FLAG_ENCRYPT_DATA = 0x04 |
| 79 |
|
| 80 |
# SMB2_TREE_CONNECT |
| 81 |
# Types |
| 82 |
SMB2_SHARE_TYPE_DISK = 0x1 |
| 83 |
SMB2_SHARE_TYPE_PIPE = 0x2 |
| 84 |
SMB2_SHARE_TYPE_PRINT = 0x3 |
| 85 |
|
| 86 |
# Share Flags |
| 87 |
SMB2_SHAREFLAG_MANUAL_CACHING = 0x00000000 |
| 88 |
SMB2_SHAREFLAG_AUTO_CACHING = 0x00000010 |
| 89 |
SMB2_SHAREFLAG_VDO_CACHING = 0x00000020 |
| 90 |
SMB2_SHAREFLAG_NO_CACHING = 0x00000030 |
| 91 |
SMB2_SHAREFLAG_DFS = 0x00000001 |
| 92 |
SMB2_SHAREFLAG_DFS_ROOT = 0x00000002 |
| 93 |
SMB2_SHAREFLAG_RESTRICT_EXCLUSIVE_OPENS = 0x00000100 |
| 94 |
SMB2_SHAREFLAG_FORCE_SHARED_DELETE = 0x00000200 |
| 95 |
SMB2_SHAREFLAG_ALLOW_NAMESPACE_CACHING = 0x00000400 |
| 96 |
SMB2_SHAREFLAG_ACCESS_BASED_DIRECTORY_ENUM = 0x00000800 |
| 97 |
SMB2_SHAREFLAG_FORCE_LEVELII_OPLOCK = 0x00001000 |
| 98 |
SMB2_SHAREFLAG_ENABLE_HASH_V1 = 0x00002000 |
| 99 |
SMB2_SHAREFLAG_ENABLE_HASH_V2 = 0x00004000 |
| 100 |
SMB2_SHAREFLAG_ENCRYPT_DATA = 0x00008000 |
| 101 |
|
| 102 |
# Capabilities |
| 103 |
SMB2_SHARE_CAP_DFS = 0x00000008 |
| 104 |
SMB2_SHARE_CAP_CONTINUOUS_AVAILABILITY = 0x00000010 |
| 105 |
SMB2_SHARE_CAP_SCALEOUT = 0x00000020 |
| 106 |
SMB2_SHARE_CAP_CLUSTER = 0x00000040 |
| 107 |
|
| 108 |
# SMB_CREATE |
| 109 |
# Oplocks |
| 110 |
SMB2_OPLOCK_LEVEL_NONE = 0x00 |
| 111 |
SMB2_OPLOCK_LEVEL_II = 0x01 |
| 112 |
SMB2_OPLOCK_LEVEL_EXCLUSIVE = 0x08 |
| 113 |
SMB2_OPLOCK_LEVEL_BATCH = 0x09 |
| 114 |
SMB2_OPLOCK_LEVEL_LEASE = 0xFF |
| 115 |
|
| 116 |
# Impersonation Level |
| 117 |
SMB2_IL_ANONYMOUS = 0x00000000 |
| 118 |
SMB2_IL_IDENTIFICATION = 0x00000001 |
| 119 |
SMB2_IL_IMPERSONATION = 0x00000002 |
| 120 |
SMB2_IL_DELEGATE = 0x00000003 |
| 121 |
|
| 122 |
# File Attributes |
| 123 |
FILE_ATTRIBUTE_ARCHIVE = 0x00000020 |
| 124 |
FILE_ATTRIBUTE_COMPRESSED = 0x00000800 |
| 125 |
FILE_ATTRIBUTE_DIRECTORY = 0x00000010 |
| 126 |
FILE_ATTRIBUTE_ENCRYPTED = 0x00004000 |
| 127 |
FILE_ATTRIBUTE_HIDDEN = 0x00000002 |
| 128 |
FILE_ATTRIBUTE_NORMAL = 0x00000080 |
| 129 |
FILE_ATTRIBUTE_NOT_CONTENT_INDEXED = 0x00002000 |
| 130 |
FILE_ATTRIBUTE_OFFLINE = 0x00001000 |
| 131 |
FILE_ATTRIBUTE_READONLY = 0x00000001 |
| 132 |
FILE_ATTRIBUTE_REPARSE_POINT = 0x00000400 |
| 133 |
FILE_ATTRIBUTE_SPARSE_FILE = 0x00000200 |
| 134 |
FILE_ATTRIBUTE_SYSTEM = 0x00000004 |
| 135 |
FILE_ATTRIBUTE_TEMPORARY = 0x00000100 |
| 136 |
FILE_ATTRIBUTE_INTEGRITY_STREAM = 0x00000800 |
| 137 |
FILE_ATTRIBUTE_NO_SCRUB_DATA = 0x00020000 |
| 138 |
|
| 139 |
# Share Access |
| 140 |
FILE_SHARE_READ = 0x00000001 |
| 141 |
FILE_SHARE_WRITE = 0x00000002 |
| 142 |
FILE_SHARE_DELETE = 0x00000004 |
| 143 |
|
| 144 |
# Create Disposition |
| 145 |
FILE_SUPERSEDE = 0x00000000 |
| 146 |
FILE_OPEN = 0x00000001 |
| 147 |
FILE_CREATE = 0x00000002 |
| 148 |
FILE_OPEN_IF = 0x00000003 |
| 149 |
FILE_OVERWRITE = 0x00000004 |
| 150 |
FILE_OVERWRITE_IF = 0x00000005 |
| 151 |
|
| 152 |
# Create Options |
| 153 |
FILE_DIRECTORY_FILE = 0x00000001 |
| 154 |
FILE_WRITE_THROUGH = 0x00000002 |
| 155 |
FILE_SEQUENTIAL_ONLY = 0x00000004 |
| 156 |
FILE_NO_INTERMEDIATE_BUFFERING = 0x00000008 |
| 157 |
FILE_SYNCHRONOUS_IO_ALERT = 0x00000010 |
| 158 |
FILE_SYNCHRONOUS_IO_NONALERT = 0x00000020 |
| 159 |
FILE_NON_DIRECTORY_FILE = 0x00000040 |
| 160 |
FILE_COMPLETE_IF_OPLOCKED = 0x00000100 |
| 161 |
FILE_NO_EA_KNOWLEDGE = 0x00000200 |
| 162 |
FILE_RANDOM_ACCESS = 0x00000800 |
| 163 |
FILE_DELETE_ON_CLOSE = 0x00001000 |
| 164 |
FILE_OPEN_BY_FILE_ID = 0x00002000 |
| 165 |
FILE_OPEN_FOR_BACKUP_INTENT = 0x00004000 |
| 166 |
FILE_NO_COMPRESSION = 0x00008000 |
| 167 |
FILE_RESERVE_OPFILTER = 0x00100000 |
| 168 |
FILE_OPEN_REPARSE_POINT = 0x00200000 |
| 169 |
FILE_OPEN_NO_RECALL = 0x00400000 |
| 170 |
FILE_OPEN_FOR_FREE_SPACE_QUERY = 0x00800000 |
| 171 |
|
| 172 |
# File Access Mask / Desired Access |
| 173 |
FILE_READ_DATA = 0x00000001 |
| 174 |
FILE_WRITE_DATA = 0x00000002 |
| 175 |
FILE_APPEND_DATA = 0x00000004 |
| 176 |
FILE_READ_EA = 0x00000008 |
| 177 |
FILE_WRITE_EA = 0x00000010 |
| 178 |
FILE_EXECUTE = 0x00000020 |
| 179 |
FILE_READ_ATTRIBUTES = 0x00000080 |
| 180 |
FILE_WRITE_ATTRIBUTES = 0x00000100 |
| 181 |
DELETE = 0x00010000 |
| 182 |
READ_CONTROL = 0x00020000 |
| 183 |
WRITE_DAC = 0x00040000 |
| 184 |
WRITE_OWNER = 0x00080000 |
| 185 |
SYNCHRONIZE = 0x00100000 |
| 186 |
ACCESS_SYSTEM_SECURITY = 0x01000000 |
| 187 |
MAXIMUM_ALLOWED = 0x02000000 |
| 188 |
GENERIC_ALL = 0x10000000 |
| 189 |
GENERIC_EXECUTE = 0x20000000 |
| 190 |
GENERIC_WRITE = 0x40000000 |
| 191 |
GENERIC_READ = 0x80000000 |
| 192 |
|
| 193 |
# Directory Access Mask |
| 194 |
FILE_LIST_DIRECTORY = 0x00000001 |
| 195 |
FILE_ADD_FILE = 0x00000002 |
| 196 |
FILE_ADD_SUBDIRECTORY = 0x00000004 |
| 197 |
FILE_TRAVERSE = 0x00000020 |
| 198 |
FILE_DELETE_CHILD = 0x00000040 |
| 199 |
|
| 200 |
# Create Contexts |
| 201 |
SMB2_CREATE_EA_BUFFER = 0x45787441 |
| 202 |
SMB2_CREATE_SD_BUFFER = 0x53656344 |
| 203 |
SMB2_CREATE_DURABLE_HANDLE_REQUEST = 0x44486e51 |
| 204 |
SMB2_CREATE_DURABLE_HANDLE_RECONNECT = 0x44486e43 |
| 205 |
SMB2_CREATE_ALLOCATION_SIZE = 0x416c5369 |
| 206 |
SMB2_CREATE_QUERY_MAXIMAL_ACCESS_REQUEST = 0x4d784163 |
| 207 |
SMB2_CREATE_TIMEWARP_TOKEN = 0x54577270 |
| 208 |
SMB2_CREATE_QUERY_ON_DISK_ID = 0x51466964 |
| 209 |
SMB2_CREATE_REQUEST = 0x52714c73 |
| 210 |
SMB2_CREATE_REQUEST_LEASE_V2 = 0x52714c73 |
| 211 |
SMB2_CREATE_DURABLE_HANDLE_REQUEST_V2 = 0x44483251 |
| 212 |
SMB2_CREATE_DURABLE_HANDLE_RECONNECT_V2 = 0x44483243 |
| 213 |
SMB2_CREATE_APP_INSTANCE_ID = 0x45BCA66AEFA7F74A9008FA462E144D74 |
| 214 |
|
| 215 |
# Flags |
| 216 |
SMB2_CREATE_FLAG_REPARSEPOINT = 0x1 |
| 217 |
FILE_NEED_EA = 0x80 |
| 218 |
|
| 219 |
# CreateAction |
| 220 |
FILE_SUPERSEDED = 0x00000000 |
| 221 |
FILE_OPENED = 0x00000001 |
| 222 |
FILE_CREATED = 0x00000002 |
| 223 |
FILE_OVERWRITTEN = 0x00000003 |
| 224 |
|
| 225 |
# SMB2_CREATE_REQUEST_LEASE states |
| 226 |
SMB2_LEASE_NONE = 0x00 |
| 227 |
SMB2_LEASE_READ_CACHING = 0x01 |
| 228 |
SMB2_LEASE_HANDLE_CACHING = 0x02 |
| 229 |
SMB2_LEASE_WRITE_CACHING = 0x04 |
| 230 |
|
| 231 |
# SMB2_CREATE_REQUEST_LEASE_V2 Flags |
| 232 |
SMB2_LEASE_FLAG_PARENT_LEASE_KEY_SET = 0x4 |
| 233 |
|
| 234 |
# SMB2_CREATE_DURABLE_HANDLE_REQUEST_V2 Flags |
| 235 |
SMB2_DHANDLE_FLAG_PERSISTENT = 0x02 |
| 236 |
|
| 237 |
# SMB2_CLOSE |
| 238 |
# Flags |
| 239 |
SMB2_CLOSE_FLAG_POSTQUERY_ATTRIB = 0x0001 |
| 240 |
|
| 241 |
# SMB2_READ |
| 242 |
# Channel |
| 243 |
SMB2_CHANNEL_NONE = 0x00 |
| 244 |
SMB2_CHANNEL_RDMA_V1 = 0x01 |
| 245 |
|
| 246 |
# SMB2_WRITE |
| 247 |
# Flags |
| 248 |
SMB2_WRITEFLAG_WRITE_THROUGH = 0x01 |
| 249 |
|
| 250 |
# Lease Break Notification |
| 251 |
SMB2_NOTIFY_BREAK_LEASE_FLAG_ACK_REQUIRED = 0x01 |
| 252 |
|
| 253 |
# SMB_LOCK |
| 254 |
# Flags |
| 255 |
SMB2_LOCKFLAG_SHARED_LOCK = 0x01 |
| 256 |
SMB2_LOCKFLAG_EXCLUSIVE_LOCK = 0x02 |
| 257 |
SMB2_LOCKFLAG_UNLOCK = 0x04 |
| 258 |
SMB2_LOCKFLAG_FAIL_IMMEDIATELY = 0x10 |
| 259 |
|
| 260 |
# SMB IOCTL |
| 261 |
# Control Codes |
| 262 |
FSCTL_DFS_GET_REFERRALS = 0x00060194 |
| 263 |
FSCTL_PIPE_PEEK = 0x0011400C |
| 264 |
FSCTL_PIPE_WAIT = 0x00110018 |
| 265 |
FSCTL_PIPE_TRANSCEIVE = 0x0011C017 |
| 266 |
FSCTL_SRV_COPYCHUNK = 0x001440F2 |
| 267 |
FSCTL_SRV_ENUMERATE_SNAPSHOTS = 0x00144064 |
| 268 |
FSCTL_SRV_REQUEST_RESUME_KEY = 0x00140078 |
| 269 |
FSCTL_SRV_READ_HASH = 0x001441bb |
| 270 |
FSCTL_SRV_COPYCHUNK_WRITE = 0x001480F2 |
| 271 |
FSCTL_LMR_REQUEST_RESILIENCY = 0x001401D4 |
| 272 |
FSCTL_QUERY_NETWORK_INTERFACE_INFO = 0x001401FC |
| 273 |
FSCTL_SET_REPARSE_POINT = 0x000900A4 |
| 274 |
FSCTL_DFS_GET_REFERRALS_EX = 0x000601B0 |
| 275 |
FSCTL_FILE_LEVEL_TRIM = 0x00098208 |
| 276 |
FSCTL_VALIDATE_NEGOTIATE_INFO = 0x00140204 |
| 277 |
|
| 278 |
# Flags |
| 279 |
SMB2_0_IOCTL_IS_FSCTL = 0x1 |
| 280 |
|
| 281 |
# SRV_READ_HASH |
| 282 |
# Type |
| 283 |
SRV_HASH_TYPE_PEER_DIST = 0x01 |
| 284 |
|
| 285 |
# Version |
| 286 |
SRV_HASH_VER_1 = 0x1 |
| 287 |
SRV_HASH_VER_2 = 0x2 |
| 288 |
|
| 289 |
# Retrieval Type |
| 290 |
SRV_HASH_RETRIEVE_HASH_BASED = 0x01 |
| 291 |
SRV_HASH_RETRIEVE_FILE_BASED = 0x02 |
| 292 |
|
| 293 |
# NETWORK_INTERFACE_INFO |
| 294 |
# Capabilities |
| 295 |
RSS_CAPABLE = 0x01 |
| 296 |
RDMA_CAPABLE = 0x02 |
| 297 |
|
| 298 |
# SMB2_QUERY_DIRECTORIES |
| 299 |
# Information Class |
| 300 |
FILE_DIRECTORY_INFORMATION = 0x01 |
| 301 |
FILE_FULL_DIRECTORY_INFORMATION = 0x02 |
| 302 |
FILEID_FULL_DIRECTORY_INFORMATION = 0x26 |
| 303 |
FILE_BOTH_DIRECTORY_INFORMATION = 0x03 |
| 304 |
FILEID_BOTH_DIRECTORY_INFORMATION = 0x25 |
| 305 |
FILENAMES_INFORMATION = 0x0C |
| 306 |
|
| 307 |
# Flags |
| 308 |
SMB2_RESTART_SCANS = 0x01 |
| 309 |
SMB2_RETURN_SINGLE_ENTRY = 0x02 |
| 310 |
SMB2_INDEX_SPECIFIED = 0x04 |
| 311 |
SMB2_REOPEN = 0x10 |
| 312 |
|
| 313 |
# SMB2_CHANGE_NOTIFY |
| 314 |
# Flags |
| 315 |
SMB2_WATCH_TREE = 0x01 |
| 316 |
|
| 317 |
# Filters |
| 318 |
FILE_NOTIFY_CHANGE_FILE_NAME = 0x00000001 |
| 319 |
FILE_NOTIFY_CHANGE_DIR_NAME = 0x00000002 |
| 320 |
FILE_NOTIFY_CHANGE_ATTRIBUTES = 0x00000004 |
| 321 |
FILE_NOTIFY_CHANGE_SIZE = 0x00000008 |
| 322 |
FILE_NOTIFY_CHANGE_LAST_WRITE = 0x00000010 |
| 323 |
FILE_NOTIFY_CHANGE_LAST_ACCESS = 0x00000020 |
| 324 |
FILE_NOTIFY_CHANGE_CREATION = 0x00000040 |
| 325 |
FILE_NOTIFY_CHANGE_EA = 0x00000080 |
| 326 |
FILE_NOTIFY_CHANGE_SECURITY = 0x00000100 |
| 327 |
FILE_NOTIFY_CHANGE_STREAM_NAME = 0x00000200 |
| 328 |
FILE_NOTIFY_CHANGE_STREAM_SIZE = 0x00000400 |
| 329 |
FILE_NOTIFY_CHANGE_STREAM_WRITE = 0x00000800 |
| 330 |
|
| 331 |
# FILE_NOTIFY_INFORMATION |
| 332 |
# Actions |
| 333 |
FILE_ACTION_ADDED = 0x00000001 |
| 334 |
FILE_ACTION_REMOVED = 0x00000002 |
| 335 |
FILE_ACTION_MODIFIED = 0x00000003 |
| 336 |
FILE_ACTION_RENAMED_OLD_NAME = 0x00000004 |
| 337 |
FILE_ACTION_RENAMED_NEW_NAME = 0x00000005 |
| 338 |
|
| 339 |
# SMB2_QUERY_INFO |
| 340 |
# InfoTypes |
| 341 |
SMB2_0_INFO_FILE = 0x01 |
| 342 |
SMB2_0_INFO_FILESYSTEM = 0x02 |
| 343 |
SMB2_0_INFO_SECURITY = 0x03 |
| 344 |
SMB2_0_INFO_QUOTA = 0x04 |
| 345 |
|
| 346 |
# File Information Classes |
| 347 |
SMB2_FILE_ACCESS_INFO = 8 |
| 348 |
SMB2_FILE_ALIGNMENT_INFO = 17 |
| 349 |
SMB2_FILE_ALL_INFO = 18 |
| 350 |
SMB2_FILE_ALLOCATION_INFO = 19 |
| 351 |
SMB2_FILE_ALTERNATE_NAME_INFO = 21 |
| 352 |
SMB2_ATTRIBUTE_TAG_INFO = 35 |
| 353 |
SMB2_FILE_BASIC_INFO = 4 |
| 354 |
SMB2_FILE_BOTH_DIRECTORY_INFO = 3 |
| 355 |
SMB2_FILE_COMPRESSION_INFO = 28 |
| 356 |
SMB2_FILE_DIRECTORY_INFO = 1 |
| 357 |
SMB2_FILE_DISPOSITION_INFO = 13 |
| 358 |
SMB2_FILE_EA_INFO = 7 |
| 359 |
SMB2_FILE_END_OF_FILE_INFO = 20 |
| 360 |
SMB2_FULL_DIRECTORY_INFO = 2 |
| 361 |
SMB2_FULL_EA_INFO = 15 |
| 362 |
SMB2_FILE_HARDLINK_INFO = 46 |
| 363 |
SMB2_FILE_ID_BOTH_DIRECTORY_INFO = 37 |
| 364 |
SMB2_FILE_ID_FULL_DIRECTORY_INFO = 38 |
| 365 |
SMB2_FILE_ID_GLOBAL_TX_DIRECTORY_INFO = 50 |
| 366 |
SMB2_FILE_INTERNAL_INFO = 6 |
| 367 |
SMB2_FILE_LINK_INFO = 11 |
| 368 |
SMB2_FILE_MAILSLOT_QUERY_INFO = 26 |
| 369 |
SMB2_FILE_MAILSLOT_SET_INFO = 27 |
| 370 |
SMB2_FILE_MODE_INFO = 16 |
| 371 |
SMB2_FILE_MOVE_CLUSTER_INFO = 31 |
| 372 |
SMB2_FILE_NAME_INFO = 9 |
| 373 |
SMB2_FILE_NAMES_INFO = 12 |
| 374 |
SMB2_FILE_NETWORK_OPEN_INFO = 34 |
| 375 |
SMB2_FILE_NORMALIZED_NAME_INFO = 48 |
| 376 |
SMB2_FILE_OBJECT_ID_INFO = 29 |
| 377 |
SMB2_FILE_PIPE_INFO = 23 |
| 378 |
SMB2_FILE_PIPE_LOCAL_INFO = 24 |
| 379 |
SMB2_FILE_PIPE_REMOTE_INFO = 25 |
| 380 |
SMB2_FILE_POSITION_INFO = 14 |
| 381 |
SMB2_FILE_QUOTA_INFO = 32 |
| 382 |
SMB2_FILE_RENAME_INFO = 10 |
| 383 |
SMB2_FILE_REPARSE_POINT_INFO = 33 |
| 384 |
SMB2_FILE_SFIO_RESERVE_INFO = 44 |
| 385 |
SMB2_FILE_SHORT_NAME_INFO = 45 |
| 386 |
SMB2_FILE_STANDARD_INFO = 5 |
| 387 |
SMB2_FILE_STANDARD_LINK_INFO = 54 |
| 388 |
SMB2_FILE_STREAM_INFO = 22 |
| 389 |
SMB2_FILE_TRACKING_INFO = 36 |
| 390 |
SMB2_FILE_VALID_DATA_LENGTH_INFO = 39 |
| 391 |
|
| 392 |
# File System Information Classes |
| 393 |
SMB2_FILESYSTEM_VOLUME_INFO = 1 |
| 394 |
SMB2_FILESYSTEM_LABEL_INFO = 2 |
| 395 |
SMB2_FILESYSTEM_SIZE_INFO = 3 |
| 396 |
SMB2_FILESYSTEM_DEVICE_INFO = 4 |
| 397 |
SMB2_FILESYSTEM_ATTRIBUTE_INFO = 5 |
| 398 |
SMB2_FILESYSTEM_CONTROL_INFO = 6 |
| 399 |
SMB2_FILESYSTEM_FULL_SIZE_INFO = 7 |
| 400 |
SMB2_FILESYSTEM_OBJECT_ID_INFO = 8 |
| 401 |
SMB2_FILESYSTEM_DRIVER_PATH_INFO = 9 |
| 402 |
SMB2_FILESYSTEM_SECTOR_SIZE_INFO = 11 |
| 403 |
|
| 404 |
# Additional information |
| 405 |
OWNER_SECURITY_INFORMATION = 0x00000001 |
| 406 |
GROUP_SECURITY_INFORMATION = 0x00000002 |
| 407 |
DACL_SECURITY_INFORMATION = 0x00000004 |
| 408 |
SACL_SECURITY_INFORMATION = 0x00000008 |
| 409 |
LABEL_SECURITY_INFORMATION = 0x00000010 |
| 410 |
|
| 411 |
# Flags |
| 412 |
SL_RESTART_SCAN = 0x00000001 |
| 413 |
SL_RETURN_SINGLE_ENTRY = 0x00000002 |
| 414 |
SL_INDEX_SPECIFIED = 0x00000004 |
| 415 |
|
| 416 |
# TRANSFORM_HEADER |
| 417 |
SMB2_ENCRYPTION_AES128_CCM = 0x0001 |
| 418 |
|
| 419 |
|
| 420 |
# STRUCtures |
| 421 |
# Represents a SMB2/3 Packet |
| 422 |
class SMBPacketBase(Structure): |
| 423 |
def addCommand(self,command): |
| 424 |
# Pad to 8 bytes and put the offset of another SMBPacket |
| 425 |
raise 'Implement This!' |
| 426 |
|
| 427 |
def isValidAnswer(self, status): |
| 428 |
if self['Status'] != status: |
| 429 |
import smb3 |
| 430 |
raise smb3.SessionError(self['Status'], self) |
| 431 |
return True |
| 432 |
|
| 433 |
def __init__(self, data = None): |
| 434 |
Structure.__init__(self,data) |
| 435 |
if data is None: |
| 436 |
self['TreeID'] = 0 |
| 437 |
|
| 438 |
|
| 439 |
class SMB2PacketAsync(SMBPacketBase): |
| 440 |
structure = ( |
| 441 |
('ProtocolID','"\xfeSMB'), |
| 442 |
('StructureSize','<H=64'), |
| 443 |
('CreditCharge','<H=0'), |
| 444 |
('Status','<L=0'), |
| 445 |
('Command','<H=0'), |
| 446 |
('CreditRequestResponse','<H=0'), |
| 447 |
('Flags','<L=0'), |
| 448 |
('NextCommand','<L=0'), |
| 449 |
('MessageID','<Q=0'), |
| 450 |
('AsyncID','<Q=0'), |
| 451 |
('SessionID','<Q=0'), |
| 452 |
('Signature','16s=""'), |
| 453 |
('Data',':=""'), |
| 454 |
) |
| 455 |
|
| 456 |
class SMB3PacketAsync(SMBPacketBase): |
| 457 |
structure = ( |
| 458 |
('ProtocolID','"\xfeSMB'), |
| 459 |
('StructureSize','<H=64'), |
| 460 |
('CreditCharge','<H=0'), |
| 461 |
('ChannelSequence','<H=0'), |
| 462 |
('Reserved','<H=0'), |
| 463 |
('Command','<H=0'), |
| 464 |
('CreditRequestResponse','<H=0'), |
| 465 |
('Flags','<L=0'), |
| 466 |
('NextCommand','<L=0'), |
| 467 |
('MessageID','<Q=0'), |
| 468 |
('AsyncID','<Q=0'), |
| 469 |
('SessionID','<Q=0'), |
| 470 |
('Signature','16s=""'), |
| 471 |
('Data',':=""'), |
| 472 |
) |
| 473 |
|
| 474 |
class SMB2Packet(SMBPacketBase): |
| 475 |
structure = ( |
| 476 |
('ProtocolID','"\xfeSMB'), |
| 477 |
('StructureSize','<H=64'), |
| 478 |
('CreditCharge','<H=0'), |
| 479 |
('Status','<L=0'), |
| 480 |
('Command','<H=0'), |
| 481 |
('CreditRequestResponse','<H=0'), |
| 482 |
('Flags','<L=0'), |
| 483 |
('NextCommand','<L=0'), |
| 484 |
('MessageID','<Q=0'), |
| 485 |
('Reserved','<L=0'), |
| 486 |
('TreeID','<L=0'), |
| 487 |
('SessionID','<Q=0'), |
| 488 |
('Signature','16s=""'), |
| 489 |
('Data',':=""'), |
| 490 |
) |
| 491 |
|
| 492 |
class SMB3Packet(SMBPacketBase): |
| 493 |
structure = ( |
| 494 |
('ProtocolID','"\xfeSMB'), |
| 495 |
('StructureSize','<H=64'), |
| 496 |
('CreditCharge','<H=0'), |
| 497 |
('ChannelSequence','<H=0'), |
| 498 |
('Reserved','<H=0'), |
| 499 |
('Command','<H=0'), |
| 500 |
('CreditRequestResponse','<H=0'), |
| 501 |
('Flags','<L=0'), |
| 502 |
('NextCommand','<L=0'), |
| 503 |
('MessageID','<Q=0'), |
| 504 |
('Reserved','<L=0'), |
| 505 |
('TreeID','<L=0'), |
| 506 |
('SessionID','<Q=0'), |
| 507 |
('Signature','16s=""'), |
| 508 |
('Data',':=""'), |
| 509 |
) |
| 510 |
|
| 511 |
class SMB2Error(Structure): |
| 512 |
structure = ( |
| 513 |
('StructureSize','<H=9'), |
| 514 |
('Reserved','<H=0'), |
| 515 |
('ByteCount','<L=0'), |
| 516 |
('_ErrorData','_-ErrorData','self["ByteCount"]'), |
| 517 |
('ErrorData','"\xff'), |
| 518 |
) |
| 519 |
|
| 520 |
class SMB2ErrorSymbolicLink(Structure): |
| 521 |
structure = ( |
| 522 |
('SymLinkLength','<L=0'), |
| 523 |
('SymLinkErrorTag','<L=0'), |
| 524 |
('ReparseTag','<L=0'), |
| 525 |
('ReparseDataLenght','<H=0'), |
| 526 |
('UnparsedPathLength','<H=0'), |
| 527 |
('SubstituteNameOffset','<H=0'), |
| 528 |
('SubstituteNameLength','<H=0'), |
| 529 |
('PrintNameOffset','<H=0'), |
| 530 |
('PrintNameLength','<H=0'), |
| 531 |
('Flags','<L=0'), |
| 532 |
('PathBuffer',':'), |
| 533 |
) |
| 534 |
|
| 535 |
# SMB2_NEGOTIATE |
| 536 |
class SMB2Negotiate(Structure): |
| 537 |
structure = ( |
| 538 |
('StructureSize','<H=36'), |
| 539 |
('DialectCount','<H=0'), |
| 540 |
('SecurityMode','<H=0'), |
| 541 |
('Reserved','<H=0'), |
| 542 |
('Capabilities','<L=0'), |
| 543 |
('ClientGuid','16s=""'), |
| 544 |
('ClientStartTime','<Q=0'), |
| 545 |
('Dialects','*<H'), |
| 546 |
) |
| 547 |
|
| 548 |
class SMB2Negotiate_Response(Structure): |
| 549 |
structure = ( |
| 550 |
('StructureSize','<H=65'), |
| 551 |
('SecurityMode','<H=0'), |
| 552 |
('DialectRevision','<H=0'), |
| 553 |
('Reserved','<H=0'), |
| 554 |
('ServerGuid','16s=""'), |
| 555 |
('Capabilities','<L=0'), |
| 556 |
('MaxTransactSize','<L=0'), |
| 557 |
('MaxReadSize','<L=0'), |
| 558 |
('MaxWriteSize','<L=0'), |
| 559 |
('SystemTime','<Q=0'), |
| 560 |
('ServerStartTime','<Q=0'), |
| 561 |
('SecurityBufferOffset','<H=0'), |
| 562 |
('SecurityBufferLength','<H=0'), |
| 563 |
('Reserved2','<L=0'), |
| 564 |
('_AlignPad','_-AlignPad','self["SecurityBufferOffset"] - (64 + self["StructureSize"] - 1)'), |
| 565 |
('AlignPad',':=""'), |
| 566 |
('_Buffer','_-Buffer','self["SecurityBufferLength"]'), |
| 567 |
('Buffer',':'), |
| 568 |
) |
| 569 |
|
| 570 |
# SMB2_SESSION_SETUP |
| 571 |
class SMB2SessionSetup(Structure): |
| 572 |
SIZE = 24 |
| 573 |
structure = ( |
| 574 |
('StructureSize','<H=25'), |
| 575 |
('Flags','<B=0'), |
| 576 |
('SecurityMode','<B=0'), |
| 577 |
('Capabilities','<L=0'), |
| 578 |
('Channel','<L=0'), |
| 579 |
('SecurityBufferOffset','<H=(self.SIZE + 64 + len(self["AlignPad"]))'), |
| 580 |
('SecurityBufferLength','<H=0'), |
| 581 |
('PreviousSessionId','<Q=0'), |
| 582 |
('_AlignPad','_-AlignPad','self["SecurityBufferOffset"] - (64 + self["StructureSize"] - 1)'), |
| 583 |
('AlignPad',':=""'), |
| 584 |
('_Buffer','_-Buffer','self["SecurityBufferLength"]'), |
| 585 |
('Buffer',':'), |
| 586 |
) |
| 587 |
|
| 588 |
def __init__(self, data = None): |
| 589 |
Structure.__init__(self,data) |
| 590 |
if data is None: |
| 591 |
self['AlignPad'] = '' |
| 592 |
|
| 593 |
def getData(self): |
| 594 |
#self['AlignPad'] = '\x00' * ((8 - ((24 + SMB2_PACKET_SIZE) & 7)) & 7) |
| 595 |
#self['SecurityBufferOffset'] = 24 + SMB2_PACKET_SIZE +len(self['AlignPad']) |
| 596 |
#self['SecurityBufferLength'] += len(self['AlignPad']) |
| 597 |
return Structure.getData(self) |
| 598 |
|
| 599 |
|
| 600 |
class SMB2SessionSetup_Response(Structure): |
| 601 |
structure = ( |
| 602 |
('StructureSize','<H=9'), |
| 603 |
('SessionFlags','<H=0'), |
| 604 |
('SecurityBufferOffset','<H=0'), |
| 605 |
('SecurityBufferLength','<H=0'), |
| 606 |
('_AlignPad','_-AlignPad','self["SecurityBufferOffset"] - (64 + self["StructureSize"] - 1)'), |
| 607 |
('AlignPad',':=""'), |
| 608 |
('_Buffer','_-Buffer','self["SecurityBufferLength"]'), |
| 609 |
('Buffer',':'), |
| 610 |
) |
| 611 |
|
| 612 |
# SMB2_LOGOFF |
| 613 |
class SMB2Logoff(Structure): |
| 614 |
structure = ( |
| 615 |
('StructureSize','<H=4'), |
| 616 |
('Reserved','<H=0'), |
| 617 |
) |
| 618 |
|
| 619 |
|
| 620 |
class SMB2Logoff_Response(Structure): |
| 621 |
structure = ( |
| 622 |
('StructureSize','<H=4'), |
| 623 |
('Reserved','<H=0'), |
| 624 |
) |
| 625 |
|
| 626 |
# SMB2_TREE_CONNECT |
| 627 |
class SMB2TreeConnect(Structure): |
| 628 |
SIZE = 8 |
| 629 |
structure = ( |
| 630 |
('StructureSize','<H=9'), |
| 631 |
('Reserved','<H=0'), |
| 632 |
('PathOffset','<H=(self.SIZE + 64 + len(self["AlignPad"]))'), |
| 633 |
('PathLength','<H=0'), |
| 634 |
('_AlignPad','_-AlignPad','self["PathOffset"] - (64 + self.SIZE - 1)'), |
| 635 |
('AlignPad',':=""'), |
| 636 |
('_Buffer','_-Buffer','self["PathLength"]'), |
| 637 |
('Buffer',':'), |
| 638 |
) |
| 639 |
def __init__(self, data = None): |
| 640 |
Structure.__init__(self,data) |
| 641 |
if data is None: |
| 642 |
self['AlignPad'] = '' |
| 643 |
|
| 644 |
class SMB2TreeConnect_Response(Structure): |
| 645 |
structure = ( |
| 646 |
('StructureSize','<H=16'), |
| 647 |
('ShareType','<B=0'), |
| 648 |
('Reserved','<B=0'), |
| 649 |
('ShareFlags','<L=0'), |
| 650 |
('Capabilities','<L=0'), |
| 651 |
('MaximalAccess','<L=0'), |
| 652 |
) |
| 653 |
|
| 654 |
# SMB2_TREE_DISCONNECT |
| 655 |
class SMB2TreeDisconnect(Structure): |
| 656 |
structure = ( |
| 657 |
('StructureSize','<H=4'), |
| 658 |
('Reserved','<H=0'), |
| 659 |
) |
| 660 |
|
| 661 |
class SMB2TreeDisconnect_Response(Structure): |
| 662 |
structure = ( |
| 663 |
('StructureSize','<H=4'), |
| 664 |
('Reserved','<H=0'), |
| 665 |
) |
| 666 |
|
| 667 |
# SMB2_CREATE |
| 668 |
class SMB2Create(Structure): |
| 669 |
SIZE = 56 |
| 670 |
structure = ( |
| 671 |
('StructureSize','<H=57'), |
| 672 |
('SecurityFlags','<B=0'), |
| 673 |
('RequestedOplockLevel','<B=0'), |
| 674 |
('ImpersonationLevel','<L=0'), |
| 675 |
('SmbCreateFlags','<Q=0'), |
| 676 |
('Reserved','<Q=0'), |
| 677 |
('DesiredAccess','<L=0'), |
| 678 |
('FileAttributes','<L=0'), |
| 679 |
('ShareAccess','<L=0'), |
| 680 |
('CreateDisposition','<L=0'), |
| 681 |
('CreateOptions','<L=0'), |
| 682 |
('NameOffset','<H=(self.SIZE + 64 + len(self["AlignPad"]))'), |
| 683 |
('NameLength','<H=0'), |
| 684 |
('CreateContextsOffset','<L=0'), |
| 685 |
('CreateContextsLength','<L=0'), |
| 686 |
('_AlignPad','_-AlignPad','self["NameOffset"] - (64 + self["StructureSize"] - 1)'), |
| 687 |
('AlignPad',':=""'), |
| 688 |
('_Buffer','_-Buffer','self["CreateContextsLength"]+self["NameLength"]'), |
| 689 |
('Buffer',':'), |
| 690 |
) |
| 691 |
def __init__(self, data = None): |
| 692 |
Structure.__init__(self,data) |
| 693 |
if data is None: |
| 694 |
self['AlignPad'] = '' |
| 695 |
|
| 696 |
class SMB2CreateContext(Structure): |
| 697 |
structure = ( |
| 698 |
('Next','<L=0'), |
| 699 |
('NameOffset','<H=0'), |
| 700 |
('NameLength','<H=0'), |
| 701 |
('Reserved','<H=0'), |
| 702 |
('DataOffset','<H=0'), |
| 703 |
('DataLength','<L=0'), |
| 704 |
('_Buffer','_-Buffer','self["DataLength"]+self["NameLength"]'), |
| 705 |
('Buffer',':'), |
| 706 |
) |
| 707 |
|
| 708 |
class SMB2_FILEID(Structure): |
| 709 |
structure = ( |
| 710 |
('Persistent','<Q=0'), |
| 711 |
('Volatile','<Q=0'), |
| 712 |
) |
| 713 |
|
| 714 |
class SMB2Create_Response(Structure): |
| 715 |
structure = ( |
| 716 |
('StructureSize','<H=89'), |
| 717 |
('OplockLevel','<B=0'), |
| 718 |
('Flags','<B=0'), |
| 719 |
('CreateAction','<L=0'), |
| 720 |
('CreationTime','<Q=0'), |
| 721 |
('LastAccessTime','<Q=0'), |
| 722 |
('LastWriteTime','<Q=0'), |
| 723 |
('ChangeTime','<Q=0'), |
| 724 |
('AllocationSize','<Q=0'), |
| 725 |
('EndOfFile','<Q=0'), |
| 726 |
('FileAttributes','<L=0'), |
| 727 |
('Reserved2','<L=0'), |
| 728 |
('FileID',':',SMB2_FILEID), |
| 729 |
('CreateContextsOffset','<L=0'), |
| 730 |
('CreateContextsLength','<L=0'), |
| 731 |
('_AlignPad','_-AlignPad','self["CreateContextsOffset"] - (64 + self["StructureSize"] - 1)'), |
| 732 |
('AlignPad',':=""'), |
| 733 |
('_Buffer','_-Buffer','self["CreateContextsLength"]'), |
| 734 |
('Buffer',':'), |
| 735 |
) |
| 736 |
|
| 737 |
class FILE_FULL_EA_INFORMATION(Structure): |
| 738 |
structure = ( |
| 739 |
('NextEntryOffset','<L=0'), |
| 740 |
('Flags','<B=0'), |
| 741 |
('EaNameLength','<B=0'), |
| 742 |
('EaValueLength','<H=0'), |
| 743 |
('_EaName','_-EaName','self["EaNameLength"]'), |
| 744 |
('EaName',':'), |
| 745 |
('_EaValue','_-EaValue','self["EaValue"]'), |
| 746 |
('EaValue',':'), |
| 747 |
) |
| 748 |
|
| 749 |
|
| 750 |
class SMB2_CREATE_DURABLE_HANDLE_RECONNECT(Structure): |
| 751 |
structure = ( |
| 752 |
('Data',':',SMB2_FILEID), |
| 753 |
) |
| 754 |
|
| 755 |
class SMB2_CREATE_DURABLE_HANDLE_REQUEST(Structure): |
| 756 |
structure = ( |
| 757 |
('DurableRequest','16s=""'), |
| 758 |
) |
| 759 |
|
| 760 |
class SMB2_CREATE_DURABLE_HANDLE_RESPONSE(Structure): |
| 761 |
structure = ( |
| 762 |
('Reserved','<Q=0'), |
| 763 |
) |
| 764 |
|
| 765 |
class SMB2_CREATE_QUERY_MAXIMAL_ACCESS_REQUEST(Structure): |
| 766 |
structure = ( |
| 767 |
('Timestamp','<Q=0'), |
| 768 |
) |
| 769 |
|
| 770 |
class SMB2_CREATE_QUERY_MAXIMAL_ACCESS_RESPONSE(Structure): |
| 771 |
structure = ( |
| 772 |
('QueryStatus','<L=0'), |
| 773 |
('MaximalAccess','<L=0'), |
| 774 |
) |
| 775 |
|
| 776 |
class SMB2_CREATE_ALLOCATION_SIZE(Structure): |
| 777 |
structure = ( |
| 778 |
('AllocationSize','<Q=0'), |
| 779 |
) |
| 780 |
|
| 781 |
class SMB2_CREATE_TIMEWARP_TOKEN(Structure): |
| 782 |
structure = ( |
| 783 |
('AllocationSize','<Q=0'), |
| 784 |
) |
| 785 |
|
| 786 |
class SMB2_CREATE_REQUEST_LEASE(Structure): |
| 787 |
structure = ( |
| 788 |
('LeaseKey','16s=""'), |
| 789 |
('LeaseState','<L=0'), |
| 790 |
('LeaseFlags','<L=0'), |
| 791 |
('LeaseDuration','<Q=0'), |
| 792 |
) |
| 793 |
|
| 794 |
SMB2_CREATE_RESPONSE_LEASE = SMB2_CREATE_REQUEST_LEASE |
| 795 |
|
| 796 |
class SMB2_CREATE_REQUEST_LEASE_V2(Structure): |
| 797 |
structure = ( |
| 798 |
('LeaseKey','16s=""'), |
| 799 |
('LeaseState','<L=0'), |
| 800 |
('Flags','<L=0'), |
| 801 |
('LeaseDuration','<Q=0'), |
| 802 |
('ParentLeaseKey','16s=""'), |
| 803 |
('Epoch','<H=0'), |
| 804 |
('Reserved','<H=0'), |
| 805 |
) |
| 806 |
|
| 807 |
SMB2_CREATE_RESPONSE_LEASE_V2 = SMB2_CREATE_REQUEST_LEASE_V2 |
| 808 |
|
| 809 |
class SMB2_CREATE_DURABLE_HANDLE_REQUEST_V2(Structure): |
| 810 |
structure = ( |
| 811 |
('Timeout','<L=0'), |
| 812 |
('Flags','<L=0'), |
| 813 |
('Reserved','8s=""'), |
| 814 |
('CreateGuid','16s=""'), |
| 815 |
) |
| 816 |
|
| 817 |
class SMB2_CREATE_DURABLE_HANDLE_RESPONSE_V2(Structure): |
| 818 |
structure = ( |
| 819 |
('Timeout','<L=0'), |
| 820 |
('Flags','<L=0'), |
| 821 |
) |
| 822 |
|
| 823 |
class SMB2_CREATE_DURABLE_HANDLE_RECONNECT_V2(Structure): |
| 824 |
structure = ( |
| 825 |
('FileID',':', SMB2_FILEID), |
| 826 |
('CreateGuid','16s=""'), |
| 827 |
('Flags','<L=0'), |
| 828 |
) |
| 829 |
|
| 830 |
class SMB2_CREATE_APP_INSTANCE_ID(Structure): |
| 831 |
structure = ( |
| 832 |
('StructureSize','<H=0'), |
| 833 |
('Reserved','<H=0'), |
| 834 |
('AppInstanceId','16s=""'), |
| 835 |
) |
| 836 |
|
| 837 |
class SMB2_CREATE_QUERY_ON_DISK_ID(Structure): |
| 838 |
structure = ( |
| 839 |
('DiskIDBuffer','32s=""'), |
| 840 |
) |
| 841 |
|
| 842 |
# Todo: Add Classes for |
| 843 |
#SMB2_CREATE_SD_BUFFER |
| 844 |
|
| 845 |
# SMB2_CLOSE |
| 846 |
class SMB2Close(Structure): |
| 847 |
structure = ( |
| 848 |
('StructureSize','<H=24'), |
| 849 |
('Flags','<H=0'), |
| 850 |
('Reserved','<L=0'), |
| 851 |
('FileID',':', SMB2_FILEID), |
| 852 |
) |
| 853 |
|
| 854 |
class SMB2Close_Response(Structure): |
| 855 |
structure = ( |
| 856 |
('StructureSize','<H=60'), |
| 857 |
('Flags','<H=0'), |
| 858 |
('Reserved','<L=0'), |
| 859 |
('CreationTime','<Q=0'), |
| 860 |
('LastAccessTime','<Q=0'), |
| 861 |
('LastWriteTime','<Q=0'), |
| 862 |
('ChangeTime','<Q=0'), |
| 863 |
('AllocationSize','<Q=0'), |
| 864 |
('EndofFile','<Q=0'), |
| 865 |
('FileAttributes','<L=0'), |
| 866 |
) |
| 867 |
|
| 868 |
# SMB2_FLUSH |
| 869 |
class SMB2Flush(Structure): |
| 870 |
structure = ( |
| 871 |
('StructureSize','<H=24'), |
| 872 |
('Reserved1','<H=0'), |
| 873 |
('Reserved2','<L=0'), |
| 874 |
('FileID',':',SMB2_FILEID), |
| 875 |
) |
| 876 |
|
| 877 |
class SMB2Flush_Response(Structure): |
| 878 |
structure = ( |
| 879 |
('StructureSize','<H=4'), |
| 880 |
('Reserved','<H=0'), |
| 881 |
) |
| 882 |
|
| 883 |
# SMB2_READ |
| 884 |
class SMB2Read(Structure): |
| 885 |
SIZE = 48 |
| 886 |
structure = ( |
| 887 |
('StructureSize','<H=49'), |
| 888 |
('Padding','<B=0'), |
| 889 |
('Reserved','<B=0'), |
| 890 |
('Length','<L=0'), |
| 891 |
('Offset','<Q=0'), |
| 892 |
('FileID',':',SMB2_FILEID), |
| 893 |
('MinimumCount','<L=0'), |
| 894 |
('Channel','<L=0'), |
| 895 |
('RemainingBytes','<L=0'), |
| 896 |
('ReadChannelInfoOffset','<H=0'), |
| 897 |
('ReadChannelInfoLength','<H=0'), |
| 898 |
('_AlignPad','_-AlignPad','self["ReadChannelInfoOffset"] - (64 + self["StructureSize"] - 1)'), |
| 899 |
('AlignPad',':=""'), |
| 900 |
('_Buffer','_-Buffer','self["ReadChannelInfoLength"]'), |
| 901 |
('Buffer',':=0'), |
| 902 |
) |
| 903 |
def __init__(self, data = None): |
| 904 |
Structure.__init__(self,data) |
| 905 |
if data is None: |
| 906 |
self['AlignPad'] = '' |
| 907 |
|
| 908 |
|
| 909 |
class SMB2Read_Response(Structure): |
| 910 |
structure = ( |
| 911 |
('StructureSize','<H=17'), |
| 912 |
('DataOffset','<B=0'), |
| 913 |
('Reserved','<B=0'), |
| 914 |
('DataLength','<L=0'), |
| 915 |
('DataRemaining','<L=0'), |
| 916 |
('Reserved2','<L=0'), |
| 917 |
('_AlignPad','_-AlignPad','self["DataOffset"] - (64 + self["StructureSize"] - 1)'), |
| 918 |
('AlignPad',':=""'), |
| 919 |
('_Buffer','_-Buffer','self["DataLength"]'), |
| 920 |
('Buffer',':'), |
| 921 |
) |
| 922 |
|
| 923 |
# SMB2_WRITE |
| 924 |
class SMB2Write(Structure): |
| 925 |
SIZE = 48 |
| 926 |
structure = ( |
| 927 |
('StructureSize','<H=49'), |
| 928 |
('DataOffset','<H=(self.SIZE + 64 + len(self["AlignPad"]))'), |
| 929 |
('Length','<L=0'), |
| 930 |
('Offset','<Q=0'), |
| 931 |
('FileID',':',SMB2_FILEID), |
| 932 |
('Channel','<L=0'), |
| 933 |
('RemainingBytes','<L=0'), |
| 934 |
('WriteChannelInfoOffset','<H=0'), |
| 935 |
('WriteChannelInfoLength','<H=0'), |
| 936 |
('_AlignPad','_-AlignPad','self["DataOffset"] + self["WriteChannelInfoOffset"] - (64 + self["StructureSize"] - 1)'), |
| 937 |
('AlignPad',':=""'), |
| 938 |
('Flags','<L=0'), |
| 939 |
('_Buffer','_-Buffer','self["Length"]+self["WriteChannelInfoLength"]'), |
| 940 |
('Buffer',':'), |
| 941 |
) |
| 942 |
def __init__(self, data = None): |
| 943 |
Structure.__init__(self,data) |
| 944 |
if data is None: |
| 945 |
self['AlignPad'] = '' |
| 946 |
|
| 947 |
|
| 948 |
class SMB2Write_Response(Structure): |
| 949 |
structure = ( |
| 950 |
('StructureSize','<H=17'), |
| 951 |
('Reserved','<H=0'), |
| 952 |
('Count','<L=0'), |
| 953 |
('Remaining','<L=0'), |
| 954 |
('WriteChannelInfoOffset','<H=0'), |
| 955 |
('WriteChannelInfoLength','<H=0'), |
| 956 |
) |
| 957 |
|
| 958 |
class SMB2OplockBreakNotification(Structure): |
| 959 |
structure = ( |
| 960 |
('StructureSize','<H=24'), |
| 961 |
('OplockLevel','<B=0'), |
| 962 |
('Reserved','<B=0'), |
| 963 |
('Reserved2','<L=0'), |
| 964 |
('FileID',':',SMB2_FILEID), |
| 965 |
) |
| 966 |
|
| 967 |
SMB2OplockBreakAcknowledgment = SMB2OplockBreakNotification |
| 968 |
SMB2OplockBreakResponse = SMB2OplockBreakNotification |
| 969 |
|
| 970 |
class SMB2LeaseBreakNotification(Structure): |
| 971 |
structure = ( |
| 972 |
('StructureSize','<H=44'), |
| 973 |
('NewEpoch','<H=0'), |
| 974 |
('Flags','<L=0'), |
| 975 |
('LeaseKey','16s=""'), |
| 976 |
('CurrentLeaseState','<L=0'), |
| 977 |
('NewLeaseState','<L=0'), |
| 978 |
('BreakReason','<L=0'), |
| 979 |
('AccessMaskHint','<L=0'), |
| 980 |
('ShareMaskHint','<L=0'), |
| 981 |
) |
| 982 |
|
| 983 |
class SMB2LeaseBreakAcknowledgement(Structure): |
| 984 |
structure = ( |
| 985 |
('StructureSize','<H=36'), |
| 986 |
('Reserved','<H=0'), |
| 987 |
('Flags','<L=0'), |
| 988 |
('LeaseKey','16s=""'), |
| 989 |
('LeaseState','<L=0'), |
| 990 |
('LeaseDuration','<Q=0'), |
| 991 |
) |
| 992 |
|
| 993 |
SMB2LeaseBreakResponse = SMB2LeaseBreakAcknowledgement |
| 994 |
|
| 995 |
# SMB2_LOCK |
| 996 |
class SMB2_LOCK_ELEMENT(Structure): |
| 997 |
structure = ( |
| 998 |
('Offset','<Q=0'), |
| 999 |
('Length','<Q=0'), |
| 1000 |
('Flags','<L=0'), |
| 1001 |
('Reserved','<L=0'), |
| 1002 |
) |
| 1003 |
|
| 1004 |
class SMB2Lock(Structure): |
| 1005 |
structure = ( |
| 1006 |
('StructureSize','<H=48'), |
| 1007 |
('LockCount','<H=0'), |
| 1008 |
('LockSequence','<L=0'), |
| 1009 |
('FileID',':',SMB2_FILEID), |
| 1010 |
('_Locks','_-Locks','self["LockCount"]*24'), |
| 1011 |
('Locks',':'), |
| 1012 |
) |
| 1013 |
|
| 1014 |
class SMB2Lock_Response(Structure): |
| 1015 |
structure = ( |
| 1016 |
('StructureSize','<H=4'), |
| 1017 |
('Reserved','<H=0'), |
| 1018 |
) |
| 1019 |
|
| 1020 |
|
| 1021 |
# SMB2_ECHO |
| 1022 |
class SMB2Echo(Structure): |
| 1023 |
structure = ( |
| 1024 |
('StructureSize','<H=4'), |
| 1025 |
('Reserved','<H=0'), |
| 1026 |
) |
| 1027 |
|
| 1028 |
SMB2Echo_Response = SMB2Echo |
| 1029 |
|
| 1030 |
# SMB2_CANCEL` |
| 1031 |
class SMB2Cancel(Structure): |
| 1032 |
structure = ( |
| 1033 |
('StructureSize','<H=4'), |
| 1034 |
('Reserved','<H=0'), |
| 1035 |
) |
| 1036 |
|
| 1037 |
# SMB2_IOCTL |
| 1038 |
class SMB2Ioctl(Structure): |
| 1039 |
SIZE = 56 |
| 1040 |
structure = ( |
| 1041 |
('StructureSize','<H=57'), |
| 1042 |
('Reserved','<H=0'), |
| 1043 |
('CtlCode','<L=0'), |
| 1044 |
('FileID',':',SMB2_FILEID), |
| 1045 |
('InputOffset','<L=(self.SIZE + 64 + len(self["AlignPad"]))'), |
| 1046 |
('InputCount','<L=0'), |
| 1047 |
('MaxInputResponse','<L=0'), |
| 1048 |
('OutputOffset','<L=(self.SIZE + 64 + len(self["AlignPad"]) + self["InputCount"])'), |
| 1049 |
('OutputCount','<L=0'), |
| 1050 |
('MaxOutputResponse','<L=0'), |
| 1051 |
('Flags','<L=0'), |
| 1052 |
('Reserved2','<L=0'), |
| 1053 |
#('_AlignPad','_-AlignPad','self["InputOffset"] + self["OutputOffset"] - (64 + self["StructureSize"] - 1)'), |
| 1054 |
#('AlignPad',':=""'), |
| 1055 |
('_Buffer','_-Buffer','self["InputCount"]+self["OutputCount"]'), |
| 1056 |
('Buffer',':'), |
| 1057 |
) |
| 1058 |
def __init__(self, data = None): |
| 1059 |
Structure.__init__(self,data) |
| 1060 |
if data is None: |
| 1061 |
self['AlignPad'] = '' |
| 1062 |
|
| 1063 |
class FSCTL_PIPE_WAIT_STRUCTURE(Structure): |
| 1064 |
structure = ( |
| 1065 |
('Timeout','<q=0'), |
| 1066 |
('NameLength','<L=0'), |
| 1067 |
('TimeoutSpecified','<B=0'), |
| 1068 |
('Padding','<B=0'), |
| 1069 |
('_Name','_-Name','self["NameLength"]'), |
| 1070 |
('Name',':'), |
| 1071 |
) |
| 1072 |
|
| 1073 |
class SRV_COPYCHUNK_COPY(Structure): |
| 1074 |
structure = ( |
| 1075 |
('SourceKey','24s=""'), |
| 1076 |
('ChunkCount','<L=0'), |
| 1077 |
('Reserved','<L=0'), |
| 1078 |
('_Chunks','_-Chunks', 'self["ChunkCount"]*len(SRV_COPYCHUNK)'), |
| 1079 |
('Chunks',':'), |
| 1080 |
) |
| 1081 |
|
| 1082 |
class SRV_COPYCHUNK(Structure): |
| 1083 |
structure = ( |
| 1084 |
('SourceOffset','<Q=0'), |
| 1085 |
('TargetOffset','<Q=0'), |
| 1086 |
('Length','<L=0'), |
| 1087 |
('Reserved','<L=0'), |
| 1088 |
) |
| 1089 |
|
| 1090 |
class SRV_COPYCHUNK_RESPONSE(Structure): |
| 1091 |
structure = ( |
| 1092 |
('ChunksWritten','<L=0'), |
| 1093 |
('ChunkBytesWritten','<L=0'), |
| 1094 |
('TotalBytesWritten','<L=0'), |
| 1095 |
) |
| 1096 |
|
| 1097 |
class SRV_READ_HASH(Structure): |
| 1098 |
structure = ( |
| 1099 |
('HashType','<L=0'), |
| 1100 |
('HashVersion','<L=0'), |
| 1101 |
('HashRetrievalType','<L=0'), |
| 1102 |
('Length','<L=0'), |
| 1103 |
('Offset','<Q=0'), |
| 1104 |
) |
| 1105 |
|
| 1106 |
class NETWORK_RESILIENCY_REQUEST(Structure): |
| 1107 |
structure = ( |
| 1108 |
('Timeout','<L=0'), |
| 1109 |
('Reserved','<L=0'), |
| 1110 |
) |
| 1111 |
|
| 1112 |
class VALIDATE_NEGOTIATE_INFO(Structure): |
| 1113 |
structure = ( |
| 1114 |
('Capabilities','<L=0'), |
| 1115 |
('Guid','16s=""'), |
| 1116 |
('SecurityMode','<H=0'), |
| 1117 |
#('DialectCount','<H=0'), |
| 1118 |
('Dialects','<H*<H'), |
| 1119 |
) |
| 1120 |
|
| 1121 |
class SRV_SNAPSHOT_ARRAY(Structure): |
| 1122 |
structure = ( |
| 1123 |
('NumberOfSnapShots','<L=0'), |
| 1124 |
('NumberOfSnapShotsReturned','<L=0'), |
| 1125 |
('SnapShotArraySize','<L=0'), |
| 1126 |
('_SnapShots','_-SnapShots','self["SnapShotArraySize"]'), |
| 1127 |
('SnapShots',':'), |
| 1128 |
) |
| 1129 |
|
| 1130 |
class SRV_REQUEST_RESUME_KEY(Structure): |
| 1131 |
structure = ( |
| 1132 |
('ResumeKey','24s=""'), |
| 1133 |
('ContextLength','<L=0'), |
| 1134 |
('_Context','_-Context','self["ContextLength"]'), |
| 1135 |
('Context',':'), |
| 1136 |
) |
| 1137 |
|
| 1138 |
class HASH_HEADER(Structure): |
| 1139 |
structure = ( |
| 1140 |
('HashType','<L=0'), |
| 1141 |
('HashVersion','<L=0'), |
| 1142 |
('SourceFileChangeTime','<Q=0'), |
| 1143 |
('SourceFileSize','<Q=0'), |
| 1144 |
('HashBlobLength','<L=0'), |
| 1145 |
('HashBlobOffset','<L=0'), |
| 1146 |
('Dirty','<H=0'), |
| 1147 |
('SourceFileNameLength','<L=0'), |
| 1148 |
('_SourceFileName','_-SourceFileName','self["SourceFileNameLength"]',), |
| 1149 |
('SourceFileName',':'), |
| 1150 |
) |
| 1151 |
|
| 1152 |
class SRV_HASH_RETRIEVE_HASH_BASED(Structure): |
| 1153 |
structure = ( |
| 1154 |
('Offset','<Q=0'), |
| 1155 |
('BufferLength','<L=0'), |
| 1156 |
('Reserved','<L=0'), |
| 1157 |
('_Buffer','_-Buffer','self["BufferLength"]'), |
| 1158 |
('Buffer',':'), |
| 1159 |
) |
| 1160 |
|
| 1161 |
class SRV_HASH_RETRIEVE_FILE_BASED(Structure): |
| 1162 |
structure = ( |
| 1163 |
('FileDataOffset','<Q=0'), |
| 1164 |
('FileDataLength','<Q=0'), |
| 1165 |
('BufferLength','<L=0'), |
| 1166 |
('Reserved','<L=0'), |
| 1167 |
('_Buffer','_-Buffer','self["BufferLength"]'), |
| 1168 |
('Buffer',':'), |
| 1169 |
) |
| 1170 |
|
| 1171 |
class NETWORK_INTERFACE_INFO(Structure): |
| 1172 |
structure = ( |
| 1173 |
('Next','<L=0'), |
| 1174 |
('IfIndex','<L=0'), |
| 1175 |
('Capability','<L=0'), |
| 1176 |
('Reserved','<L=0'), |
| 1177 |
('LinkSpeed','<Q=0'), |
| 1178 |
('SockAddr_Storage','128s=""'), |
| 1179 |
) |
| 1180 |
|
| 1181 |
class SMB2Ioctl_Response(Structure): |
| 1182 |
structure = ( |
| 1183 |
('StructureSize','<H=49'), |
| 1184 |
('Reserved','<H=0'), |
| 1185 |
('CtlCode','<L=0'), |
| 1186 |
('FileID',':',SMB2_FILEID), |
| 1187 |
('InputOffset','<L=0'), |
| 1188 |
('InputCount','<L=0'), |
| 1189 |
('OutputOffset','<L=0'), |
| 1190 |
('OutputCount','<L=0'), |
| 1191 |
('Flags','<L=0'), |
| 1192 |
('Reserved2','<L=0'), |
| 1193 |
('_AlignPad','_-AlignPad','self["OutputOffset"] - (64 + self["StructureSize"] - 1)'), |
| 1194 |
('AlignPad',':=""'), |
| 1195 |
('_Buffer','_-Buffer','self["InputCount"]+self["OutputCount"]'), |
| 1196 |
('Buffer',':'), |
| 1197 |
) |
| 1198 |
|
| 1199 |
# SMB2_QUERY_DIRECTORY |
| 1200 |
class SMB2QueryDirectory(Structure): |
| 1201 |
SIZE = 32 |
| 1202 |
structure = ( |
| 1203 |
('StructureSize','<H=33'), |
| 1204 |
('FileInformationClass','<B=0'), |
| 1205 |
('Flags','<B=0'), |
| 1206 |
('FileIndex','<L=0'), |
| 1207 |
('FileID',':',SMB2_FILEID), |
| 1208 |
('FileNameOffset','<H=(self.SIZE + 64 + len(self["AlignPad"]))'), |
| 1209 |
('FileNameLength','<H=0'), |
| 1210 |
('OutputBufferLength','<L=0'), |
| 1211 |
('_AlignPad','_-AlignPad','self["FileNameOffset"] - (64 + self["StructureSize"] - 1)'), |
| 1212 |
('AlignPad',':=""'), |
| 1213 |
('_Buffer','_-Buffer','self["FileNameLength"]'), |
| 1214 |
('Buffer',':'), |
| 1215 |
) |
| 1216 |
def __init__(self, data = None): |
| 1217 |
Structure.__init__(self,data) |
| 1218 |
if data is None: |
| 1219 |
self['AlignPad'] = '' |
| 1220 |
|
| 1221 |
class SMB2QueryDirectory_Response(Structure): |
| 1222 |
structure = ( |
| 1223 |
('StructureSize','<H=9'), |
| 1224 |
('OutputBufferOffset','<H=0'), |
| 1225 |
('OutputBufferLength','<L=0'), |
| 1226 |
('_AlignPad','_-AlignPad','self["OutputBufferOffset"] - (64 + self["StructureSize"] - 1)'), |
| 1227 |
('AlignPad',':=""'), |
| 1228 |
('_Buffer','_-Buffer','self["OutputBufferLength"]'), |
| 1229 |
('Buffer',':'), |
| 1230 |
) |
| 1231 |
|
| 1232 |
# SMB2_CHANGE_NOTIFY |
| 1233 |
class SMB2ChangeNotify(Structure): |
| 1234 |
structure = ( |
| 1235 |
('StructureSize','<H=32'), |
| 1236 |
('Flags','<H=0'), |
| 1237 |
('OutputBufferLength','<L=0'), |
| 1238 |
('FileID',':',SMB2_FILEID), |
| 1239 |
('CompletionFilter','<L=0'), |
| 1240 |
('Reserved','<L=0'), |
| 1241 |
) |
| 1242 |
|
| 1243 |
class SMB2ChangeNotify_Response(Structure): |
| 1244 |
structure = ( |
| 1245 |
('StructureSize','<H=9'), |
| 1246 |
('OutputBufferOffset','<H=0'), |
| 1247 |
('OutputBufferLength','<L=0'), |
| 1248 |
('_AlignPad','_-AlignPad','self["OutputBufferOffset"] - (64 + self["StructureSize"] - 1)'), |
| 1249 |
('AlignPad',':=""'), |
| 1250 |
('_Buffer','_-Buffer','self["OutputBufferLength"]'), |
| 1251 |
('Buffer',':'), |
| 1252 |
) |
| 1253 |
|
| 1254 |
class FILE_NOTIFY_INFORMATION(Structure): |
| 1255 |
structure = ( |
| 1256 |
('NextEntryOffset','<L=0'), |
| 1257 |
('Action','<L=0'), |
| 1258 |
('FileNameLength','<L=0'), |
| 1259 |
('_FileName','_-FileName','self["FileNameLength"]',), |
| 1260 |
('FileName',':'), |
| 1261 |
) |
| 1262 |
|
| 1263 |
# SMB2_QUERY_INFO |
| 1264 |
class SMB2QueryInfo(Structure): |
| 1265 |
SIZE = 40 |
| 1266 |
structure = ( |
| 1267 |
('StructureSize','<H=41'), |
| 1268 |
('InfoType','<B=0'), |
| 1269 |
('FileInfoClass','<B=0'), |
| 1270 |
('OutputBufferLength','<L=0'), |
| 1271 |
('InputBufferOffset','<H=(self.SIZE + 64 + len(self["AlignPad"]))'), |
| 1272 |
('Reserved','<H=0'), |
| 1273 |
('InputBufferLength','<L=0'), |
| 1274 |
('AdditionalInformation','<L=0'), |
| 1275 |
('Flags','<L=0'), |
| 1276 |
('FileID',':',SMB2_FILEID), |
| 1277 |
('_AlignPad','_-AlignPad','self["InputBufferOffset"] - (64 + self["StructureSize"] - 1)'), |
| 1278 |
('AlignPad',':=""'), |
| 1279 |
('_Buffer','_-Buffer','self["InputBufferLength"]'), |
| 1280 |
('Buffer',':'), |
| 1281 |
) |
| 1282 |
def __init__(self, data = None): |
| 1283 |
Structure.__init__(self,data) |
| 1284 |
if data is None: |
| 1285 |
self['AlignPad'] = '' |
| 1286 |
|
| 1287 |
|
| 1288 |
class SMB2_QUERY_QUOTA_INFO(Structure): |
| 1289 |
structure = ( |
| 1290 |
('ReturnSingle','<B=0'), |
| 1291 |
('RestartScan','<B=0'), |
| 1292 |
('Reserved','<H=0'), |
| 1293 |
('SidListLength','<L=0'), |
| 1294 |
('StartSidLength','<L=0'), |
| 1295 |
('StartSidOffset','<L=0'), |
| 1296 |
# ToDo: Check 2.2.37.1 here |
| 1297 |
('SidBuffer',':'), |
| 1298 |
) |
| 1299 |
|
| 1300 |
class SMB2QueryInfo_Response(Structure): |
| 1301 |
structure = ( |
| 1302 |
('StructureSize','<H=9'), |
| 1303 |
('OutputBufferOffset','<H=0'), |
| 1304 |
('OutputBufferLength','<L=0'), |
| 1305 |
('_AlignPad','_-AlignPad','self["OutputBufferOffset"] - (64 + self["StructureSize"] - 1)'), |
| 1306 |
('AlignPad',':=""'), |
| 1307 |
('_Buffer','_-Buffer','self["OutputBufferLength"]'), |
| 1308 |
('Buffer',':'), |
| 1309 |
) |
| 1310 |
|
| 1311 |
# SMB2_SET_INFO |
| 1312 |
class SMB2SetInfo(Structure): |
| 1313 |
SIZE = 32 |
| 1314 |
structure = ( |
| 1315 |
('StructureSize','<H=33'), |
| 1316 |
('InfoType','<B=0'), |
| 1317 |
('FileInfoClass','<B=0'), |
| 1318 |
('BufferLength','<L=0'), |
| 1319 |
('BufferOffset','<H=(self.SIZE + 64 + len(self["AlignPad"]))'), |
| 1320 |
('Reserved','<H=0'), |
| 1321 |
('AdditionalInformation','<L=0'), |
| 1322 |
('FileID',':',SMB2_FILEID), |
| 1323 |
('_AlignPad','_-AlignPad','self["BufferOffset"] - (64 + self["StructureSize"] - 1)'), |
| 1324 |
('AlignPad',':=""'), |
| 1325 |
('_Buffer','_-Buffer','self["BufferLength"]'), |
| 1326 |
('Buffer',':'), |
| 1327 |
) |
| 1328 |
def __init__(self, data = None): |
| 1329 |
Structure.__init__(self,data) |
| 1330 |
if data is None: |
| 1331 |
self['AlignPad'] = '' |
| 1332 |
|
| 1333 |
class SMB2SetInfo_Response(Structure): |
| 1334 |
structure = ( |
| 1335 |
('StructureSize','<H=2'), |
| 1336 |
) |
| 1337 |
|
| 1338 |
class FILE_RENAME_INFORMATION_TYPE_2(Structure): |
| 1339 |
structure = ( |
| 1340 |
('ReplaceIfExists','<B=0'), |
| 1341 |
('Reserved','7s=""'), |
| 1342 |
('RootDirectory','<Q=0'), |
| 1343 |
('FileNameLength','<L=0'), |
| 1344 |
('_FileName','_-FileName','self["FileNameLength"]'), |
| 1345 |
('FileName',':'), |
| 1346 |
) |
| 1347 |
|
| 1348 |
class SMB2_TRANSFORM_HEADER(Structure): |
| 1349 |
structure = ( |
| 1350 |
('ProtocolID','"\xfdSMB'), |
| 1351 |
('Signature','16s=""'), |
| 1352 |
('Nonce','16s=""'), |
| 1353 |
('OriginalMessageSize','<L=0'), |
| 1354 |
('Reserved','<H=0'), |
| 1355 |
('EncryptionAlgorithm','<H=0'), |
| 1356 |
('SessionID','<Q=0'), |
| 1357 |
) |
| 1358 |
|
| 1359 |
# SMB2_FILE_INTERNAL_INFO |
| 1360 |
class FileInternalInformation(Structure): |
| 1361 |
structure = ( |
| 1362 |
('IndexNumber','<q=0'), |
| 1363 |
) |