No description
  • Python 99.3%
  • Shell 0.7%
Find a file
2026-01-04 10:38:15 +01:00
internal Uncommitted changes 2026-01-04 10:38:15 +01:00
.gitignore Uncommitted changes 2026-01-04 10:38:15 +01:00
bind.py Uncommitted changes 2026-01-04 10:38:15 +01:00
bird.py Uncommitted changes 2026-01-04 10:38:15 +01:00
gen-cert.sh Initial commit 2025-12-31 10:38:58 +01:00
install_bird.yml Uncommitted changes 2026-01-04 10:38:15 +01:00
nebula.py Uncommitted changes 2026-01-04 10:38:15 +01:00
nftables.py Uncommitted changes 2026-01-04 10:38:15 +01:00
README.md Uncommitted changes 2026-01-04 10:38:15 +01:00
ssh.py Uncommitted changes 2026-01-04 10:38:15 +01:00
wireguard.py Uncommitted changes 2026-01-04 10:38:15 +01:00

Scripts I use to manage VPS.

This only works on Alpine Linux remotes.

Still WIP


Very unclean snippet to convert WireGuard .conf files to a list of WireGuardInterface assuming keys and values are separated with a equals sign surrounded by spaces and lots of other assumptions

def vv(name):
     vals = dict([i.split(' = ') for i in open(name).read().split('\n') if '=' in i])
     params = {
        'id': name[:-5],
        'peer': vals['PostUp'].split(' ')[-1],
        'public_key': vals['PublicKey'],
        'endpoint': vals.get('Endpoint'),
        'listen_port': int(vals.get('ListenPort')),
        'preshared_key': vals.get('PresharedKey')
     }
         
     return f'WireGuardInterface({', '.join([f'{k}={f'"{v}"' if type(v) != int else v}' for k, v in params.items() if v is not None])})'

     
print('[\n    ' + ',\n    '.join([vv(f) for f in sorted(listdir()) if f[-5:] == '.conf']) + '\n]')