| 1 | + | from queue import Queue |
| 2 | + | |
1 | 3 | | import pytest |
2 | 4 | | |
3 | 5 | | from rtspbrute.modules import worker |
| 6 | + | from rtspbrute.modules.cli.output import ProgressBar |
| 7 | + | from rtspbrute.modules.rtsp import RTSPClient |
4 | 8 | | |
5 | | - | target = worker.RTSPClient("0.0.0.0") |
| 9 | + | target = RTSPClient("0.0.0.0") |
6 | 10 | | |
7 | 11 | | |
8 | 12 | | @pytest.fixture |
9 | 13 | | def queues(): |
10 | | - | input_queue = worker.Queue() |
11 | | - | output_queue = worker.Queue() |
| 14 | + | input_queue = Queue() |
| 15 | + | output_queue = Queue() |
12 | 16 | | input_queue.put(target) |
13 | 17 | | input_queue.put(None) |
14 | 18 | | |
| skipped 3 lines |
18 | 22 | | class TestBruteRoutes: |
19 | 23 | | def test_with_result(self, queues, monkeypatch): |
20 | 24 | | input_queue, output_queue = queues |
21 | | - | worker.PROGRESS_BAR = worker.ProgressBar() |
| 25 | + | worker.PROGRESS_BAR = ProgressBar() |
22 | 26 | | worker.CHECK_PROGRESS = worker.PROGRESS_BAR.add_task("Check", total=1) |
23 | 27 | | worker.BRUTE_PROGRESS = worker.PROGRESS_BAR.add_task("Brute", total=0) |
24 | 28 | | check_task = worker.PROGRESS_BAR.tasks[worker.CHECK_PROGRESS] |
| skipped 13 lines |
38 | 42 | | |
39 | 43 | | def test_without_result(self, queues, monkeypatch): |
40 | 44 | | input_queue, output_queue = queues |
41 | | - | worker.PROGRESS_BAR = worker.ProgressBar() |
| 45 | + | worker.PROGRESS_BAR = ProgressBar() |
42 | 46 | | worker.CHECK_PROGRESS = worker.PROGRESS_BAR.add_task("Check", total=1) |
43 | 47 | | worker.BRUTE_PROGRESS = worker.PROGRESS_BAR.add_task("Brute", total=0) |
44 | 48 | | check_task = worker.PROGRESS_BAR.tasks[worker.CHECK_PROGRESS] |
| skipped 14 lines |
59 | 63 | | class TestBruteCredentials: |
60 | 64 | | def test_with_result(self, queues, monkeypatch): |
61 | 65 | | input_queue, output_queue = queues |
62 | | - | worker.PROGRESS_BAR = worker.ProgressBar() |
| 66 | + | worker.PROGRESS_BAR = ProgressBar() |
63 | 67 | | worker.BRUTE_PROGRESS = worker.PROGRESS_BAR.add_task("Brute", total=1) |
64 | 68 | | worker.SCREENSHOT_PROGRESS = worker.PROGRESS_BAR.add_task("Screenshot", total=0) |
65 | 69 | | brute_task = worker.PROGRESS_BAR.tasks[worker.BRUTE_PROGRESS] |
| skipped 13 lines |
79 | 83 | | |
80 | 84 | | def test_without_result(self, queues, monkeypatch): |
81 | 85 | | input_queue, output_queue = queues |
82 | | - | worker.PROGRESS_BAR = worker.ProgressBar() |
| 86 | + | worker.PROGRESS_BAR = ProgressBar() |
83 | 87 | | worker.BRUTE_PROGRESS = worker.PROGRESS_BAR.add_task("Brute", total=1) |
84 | 88 | | worker.SCREENSHOT_PROGRESS = worker.PROGRESS_BAR.add_task("Screenshot", total=0) |
85 | 89 | | brute_task = worker.PROGRESS_BAR.tasks[worker.BRUTE_PROGRESS] |
| skipped 14 lines |
100 | 104 | | class TestScreenshotTargets: |
101 | 105 | | def test_with_result(self, queues, tmp_path, result_file, html_file, monkeypatch): |
102 | 106 | | input_queue, _ = queues |
103 | | - | worker.PROGRESS_BAR = worker.ProgressBar() |
| 107 | + | worker.PROGRESS_BAR = ProgressBar() |
104 | 108 | | worker.SCREENSHOT_PROGRESS = worker.PROGRESS_BAR.add_task("Screenshot", total=1) |
105 | 109 | | screenshot_task = worker.PROGRESS_BAR.tasks[worker.SCREENSHOT_PROGRESS] |
106 | 110 | | |
| skipped 13 lines |
120 | 124 | | |
121 | 125 | | def test_without_result(self, queues, monkeypatch): |
122 | 126 | | input_queue, _ = queues |
123 | | - | worker.PROGRESS_BAR = worker.ProgressBar() |
| 127 | + | worker.PROGRESS_BAR = ProgressBar() |
124 | 128 | | worker.SCREENSHOT_PROGRESS = worker.PROGRESS_BAR.add_task("Screenshot", total=1) |
125 | 129 | | screenshot_task = worker.PROGRESS_BAR.tasks[worker.SCREENSHOT_PROGRESS] |
126 | 130 | | |
| skipped 8 lines |