NitroExpose 2.5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ MIT License
2
+
3
+ Copyright © 2025 @NacDevs
4
+
5
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND.
6
+
7
+ SOFTWARE IS FREE AND COMPLETELY OPENSOURCE, IF ANYONE TRY TO MODIFIE OR COPY OUR SOFTWARE, GIVE CREDIT TO AUTHOR (@Nactire) And Community (@NacDevs).
@@ -0,0 +1,115 @@
1
+ Metadata-Version: 2.4
2
+ Name: NitroExpose
3
+ Version: 2.5
4
+ Summary: Advanced CLI To Expose Port To Your Domain.
5
+ Home-page: https://github.com/yuvrajmodz/NitroExpose
6
+ Author: @NacDevs
7
+ Author-email: yuvrajmodz@gmail.com
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: POSIX :: Linux
11
+ Requires-Python: >=3.8
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Requires-Dist: requests
15
+ Requires-Dist: supercore
16
+ Requires-Dist: uvloop
17
+ Requires-Dist: httptools
18
+ Dynamic: author
19
+ Dynamic: author-email
20
+ Dynamic: classifier
21
+ Dynamic: description
22
+ Dynamic: description-content-type
23
+ Dynamic: home-page
24
+ Dynamic: license-file
25
+ Dynamic: requires-dist
26
+ Dynamic: requires-python
27
+ Dynamic: summary
28
+
29
+ ## NitroExpose
30
+
31
+ **Letest Version:** 2.5
32
+ **Developer:** @Nactire
33
+ **Git Repo:** [NitroExpose](https://github.com/yuvrajmodz/NitroExpose)
34
+
35
+
36
+ ## 🚀 Overview
37
+
38
+ **NitroExpose** is an advanced CLI tool that allows you to **instantly expose any local port to your custom domain,**
39
+ **automatic SSL installation** Powered by Let's Encrypt.
40
+
41
+ If You Don't Have Domain, No Problem We Also Provide Free Subdomain To Host Your Local Port Service On Subdomain With Https.
42
+
43
+ It provides a **one-command deployment system** for developers who want to run their local apps (Flask, FastAPI, Node.js, etc.) directly on a live domain without manually configuring NGINX or DNS records.
44
+
45
+
46
+ ## ⚡ Key Features
47
+
48
+ • Easily Expose Your Local Port to Your Domain.
49
+ • Automatic **NGINX** configuration
50
+ • Automatic **SSL (Let's Encrypt)** installation
51
+ • Required **Root (Sudo)** Environment
52
+ • Intelligent error handling with Fast Speed.
53
+ • Lightweight and Fast Completes setup in under 10 Sec
54
+
55
+
56
+ ## 🛠️ System Requirements
57
+
58
+ - Python **3.8+**
59
+ - **Ubuntu** or **Debian-based** System
60
+ - **Root** or **Sudo** privileges
61
+ - **apt** Package Manager Required
62
+
63
+
64
+ ## 🌊 Module installation
65
+
66
+ ```bash
67
+ pip install NitroExpose --break-system-packages
68
+ ```
69
+
70
+ ## 🧭 Usage Guide
71
+
72
+ Step 1 – Point Your Vps/Server IP in Your Domain Records:
73
+
74
+ **Type**: A
75
+ **Name**: *
76
+ **IPv4**: Your Vps Server IP
77
+ **TTL**: Auto
78
+
79
+ Step 2 – **Launch NitroExpose**
80
+ ```bash
81
+ NitroExpose
82
+ ```
83
+
84
+ Step 3 – **Enter Your Domain Or Subdomain**
85
+ ```bash
86
+ ┌─╼ Enter Domain Or Subdomain
87
+ └────╼ ❯❯❯ myproject.example.com
88
+ ```
89
+
90
+ Step 4 – **Enter Your Local Port to Expose**
91
+ ```bash
92
+ ┌─╼ Enter Port To Expose
93
+ └────╼ ❯❯❯ 8000
94
+ ```
95
+
96
+ ✨ **Now it Will Take 8 to 9 Seconds For Verification And Then Boom! Your Local Port Successfully Exposed To Your Public Domain/Subdomain**.
97
+
98
+
99
+ ## 🎯 To Remove Domain/Subdomain
100
+
101
+ ```bash
102
+ NitroExpose remove <domain/subdomain>
103
+ ```
104
+
105
+ ## 🎯 Domain/Subdomain Remove Example
106
+
107
+ ```bash
108
+ NitroExpose remove myproject.example.com
109
+ ```
110
+
111
+ ## To Check Package Version
112
+
113
+ ```bash
114
+ NitroExpose --v
115
+ ```
@@ -0,0 +1,12 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ setup.py
5
+ NitroExpose.egg-info/PKG-INFO
6
+ NitroExpose.egg-info/SOURCES.txt
7
+ NitroExpose.egg-info/dependency_links.txt
8
+ NitroExpose.egg-info/entry_points.txt
9
+ NitroExpose.egg-info/requires.txt
10
+ NitroExpose.egg-info/top_level.txt
11
+ nitroexpose/__init__.py
12
+ nitroexpose/cli.py
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ NitroExpose = nitroexpose.cli:main
@@ -0,0 +1,4 @@
1
+ requests
2
+ supercore
3
+ uvloop
4
+ httptools
@@ -0,0 +1 @@
1
+ nitroexpose
@@ -0,0 +1,115 @@
1
+ Metadata-Version: 2.4
2
+ Name: NitroExpose
3
+ Version: 2.5
4
+ Summary: Advanced CLI To Expose Port To Your Domain.
5
+ Home-page: https://github.com/yuvrajmodz/NitroExpose
6
+ Author: @NacDevs
7
+ Author-email: yuvrajmodz@gmail.com
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: POSIX :: Linux
11
+ Requires-Python: >=3.8
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Requires-Dist: requests
15
+ Requires-Dist: supercore
16
+ Requires-Dist: uvloop
17
+ Requires-Dist: httptools
18
+ Dynamic: author
19
+ Dynamic: author-email
20
+ Dynamic: classifier
21
+ Dynamic: description
22
+ Dynamic: description-content-type
23
+ Dynamic: home-page
24
+ Dynamic: license-file
25
+ Dynamic: requires-dist
26
+ Dynamic: requires-python
27
+ Dynamic: summary
28
+
29
+ ## NitroExpose
30
+
31
+ **Letest Version:** 2.5
32
+ **Developer:** @Nactire
33
+ **Git Repo:** [NitroExpose](https://github.com/yuvrajmodz/NitroExpose)
34
+
35
+
36
+ ## 🚀 Overview
37
+
38
+ **NitroExpose** is an advanced CLI tool that allows you to **instantly expose any local port to your custom domain,**
39
+ **automatic SSL installation** Powered by Let's Encrypt.
40
+
41
+ If You Don't Have Domain, No Problem We Also Provide Free Subdomain To Host Your Local Port Service On Subdomain With Https.
42
+
43
+ It provides a **one-command deployment system** for developers who want to run their local apps (Flask, FastAPI, Node.js, etc.) directly on a live domain without manually configuring NGINX or DNS records.
44
+
45
+
46
+ ## ⚡ Key Features
47
+
48
+ • Easily Expose Your Local Port to Your Domain.
49
+ • Automatic **NGINX** configuration
50
+ • Automatic **SSL (Let's Encrypt)** installation
51
+ • Required **Root (Sudo)** Environment
52
+ • Intelligent error handling with Fast Speed.
53
+ • Lightweight and Fast Completes setup in under 10 Sec
54
+
55
+
56
+ ## 🛠️ System Requirements
57
+
58
+ - Python **3.8+**
59
+ - **Ubuntu** or **Debian-based** System
60
+ - **Root** or **Sudo** privileges
61
+ - **apt** Package Manager Required
62
+
63
+
64
+ ## 🌊 Module installation
65
+
66
+ ```bash
67
+ pip install NitroExpose --break-system-packages
68
+ ```
69
+
70
+ ## 🧭 Usage Guide
71
+
72
+ Step 1 – Point Your Vps/Server IP in Your Domain Records:
73
+
74
+ **Type**: A
75
+ **Name**: *
76
+ **IPv4**: Your Vps Server IP
77
+ **TTL**: Auto
78
+
79
+ Step 2 – **Launch NitroExpose**
80
+ ```bash
81
+ NitroExpose
82
+ ```
83
+
84
+ Step 3 – **Enter Your Domain Or Subdomain**
85
+ ```bash
86
+ ┌─╼ Enter Domain Or Subdomain
87
+ └────╼ ❯❯❯ myproject.example.com
88
+ ```
89
+
90
+ Step 4 – **Enter Your Local Port to Expose**
91
+ ```bash
92
+ ┌─╼ Enter Port To Expose
93
+ └────╼ ❯❯❯ 8000
94
+ ```
95
+
96
+ ✨ **Now it Will Take 8 to 9 Seconds For Verification And Then Boom! Your Local Port Successfully Exposed To Your Public Domain/Subdomain**.
97
+
98
+
99
+ ## 🎯 To Remove Domain/Subdomain
100
+
101
+ ```bash
102
+ NitroExpose remove <domain/subdomain>
103
+ ```
104
+
105
+ ## 🎯 Domain/Subdomain Remove Example
106
+
107
+ ```bash
108
+ NitroExpose remove myproject.example.com
109
+ ```
110
+
111
+ ## To Check Package Version
112
+
113
+ ```bash
114
+ NitroExpose --v
115
+ ```
@@ -0,0 +1,87 @@
1
+ ## NitroExpose
2
+
3
+ **Letest Version:** 2.5
4
+ **Developer:** @Nactire
5
+ **Git Repo:** [NitroExpose](https://github.com/yuvrajmodz/NitroExpose)
6
+
7
+
8
+ ## 🚀 Overview
9
+
10
+ **NitroExpose** is an advanced CLI tool that allows you to **instantly expose any local port to your custom domain,**
11
+ **automatic SSL installation** Powered by Let's Encrypt.
12
+
13
+ If You Don't Have Domain, No Problem We Also Provide Free Subdomain To Host Your Local Port Service On Subdomain With Https.
14
+
15
+ It provides a **one-command deployment system** for developers who want to run their local apps (Flask, FastAPI, Node.js, etc.) directly on a live domain without manually configuring NGINX or DNS records.
16
+
17
+
18
+ ## ⚡ Key Features
19
+
20
+ • Easily Expose Your Local Port to Your Domain.
21
+ • Automatic **NGINX** configuration
22
+ • Automatic **SSL (Let's Encrypt)** installation
23
+ • Required **Root (Sudo)** Environment
24
+ • Intelligent error handling with Fast Speed.
25
+ • Lightweight and Fast Completes setup in under 10 Sec
26
+
27
+
28
+ ## 🛠️ System Requirements
29
+
30
+ - Python **3.8+**
31
+ - **Ubuntu** or **Debian-based** System
32
+ - **Root** or **Sudo** privileges
33
+ - **apt** Package Manager Required
34
+
35
+
36
+ ## 🌊 Module installation
37
+
38
+ ```bash
39
+ pip install NitroExpose --break-system-packages
40
+ ```
41
+
42
+ ## 🧭 Usage Guide
43
+
44
+ Step 1 – Point Your Vps/Server IP in Your Domain Records:
45
+
46
+ **Type**: A
47
+ **Name**: *
48
+ **IPv4**: Your Vps Server IP
49
+ **TTL**: Auto
50
+
51
+ Step 2 – **Launch NitroExpose**
52
+ ```bash
53
+ NitroExpose
54
+ ```
55
+
56
+ Step 3 – **Enter Your Domain Or Subdomain**
57
+ ```bash
58
+ ┌─╼ Enter Domain Or Subdomain
59
+ └────╼ ❯❯❯ myproject.example.com
60
+ ```
61
+
62
+ Step 4 – **Enter Your Local Port to Expose**
63
+ ```bash
64
+ ┌─╼ Enter Port To Expose
65
+ └────╼ ❯❯❯ 8000
66
+ ```
67
+
68
+ ✨ **Now it Will Take 8 to 9 Seconds For Verification And Then Boom! Your Local Port Successfully Exposed To Your Public Domain/Subdomain**.
69
+
70
+
71
+ ## 🎯 To Remove Domain/Subdomain
72
+
73
+ ```bash
74
+ NitroExpose remove <domain/subdomain>
75
+ ```
76
+
77
+ ## 🎯 Domain/Subdomain Remove Example
78
+
79
+ ```bash
80
+ NitroExpose remove myproject.example.com
81
+ ```
82
+
83
+ ## To Check Package Version
84
+
85
+ ```bash
86
+ NitroExpose --v
87
+ ```
@@ -0,0 +1,3 @@
1
+ # 𝗗𝗲𝘃𝗲𝗹𝗼𝗽𝗲𝗱 𝗕𝘆 @nactire
2
+ # 𝗦𝘁𝗮𝗯𝗹𝗲 𝗥𝗲𝗹𝗲𝗮𝘀𝗲
3
+ # 𝗖𝗼𝗺𝗺𝘂𝗻𝗶𝘁𝘆: @NacDevs
@@ -0,0 +1,403 @@
1
+ import os
2
+ import subprocess
3
+ import sys
4
+ import re
5
+ import termios
6
+ import tty
7
+ import select
8
+ import time
9
+ import requests
10
+ import signal
11
+ import socket
12
+ import importlib.metadata
13
+
14
+ # cli.py (Main File)
15
+ # 𝗠𝗮𝗻𝗮𝗴𝗲𝗱 𝗕𝘆 @Nactire
16
+
17
+ def print_green(text):
18
+ print("\033[1;32m" + text + "\033[0m")
19
+
20
+ def print_red(text):
21
+ print("\033[1;31m" + text + "\033[0m")
22
+
23
+ def print_yellow(text):
24
+ print("\033[1;33m" + text + "\033[0m")
25
+
26
+ def print_turquoise(text):
27
+ print("\033[38;2;0;255;234m" + text + "\033[0m")
28
+
29
+ def get_version():
30
+ try:
31
+ version = importlib.metadata.version('nitroexpose')
32
+ return version
33
+ except importlib.metadata.PackageNotFoundError:
34
+ return "Unknown"
35
+
36
+ def run_command(cmd):
37
+ process = subprocess.Popen(
38
+ cmd,
39
+ shell=True,
40
+ stdout=subprocess.DEVNULL,
41
+ stderr=subprocess.DEVNULL
42
+ )
43
+ process.wait()
44
+ return process.returncode
45
+
46
+ def is_installed(cmd):
47
+ return subprocess.call(
48
+ f"{cmd} > /dev/null 2>&1",
49
+ shell=True,
50
+ stdout=subprocess.DEVNULL,
51
+ stderr=subprocess.DEVNULL
52
+ ) == 0
53
+
54
+ def is_certbot_nginx_plugin_installed():
55
+ try:
56
+ result = subprocess.check_output(
57
+ "dpkg -l | grep python3-certbot-nginx",
58
+ shell=True,
59
+ text=True,
60
+ stderr=subprocess.DEVNULL
61
+ )
62
+ return "python3-certbot-nginx" in result
63
+ except subprocess.CalledProcessError:
64
+ return False
65
+
66
+ def is_port_listening(port):
67
+ try:
68
+ sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
69
+ sock.settimeout(2)
70
+ result = sock.connect_ex(('127.0.0.1', int(port)))
71
+ sock.close()
72
+ return result == 0
73
+ except Exception:
74
+ return False
75
+
76
+ def restricted_input(prompt, allowed_pattern):
77
+ def handle_sigint(signum, frame):
78
+ print("\n\n")
79
+ sys.exit(1)
80
+
81
+ signal.signal(signal.SIGINT, handle_sigint)
82
+
83
+ sys.stdout.write("\033[1;32m" + prompt + "\033[0m")
84
+ sys.stdout.flush()
85
+
86
+ fd = sys.stdin.fileno()
87
+ old_settings = termios.tcgetattr(fd)
88
+ tty.setraw(fd)
89
+
90
+ buffer = ""
91
+ try:
92
+ while True:
93
+ r, _, _ = select.select([fd], [], [], 0)
94
+ if r:
95
+ ch = sys.stdin.read(1)
96
+ if ch == "\n" or ch == "\r":
97
+ print()
98
+ break
99
+ elif ch == "\x03":
100
+ raise KeyboardInterrupt
101
+ elif ch == "\x7f":
102
+ if buffer:
103
+ buffer = buffer[:-1]
104
+ sys.stdout.write("\b \b")
105
+ sys.stdout.flush()
106
+ elif re.match(allowed_pattern, ch):
107
+ buffer += ch
108
+ sys.stdout.write(ch)
109
+ sys.stdout.flush()
110
+ except KeyboardInterrupt:
111
+ print("\n\n")
112
+ sys.exit(1)
113
+ finally:
114
+ termios.tcsetattr(fd, termios.TCSADRAIN, old_settings)
115
+ return buffer
116
+
117
+ def install_and_verify_package(package_name, check_cmd, install_cmds):
118
+ print_green(f"Installing {package_name}...")
119
+
120
+ for cmd in install_cmds:
121
+ run_command(cmd)
122
+
123
+ if check_cmd():
124
+ print_green(f"{package_name} installed.")
125
+ return True
126
+ else:
127
+ print_red(f"{package_name} installing Error.")
128
+ sys.exit(1)
129
+
130
+ def is_valid_domain(domain):
131
+ if "http://" in domain or "https://" in domain or " " in domain:
132
+ return False
133
+
134
+ if "." not in domain:
135
+ return False
136
+
137
+ pattern = r'^[a-zA-Z0-9\.\-]+$'
138
+ if not re.match(pattern, domain):
139
+ return False
140
+
141
+ return True
142
+
143
+ def is_subdomain(domain):
144
+ parts = domain.split(".")
145
+ return len(parts) > 2
146
+
147
+ def remove_domain(domain):
148
+ if os.geteuid() != 0:
149
+ print_red("\nPlease Use Root Environment.\n")
150
+ sys.exit(1)
151
+
152
+ if not is_valid_domain(domain):
153
+ print_red("\nDomain Format Not Valid.\n")
154
+ sys.exit(1)
155
+
156
+ if not is_installed("nginx -v"):
157
+ install_and_verify_package(
158
+ "NGINX",
159
+ lambda: is_installed("nginx -v"),
160
+ [
161
+ "sudo apt update -o Acquire::AllowInsecureRepositories=true",
162
+ "sudo apt install -y nginx",
163
+ "sudo systemctl start nginx",
164
+ "sudo systemctl enable nginx"
165
+ ]
166
+ )
167
+ else:
168
+ print_green("NGINX installed.")
169
+
170
+ if not is_installed("certbot --version"):
171
+ install_and_verify_package(
172
+ "Certbot",
173
+ lambda: is_installed("certbot --version"),
174
+ [
175
+ "sudo apt update -o Acquire::AllowInsecureRepositories=true",
176
+ "sudo apt install -y certbot python3-certbot-nginx"
177
+ ]
178
+ )
179
+ else:
180
+ print_green("Certbot installed.")
181
+
182
+ if not is_certbot_nginx_plugin_installed():
183
+ install_and_verify_package(
184
+ "python3-certbot-nginx plugin",
185
+ is_certbot_nginx_plugin_installed,
186
+ [
187
+ "sudo apt update -o Acquire::AllowInsecureRepositories=true",
188
+ "sudo apt install -y python3-certbot-nginx"
189
+ ]
190
+ )
191
+ else:
192
+ print_green("python3-certbot-nginx plugin installed.")
193
+
194
+ print("\n")
195
+
196
+ available_path = f"/etc/nginx/sites-available/{domain}"
197
+ enabled_path = f"/etc/nginx/sites-enabled/{domain}"
198
+
199
+ available_exists = os.path.exists(available_path)
200
+ enabled_exists = os.path.exists(enabled_path)
201
+
202
+ domain_type = "Subdomain" if is_subdomain(domain) else "Domain"
203
+
204
+ if not available_exists and not enabled_exists:
205
+ run_command(f"sudo rm -f {available_path}")
206
+ run_command(f"sudo rm -f {enabled_path}")
207
+ run_command("sudo systemctl reload nginx")
208
+ print_red(f"Targeted {domain_type} Doesn't Exist in Your Server.\n")
209
+ sys.exit(1)
210
+ elif not available_exists or not enabled_exists:
211
+ run_command(f"sudo rm -f {available_path}")
212
+ run_command(f"sudo rm -f {enabled_path}")
213
+ run_command("sudo systemctl reload nginx")
214
+ print_red(f"Targeted {domain_type} Doesn't Exist in Your Server.\n")
215
+ sys.exit(1)
216
+ else:
217
+ run_command(f"sudo rm -f {available_path}")
218
+ run_command(f"sudo rm -f {enabled_path}")
219
+ run_command("sudo systemctl reload nginx")
220
+ print_green(f"\n{domain_type} Removed Successfully.\n")
221
+ sys.exit(0)
222
+
223
+ def main():
224
+ if len(sys.argv) == 2 and sys.argv[1] in ["-v", "--v"]:
225
+ version = get_version()
226
+ print_green(f"V{version}")
227
+ sys.exit(0)
228
+
229
+ if len(sys.argv) == 3 and sys.argv[1] == "remove":
230
+ domain = sys.argv[2]
231
+ remove_domain(domain)
232
+ return
233
+
234
+ if os.geteuid() != 0:
235
+ print_red("\nPlease Use Root Environment.\n")
236
+ sys.exit(1)
237
+
238
+ if not is_installed("nginx -v"):
239
+ install_and_verify_package(
240
+ "NGINX",
241
+ lambda: is_installed("nginx -v"),
242
+ [
243
+ "sudo apt update -o Acquire::AllowInsecureRepositories=true",
244
+ "sudo apt install -y nginx",
245
+ "sudo systemctl start nginx",
246
+ "sudo systemctl enable nginx"
247
+ ]
248
+ )
249
+ else:
250
+ print_green("NGINX installed.")
251
+
252
+ if not is_installed("certbot --version"):
253
+ install_and_verify_package(
254
+ "Certbot",
255
+ lambda: is_installed("certbot --version"),
256
+ [
257
+ "sudo apt update -o Acquire::AllowInsecureRepositories=true",
258
+ "sudo apt install -y certbot python3-certbot-nginx"
259
+ ]
260
+ )
261
+ else:
262
+ print_green("Certbot installed.")
263
+
264
+ if not is_certbot_nginx_plugin_installed():
265
+ install_and_verify_package(
266
+ "python3-certbot-nginx plugin",
267
+ is_certbot_nginx_plugin_installed,
268
+ [
269
+ "sudo apt update -o Acquire::AllowInsecureRepositories=true",
270
+ "sudo apt install -y python3-certbot-nginx"
271
+ ]
272
+ )
273
+ else:
274
+ print_green("python3-certbot-nginx plugin installed.")
275
+
276
+ print("\n")
277
+
278
+ print_turquoise("┌─╼ Enter Domain Or Subdomain")
279
+ domain = restricted_input("\033[38;2;0;255;234m└────╼ ❯❯❯ \033[0m", r"[a-zA-Z0-9\.\-]")
280
+
281
+ print("\n")
282
+
283
+ if "." not in domain:
284
+ print_red("Domain is invalid, Operation Failed.")
285
+ sys.exit(1)
286
+
287
+ print_turquoise("┌─╼ Enter Port To Expose")
288
+ port = restricted_input("\033[38;2;0;255;234m└────╼ ❯❯❯ \033[0m", r"[0-9]+")
289
+
290
+ print("\n")
291
+
292
+ if not is_port_listening(port):
293
+ print_red("Port Not Listening, Operation Failed.")
294
+ sys.exit(1)
295
+
296
+ nginx_temp_conf = f"""
297
+ server {{
298
+ server_name {domain};
299
+
300
+ location /nitroverify/auth.txt {{
301
+ default_type text/plain;
302
+ return 200 "nitroverify-success";
303
+ }}
304
+
305
+ location / {{
306
+ return 404;
307
+ }}
308
+
309
+ listen 80;
310
+ }}
311
+ """
312
+ conf_path = f"/etc/nginx/sites-available/{domain}"
313
+ with open(conf_path, "w") as f:
314
+ f.write(nginx_temp_conf)
315
+
316
+ run_command(f"sudo ln -sf /etc/nginx/sites-available/{domain} /etc/nginx/sites-enabled/")
317
+ run_command("sudo systemctl reload nginx")
318
+
319
+ print_yellow("Domain verifying...")
320
+ time.sleep(5)
321
+
322
+ verified = False
323
+ for url in [f"http://{domain}/nitroverify/auth.txt", f"https://{domain}/nitroverify/auth.txt"]:
324
+ try:
325
+ r = requests.get(url, timeout=5)
326
+ if "nitroverify-success" in r.text:
327
+ verified = True
328
+ break
329
+ except Exception:
330
+ continue
331
+
332
+ if not verified:
333
+ print_red("Domain Verification Failed, Check Records Carefully.")
334
+ run_command(f"sudo rm -f /etc/nginx/sites-available/{domain}")
335
+ run_command(f"sudo rm -f /etc/nginx/sites-enabled/{domain}")
336
+ run_command("sudo systemctl reload nginx")
337
+ sys.exit(1)
338
+
339
+ print_green("Domain Verification Success.\n")
340
+
341
+ run_command(f"sudo rm -f /etc/nginx/sites-available/{domain}")
342
+ run_command(f"sudo rm -f /etc/nginx/sites-enabled/{domain}")
343
+ run_command("sudo systemctl reload nginx")
344
+
345
+ print_yellow("SSL Cert installing...")
346
+
347
+ nginx_conf = f"""
348
+ server {{
349
+ server_name {domain};
350
+
351
+ location / {{
352
+ proxy_pass http://127.0.0.1:{port};
353
+ proxy_set_header Host $host;
354
+ proxy_set_header X-Real-IP $remote_addr;
355
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
356
+ proxy_set_header X-Forwarded-Proto $scheme;
357
+ }}
358
+
359
+ listen 80;
360
+ }}
361
+ """
362
+ conf_path = f"/etc/nginx/sites-available/{domain}"
363
+ with open(conf_path, "w") as f:
364
+ f.write(nginx_conf)
365
+
366
+ run_command(f"sudo ln -sf /etc/nginx/sites-available/{domain} /etc/nginx/sites-enabled/")
367
+ run_command("sudo systemctl reload nginx")
368
+
369
+ run_command(f"sudo certbot --nginx -d {domain} --non-interactive --agree-tos --email nitroexpose@gmail.com")
370
+ run_command("sudo systemctl reload nginx")
371
+
372
+ print_yellow("SSL Certificate Checking...")
373
+ time.sleep(2)
374
+
375
+ ssl_installed = False
376
+ try:
377
+ r = requests.get(f"https://{domain}", timeout=10)
378
+ if r.status_code == 200:
379
+ ssl_installed = True
380
+ except requests.exceptions.SSLError:
381
+ ssl_installed = False
382
+ except requests.exceptions.RequestException:
383
+ ssl_installed = False
384
+
385
+ print("\n")
386
+ if ssl_installed:
387
+ print_green(f"Exposed Successfully On Your Domain\n")
388
+ print_green(f"Exposed On: https://{domain}\n")
389
+ print_green(f"Port: {port}\n")
390
+ print_green(f"SSL Installed Using Let's Encrypt.\n")
391
+ print_yellow(f"- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -")
392
+ print_yellow(f"If You Like NitroExpose, Please Support Us by:\n")
393
+ print_yellow(f" * Join Our Telegram Channel: https://t.me/NacDevs")
394
+ print_yellow(f" * Please Star Our Project: https://github.com/yuvrajmodz/NitroExpose")
395
+ print_yellow(f"- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n\n")
396
+ else:
397
+ print_green(f"Exposed Successfully On Your Domain\n")
398
+ print_green(f"Exposed On: http://{domain}\n")
399
+ print_green(f"Port: {port}\n")
400
+ print_yellow(f"Unfortunately, please verify your records carefully. Your server is exposed on your domain, and we are experiencing difficulties while attempting to install an SSL certificate.\n\n")
401
+
402
+ if __name__ == "__main__":
403
+ main()
@@ -0,0 +1,3 @@
1
+ [build-system]
2
+ requires = ["setuptools>=42", "wheel"]
3
+ build-backend = "setuptools.build_meta"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,30 @@
1
+ from setuptools import setup, find_packages
2
+
3
+ setup(
4
+ name="NitroExpose",
5
+ version="2.5",
6
+ author="@NacDevs",
7
+ author_email="yuvrajmodz@gmail.com",
8
+ description="Advanced CLI To Expose Port To Your Domain.",
9
+ long_description=open("README.md").read(),
10
+ long_description_content_type="text/markdown",
11
+ url="https://github.com/yuvrajmodz/NitroExpose",
12
+ packages=find_packages(),
13
+ python_requires='>=3.8',
14
+ install_requires=[
15
+ "requests",
16
+ "supercore",
17
+ "uvloop",
18
+ "httptools"
19
+ ],
20
+ entry_points={
21
+ 'console_scripts': [
22
+ 'NitroExpose=nitroexpose.cli:main',
23
+ ],
24
+ },
25
+ classifiers=[
26
+ "Programming Language :: Python :: 3",
27
+ "License :: OSI Approved :: MIT License",
28
+ "Operating System :: POSIX :: Linux",
29
+ ],
30
+ )