public void Start() { TcpListener serverSocket = new TcpListener(IPAddress.Any, PORT); serverSocket.Start(); Console.WriteLine("Server started"); using (TcpClient connectionSocket = serverSocket.AcceptTcpClient()) using (Stream ns = connectionSocket.GetStream()) using (StreamReader sr = new StreamReader(ns)) using (StreamWriter sw = new StreamWriter(ns)) { Console.WriteLine("Server activated"); sw.AutoFlush = true; // enable automatic flushing string message = sr.ReadLine(); // read string from client string answer = ""; while (!string.IsNullOrEmpty(message)) { Console.WriteLine("Client: " + message); if (message == "Crack") { Cracking cracker = new Cracking(); cracker.RunCracking(); } answer = message.ToUpper(); // convert string to upper case sw.WriteLine(answer); // send back upper case string message = sr.ReadLine(); } } }
static void Main(string[] args) { TcpClient socket = new TcpClient("localhost", 6789); Stream ns = socket.GetStream(); Console.WriteLine("Server connected"); sr = new StreamReader(ns); sw = new StreamWriter(ns); sw.AutoFlush = true; while (true) { var msg = Console.ReadLine(); if (msg == "-exit") { sw.WriteLine("exit"); Console.WriteLine("Shutting down..."); break; } else if (msg == "-go") { sw.WriteLine(msg); GetPassword(); GetWordListPart(); Cracking cracking = new Cracking(UserInfo, WordListPart); var passwords = cracking.RunCracking(); sw.WriteLine(passwords); } } }
static void Main(string[] args) { TcpClient clientSocket = new TcpClient("192.168.3.110", 6789); Console.WriteLine("Client started"); Stream ns = clientSocket.GetStream(); StreamReader sr = new StreamReader(ns); StreamWriter sw = new StreamWriter(ns); sw.AutoFlush = true; // enable automatic flushing //(List<string> DictList = PasswordFileHandler.ReadDictFile("webster-dictionary.txt"); for (int i = 0; i < 100; i++) { string master = sr.ReadLine(); if (master.StartsWith("\\")) //Gets the Userinfo and adding it to a static list { Console.WriteLine("Server: " + master.Substring(1)); string line = master.Substring(1); string[] parts = line.Split(":".ToCharArray()); UserInfo userInfo = new UserInfo(parts[0], parts[1]); UserList.Add(userInfo); } else { if (master == "RESULT") //Will send the cracked userinfo when master asks for it { //ResultList.Add("List of results"); //ResultList.Add("2nd line"); //ResultList.Add("3rd line"); foreach (string result in ResultList) { sw.WriteLine(result); } break; } Indexer = int.Parse(master); //Gets the chunk the master apointed Console.WriteLine("Starting Cracking on chunk {0}", master); Cracking cracker = new Cracking(); cracker.RunCracking(); Console.WriteLine("Done with chunk {0}", master); Console.ReadKey(); sw.WriteLine("ready"); } } ns.Close(); clientSocket.Close(); }
static void Main(string[] args) { Trace.Listeners.Add(new ConsoleTraceListener()); Trace.Listeners.Add(new TextWriterTraceListener("./FileTcpClientLog.txt")); FileClientService client = new FileClientService(SERVER_PORT); client.Start(); Cracking cracker = new Cracking(); cracker.RunCracking(); }
public void Start() { String nameofclient = ""; String nameofserver = ""; Console.Write("Who are you "); nameofclient = Console.ReadLine(); using (TcpClient socket = new TcpClient("localhost", PORT)) using (NetworkStream ns = socket.GetStream()) using (StreamReader sr = new StreamReader(ns)) using (StreamWriter sw = new StreamWriter(ns) { AutoFlush = true }) { /* * Hello between client server */ // client String line = ""; String myLine = nameofclient; sw.WriteLine($"Hello: {nameofclient}"); // server String fromServer = sr.ReadLine(); String[] strs = fromServer.Split(' '); nameofserver = strs[1]; while (!myLine.Trim().ToLower().Equals("stop")) { // start chat loop if (line == "Crack") { Cracking cracker = new Cracking(); cracker.RunCracking(); } else { myLine = Console.ReadLine().Trim(); } sw.WriteLine(myLine); if (line == "Crack2") { Cracking2 cracker = new Cracking2(); cracker.RunCracking2(); } else { myLine = Console.ReadLine().Trim(); } sw.WriteLine(myLine); if (myLine.ToLower().Equals("stop")) { line = "stop"; } else { line = sr.ReadLine(); } Console.WriteLine($"{nameofserver}: {line}"); } } }
public static void Main() { var cracker = new Cracking(); cracker.RunCracking(); }
static void Main() { Cracking cracker = new Cracking(); cracker.RunCracking(); }