写了个Telnet Server
2024-07-21 02:21:41
供稿:网友
o^o telnet server源代码星期五 2004 05 28上午 10:16:16
昨天晚上,正在上网,一时精力过剩,想起写一个telnet server的想法。结果昨天晚上2个小时,加上今天上午2个小时,一个被我称为o^o的telnet server诞生了。
之所以想写它,是因为我想用完全的oo的方法实现telnet server,用oo的方法实现非常简单。而o^o telnet server这个名字的意思就是oo面向对象的意思,只不过在中间加了个“^”而已。
o^o可以支持多个客户端同时连接,调用cmd.exe实现shell,暂时只支持2000、xp、2003系列,因为我没有98下的vs.net,所以我也不打算让他支持98。
刚刚完成,bug很多,不管他,先来个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/y97523/upload/20046720132774471.jpg下载后将扩展名改为rar即可