public void TestClnt() { FTPparser.FTPparser parser = new FTPparser.FTPparser(); Message tmp = FTPparser.FTPparser.parseMessage(getBinaryContents("clnt.bin")); Assert.Equal("request", tmp.Type); Assert.Equal("CLNT", tmp.Command); Assert.Equal("FlashFXP 3.4.0.1145", tmp.CommandArgument); }
public void TestMessageBuferCnt() { FTPparser.FTPparser parser = new FTPparser.FTPparser(); parser.parseFlow(pathFlow + "user_pass_syst.pcap"); Assert.Equal(6, parser.messageBufferLen()); parser.getNextMessage(); Assert.Equal(5, parser.messageBufferLen()); parser.getNextMessage(); parser.getNextMessage(); Assert.Equal(3, parser.messageBufferLen()); parser.resetMessageBuffer(); Assert.Equal(0, parser.messageBufferLen()); parser.getNextMessage(); }
public void TestUserPassSystFlow() { FTPparser.FTPparser parser = new FTPparser.FTPparser(); parser.parseFlow(pathFlow + "user_pass_syst.pcap"); Message tmp = parser.getNextMessage(); Assert.Equal("request", tmp.Type); Assert.Equal("USER", tmp.Command); Assert.Equal("csanders", tmp.CommandArgument); tmp = parser.getNextMessage(); Assert.Equal("response", tmp.Type); Assert.Equal(331, tmp.ResponseCode); Assert.Equal("Password required for csanders.", tmp.ResponseMessage); tmp = parser.getNextMessage(); Assert.Equal("request", tmp.Type); Assert.Equal("PASS", tmp.Command); Assert.Equal("echo", tmp.CommandArgument); tmp = parser.getNextMessage(); Assert.Equal("response", tmp.Type); Assert.Equal(230, tmp.ResponseCode); Assert.Equal("User csanders logged in.", tmp.ResponseMessage); tmp = parser.getNextMessage(); Assert.Equal("request", tmp.Type); Assert.Equal("SYST", tmp.Command); tmp = parser.getNextMessage(); Assert.Equal("response", tmp.Type); Assert.Equal(215, tmp.ResponseCode); Assert.Equal("UNIX Type: L8", tmp.ResponseMessage); }