Skip to content

Commit dabbbc6

Browse files
committed
Improved --no_blacklist param (closed #24)
1 parent 9e5360a commit dabbbc6

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

src/main.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,8 @@ def load_blacklist(self):
123123
"""
124124
Load the blacklist from the specified file.
125125
"""
126+
if self.no_blacklist:
127+
return
126128
if not os.path.exists(self.blacklist):
127129
self.print(
128130
f"\033[91m[ERROR]: File {self.blacklist} not found\033[0m")
@@ -175,9 +177,10 @@ def print_banner(self):
175177
self.print(
176178
f"\033[92m[INFO]:\033[97m Proxy started at {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}"
177179
)
178-
self.print(
179-
f"\033[92m[INFO]:\033[97m Blacklist contains {len(self.blocked)} domains"
180-
)
180+
if not self.no_blacklist:
181+
self.print(
182+
f"\033[92m[INFO]:\033[97m Blacklist contains {len(self.blocked)} domains"
183+
)
181184
self.print(
182185
"\033[92m[INFO]:\033[97m To stop the proxy, press Ctrl+C twice")
183186
if self.log_err_file:
@@ -439,18 +442,21 @@ def parse_args():
439442
parser.add_argument("--host", default="127.0.0.1", help="Proxy host")
440443
parser.add_argument("--port", type=int,
441444
default=8881, help="Proxy port")
442-
parser.add_argument(
445+
446+
blacklist_group = parser.add_mutually_exclusive_group()
447+
blacklist_group.add_argument(
443448
"--blacklist", default="blacklist.txt", help="Path to blacklist file"
444449
)
450+
blacklist_group.add_argument(
451+
"--no_blacklist", action="store_true", help="Use fragmentation for all domains"
452+
)
453+
445454
parser.add_argument(
446455
"--log_access", required=False, help="Path to the access control log"
447456
)
448457
parser.add_argument(
449458
"--log_error", required=False, help="Path to log file for errors"
450459
)
451-
parser.add_argument(
452-
"--no_blacklist", action="store_true", help="Use fragmentation for all domains"
453-
)
454460
parser.add_argument(
455461
"-q", "--quiet", action="store_true", help="Remove UI output"
456462
)

0 commit comments

Comments
 (0)