MCPcopy Create free account
hub / github.com/secdev/scapy / send_query_info_response

Method send_query_info_response

scapy/layers/smbserver.py:1403–1510  ·  view source on GitHub ↗
(self, pkt)

Source from the content-addressed store, hash-verified

1401
1402 @ATMT.action(receive_query_info)
1403 def send_query_info_response(self, pkt):
1404 self.update_smbheader(pkt)
1405 # [MS-FSCC] + [MS-SMB2] sect 2.2.37 / 3.3.5.20.1
1406 fid = self.get_file_id(pkt)
1407 if pkt.InfoType == 0x01: # SMB2_0_INFO_FILE
1408 if pkt.FileInfoClass == 0x05: # FileStandardInformation
1409 attrs = self.current_handles[fid][1]
1410 fileinfo = FileStandardInformation(
1411 EndOfFile=attrs["EndOfFile"],
1412 AllocationSize=attrs["AllocationSize"],
1413 )
1414 elif pkt.FileInfoClass == 0x06: # FileInternalInformation
1415 pth = self.current_handles[fid][0]
1416 fileinfo = FileInternalInformation(
1417 IndexNumber=hash(pth) & 0xFFFFFFFFFFFFFFFF,
1418 )
1419 elif pkt.FileInfoClass == 0x07: # FileEaInformation
1420 fileinfo = FileEaInformation()
1421 elif pkt.FileInfoClass == 0x12: # FileAllInformation
1422 attrs = self.current_handles[fid][1]
1423 fileinfo = FileAllInformation(
1424 BasicInformation=FileBasicInformation(
1425 CreationTime=attrs["CreationTime"],
1426 LastAccessTime=attrs["LastAccessTime"],
1427 LastWriteTime=attrs["LastWriteTime"],
1428 ChangeTime=attrs["ChangeTime"],
1429 FileAttributes=attrs["FileAttributes"],
1430 ),
1431 StandardInformation=FileStandardInformation(
1432 EndOfFile=attrs["EndOfFile"],
1433 AllocationSize=attrs["AllocationSize"],
1434 ),
1435 )
1436 elif pkt.FileInfoClass == 0x15: # FileAlternateNameInformation
1437 pth = self.current_handles[fid][0]
1438 fileinfo = FileAlternateNameInformation(
1439 FileName=pth.name,
1440 )
1441 elif pkt.FileInfoClass == 0x16: # FileStreamInformation
1442 attrs = self.current_handles[fid][1]
1443 fileinfo = FileStreamInformation(
1444 StreamSize=attrs["EndOfFile"],
1445 StreamAllocationSize=attrs["AllocationSize"],
1446 )
1447 elif pkt.FileInfoClass == 0x22: # FileNetworkOpenInformation
1448 attrs = self.current_handles[fid][1]
1449 fileinfo = FileNetworkOpenInformation(
1450 **attrs,
1451 )
1452 elif pkt.FileInfoClass == 0x30: # FileNormalizedNameInformation
1453 pth = self.current_handles[fid][0]
1454 fileinfo = FILE_NAME_INFORMATION(
1455 FileName=pth.name,
1456 )
1457 else:
1458 log_runtime.warning(
1459 "Unimplemented: %s"
1460 % pkt[SMB2_Query_Info_Request].sprintf("%InfoType% %FileInfoClass%")

Callers

nothing calls this directly

Calls 15

update_smbheaderMethod · 0.95
get_file_idMethod · 0.95
sendMethod · 0.95
FileEaInformationClass · 0.90
FileAllInformationClass · 0.90

Tested by

no test coverage detected