Spaces:
Running
Running
Commit
·
e9a5935
1
Parent(s):
b59afc0
Refactor gen_ssl function to include email status
Browse files
app.py
CHANGED
@@ -12,12 +12,12 @@ def gen_ssl(i_domains, wildcard, email, ca_server, key_type, key_size=None, key_
|
|
12 |
key_curve = None
|
13 |
if key_size is not None:
|
14 |
key_size = int(key_size)
|
15 |
-
pvt, csr, cert = main(i_domains, wildcard, email, ca_server, key_type, key_size, key_curve)
|
16 |
print("SSL Certificate generated successfully")
|
17 |
try:
|
18 |
-
return pvt.decode('utf-8'), csr.decode('utf-8'), cert.decode('utf-8')
|
19 |
except:
|
20 |
-
return pvt, csr, cert
|
21 |
|
22 |
def update_key_options(key_type):
|
23 |
if key_type == "rsa":
|
@@ -60,7 +60,8 @@ def app():
|
|
60 |
csr = gr.Textbox(label="Your CSR", placeholder="Your CSR will appear here, after successful SSL generation", type="text", interactive=False, show_copy_button=True, lines=10, max_lines=10)
|
61 |
with gr.Column():
|
62 |
crt = gr.Textbox(label="Your SSL Certificate", placeholder="Your SSL Certificate will appear here, after successful SSL generation", type="text", interactive=False, show_copy_button=True, lines=10, max_lines=10)
|
63 |
-
|
|
|
64 |
try:
|
65 |
webui.queue(default_concurrency_limit=15).launch()
|
66 |
except Exception as e:
|
|
|
12 |
key_curve = None
|
13 |
if key_size is not None:
|
14 |
key_size = int(key_size)
|
15 |
+
pvt, csr, cert, email_status = main(i_domains, wildcard, email, ca_server, key_type, key_size, key_curve)
|
16 |
print("SSL Certificate generated successfully")
|
17 |
try:
|
18 |
+
return pvt.decode('utf-8'), csr.decode('utf-8'), cert.decode('utf-8'), email_status
|
19 |
except:
|
20 |
+
return pvt, csr, cert, email_status
|
21 |
|
22 |
def update_key_options(key_type):
|
23 |
if key_type == "rsa":
|
|
|
60 |
csr = gr.Textbox(label="Your CSR", placeholder="Your CSR will appear here, after successful SSL generation", type="text", interactive=False, show_copy_button=True, lines=10, max_lines=10)
|
61 |
with gr.Column():
|
62 |
crt = gr.Textbox(label="Your SSL Certificate", placeholder="Your SSL Certificate will appear here, after successful SSL generation", type="text", interactive=False, show_copy_button=True, lines=10, max_lines=10)
|
63 |
+
email_status = gr.Textbox(label="Email Status", placeholder="Email status will appear here, after sending email", type="text", interactive=False)
|
64 |
+
btn.click(gen_ssl, inputs=[domains_input, wildcard, email_input, ca_server, key_type, key_size_dropdown, key_curve_dropdown], outputs=[pvt, csr, crt, email_status])
|
65 |
try:
|
66 |
webui.queue(default_concurrency_limit=15).launch()
|
67 |
except Exception as e:
|
main.py
CHANGED
@@ -126,8 +126,8 @@ def main(i_domains, wildcard, email, ca_server, key_type, key_size=None, key_cur
|
|
126 |
cf_non_wildcard(verification_tokens, email, exchange)
|
127 |
except Exception as e:
|
128 |
print(f"Error adding TXT records: {e}")
|
129 |
-
for i in range(
|
130 |
-
print(f"Waiting for {
|
131 |
time.sleep(1)
|
132 |
while not verify_txt_records(verification_tokens, exchange):
|
133 |
print("TXT records not verified yet")
|
@@ -151,8 +151,11 @@ def main(i_domains, wildcard, email, ca_server, key_type, key_size=None, key_cur
|
|
151 |
Key Size = {key_size}
|
152 |
For more details, visit: https://projectgatekeeper.vercel.app/tool/decode.html
|
153 |
"""
|
154 |
-
send_email(email, private_key, csr, cert, generation_details)
|
155 |
-
|
|
|
|
|
|
|
156 |
|
157 |
if __name__ == "__main__":
|
158 |
DOMAINS = 'raannakasturi.eu.org'
|
|
|
126 |
cf_non_wildcard(verification_tokens, email, exchange)
|
127 |
except Exception as e:
|
128 |
print(f"Error adding TXT records: {e}")
|
129 |
+
for i in range(30):
|
130 |
+
print(f"Waiting for {30-i} seconds", end="\r")
|
131 |
time.sleep(1)
|
132 |
while not verify_txt_records(verification_tokens, exchange):
|
133 |
print("TXT records not verified yet")
|
|
|
151 |
Key Size = {key_size}
|
152 |
For more details, visit: https://projectgatekeeper.vercel.app/tool/decode.html
|
153 |
"""
|
154 |
+
if send_email(email, private_key, csr, cert, generation_details):
|
155 |
+
email_status = f"Email Sent to {email}"
|
156 |
+
else:
|
157 |
+
email_status = f"Can't sent email to {email}"
|
158 |
+
return private_key, csr, cert, email_status
|
159 |
|
160 |
if __name__ == "__main__":
|
161 |
DOMAINS = 'raannakasturi.eu.org'
|