-
Notifications
You must be signed in to change notification settings - Fork 1
/
wyzefwtool
executable file
·90 lines (79 loc) · 2.25 KB
/
wyzefwtool
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/usr/bin/env python3
from fwtool.utils import download_firmware, unzip_firmware, unpack_bin, pack_bin, run_mods, wait_for_mods
import argparse
import os
class NotSudo(Exception):
pass
if os.getuid() != 0:
raise NotSudo("This program is not run as sudo or elevated this it will not work")
parser = argparse.ArgumentParser()
parser.add_argument(
'-f',
'--firmware-version',
nargs='?',
help='The version number of the firmware to modify'
)
parser.add_argument(
'-r',
'--rtsp',
action='store_true',
help='Download the RTSP firmware. If used the Firmware Version argument is ignored.'
)
parser.add_argument(
'-u',
'--usb-ethernet',
action='store_true',
help='Enable USB Ethernet support for ASIX based ethernet adapters.'
)
parser.add_argument(
'-d',
'--disable-wlan',
action='store_true',
help='Disabled the wifi connection. Requires that you enable USB ethernet support.'
)
parser.add_argument(
'-t',
'--telnet-server',
action='store_true',
help='Enable persistent telnet server on the camera. Requires that you set a root password.'
)
# NFS is disabled for now. @todo revisit NFS
# parser.add_argument(
# '-n',
# '--nfs-sdcard',
# action='store_true',
# help='Enables the NFS SDCard hack. An NFS share is used as a virtual SD card. You will be prompted for NFS info.'
# )
parser.add_argument(
'-y',
'--no-extra-mods',
action='store_true',
help='The tool will not wait for you to make extra custom modifications.'
)
args = parser.parse_args()
# @todo support other cameras
cam_ver = 'cam_v2'
if args.rtsp:
zip_file = download_firmware(rtsp=True)
else:
if args.firmware_version:
fw_ver = args.firmware_version
else:
fw_ver = input('Firmware Version To Patch: ')
zip_file = download_firmware(version=fw_ver)
enable_eth = args.usb_ethernet
if args.disable_wlan:
enable_eth = True
bin_file = unzip_firmware(zip_file)
unpack_dir = unpack_bin(bin_file)
run_mods(
unpack_dir,
usb_eth=enable_eth,
dis_wlan=args.disable_wlan,
telnet=args.telnet_server,
nfs=False
# nfs=args.nfs_sdcard
)
if not args.no_extra_mods:
wait_for_mods(unpack_dir)
pack_bin(unpack_dir, cam_ver, enable_eth, args.disable_wlan, args.telnet_server)