|
8 | 8 | from rich import print |
9 | 9 | from rich.panel import Panel |
10 | 10 | from rich.padding import Padding |
11 | | -from rich.progress import Progress, SpinnerColumn, TimeElapsedColumn |
12 | | - |
13 | | -from bugscanx.utils.common import get_input, get_confirm |
| 11 | +from rich.progress import Progress, TimeElapsedColumn |
14 | 12 |
|
| 13 | +from bugscanx.utils.common import get_input, get_confirm, clear_screen |
| 14 | +from bugscanx import text_ascii |
15 | 15 |
|
16 | 16 | def read_lines(file_path): |
17 | 17 | try: |
@@ -226,9 +226,9 @@ def domains_to_ip(): |
226 | 226 | socket.setdefaulttimeout(1) |
227 | 227 |
|
228 | 228 | with Progress( |
229 | | - SpinnerColumn(), *Progress.get_default_columns(), TimeElapsedColumn() |
| 229 | + *Progress.get_default_columns(), TimeElapsedColumn(), transient=True |
230 | 230 | ) as progress: |
231 | | - task = progress.add_task("[yellow]Resolving", total=len(domains)) |
| 231 | + task = progress.add_task("[yellow] Resolving", total=len(domains)) |
232 | 232 |
|
233 | 233 | with ThreadPoolExecutor(max_workers=100) as executor: |
234 | 234 | def resolve_domain(domain): |
@@ -273,29 +273,36 @@ def main(): |
273 | 273 | "6": ("FILTER BY KEYWORD", filter_by_keywords, "bold yellow"), |
274 | 274 | "7": ("CIDR TO IP", cidr_to_ip, "bold green"), |
275 | 275 | "8": ("DOMAIN TO IP", domains_to_ip, "bold blue"), |
276 | | - "0": ("BACK", lambda: None, "bold red") |
| 276 | + "0": ("BACK", lambda: None, "bold red"), |
277 | 277 | } |
278 | | - |
| 278 | + |
279 | 279 | while True: |
280 | 280 | print("\n".join( |
281 | 281 | f"[{color}] [{key}] {desc}" for key, (desc, _, color) in options.items() |
282 | 282 | )) |
| 283 | + |
283 | 284 | choice = input("\n\033[36m [-] Your Choice: \033[0m").strip() |
284 | 285 |
|
285 | 286 | if choice == '0': |
286 | 287 | raise KeyboardInterrupt |
287 | | - |
288 | | - if choice not in options: |
289 | | - from bugscanx import text_ascii |
| 288 | + |
| 289 | + action = options.get(choice) |
| 290 | + if not action: |
290 | 291 | text_ascii("FILE TOOLKIT") |
291 | 292 | continue |
292 | | - |
293 | | - if choice in options: |
294 | | - print() |
| 293 | + |
| 294 | + desc, func, color = action |
| 295 | + |
| 296 | + try: |
| 297 | + clear_screen() |
295 | 298 | print(Padding(Panel.fit( |
296 | | - f"[{options[choice][2]}]{options[choice][0]}[/{options[choice][2]}]", |
297 | | - border_style=options[choice][2] |
298 | | - ), (0, 0, 0, 2))) |
299 | | - print() |
300 | | - options[choice][1]() |
301 | | - break |
| 299 | + f"[{color}]{desc}[/{color}]", |
| 300 | + border_style=color |
| 301 | + ), (0, 0, 1, 2))) |
| 302 | + func() |
| 303 | + print("\n[yellow] Press Enter to continue...", end="") |
| 304 | + input() |
| 305 | + except KeyboardInterrupt: |
| 306 | + pass |
| 307 | + finally: |
| 308 | + text_ascii("FILE TOOLKIT") |
0 commit comments