Rename GUI.py to app.py
Browse files
GUI.py
DELETED
@@ -1,39 +0,0 @@
|
|
1 |
-
import gradio as gr
|
2 |
-
from main import main
|
3 |
-
|
4 |
-
def run(i_domains, wildcard, email, ca_server, key_type, key_size=None, key_curve=None):
|
5 |
-
pvt, pvt_file, cert, cert_file = main(i_domains, wildcard, email, ca_server, key_type, key_size, key_curve)
|
6 |
-
return pvt, pvt_file, cert, cert_file
|
7 |
-
|
8 |
-
def update_key_options(key_type):
|
9 |
-
if key_type == "rsa":
|
10 |
-
return gr.update(visible=True), gr.update(visible=False)
|
11 |
-
else:
|
12 |
-
return gr.update(visible=False), gr.update(visible=True)
|
13 |
-
|
14 |
-
with gr.Blocks() as app:
|
15 |
-
with gr.Row():
|
16 |
-
with gr.Column():
|
17 |
-
domains_input = gr.Textbox(label="Enter Domains", placeholder="thenayankasturi.eu.org, dash.thenayankasturi.eu.org, www.thenayankasturi.eu.org", type="text", interactive=True)
|
18 |
-
wildcard = gr.Checkbox(label="Wildcard SSL", interactive=True, value=False)
|
19 |
-
email_input = gr.Textbox(label="Enter your Email ID", placeholder="[email protected]", type="text", interactive=True)
|
20 |
-
with gr.Row():
|
21 |
-
ca_server = gr.Dropdown(label="Select Certificate Authority", choices=["Let's Encrypt (Testing)","Let's Encrypt", "Buypass (Testing)", "Buypass", "ZeroSSL", "Google (Testing)","Google", "SSL.com"], interactive=True, value="Let's Encrypt (Testing)")
|
22 |
-
key_type = gr.Radio(label="Select SSL key type", choices=["rsa", "ec"], interactive=True, value='ec')
|
23 |
-
key_size_dropdown = gr.Dropdown(label="Select Key Size", choices=['2048', '4096'], value='4096', visible=False) # Initially visible
|
24 |
-
key_curve_dropdown = gr.Dropdown(label="Select Key Curve", choices=['SECP256R1', 'SECP384R1'], value='SECP384R1', visible=True) # Initially hidden
|
25 |
-
|
26 |
-
key_type.change(fn=update_key_options, inputs=key_type, outputs=[key_size_dropdown, key_curve_dropdown])
|
27 |
-
btn = gr.Button(value="Generate SSL Certificate")
|
28 |
-
|
29 |
-
with gr.Row():
|
30 |
-
with gr.Column():
|
31 |
-
pvt = gr.Textbox(label="Your Private Key", placeholder="Your Private Key will appear here, after successful SSL generation", type="text", interactive=False, show_copy_button=True, lines=10, max_lines=10)
|
32 |
-
pvtfile = gr.File(label="Download your Private Key")
|
33 |
-
with gr.Column():
|
34 |
-
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)
|
35 |
-
crtfile = gr.File(label="Download your SSL Certificate")
|
36 |
-
|
37 |
-
btn.click(run, inputs=[domains_input, wildcard, email_input, ca_server, key_type, key_size_dropdown, key_curve_dropdown], outputs=[pvt, pvtfile, crt, crtfile])
|
38 |
-
|
39 |
-
app.queue(default_concurrency_limit=15).launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app.py
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from main import main
|
3 |
+
|
4 |
+
def run(i_domains, wildcard, email, ca_server, key_type, key_size=None, key_curve=None):
|
5 |
+
pvt, pvt_file, cert, cert_file = main(i_domains, wildcard, email, ca_server, key_type, key_size, key_curve)
|
6 |
+
return pvt, pvt_file, cert, cert_file
|
7 |
+
|
8 |
+
def update_key_options(key_type):
|
9 |
+
if key_type == "rsa":
|
10 |
+
return gr.update(visible=True), gr.update(visible=False)
|
11 |
+
else:
|
12 |
+
return gr.update(visible=False), gr.update(visible=True)
|
13 |
+
|
14 |
+
def app():
|
15 |
+
with gr.Blocks() as webui:
|
16 |
+
with gr.Row():
|
17 |
+
with gr.Column():
|
18 |
+
domains_input = gr.Textbox(label="Enter Domains", placeholder="thenayankasturi.eu.org, dash.thenayankasturi.eu.org, www.thenayankasturi.eu.org", type="text", interactive=True)
|
19 |
+
wildcard = gr.Checkbox(label="Wildcard SSL", interactive=True, value=False)
|
20 |
+
email_input = gr.Textbox(label="Enter your Email ID", placeholder="[email protected]", type="text", interactive=True)
|
21 |
+
with gr.Row():
|
22 |
+
ca_server = gr.Dropdown(label="Select Certificate Authority", choices=["Let's Encrypt (Testing)","Let's Encrypt", "Buypass (Testing)", "Buypass", "ZeroSSL", "Google (Testing)","Google", "SSL.com"], interactive=True, value="Let's Encrypt (Testing)")
|
23 |
+
key_type = gr.Radio(label="Select SSL key type", choices=["rsa", "ec"], interactive=True, value='ec')
|
24 |
+
key_size_dropdown = gr.Dropdown(label="Select Key Size", choices=['2048', '4096'], value='4096', visible=False) # Initially visible
|
25 |
+
key_curve_dropdown = gr.Dropdown(label="Select Key Curve", choices=['SECP256R1', 'SECP384R1'], value='SECP384R1', visible=True) # Initially hidden
|
26 |
+
|
27 |
+
key_type.change(fn=update_key_options, inputs=key_type, outputs=[key_size_dropdown, key_curve_dropdown])
|
28 |
+
btn = gr.Button(value="Generate SSL Certificate")
|
29 |
+
|
30 |
+
with gr.Row():
|
31 |
+
with gr.Column():
|
32 |
+
pvt = gr.Textbox(label="Your Private Key", placeholder="Your Private Key will appear here, after successful SSL generation", type="text", interactive=False, show_copy_button=True, lines=10, max_lines=10)
|
33 |
+
pvtfile = gr.File(label="Download your Private Key")
|
34 |
+
with gr.Column():
|
35 |
+
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)
|
36 |
+
crtfile = gr.File(label="Download your SSL Certificate")
|
37 |
+
|
38 |
+
btn.click(run, inputs=[domains_input, wildcard, email_input, ca_server, key_type, key_size_dropdown, key_curve_dropdown], outputs=[pvt, pvtfile, crt, crtfile])
|
39 |
+
webui.queue(default_concurrency_limit=15).launch()
|
40 |
+
|
41 |
+
if __name__ == "__main__":
|
42 |
+
app()
|