(self, adresse_ip, port)
| 162 | progress.update(task_id, advance=1) |
| 163 | |
| 164 | def run_bruteforce(self, adresse_ip, port): |
| 165 | self.load_scan_file() |
| 166 | |
| 167 | total_tasks = len(self.users) * len(self.passwords) |
| 168 | |
| 169 | for user in self.users: |
| 170 | for password in self.passwords: |
| 171 | if self.shared_data.orchestrator_should_exit: |
| 172 | logger.info("Orchestrator exit signal received, stopping bruteforce task addition.") |
| 173 | return False, [] |
| 174 | self.queue.put((adresse_ip, user, password, port)) |
| 175 | |
| 176 | success_flag = [False] |
| 177 | threads = [] |
| 178 | |
| 179 | with Progress(SpinnerColumn(), TextColumn("[progress.description]{task.description}"), BarColumn(), TextColumn("[progress.percentage]{task.percentage:>3.0f}%")) as progress: |
| 180 | task_id = progress.add_task("[cyan]Bruteforcing SQL...", total=total_tasks) |
| 181 | |
| 182 | for _ in range(40): # Adjust the number of threads based on the RPi Zero's capabilities |
| 183 | t = threading.Thread(target=self.worker, args=(progress, task_id, success_flag)) |
| 184 | t.start() |
| 185 | threads.append(t) |
| 186 | |
| 187 | while not self.queue.empty(): |
| 188 | if self.shared_data.orchestrator_should_exit: |
| 189 | logger.info("Orchestrator exit signal received, stopping bruteforce.") |
| 190 | while not self.queue.empty(): |
| 191 | self.queue.get() |
| 192 | self.queue.task_done() |
| 193 | break |
| 194 | |
| 195 | self.queue.join() |
| 196 | |
| 197 | for t in threads: |
| 198 | t.join() |
| 199 | |
| 200 | logger.info(f"Bruteforcing complete with success status: {success_flag[0]}") |
| 201 | return success_flag[0], self.results # Return True and the list of successes if at least one attempt was successful |
| 202 | |
| 203 | def save_results(self): |
| 204 | """ |
no test coverage detected