image-station/simple-wireguard/tools/wg-gen.py
2021-02-24 04:10:39 +08:00

13 lines
389 B
Python

# -*- coding: utf-8 -*-
import sys
import subprocess
if __name__ == "__main__":
prik = subprocess.check_output(["wg", "genkey"])
print("[PrivateKey]: {}".format(prik.strip()))
subp = subprocess.Popen(["wg", "pubkey"], stdin=subprocess.PIPE, stdout=subprocess.PIPE)
pubk = subp.communicate(input=prik)[0]
print("[Public Key]: {}".format(pubk.strip()))
subp.wait()