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

Method send_read_response

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

Source from the content-addressed store, hash-verified

1557
1558 @ATMT.action(receive_read_request)
1559 def send_read_response(self, pkt):
1560 self.update_smbheader(pkt)
1561 resp = SMB2_Read_Response()
1562 fid = self.get_file_id(pkt)
1563 if self.current_tree() == "IPC$":
1564 # Read output from DCE/RPC server
1565 r = self.rpc_server.get_response()
1566 resp.Data = bytes(r)
1567 else:
1568 # Read file and send content
1569 pth, _ = self.current_handles[fid]
1570 length = pkt[SMB2_Read_Request].Length
1571 off = pkt[SMB2_Read_Request].Offset
1572 self.vprint("Reading %s bytes at %s" % (length, off))
1573 with open(pth, "rb") as fd:
1574 fd.seek(off)
1575 resp.Data = fd.read(length)
1576 self.send(self.smb_header.copy() / resp)
1577
1578 @ATMT.receive_condition(SERVING)
1579 def receive_close_request(self, pkt):

Callers

nothing calls this directly

Calls 9

update_smbheaderMethod · 0.95
get_file_idMethod · 0.95
current_treeMethod · 0.95
vprintMethod · 0.95
sendMethod · 0.95
SMB2_Read_ResponseClass · 0.90
get_responseMethod · 0.45
readMethod · 0.45
copyMethod · 0.45

Tested by

no test coverage detected