一个(python)脚本,用于远程设置avm fritz的设备配置文件!盒子
fritz-switch-profiles的Python项目详细描述
fritz开关配置文件
一个(python)脚本,用于远程设置avm fritz的设备配置文件!框
安装
git clone https://github.com/flopp/fritz-switch-profiles.git
cd fritz-switch-profiles
virtualenv -p python3 env
source env/bin/activate
pip install -r requirements.txt
用法
usage: fritz-switch-profiles.py [-h] [--url URL] [--user USER] --password
PASSWORD [--list-devices] [--list-profiles]
[DEVICE=PROFILE [DEVICE=PROFILE ...]]
positional arguments:
DEVICE=PROFILE Desired device to profile mapping
optional arguments:
-h, --help show this help message and exit
--url URL The URL of your Fritz!Box; default: http://fritz.box
--user USER Login username; default: empty
--password PASSWORD Login password
--list-devices List all known devices
--list-profiles List all available profiles
- 确定要更改其配置文件的设备的ID
./fritz-switch-profiles.py --password YOURPASSWORD --list-devices
->;
LOGGING IN TO FRITZ!BOX AT http://fritz.box...
FETCHING AVAILABLE PROFILES...
FETCHING DEVICES...
FETCHING DEVICE PROFILES...
DEVICE_ID PROFILE_ID DEVICE_NAME
landevice5007 filtprof1 android-1234567890123456 [NOT ACTIVE]
landevice6494 filtprof1 my kid's iphone
landevice5006 filtprof2 Chromecast
...
- 确定可用的配置文件
./fritz-switch-profiles.py --password YOURPASSWORD --list-profiles
->;
LOGGING IN TO FRITZ!BOX AT http://fritz.box...
FETCHING AVAILABLE PROFILES...
FETCHING DEVICES...
FETCHING DEVICE PROFILES...
PROFILE_ID PROFILE_NAME
filtprof1 Standard
filtprof2 Gast
filtprof3 Unbeschränkt
filtprof4 Gesperrt
- 实际更改配置文件
./fritz-switch-profiles.py --password YOURPASSWORD landevice6494=filtprof4
->;
LOGGING IN TO FRITZ!BOX AT http://fritz.box...
FETCHING AVAILABLE PROFILES...
FETCHING DEVICES...
FETCHING DEVICE PROFILES...
UPDATING DEVICE PROFILES...
CHANGING PROFILE OF landevice6494/my kid's iphone TO filtprof4/Gesperrt
注意,您可以通过在命令行上提供多个DEVICE=PROFILE
对,一次更改多个设备的配置文件。
用作库
fromfritz_switch_profilesimportFritzProfileSwitchurl='http://fritz.box'user=''password='mysecurepassword'fps=FritzProfileSwitch(url,user,password)devices=fps.get_devices()profiles=fps.get_profiles()fps.print_devices()fps.print_profiles()profile_for_device=[devices[0]['id1'],profiles[2]['id']]fps.set_profiles(profile_for_device)
已知问题
- 非唯一命名的设备可能会混淆脚本。
许可证
MIT©2018弗洛里安猪舍&贡献者