public void UpdateSettings(KeySearcher.KeySearcher keySearcher, KeySearcherSettings keySearcherSettings) { IsVerboseEnabled = keySearcherSettings.VerbosePeerToPeerDisplay; if (keySearcher.Pattern == null || !keySearcher.Pattern.testWildcardKey(keySearcherSettings.Key) || keySearcherSettings.ChunkSize == 0) { return; } var keyPattern = new KeyPattern(keySearcher.ControlMaster.GetKeyPattern()) { WildcardKey = keySearcherSettings.Key }; var keysPerChunk = Math.Pow(2, keySearcherSettings.ChunkSize); var keyPatternPool = new KeyPatternPool(keyPattern, new BigInteger(keysPerChunk)); if (keyPatternPool.Length > 9999999999) { TotalAmountOfChunks.Content = keyPatternPool.Length.ToString().Substring(0, 10) + "..."; } else { TotalAmountOfChunks.Content = keyPatternPool.Length; } KeysPerChunk.Content = keysPerChunk; TestedBits.Content = Math.Ceiling(Math.Log((double)keyPatternPool.Length * keysPerChunk, 2)); }
public DistributedBruteForceManager(KeySearcher keySearcher, KeyPattern.KeyPattern keyPattern, KeySearcherSettings settings, KeyQualityHelper keyQualityHelper, P2PQuickWatchPresentation quickWatch, KeyPoolTreePresentation keyPoolTreePresentation) { this.keySearcher = keySearcher; this.settings = settings; this.keyQualityHelper = keyQualityHelper; this.quickWatch = quickWatch; _keyPoolTreePresentation = keyPoolTreePresentation; // TODO when setting is still default (21), it is only displayed as 21 - but the settings-instance contains 0 for that key! if (settings.ChunkSize == 0) { settings.ChunkSize = 21; } StopWatch = new Stopwatch(); status = new StatusContainer(keySearcher); status.IsCurrentProgressIndeterminate = true; keyGenerator = new StorageKeyGenerator(keySearcher, settings); patternPool = new KeyPatternPool(keyPattern, new BigInteger(Math.Pow(2, settings.ChunkSize))); StatisticsGenerator = new StatisticsGenerator(status, quickWatch, keySearcher, settings, this); quickWatch.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(UpdateStatusContainerInQuickWatch)); _keyPoolTreePresentation.PatternPool = patternPool; _keyPoolTreePresentation.KeyQualityHelper = keyQualityHelper; _keyPoolTreePresentation.KeyGenerator = keyGenerator; _keyPoolTreePresentation.StatusContainer = status; }
public ConnectionHelper(KeySearcher keySearcher, KeySearcherSettings settings) { this.keySearcher = keySearcher; this.settings = settings; }
public StatisticsGenerator(StatusContainer status, P2PQuickWatchPresentation quickWatch, KeySearcher keySearcher, KeySearcherSettings settings, DistributedBruteForceManager distributedBruteForceManager) { this.status = status; this.quickWatch = quickWatch; this.keySearcher = keySearcher; this.distributedBruteForceManager = distributedBruteForceManager; lastDateOfGlobalStatistics = DateTime.Now; HighestChunkCalculated = -1; stopWatch = new Stopwatch(); var keyPattern = new KeyPattern.KeyPattern(keySearcher.ControlMaster.GetKeyPattern()) { WildcardKey = settings.Key }; var keysPerChunk = Math.Pow(2, settings.ChunkSize); var keyPatternPool = new KeyPatternPool(keyPattern, new BigInteger(keysPerChunk)); TotalAmountOfChunks = keyPatternPool.Length; status.PropertyChanged += StatusPropertyChanged; elapsedTimeTimer = new Timer(1000); elapsedTimeTimer.Elapsed += ElapsedTimeTimerTick; elapsedTimeTimer.Start(); trafficUpdateTimer = new Timer(10000); trafficUpdateTimer.Elapsed += TrafficUpdateTimerTick; trafficUpdateTimer.Start(); }
public StorageKeyGenerator(KeySearcher keySearcher, KeySearcherSettings settings) { this.keySearcher = keySearcher; this.settings = settings; }
public static void PushToDatabase(StatusContainer status, long bruteForceTime, string identifier, KeySearcherSettings settings, KeySearcher keySearcher) { if (string.IsNullOrEmpty(settings.EvaluationHost)) { return; } var connectionString = "Data Source=" + settings.EvaluationHost + ";"; connectionString += "User ID=" + settings.EvaluationUser + ";"; connectionString += "Password="******";"; connectionString += "Initial Catalog=" + settings.EvaluationDatabase; var sqlConnection = new SqlConnection(); try { sqlConnection.ConnectionString = connectionString; sqlConnection.Open(); // You can get the server version // SQLConnection.ServerVersion } catch (Exception ex) { sqlConnection.Dispose(); keySearcher.GuiLogMessage("DB Error: " + ex.Message, NotificationLevel.Error); return; } var globalProgress = status.GlobalProgress.ToString(CultureInfo.CreateSpecificCulture("en-US")); var dhtTimeInMilliseconds = status.DhtOverheadInReadableTime.TotalMilliseconds.ToString(CultureInfo.CreateSpecificCulture("en-US")); var sqlStatement = string.Format("INSERT INTO [statistics] ([host],[date],[localFinishedChunks],[currentChunk],[globalProgress],[totalAmountOfParticipants],[totalDhtRequests],[requestsPerNode],[retrieveRequests],[removeRequests],[storeRequests],[dhtTimeInMilliseconds],[dhtOverheadInPercent],[storedBytes],[retrievedBytes],[totalBytes],[sentBytesByLinkManager],[receivedBytesByLinkManager],[totalBytesByLinkManager],[bruteForceTimeInMilliseconds],[identifier],[processID]) " + "VALUES ('{0}', GetDate(), {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}, '{11}', {12}, {13}, {14}, {15}, {16}, {17}, {18}, '{19}', {20});", Environment.MachineName, status.LocalFinishedChunks, status.CurrentChunk, globalProgress, status.TotalAmountOfParticipants, status.TotalDhtRequests, status.RequestsPerNode, status.RetrieveRequests, status.RemoveRequests, status.StoreRequests, dhtTimeInMilliseconds, status.DhtOverheadInPercent, status.StoredBytes, status.RetrievedBytes, status.TotalBytes, status.SentBytesByLinkManager, status.ReceivedBytesByLinkManager, status.TotalBytesByLinkManager, bruteForceTime, identifier, Process.GetCurrentProcess().Id); try { var command = new SqlCommand(sqlStatement, sqlConnection); command.ExecuteNonQuery(); } catch (Exception ex) { keySearcher.GuiLogMessage("DB Error: " + ex.Message, NotificationLevel.Error); } finally { sqlConnection.Close(); sqlConnection.Dispose(); } }