-t, --targets TARGETS the targets on which to scan for open RTSP streams
49
+
-p, --ports PORTS [PORTS ...] the ports on which to search for RTSP streams
50
+
-r, --routes ROUTES the path on which to load a custom routes
51
+
-c, --credentials CREDENTIALS the path on which to load a custom credentials
52
+
-ct, --check-threads N the number of threads to brute-force the routes
53
+
-bt, --brute-threads N the number of threads to brute-force the credentials
54
+
-st, --screenshot-threads N the number of threads to screenshot the streams
55
+
-T, --timeout TIMEOUT the timeout to use for sockets
56
+
-d, --debug enable the debug logs
50
57
51
-
At the moment it is possible to change only the following variables in `config.py` file:
52
-
* Number of `CHECK`, `BRUTE` and `SCREENSHOT` `_THREADS`
53
-
* `PORT` to check
54
-
* `SOCKET_TIMEOUT`
58
+
EXAMPLES
59
+
$ python core.py
60
+
$ python core.py -t ips.txt -p 554 5554
61
+
$ python core.py -r paths.txt -c combinations.txt
62
+
$ python core.py -st 10 -T 10
63
+
```
55
64
56
-
In the future, the CLI will be used for this.
65
+
- **"-t, --targets"** (`hosts.txt`): Set custom path to the input file. The file can contain IPs, IP ranges and CIDRs. Each one of them should be on a separate line, e.g.:
- **"-r, --routes"** (`routes.txt`): Set custom path to the file with routes. Each route should start with `/` and be on a separate line, e.g.:
60
75
61
-
1. Get IPs in any format (`1.1.1.1-1.10.10.1`, `192.168.100.1/24`, `8.8.8.8`):
62
-
* Scan manually
63
-
* Use [Shodan](https://www.shodan.io/) or [Censys](https://censys.io/)
64
-
2. Insert them into the `hosts.txt` file so that each IP object (range, cidr or single IP) is on a new line
65
-
3. `python core.py`
76
+
```
77
+
/1
78
+
/11
79
+
/h264
80
+
```
81
+
82
+
- **"-c, --credentials"** (`credentials.txt`): Set custom path to the file with credentials. Each combination should contain `:` and be on a separate line, e.g.:
66
83
84
+
```
85
+
admin:admin
86
+
user:user
87
+
```
88
+
89
+
- **"-ct, --check-threads"** (`500`): Set custom number of threads to brute-force the routes
90
+
- **"-bt, --brute-threads"** (`200`): Set custom number of threads to brute-force the credentials
91
+
- **"-st, --screenshot-threads"** (`20`): Set custom number of threads to screenshot the streams. Smaller number leads to more successful screenshots: when there's too much threads PyAV will throw errors and wouldn't connect to target.
92
+
- **"-T, --timeout"** (`2`): Set custom timeout value for socket connections
93
+
- **"-d, --debug"** (`False`): Enable debug logging to `debug.log` file
# There's a high possibility that this video stream is broken
179
131
# or something else, so we try again just to make sure
180
-
if tries == 0:
132
+
if tries == 2:
181
133
video.close()
182
-
return get_screenshot(target, 1)
134
+
tries += 1
135
+
return get_screenshot(target, tries)
183
136
else:
184
137
logger.debug(
185
138
f"Broken video stream or unknown issues with {str(target)}"
186
139
)
187
-
return""
140
+
return
188
141
video.streams.video[0].thread_type = "AUTO"
189
142
for frame in video.decode(video=0):
190
143
frame.to_image().save(file_path)
skipped 2 lines
193
146
# Those errors occurs when there's too much SCREENSHOT_THREADS.
194
147
logger.debug(f"Missed screenshot of {str(target)}: {repr(e)}")
195
148
# Try one more time in hope for luck.
196
-
if tries == 0:
197
-
logging.info(
198
-
f"{Fore.YELLOW}Retry to get a screenshot of the {str(target)}{Style.RESET_ALL}"
199
-
)
200
-
return get_screenshot(target, 1)
149
+
if tries == 2:
150
+
tries += 1
151
+
console.print("[yellow]Retry to get a screenshot of the", target)
152
+
return get_screenshot(target, tries)
201
153
else:
202
-
logging.error(
203
-
f"{Fore.RED}Missed screenshot of {str(target)}: if you see this message a lot - consider lowering SCREENSHOT_THREADS ({config.SCREENSHOT_THREADS}){Style.RESET_ALL}"
154
+
console.print(
155
+
f"[italic red]Missed screenshot of [underline]{str(target)}[/underline] - if you see this message a lot, consider reducing the number of screenshot threads",
204
156
)
205
-
return""
157
+
return
206
158
except Exception as e:
207
159
logger.debug(f"get_screenshot failed with {str(target)}: {repr(e)}")
208
-
return""
160
+
return
209
161
210
-
logging.info(
211
-
f"{Style.BRIGHT}Captured screenshot for {str(target)}{Style.RESET_ALL}"