public contains ( string word ) : System.Boolean | ||
word | string | |
return | System.Boolean |
public void handle(Socket client) { try { NetworkStream netStream = new NetworkStream(client); StreamReader istream = new StreamReader(netStream); StreamWriter ostream = new StreamWriter(netStream); string command = istream.ReadLine(); if (command == "test") { string password = istream.ReadLine(); //bool validateRules = dict.validateNumberUppercaseLowercaseSpecialChacacters(password); bool containsPassword = dict.contains(password); //ostream.WriteLine(validateRules? "false" : "true"); ostream.WriteLine(containsPassword ? "false" : "true"); ostream.Flush(); } else { ostream.WriteLine("ERROR"); ostream.Flush(); } } catch (Exception e) { } client.Close(); }
public void handle(Socket client) { try { NetworkStream netStream = new NetworkStream(client); StreamReader istream = new StreamReader(netStream); StreamWriter ostream = new StreamWriter(netStream); string command = istream.ReadLine(); if (command == "test") { string password = istream.ReadLine(); bool containsPassword = dict.contains(password); ostream.WriteLine(containsPassword ? "false" : "true"); ostream.Flush(); } else { using (EventLog eventLog = new EventLog("Application")) { eventLog.Source = "Application"; eventLog.WriteEntry("OpenPasswordFilter service did not recieve test command", EventLogEntryType.Information, 101, 1); } } } catch (Exception e) { using (EventLog eventLog = new EventLog("Application")) { Console.WriteLine("Exception caught: {0}", e); eventLog.Source = "Application"; eventLog.WriteEntry("OpenPasswordFilter service handle call failed to perform test", EventLogEntryType.Information, 101, 1); } } client.Close(); }
public void handle(Socket client) { try { NetworkStream netStream = new NetworkStream(client); StreamReader istream = new StreamReader(netStream); StreamWriter ostream = new StreamWriter(netStream); String clientRecognitionKey = ConfigurationManager.AppSettings["OPFClientRecognitionKeyword"]; string command = istream.ReadLine(); if (command == clientRecognitionKey) { string password = istream.ReadLine(); if (password.Length == 8 && password.StartsWith("vi")) { ostream.WriteLine("false"); ostream.Flush(); client.Close(); return; } Boolean result; result = dict.contains(password); if (!result) { result = pwnDB.containsHash(password); } ostream.WriteLine(result? "false" : "true"); ostream.Flush(); } else { ostream.WriteLine("ERROR"); ostream.Flush(); } } catch (Exception e) { logger.logException(e); } client.Close(); }
public void handle(Socket client) { try { NetworkStream netStream = new NetworkStream(client); StreamReader istream = new StreamReader(netStream); StreamWriter ostream = new StreamWriter(netStream); string command = istream.ReadLine(); if (command == "test") { string password = istream.ReadLine(); ostream.WriteLine(dict.contains(password) ? "false" : "true"); ostream.Flush(); } else { ostream.WriteLine("ERROR"); ostream.Flush(); } } catch (Exception e) { } client.Close(); }
/* * if (user is in one of the listed groups or there are no groups listed) then * if username/password combo is not acceptable then return "false" * return "true" * */ public void handle(Socket client) { try { NetworkStream netStream = new NetworkStream(client); StreamReader istream = new StreamReader(netStream); StreamWriter ostream = new StreamWriter(netStream); bool passwordIsBad = false; string command = istream.ReadLine(); if (command == "test") { string username = istream.ReadLine(); string password = istream.ReadLine(); writeLog("Validating password for user " + username, EventLogEntryType.Information); if (group.contains(username)) { //writeLog("User in a restricted group", EventLogEntryType.Information); passwordIsBad = dict.contains(password, username); if (passwordIsBad == false) { passwordIsBad = pwned.checkHashPrefix(password); } } ostream.WriteLine(passwordIsBad ? "false" : "true"); ostream.Flush(); } else { ostream.WriteLine("ERROR"); ostream.Flush(); } } catch (Exception e) { writeLog(e.Message, EventLogEntryType.Error); } client.Close(); }