//////////////////////////////////////////////////////////////////////////////// // //////////////////////////////////////////////////////////////////////////////// internal virtual Boolean InfoRequest() { SMB2Header header = new SMB2Header(); header.SetCommand(new Byte[] { 0x10, 0x00 }); header.SetCreditsRequested(new Byte[] { 0x01, 0x00 }); header.SetMessageID(++messageId); header.SetProcessID(processId); header.SetTreeId(treeId); header.SetSessionID(sessionId); SMB2GetInfo getInfo = new SMB2GetInfo(); getInfo.SetClass(new Byte[] { 0x02 }); getInfo.SetInfoLevel(new Byte[] { 0x05 }); getInfo.SetMaxResponseSize(new Byte[] { 0x50, 0x00, 0x00, 0x00 }); getInfo.SetGUIDHandleFile(recieve.Skip(132).Take(16).ToArray()); Byte[] bData = getInfo.GetRequest(); if (signing) { header.SetFlags(new Byte[] { 0x08, 0x00, 0x00, 0x00 }); header.SetSignature(sessionKey, ref bData); } Byte[] bHeader = header.GetHeader(); NetBIOSSessionService sessionService = new NetBIOSSessionService(); sessionService.SetHeaderLength(bHeader.Length); sessionService.SetDataLength(bData.Length); Byte[] bSessionService = sessionService.GetNetBIOSSessionService(); Byte[] bSend = Combine.combine(Combine.combine(bSessionService, bHeader), bData); streamSocket.Write(bSend, 0, bSend.Length); streamSocket.Flush(); streamSocket.Read(recieve, 0, recieve.Length); if (GetStatus(recieve.Skip(12).Take(4).ToArray())) return true; else return false; }
//////////////////////////////////////////////////////////////////////////////// // //////////////////////////////////////////////////////////////////////////////// internal Boolean GetInfoRequest() { SMB2Header header = new SMB2Header(); header.SetCommand(new Byte[] { 0x10, 0x00 }); header.SetCreditsRequested(new Byte[] { 0x01, 0x00 }); header.SetMessageID(++messageId); header.SetProcessID(processId); header.SetTreeId(treeId); header.SetSessionID(sessionId); SMB2GetInfo getInfo = new SMB2GetInfo(); getInfo.SetClass(new Byte[] { 0x02 }); getInfo.SetInfoLevel(new Byte[] { 0x01 }); getInfo.SetMaxResponseSize(new Byte[] { 0x58, 0x00, 0x00, 0x00 }); getInfo.SetGetInfoInputOffset(new Byte[] { 0x00, 0x00 }); getInfo.SetGUIDHandleFile(guidFileHandle); Byte[] bData = getInfo.GetRequest(); header.SetChainOffset(bData.Length); if (signing) { header.SetFlags(new Byte[] { 0x08, 0x00, 0x00, 0x00 }); header.SetSignature(sessionKey, ref bData); } Byte[] bHeader = header.GetHeader(); SMB2Header header2 = new SMB2Header(); header2.SetCommand(new Byte[] { 0x10, 0x00 }); header2.SetCreditsRequested(new Byte[] { 0x01, 0x00 }); header2.SetMessageID(++messageId); header2.SetProcessID(processId); header2.SetTreeId(treeId); header2.SetSessionID(sessionId); header2.SetFlags(new Byte[] { 0x00, 0x00, 0x00, 0x04 }); SMB2GetInfo getInfo2 = new SMB2GetInfo(); getInfo2.SetClass(new Byte[] { 0x02 }); getInfo2.SetInfoLevel(new Byte[] { 0x05 }); getInfo2.SetMaxResponseSize(new Byte[] { 0x50, 0x00, 0x00, 0x00 }); getInfo2.SetGetInfoInputOffset(new Byte[] { 0x00, 0x00 }); getInfo2.SetGUIDHandleFile(guidFileHandle); Byte[] bData2 = getInfo2.GetRequest(); if (signing) { header2.SetFlags(new Byte[] { 0x08, 0x00, 0x00, 0x00 }); header2.SetSignature(sessionKey, ref bData2); } Byte[] bHeader2 = header2.GetHeader(); NetBIOSSessionService sessionService = new NetBIOSSessionService(); sessionService.SetHeaderLength(bHeader.Length + bHeader2.Length); sessionService.SetDataLength(bData.Length + bData2.Length); Byte[] bSessionService = sessionService.GetNetBIOSSessionService(); Combine combine = new Combine(); combine.Extend(bHeader); combine.Extend(bData); combine.Extend(bHeader2); combine.Extend(bData2); Byte[] bSend = Combine.combine(bSessionService, combine.Retrieve()); streamSocket.Write(bSend, 0, bSend.Length); streamSocket.Flush(); streamSocket.Read(recieve, 0, recieve.Length); if (GetStatus(recieve.Skip(12).Take(4).ToArray())) { return(true); } return(false); }