Skip to content

Commit 968e8de

Browse files
committed
Added disclaimer
1 parent b68c661 commit 968e8de

1 file changed

Lines changed: 33 additions & 10 deletions

File tree

src/main.py

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,26 @@
22

33
import argparse
44
import asyncio
5-
import random
65
import logging
76
import os
8-
import sys
9-
from urllib.request import urlopen, Request
10-
from urllib.error import URLError
7+
import random
118
import ssl
12-
from datetime import datetime
9+
import sys
10+
import textwrap
1311
import time
1412
import traceback
1513

16-
__version__ = "1.9"
17-
18-
os.system("")
14+
from urllib.error import URLError
15+
from datetime import datetime
16+
from urllib.request import urlopen, Request
1917

2018
if sys.platform == "win32":
2119
import winreg
2220

21+
__version__ = "1.9"
22+
23+
os.system("")
24+
2325

2426
class ConnectionInfo:
2527
""" Class to store connection information """
@@ -154,7 +156,7 @@ async def run(self):
154156
method.
155157
"""
156158

157-
self.print_banner()
159+
self.print_info()
158160
if not self.quiet:
159161
asyncio.create_task(self.display_stats())
160162
try:
@@ -170,10 +172,31 @@ async def run(self):
170172
asyncio.create_task(self.cleanup_tasks())
171173
await self.server.serve_forever()
172174

173-
def print_banner(self):
175+
def print_info(self):
174176
"""
175177
Print a banner with the NoDPI logo and information about the proxy.
176178
"""
179+
if sys.platform == "win32":
180+
os.system("mode con: cols=130")
181+
182+
console_width = os.get_terminal_size().columns
183+
disclaimer = """DISCLAIMER. The developer and/or supplier of this software shall not be liable for any loss or damage, including but not limited to direct, indirect, incidental, punitive or consequential damages arising out of the use of or inability to use this software, even if the developer or supplier has been advised of the possibility of such damages. The developer and/or supplier of this software shall not be liable for any legal consequences arising out of the use of this software. This includes, but is not limited to, violation of laws, rules or regulations, as well as any claims or suits arising out of the use of this software. The user is solely responsible for compliance with all applicable laws and regulations when using this software."""
184+
wrapped_text = textwrap.TextWrapper(width=70).wrap(disclaimer)
185+
186+
left_padding = (console_width - 76) // 2
187+
border = '\033[91m' + ' ' * left_padding + \
188+
'+' + '-' * 72 + '+' + '\033[0m'
189+
190+
self.print(border)
191+
192+
for line in wrapped_text:
193+
padded_line = line.ljust(70)
194+
print('\033[91m' + ' ' * left_padding +
195+
'| ' + padded_line + ' |' + '\033[0m', flush=True)
196+
197+
self.print(border)
198+
time.sleep(2)
199+
self.print('\033[2J\033[H')
177200

178201
self.print(
179202
'''

0 commit comments

Comments
 (0)