aboutsummaryrefslogtreecommitdiff
blob: dc366793ee97cad99e91c9e74972f4c6e4cf952a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;

namespace PasswordCrackerServer
{
    class clientConnection
    {
        public TcpClient connectionSocket { get; set; }
        public string chunk { get; set; }

        public string pass { get; set; }


        public clientConnection(TcpClient connectionSocket, string chunk, string pass)
        {
            this.connectionSocket = connectionSocket;
            this.chunk = chunk;
            this.pass = pass;
        }

        public async Task<string> Doit()
        {
            Stream ns = connectionSocket.GetStream();
            StreamReader sr = new StreamReader(ns);

            StreamWriter sw = new StreamWriter(ns);
            sw.AutoFlush = true;

            sw.WriteLine($"DPCP 1.0\n{pass}\n{chunk}\n\n");
            //sw.WriteLine(pass);
            //sw.WriteLine(chunk);
            
            return sr.ReadLine();
        }
    }
}