寫了個(gè)Telnet Server
發(fā)表時(shí)間:2024-06-19 來源:明輝站整理相關(guān)軟件相關(guān)文章人氣:
[摘要]O^O Telnet Server源代碼星期五 2004 05 28上午 10:16:16 昨天晚上,正在上網(wǎng),一時(shí)精力過剩,想起寫一個(gè)Telnet Server的想法。結(jié)果昨天晚上2個(gè)小時(shí),加上今天上午2個(gè)小時(shí),一個(gè)被我稱為O^O的Telnet Server誕生了! ≈韵雽懰,是因?yàn)槲蚁?..
O^O Telnet Server源代碼星期五 2004 05 28上午 10:16:16
昨天晚上,正在上網(wǎng),一時(shí)精力過剩,想起寫一個(gè)Telnet Server的想法。結(jié)果昨天晚上2個(gè)小時(shí),加上今天上午2個(gè)小時(shí),一個(gè)被我稱為O^O的Telnet Server誕生了。
之所以想寫它,是因?yàn)槲蚁胗猛耆腛O的方法實(shí)現(xiàn)Telnet Server,用OO的方法實(shí)現(xiàn)非常簡(jiǎn)單。而O^O Telnet Server這個(gè)名字的意思就是OO面向?qū)ο蟮囊馑,只不過在中間加了個(gè)“^”而已。
O^O可以支持多個(gè)客戶端同時(shí)連接,調(diào)用CMD.exe實(shí)現(xiàn)Shell,暫時(shí)只支持2000、xp、2003系列,因?yàn)槲覜]有98下的vs.net,所以我也不打算讓他支持98。
剛剛完成,bug很多,不管他,先來個(gè)0.1的release再說。
呵呵,搞不好是絕版哦,還不看看先!
文件列表:
App.ico
AssemblyInfo.cs
bin
mainclass.cs
MyTelnetServer.csproj
MyTelnetServer.csproj.user
MyTelnetServer.sln
TelnetCMD.cs
TelnetReader.cs
TelnetSession.cs
TelnetWriter.cs
說明.txt
部分代碼:
public class TelnetSession
{
public TelnetSession(TcpClient client)
{
NetworkStream stream = client.GetStream();
TelnetCMD cmd = new TelnetCMD();
new TelnetReader(stream,cmd);
new TelnetWriter(stream,cmd);
}
}
public class TelnetCMD
{
Process process1;
StreamReader reader1;
StreamWriter writer1;
StreamReader readerErr1;
public StreamReader ReadStream
{
get
{
return reader1;
}
}
public StreamWriter WriterStream
{
get
{
return writer1;
}
}
public StreamReader ReadErrStream
{
get
{
return readerErr1;
}
}
public TelnetCMD()
{
Process process1 = new Process();
process1.StartInfo.UseShellExecute = false;
process1.StartInfo.RedirectStandardInput = true;
process1.StartInfo.RedirectStandardOutput = true;
process1.StartInfo.RedirectStandardError = true;
process1.StartInfo.FileName="cmd.exe";
process1.Start();
reader1 = process1.StandardOutput;
writer1 = process1.StandardInput;
readerErr1 = process1.StandardError;
}
} http://www.blogcn.com/user9/y97523http://img6-2.22122511.com/upload/technique_5/20046720132774471.jpg下載后將擴(kuò)展名改為rar即可