Skip to content

Instantly share code, notes, and snippets.

@ElDavoo
Created March 27, 2022 18:36
Show Gist options
  • Save ElDavoo/f3a736afe581a98608773f31540d323b to your computer and use it in GitHub Desktop.
Save ElDavoo/f3a736afe581a98608773f31540d323b to your computer and use it in GitHub Desktop.
wgcf to wirepxoy config
#very ugly, didn't make it for publishing
from re import sub
with open("wgcf-profile.conf",'r') as f:
iff = f.readline()
if iff != "[Interface]\n":
print(iff)
raise ValueError
output = open("wireproxy.conf",'w')
private_key = f.readline()
if (private_key[:10] == "PrivateKey"):
private_key = private_key.replace("PrivateKey", "SelfSecretKey")
output.write(private_key)
else:
print(private_key)
raise ValueError
private_key = f.readline()
#private_key = f.readline()
if (private_key[:7] == "Address"):
private_key = private_key.replace("Address", "SelfEndpoint")
private_key = sub(r'/128$','',private_key)
private_key = sub(r'/32$','',private_key)
output.write(private_key)
else:
print(private_key)
raise ValueError
private_key = f.readline()
private_key = f.readline()
if (private_key == "DNS = 1.1.1.1\n"):
output.write("DNS = 1.1.1.1\n")
#pass
else:
print(private_key)
raise ValueError
private_key = f.readline()
private_key = f.readline()
private_key = f.readline()
if (private_key[:9] == "PublicKey"):
private_key = private_key.replace("PublicKey", "PeerPublicKey")
output.write(private_key)
else:
print(private_key)
raise ValueError
private_key = f.readline()
private_key = f.readline()
private_key = f.readline()
if (private_key[:8] == "Endpoint"):
private_key = private_key.replace("Endpoint", "PeerEndpoint")
output.write(private_key)
else:
print(private_key)
raise ValueError
rem = f.read()
if rem != "":
print("({})".format(rem))
raise ValueError
output.write("[Socks5]\n")
output.write("BindAddress = 0.0.0.0:40000")
output.close()
# with open("wireproxy.conf", "r") as t:
# print("test")
# print(t.read())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment