From c684015a82de139e53b60a4805d18137b74c13ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricco=20Mandahl=20J=C3=B8rgensen?= Date: Tue, 13 Mar 2018 14:53:05 +0100 Subject: WORKS..kindof --- PassCrackerClient/PassCrackerClient/Program.cs | 32 +++++++++++++++++--------- 1 file changed, 21 insertions(+), 11 deletions(-) (limited to 'PassCrackerClient') diff --git a/PassCrackerClient/PassCrackerClient/Program.cs b/PassCrackerClient/PassCrackerClient/Program.cs index 7bf3859..be3b6b4 100755 --- a/PassCrackerClient/PassCrackerClient/Program.cs +++ b/PassCrackerClient/PassCrackerClient/Program.cs @@ -25,14 +25,22 @@ namespace PassCrackerClient string dictionary = ParseData(data); string[,] splitDictionary = SplitDictionary(dictionary); - List result; + List result = new List(); for(int i = 0; i < 5; i++) { - int rowLength = splitDictionary.GetLength(i); + int rowLength = splitDictionary.GetLength(1); string[] chunk = new string[rowLength]; for (int j = 0; j < rowLength; j++) chunk[j] = splitDictionary[i, j]; - Task.Run(() => result = DecryptPassword(chunk)); + result = DecryptPassword(chunk); + } + if (result.Count != 0) + { + sw.WriteLine(result[0].ToString()); + } + else + { + sw.WriteLine("Nothing Found!"); } } @@ -43,7 +51,7 @@ namespace PassCrackerClient while (true) { string message = sr.ReadLine(); - if (message != "") data += message; + if (message != "") data += message + "\n"; else break; } @@ -56,7 +64,8 @@ namespace PassCrackerClient if (splitData[0] == "DPCP 1.0") { - File.WriteAllText("password.txt", splitData[1]); + splitData[1] = splitData[1].Replace('|', '\n'); + File.WriteAllText("passwords.txt", splitData[1]); File.WriteAllText("dictionary.txt", splitData[2]); } @@ -65,20 +74,21 @@ namespace PassCrackerClient private static string[,] SplitDictionary(string dictionary) { - string[] dicWords = dictionary.Split('\n'); + string[] dicWords = dictionary.Split('|'); int dicWordsLength = dicWords.Length; string[,] splitDictionary = new string[5,dicWordsLength/5]; int offset = 0; int j = 0; - for(int i = 0; i < 5; i = i++) + for (int i = 0; i < 5; i++) { - while(j < dicWordsLength / 5) - { - splitDictionary[i,j] = dicWords[j + offset]; + while (j < dicWordsLength/5) + { + splitDictionary[i, j] = dicWords[j + offset]; j++; } - offset += dicWordsLength / 5; + offset += dicWordsLength/5; + j = 0; } return splitDictionary; -- cgit v1.2.3