Esempio n. 1
0
 public static SMB1Message GetSMB1Message(byte[] buffer)
 {
     if (!SMB1Header.IsValidSMB1Header(buffer))
     {
         throw new InvalidDataException("Invalid SMB header signature");
     }
     return(new SMB1Message(buffer));
 }
Esempio n. 2
0
        public SMB1Message(byte[] buffer)
        {
            Header = new SMB1Header(buffer);
            SMB1Command command = SMB1Command.ReadCommand(buffer, SMB1Header.Length, Header.Command, Header);

            Commands.Add(command);
            while (command is SMBAndXCommand)
            {
                SMBAndXCommand andXCommand = (SMBAndXCommand)command;
                if (andXCommand.AndXCommand == CommandName.SMB_COM_NO_ANDX_COMMAND)
                {
                    break;
                }
                command = SMB1Command.ReadCommand(buffer, andXCommand.AndXOffset, andXCommand.AndXCommand, Header);
                Commands.Add(command);
            }
        }
Esempio n. 3
0
 public SMB1Message()
 {
     Header = new SMB1Header();
 }
Esempio n. 4
0
 public static SMB1Command ReadCommand(byte[] buffer, int offset, CommandName commandName, SMB1Header header)
 {
     if ((header.Flags & HeaderFlags.Reply) > 0)
     {
         return(ReadCommandResponse(buffer, offset, commandName, header.UnicodeFlag));
     }
     else
     {
         return(ReadCommandRequest(buffer, offset, commandName, header.UnicodeFlag));
     }
 }