private void TelnetInterpreter(object Sender, NvtParserEventArgs e) { switch (e.Action) { case NvtActions.SendUp: this.Parser.ParseString (e.CurChar.ToString ()); break; case NvtActions.Execute: this.NvtExecuteChar (e.CurChar); break; default: break; } // if the sequence is a DO message if (e.CurSequence.StartsWith ("\xFD")) { System.Char CurCmd = System.Convert.ToChar (e.CurSequence.Substring (1, 1)); switch (CurCmd) { // 24 - terminal type case '\x18': NvtSendWill (CurCmd); break; default: NvtSendWont (CurCmd); //System.Console.Write ("unsupported telnet DO sequence {0} happened\n", //System.Convert.ToInt32 (System.Convert.ToChar (e.CurSequence.Substring (1,1)))); break; } } // if the sequence is a WILL message if (e.CurSequence.StartsWith ("\xFB")) { System.Char CurCmd = System.Convert.ToChar (e.CurSequence.Substring (1, 1)); switch (CurCmd) { case '\x01': // echo NvtSendDo (CurCmd); break; default: NvtSendDont (CurCmd); //System.Console.Write ("unsupported telnet WILL sequence {0} happened\n", //System.Convert.ToInt32 (System.Convert.ToChar (e.CurSequence.Substring (1,1)))); break; } } // if the sequence is a SUBNEGOTIATE message if (e.CurSequence.StartsWith ("\xFA")) { if (e.CurSequence[2] != '\x01') { // not interested in data from host just yet as we don't ask for it at the moment return; } System.Char CurCmd = System.Convert.ToChar (e.CurSequence.Substring (1, 1)); switch (CurCmd) { // 24 - terminal type case '\x18': NvtSendSubNeg (CurCmd, "vt220"); break; default: NvtSendSubNeg (CurCmd, ""); System.Console.Write ("unsupported telnet SUBNEG sequence {0} happened\n", System.Convert.ToInt32 (System.Convert.ToChar (e.CurSequence.Substring (1,1)))); break; } } }
private void TelnetInterpreter(object Sender, NvtParserEventArgs e) { //counttelint //prntSome.printSome(System.String.Format("CurChar:{0}CurSequence:{1}", e.CurChar, e.CurSequence), "TelnetInterpreter", counttelint); switch (e.Action) { case NvtActions.SendUp: this.Parser.ParseString(e.CurChar.ToString()); break; case NvtActions.Execute: this.NvtExecuteChar(e.CurChar); break; default: break; } // if the sequence is a DO message if (e.CurSequence.StartsWith("\xFD")) { System.Char CurCmd = System.Convert.ToChar(e.CurSequence.Substring(1, 1)); //prntSome.printSome(System.String.Format("CurChar:{0}CurSequence:{1:X}", e.CurChar, e.CurSequence), "will", counttelint); //counttelint++; switch (CurCmd) { // 24 - terminal type case '\x18': NvtSendWill(CurCmd); break; default: NvtSendWont(CurCmd); //System.Console.Write ("unsupported telnet DO sequence {0} happened\n", //System.Convert.ToInt32 (System.Convert.ToChar (e.CurSequence.Substring (1,1)))); break; } } // if the sequence is a WILL message if (e.CurSequence.StartsWith("\xFB")) { System.Char CurCmd = System.Convert.ToChar(e.CurSequence.Substring(1, 1)); //prntSome.printSome(System.String.Format("CurChar:{0}CurSequence:{1:X}", e.CurChar, e.CurSequence), "do", counttelint); switch (CurCmd) { case '\x01': // echo NvtSendDo(CurCmd); break; default: NvtSendDont(CurCmd); //System.Console.Write ("unsupported telnet WILL sequence {0} happened\n", //System.Convert.ToInt32 (System.Convert.ToChar (e.CurSequence.Substring (1,1)))); break; } } // if the sequence is a SUBNEGOTIATE message if (e.CurSequence.StartsWith("\xFA")) { //prntSome.printSome(System.String.Format("CurChar:{0}CurSequence:{1:X}", e.CurChar, e.CurSequence), "sub", counttelint); if (e.CurSequence[2] != '\x01') { // not interested in data from host just yet as we don't ask for it at the moment return; } System.Char CurCmd = System.Convert.ToChar(e.CurSequence.Substring(1, 1)); switch (CurCmd) { // 24 - terminal type case '\x18': NvtSendSubNeg(CurCmd, "ansi"); //"vt220"); break; default: NvtSendSubNeg(CurCmd, ""); System.Console.Write("unsupported telnet SUBNEG sequence {0} happened\n", System.Convert.ToInt32(System.Convert.ToChar(e.CurSequence.Substring(1, 1)))); break; } } //counttelint++; }