■ ■ ■ ■ ■ ■
Src/ES.Taipan.Inspector.AddOns/WebFormBruteforcer/WebFormBruteforcerAddOn.fs
| skipped 21 lines |
22 | 22 | | inherit BaseStatelessAddOn("Web Form Bruteforcer AddOn", string WebFormBruteforcerAddOn.Id, 1) |
23 | 23 | | let _progressIndexes = new Dictionary<String, String * Int32 * Int32 * Int32>() |
24 | 24 | | |
25 | | - | let _numOfConcurrentTasks = 5 |
| 25 | + | let _numOfConcurrentTasks = 10 |
26 | 26 | | let _analyzedPages = new HashSet<String>() |
27 | 27 | | let _scanLock = new Object() |
28 | 28 | | let _testRequests = new BlockingCollection<TestRequest>() |
| skipped 33 lines |
62 | 62 | | lock _progressIndexes (fun _ -> |
63 | 63 | | if _progressIndexes.ContainsKey(index) then |
64 | 64 | | let (username, currentIndex, totalCount, lastPercentage) = _progressIndexes.[index] |
65 | | - | let percentage = (float currentIndex / float totalCount) * 100. |> int32 |
| 65 | + | let percentage = System.Math.Round((float currentIndex / float totalCount) * 100.) |> int32 |
66 | 66 | | _progressIndexes.[index] <- (username, currentIndex+1, totalCount, lastPercentage) |
67 | 67 | | |
68 | 68 | | if forcePrint || lastPercentage < percentage && percentage % 5 = 0 then |
| skipped 47 lines |
116 | 116 | | | Some tm -> tm |
117 | 117 | | |
118 | 118 | | let bruteforcePasswordList(testRequest: TestRequest, username: String, usernameInputs: String list, passwordInputs: String list, resultVerifier: WebResponse -> Boolean, serviceStateController: ServiceStateController) = |
119 | | - | // run in parallels all the instantiated workers |
| 119 | + | // add all password and set the queue to completed |
120 | 120 | | let queue = new BlockingCollection<String>() |
| 121 | + | _passwords |> List.iter(queue.Add) |
| 122 | + | queue.CompleteAdding() |
| 123 | + | |
| 124 | + | // run in parallels all the instantiated workers |
121 | 125 | | let tasks = new List<Task>() |
122 | 126 | | let taskManager = getTaskManager(serviceStateController) |
123 | 127 | | let passwordFound = ref 0 |
| skipped 27 lines |
151 | 155 | | // password found set exit flag |
152 | 156 | | Interlocked.Increment(passwordFound) |> ignore |
153 | 157 | | , true) |> tasks.Add |
154 | | - | |
155 | | - | // add all password and set the queue to completed |
156 | | - | _passwords |> List.iter(queue.Add) |
157 | | - | queue.CompleteAdding() |
158 | 158 | | |
159 | 159 | | // wait for all task completed |
160 | 160 | | let counter = ref 0 |
| skipped 150 lines |