Skip to content

Instantly share code, notes, and snippets.

@Alkanov
Created June 14, 2021 14:24
Show Gist options
  • Save Alkanov/cd02d2034d4109e59c0e6f1924ee2d4b to your computer and use it in GitHub Desktop.
Save Alkanov/cd02d2034d4109e59c0e6f1924ee2d4b to your computer and use it in GitHub Desktop.
Generate AdGuard Home client list
devices = """192.168.0.100,monster_server,device_other
192.168.0.169,livingroom_shield,device_other
192.168.0.224,attic_nvr,device_securityalarm
192.168.0.207,office_huebridge,device_other
100.94.125.43,g-us-fl3_server,device_other
100.116.193.39,g-us-fl4_server,device_other
"""
template = """
- name: {{%name}}
tags:
- {{%tag}}
ids:
- {{%ip}}
use_global_settings: true
filtering_enabled: false
parental_enabled: false
safesearch_enabled: false
safebrowsing_enabled: false
use_global_blocked_services: true
blocked_services: []
upstreams: []
"""
for device in devices.splitlines():
print(template.replace("{{%name}}",device.split(",")[1]).replace("{{%tag}}",device.split(",")[2]).replace("{{%ip}}",device.split(",")[0]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment