| 49 | } |
| 50 | |
| 51 | MessageBuffer RelayContext::SendCommand(const Command& command){ |
| 52 | |
| 53 | MessageExchangePtr messageEx = _messageExFactory->Create(); |
| 54 | bitsery::ext::InheritanceContext ctx; |
| 55 | MessageBuffer buffer; |
| 56 | size_t writtenSize = 0; |
| 57 | |
| 58 | if(command.GetCommandId() == CommandType::RelayNTLM){ |
| 59 | const NtlmRelayCommand& relayCommand = dynamic_cast<const NtlmRelayCommand&>(command); |
| 60 | writtenSize = bitsery::quickSerialization(ctx, Writer{buffer}, relayCommand); |
| 61 | }else if(command.GetCommandId() == CommandType::NegotiateRequest){ |
| 62 | const NegotiateCommand& negCommand = dynamic_cast<const NegotiateCommand&>(command); |
| 63 | writtenSize = bitsery::quickSerialization(ctx, Writer{buffer}, negCommand); |
| 64 | }else{ |
| 65 | writtenSize = bitsery::quickSerialization(ctx, Writer{buffer}, command); |
| 66 | } |
| 67 | |
| 68 | messageEx->WriteAll(buffer.data(), writtenSize); |
| 69 | return messageEx->ReadAll(); |
| 70 | } |
no test coverage detected