Beispiel #1
0
        /// <summary>
        /// Decode the packet as smb packet
        /// </summary>
        /// <param name="messageBytes">The received packet</param>
        /// <param name="role">The role of this decoder, client or server</param>
        /// <param name="consumedLen">[OUT]The consumed length of the message</param>
        /// <param name="expectedLen">[OUT]The expected length</param>
        /// <returns>A smb2Packet</returns>
        private static Smb2Packet DecodeSmbPacket(byte[] messageBytes, Smb2Role role, out int consumedLen, out int expectedLen)
        {
            // SMB2 only uses smb negotiate packet
            Smb2Packet packet;

            if (role == Smb2Role.Client)
            {
                packet = new SmbNegotiateResponsePacket();
            }
            else
            {
                packet = new SmbNegotiateRequestPacket();
            }
            packet.FromBytes(messageBytes, out consumedLen, out expectedLen);
            return(packet);
        }
 /// <summary>
 /// Decode the packet as smb packet
 /// </summary>
 /// <param name="messageBytes">The received packet</param>
 /// <param name="role">The role of this decoder, client or server</param>
 /// <param name="consumedLen">[OUT]The consumed length of the message</param>
 /// <param name="expectedLen">[OUT]The expected length</param>
 /// <returns>A smb2Packet</returns>
 private static Smb2Packet DecodeSmbPacket(byte[] messageBytes, Smb2Role role, out int consumedLen, out int expectedLen)
 {
     // SMB2 only uses smb negotiate packet
     Smb2Packet packet;
     if (role == Smb2Role.Client)
     {
         packet = new SmbNegotiateResponsePacket();
     }
     else
     {
         packet = new SmbNegotiateRequestPacket();
     }
     packet.FromBytes(messageBytes, out consumedLen, out expectedLen);
     return packet;
 }