Should use UUIDs again since Organization names weren't the culprit of failing generations.

This commit is contained in:
Nova Cat 2025-01-14 22:02:45 -08:00
parent 5f08c85a0b
commit b1b04439d5

View file

@ -1,5 +1,5 @@
#!/usr/bin/python3
import asyncio, traceback, socket, ssl, zipfile, random, string, io
import asyncio, traceback, socket, ssl, zipfile, uuid, io
from OpenSSL import crypto
from urllib.parse import urlparse, quote
from flask import Flask, request, redirect, send_file, Response, make_response
@ -37,7 +37,7 @@ def loadcert_backend():
if cert.filename == '' or privkey.filename == '':
return "Please upload a certificate and private key."
if allowed_file(cert.filename) and allowed_file(privkey.filename):
random_name = ''.join(random.choice(string.ascii_lowercase+string.digits+string.ascii_uppercase) for i in range(8))
random_name = str(uuid.uuid4())
cert.save(homefolder + "/certs/" + random_name + "-chain.pem")
privkey.save(homefolder + "/certs/" + random_name + "-privkey.pem")
resp = make_response('<link rel="stylesheet" href="/style.css">Success!<br><br><p><a href="/" class=go style="color: white;">Go home</a></p>')
@ -49,7 +49,7 @@ def loadcert_backend():
return "Cannot go to /certload with GET, perhaps you're looking for /loadcert"
@app.route("/gencert.zip")
def gencert():
random_name = ''.join(random.choice(string.ascii_lowercase+string.digits+string.ascii_uppercase) for i in range(8))
random_name = str(uuid.uuid4())
k = crypto.PKey()
k.generate_key(crypto.TYPE_RSA, 2048)
cert = crypto.X509()
@ -195,12 +195,17 @@ def relay():
goto = temp.split(" ")[0]
prse = urlparse(goto)
extra = ""
qury = None
extracomment = goto
if prse.netloc == "" and prse.scheme == "":
isdir = url[len(url) - 1] == "/"
isabs = goto[0] == "/" or goto[0:2] == "//"
isquery = goto[0] == "?"
dubleslash = goto[0:2] == "//"
if isabs:
if isquey:
tempurl = url
qury = ""
elif isabs:
tempurl = urlparse(fulladdr).hostname + (goto[1:] if dubleslash else goto)
elif isdir:
tempurl = url + goto