MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / _echo_SMB1

Method _echo_SMB1

pager_lib/smb/base.py:2964–2980  ·  view source on GitHub ↗
(self, data, callback, errback, timeout = 30)

Source from the content-addressed store, hash-verified

2962 sendOpen(self.connected_trees[service_name])
2963
2964 def _echo_SMB1(self, data, callback, errback, timeout = 30):
2965 messages_history = [ ]
2966
2967 if not isinstance(data, type(b'')):
2968 raise TypeError('Echo data must be %s not %s' % (type(b'').__name__, type(data).__name__))
2969
2970 def echoCB(echo_message, **kwargs):
2971 self._pushToArray(messages_history, echo_message)
2972 if not echo_message.status.hasError:
2973 callback(echo_message.payload.data)
2974 else:
2975 errback(OperationFailure('Echo failed', messages_history))
2976
2977 m = SMBMessage(ComEchoRequest(echo_data = data))
2978 self._sendSMBMessage(m)
2979 self.pending_requests[m.mid] = _PendingRequest(m.mid, int(time.time()) + timeout, echoCB, errback)
2980 self._pushToArray(messages_history, m)
2981
2982 def _extractLastPathComponent(self, path):
2983 return path.replace('\\', '/').split('/')[-1]

Callers

nothing calls this directly

Calls 4

_pushToArrayMethod · 0.95
SMBMessageClass · 0.85
ComEchoRequestClass · 0.85
_PendingRequestClass · 0.85

Tested by

no test coverage detected