Should use UUIDs again since Organization names weren't the culprit of failing generations.
This commit is contained in:
parent
5f08c85a0b
commit
b1b04439d5
1 changed files with 9 additions and 4 deletions
13
server.py
13
server.py
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/python3
|
#!/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 OpenSSL import crypto
|
||||||
from urllib.parse import urlparse, quote
|
from urllib.parse import urlparse, quote
|
||||||
from flask import Flask, request, redirect, send_file, Response, make_response
|
from flask import Flask, request, redirect, send_file, Response, make_response
|
||||||
|
@ -37,7 +37,7 @@ def loadcert_backend():
|
||||||
if cert.filename == '' or privkey.filename == '':
|
if cert.filename == '' or privkey.filename == '':
|
||||||
return "Please upload a certificate and private key."
|
return "Please upload a certificate and private key."
|
||||||
if allowed_file(cert.filename) and allowed_file(privkey.filename):
|
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")
|
cert.save(homefolder + "/certs/" + random_name + "-chain.pem")
|
||||||
privkey.save(homefolder + "/certs/" + random_name + "-privkey.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>')
|
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"
|
return "Cannot go to /certload with GET, perhaps you're looking for /loadcert"
|
||||||
@app.route("/gencert.zip")
|
@app.route("/gencert.zip")
|
||||||
def gencert():
|
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 = crypto.PKey()
|
||||||
k.generate_key(crypto.TYPE_RSA, 2048)
|
k.generate_key(crypto.TYPE_RSA, 2048)
|
||||||
cert = crypto.X509()
|
cert = crypto.X509()
|
||||||
|
@ -195,12 +195,17 @@ def relay():
|
||||||
goto = temp.split(" ")[0]
|
goto = temp.split(" ")[0]
|
||||||
prse = urlparse(goto)
|
prse = urlparse(goto)
|
||||||
extra = ""
|
extra = ""
|
||||||
|
qury = None
|
||||||
extracomment = goto
|
extracomment = goto
|
||||||
if prse.netloc == "" and prse.scheme == "":
|
if prse.netloc == "" and prse.scheme == "":
|
||||||
isdir = url[len(url) - 1] == "/"
|
isdir = url[len(url) - 1] == "/"
|
||||||
isabs = goto[0] == "/" or goto[0:2] == "//"
|
isabs = goto[0] == "/" or goto[0:2] == "//"
|
||||||
|
isquery = goto[0] == "?"
|
||||||
dubleslash = goto[0:2] == "//"
|
dubleslash = goto[0:2] == "//"
|
||||||
if isabs:
|
if isquey:
|
||||||
|
tempurl = url
|
||||||
|
qury = ""
|
||||||
|
elif isabs:
|
||||||
tempurl = urlparse(fulladdr).hostname + (goto[1:] if dubleslash else goto)
|
tempurl = urlparse(fulladdr).hostname + (goto[1:] if dubleslash else goto)
|
||||||
elif isdir:
|
elif isdir:
|
||||||
tempurl = url + goto
|
tempurl = url + goto
|
||||||
|
|
Loading…
Add table
Reference in a new issue