Last active
July 21, 2021 16:10
-
-
Save cofob/5b1b3dba7655b3d2da5abf67be8bdd31 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
peers = [ | |
'tcp://ygg.cofob.ru:80', | |
'tcp://ygg-ru.cofob.ru:18000', | |
'tcp://ygg-ru2.cofob.ru:80', | |
'tcp://46.151.26.194:60575' | |
] | |
import os, json, random | |
if not os.path.isdir('yggspoof'): | |
os.mkdir('yggspoof') | |
path = os.path.abspath('yggspoof') | |
rand = str(random.randint(1000, 9999)) | |
print(rand) | |
os.system('yggdrasil -genconf -json > yggcfg.json') | |
with open('yggcfg.json', 'r') as f: | |
config = json.load(f) | |
os.remove('yggcfg.json') | |
config["Peers"] = peers | |
config["AdminListen"] = f"unix://{path}/{rand}.sock" | |
config['MulticastInterfaces'] = [] | |
#config["NodeInfo"] = {'name':f'{rand}.cofob.ru'} | |
config['IfName'] = f"ys{rand}" | |
with open(f'{path}/{rand}.conf', 'w') as f: | |
json.dump(config, f) | |
with open(f'/etc/systemd/system/yggspoof-{rand}.service', 'w') as f: | |
f.write(f""" | |
[Unit] | |
Description=yggdrasil | |
Wants=network.target | |
After=network.target | |
[Service] | |
User=root | |
Group=root | |
ExecStart=/bin/yggdrasil -useconffile {path}/{rand}.conf | |
Restart=always | |
TimeoutStopSec=5 | |
[Install] | |
WantedBy=multi-user.target | |
""") | |
os.system('systemctl daemon-reload') | |
os.system(f'systemctl enable --now yggspoof-{rand}') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment