aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarcinzelent <zelent.marcin@gmail.com>2018-03-17 00:37:41 -0700
committermarcinzelent <zelent.marcin@gmail.com>2018-03-17 00:37:41 -0700
commit017da9023af14430adc165b524ee50ae37ba9f5e (patch)
treecf330d55becbb1c777bef571e55962f1ac71542f /PassCrackerClient
parentc684015a82de139e53b60a4805d18137b74c13ac (diff)
Changes
Diffstat (limited to 'PassCrackerClient')
-rwxr-xr-xPassCrackerClient/PassCrackerClient/Program.cs29
1 files changed, 20 insertions, 9 deletions
diff --git a/PassCrackerClient/PassCrackerClient/Program.cs b/PassCrackerClient/PassCrackerClient/Program.cs
index be3b6b4..45f0309 100755
--- a/PassCrackerClient/PassCrackerClient/Program.cs
+++ b/PassCrackerClient/PassCrackerClient/Program.cs
@@ -2,32 +2,43 @@
using System;
using System.Collections.Generic;
using System.IO;
-using System.Linq;
using System.Net.Sockets;
-using System.Text;
-using System.Threading.Tasks;
namespace PassCrackerClient
{
class Program
{
+ const int NumberOfTasks = 5;
+
private static StreamReader sr;
private static StreamWriter sw;
+
static void Main(string[] args)
{
- TcpClient clientSocket = new TcpClient("192.168.3.163", 6789);
+ Console.Write("Connecting to server... ");
+ TcpClient clientSocket = new TcpClient("127.0.0.1", 6789);
NetworkStream ns = clientSocket.GetStream();
+ Console.Write("OK\n");
sr = new StreamReader(ns);
sw = new StreamWriter(ns);
sw.AutoFlush = true;
+ Console.Write("Getting data from the server... ");
string data = GetData();
+ if (data != "") Console.Write("OK\n");
+
+ Console.Write("Parsing data... ");
string dictionary = ParseData(data);
+ if (dictionary != "") Console.Write("OK\n");
+
+ Console.Write("Splitting dictionary... ");
string[,] splitDictionary = SplitDictionary(dictionary);
+ if (splitDictionary[0,0] != "") Console.Write("OK\n");
List<UserInfoClearText> result = new List<UserInfoClearText>();
- for(int i = 0; i < 5; i++)
+ for(int i = 0; i < NumberOfTasks; i++)
{
+ Console.Write("Running task no." + (i + 1) + "...\n" );
int rowLength = splitDictionary.GetLength(1);
string[] chunk = new string[rowLength];
for (int j = 0; j < rowLength; j++)
@@ -76,18 +87,18 @@ namespace PassCrackerClient
{
string[] dicWords = dictionary.Split('|');
int dicWordsLength = dicWords.Length;
- string[,] splitDictionary = new string[5,dicWordsLength/5];
+ string[,] splitDictionary = new string[NumberOfTasks,dicWordsLength/NumberOfTasks];
int offset = 0;
int j = 0;
- for (int i = 0; i < 5; i++)
+ for (int i = 0; i < NumberOfTasks; i++)
{
- while (j < dicWordsLength/5)
+ while (j < dicWordsLength/NumberOfTasks)
{
splitDictionary[i, j] = dicWords[j + offset];
j++;
}
- offset += dicWordsLength/5;
+ offset += dicWordsLength/NumberOfTasks;
j = 0;
}