def send_echo(self, data): pkt = smb.NewSMBPacket() pkt['Tid'] = self._default_tid transCommand = smb.SMBCommand(smb.SMB.SMB_COM_ECHO) transCommand['Parameters'] = smb.SMBEcho_Parameters() transCommand['Data'] = smb.SMBEcho_Data() transCommand['Parameters']['EchoCount'] = 1 transCommand['Data']['Data'] = data pkt.addCommand(transCommand) self.sendSMB(pkt) return self.recvSMB()
def sendEcho(conn, tid, data): pkt = smb.NewSMBPacket() pkt['Tid'] = tid transCommand = smb.SMBCommand(smb.SMB.SMB_COM_ECHO) transCommand['Parameters'] = smb.SMBEcho_Parameters() transCommand['Data'] = smb.SMBEcho_Data() transCommand['Parameters']['EchoCount'] = 1 transCommand['Data']['Data'] = data pkt.addCommand(transCommand) conn.sendSMB(pkt) recvPkt = conn.recvSMB()
def sendEcho(conn, tid, data): pkt = smb.NewSMBPacket() pkt['Tid'] = tid transCommand = smb.SMBCommand(smb.SMB.SMB_COM_ECHO) transCommand['Parameters'] = smb.SMBEcho_Parameters() transCommand['Data'] = smb.SMBEcho_Data() transCommand['Parameters']['EchoCount'] = 1 transCommand['Data']['Data'] = data pkt.addCommand(transCommand) conn.sendSMB(pkt) recvPkt = conn.recvSMB() if recvPkt.getNTStatus() == 0: module.log('got good ECHO response') else: module.log('got bad ECHO response: 0x{:x}'.format(recvPkt.getNTStatus()), 'error')
def send_echo_request(connection, tid, data): packet = smb.NewSMBPacket() packet['Tid'] = tid transfer_command = smb.SMBCommand(smb.SMB.SMB_COM_ECHO) transfer_command['Parameters'] = smb.SMBEcho_Parameters() transfer_command['Data'] = smb.SMBEcho_Data() transfer_command['Parameters']['EchoCount'] = 1 transfer_command['Data']['Data'] = data packet.addCommand(transfer_command) connection.sendSMB(packet) retval_packet = connection.recvSMB() if retval_packet.getNTStatus() == 0: print("echo request succeeded") else: print("bad echo request: 0x{:x}".format( retval_packet.getNTStatus()))