Skip to content

Commit 14a70b2

Browse files
committed
quiet errors on timeout 0
1 parent 5f8b73a commit 14a70b2

File tree

1 file changed

+58
-54
lines changed

1 file changed

+58
-54
lines changed

MacAttack.pyw

Lines changed: 58 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -3967,10 +3967,11 @@ class MacAttack(QMainWindow):
39673967
or "521: Web server is down" in res.text
39683968
or "temporarily unavailable" in res.text
39693969
):
3970-
self.update_error_text_signal.emit(
3971-
f"Error for Portal: <b>503 Rate Limited</b> {selected_proxy}"
3972-
)
3973-
self.temp_remove_proxy(selected_proxy) # Temp remove the proxy
3970+
if ratelimit_timeout > 0:
3971+
self.update_error_text_signal.emit(
3972+
f"Error for Portal: <b>503 Rate Limited</b> {selected_proxy}"
3973+
)
3974+
self.temp_remove_proxy(selected_proxy) # Temp remove the proxy
39743975

39753976
elif "ERR_ACCESS_DENIED" in res.text:
39763977
# Track error count for the proxy
@@ -4292,15 +4293,17 @@ class MacAttack(QMainWindow):
42924293
# Attempt to remove the proxy if it exceeds the allowed error count
42934294
self.remove_proxy(selected_proxy, self.proxy_error_counts)
42944295
elif "banned your IP" in res.text or "403: Forbidden" in res.text:
4295-
self.update_error_text_signal.emit(
4296-
f"Error for Portal: <b>Banned</b> {selected_proxy}"
4297-
)
4298-
self.temp_remove_proxy(selected_proxy) # Temp remove the proxy
4296+
if ratelimit_timeout > 0:
4297+
self.update_error_text_signal.emit(
4298+
f"Error for Portal: <b>Banned</b> {selected_proxy}"
4299+
)
4300+
self.temp_remove_proxy(selected_proxy) # Temp remove the proxy
42994301
elif "403 Forbidden" in res.text or "403: Forbidden" in res.text:
4300-
self.update_error_text_signal.emit(
4301-
f"Error for Portal: <b>403 Forbidden</b> {selected_proxy} <b>Blacklisted</b> or <b>ratelimited</b>"
4302-
)
4303-
self.temp_remove_proxy(selected_proxy) # Temp remove the proxy
4302+
if ratelimit_timeout > 0:
4303+
self.update_error_text_signal.emit(
4304+
f"Error for Portal: <b>403 Forbidden</b> {selected_proxy} <b>Blacklisted</b> or <b>ratelimited</b>"
4305+
)
4306+
self.temp_remove_proxy(selected_proxy) # Temp remove the proxy
43044307
elif "Connection to server failed" in res.text:
43054308
# Track error count for the proxy
43064309
if selected_proxy not in self.proxy_error_counts:
@@ -4355,54 +4358,55 @@ class MacAttack(QMainWindow):
43554358
# elif "Failed to parse" in str(e):
43564359
# self.update_error_text_signal.emit("ERROR: error parsing the url")
43574360
elif "target machine actively refused it" in str(e):
4358-
# Track connection error counts
4359-
if selected_proxy not in self.proxy_error_connect_counts:
4360-
self.proxy_error_connect_counts[selected_proxy] = 1
4361-
else:
4362-
self.proxy_error_connect_counts[selected_proxy] += 1
4363-
if (
4364-
self.proxy_error_connect_counts[selected_proxy] > 20
4365-
): # Track error count for the proxy every # consecutive connection errors.
4366-
self.update_error_text_signal.emit(
4367-
f"Error for portal: <b>The target machine refused connection</b> {selected_proxy} Ratelimited?"
4368-
)
4369-
self.temp_remove_proxy(selected_proxy) # Temp remove the proxy
4370-
del self.proxy_error_connect_counts[selected_proxy]
4361+
if ratelimit_timeout > 0:
4362+
# Track connection error counts
4363+
if selected_proxy not in self.proxy_error_connect_counts:
4364+
self.proxy_error_connect_counts[selected_proxy] = 1
4365+
else:
4366+
self.proxy_error_connect_counts[selected_proxy] += 1
4367+
if (
4368+
self.proxy_error_connect_counts[selected_proxy] > 20
4369+
): # Track error count for the proxy every # consecutive connection errors.
4370+
self.update_error_text_signal.emit(
4371+
f"Error for portal: <b>The target machine refused connection</b> {selected_proxy} Ratelimited?"
4372+
)
4373+
self.temp_remove_proxy(selected_proxy) # Temp remove the proxy
4374+
del self.proxy_error_connect_counts[selected_proxy]
43714375

43724376
elif "Read timed out" in str(e):
43734377
logging.debug(f"{selected_proxy} did not respond")
4374-
4375-
# Track connection error counts
4376-
if selected_proxy not in self.proxy_error_connect_counts:
4377-
self.proxy_error_connect_counts[selected_proxy] = 1
4378-
else:
4379-
self.proxy_error_connect_counts[selected_proxy] += 1
4380-
if (
4381-
self.proxy_error_connect_counts[selected_proxy] > 20
4382-
): # Track error count for the proxy every # consecutive connection errors.
4383-
self.update_error_text_signal.emit(
4384-
f"Error for Proxy: <b>Read timed out</b> {selected_proxy} Overloaded proxy?"
4385-
)
4386-
self.temp_remove_proxy(selected_proxy) # Temp remove the proxy
4387-
del self.proxy_error_connect_counts[selected_proxy]
4378+
if ratelimit_timeout > 0:
4379+
# Track connection error counts
4380+
if selected_proxy not in self.proxy_error_connect_counts:
4381+
self.proxy_error_connect_counts[selected_proxy] = 1
4382+
else:
4383+
self.proxy_error_connect_counts[selected_proxy] += 1
4384+
if (
4385+
self.proxy_error_connect_counts[selected_proxy] > 20
4386+
): # Track error count for the proxy every # consecutive connection errors.
4387+
self.update_error_text_signal.emit(
4388+
f"Error for Proxy: <b>Read timed out</b> {selected_proxy} Overloaded proxy?"
4389+
)
4390+
self.temp_remove_proxy(selected_proxy) # Temp remove the proxy
4391+
del self.proxy_error_connect_counts[selected_proxy]
43884392

43894393
elif "Unable to connect to proxy" in str(e):
43904394
logging.debug(f"Unable to connect to {selected_proxy}")
4391-
4392-
# Could be bad internet, the proxy ratelimiting, or the proxy not connecting
4393-
# Track connection error counts
4394-
if selected_proxy not in self.proxy_error_connect_counts:
4395-
self.proxy_error_connect_counts[selected_proxy] = 1
4396-
else:
4397-
self.proxy_error_connect_counts[selected_proxy] += 1
4398-
if (
4399-
self.proxy_error_connect_counts[selected_proxy] > 20
4400-
): # Track error count for the proxy every # consecutive connection errors.
4401-
self.update_error_text_signal.emit(
4402-
f"Error for Proxy: <b>Proxy Timing out</b> {selected_proxy} Ratelimited?"
4403-
)
4404-
self.temp_remove_proxy(selected_proxy) # Temp remove the proxy
4405-
del self.proxy_error_connect_counts[selected_proxy]
4395+
if ratelimit_timeout > 0:
4396+
# Could be bad internet, the proxy ratelimiting, or the proxy not connecting
4397+
# Track connection error counts
4398+
if selected_proxy not in self.proxy_error_connect_counts:
4399+
self.proxy_error_connect_counts[selected_proxy] = 1
4400+
else:
4401+
self.proxy_error_connect_counts[selected_proxy] += 1
4402+
if (
4403+
self.proxy_error_connect_counts[selected_proxy] > 20
4404+
): # Track error count for the proxy every # consecutive connection errors.
4405+
self.update_error_text_signal.emit(
4406+
f"Error for Proxy: <b>Proxy Timing out</b> {selected_proxy} Ratelimited?"
4407+
)
4408+
self.temp_remove_proxy(selected_proxy) # Temp remove the proxy
4409+
del self.proxy_error_connect_counts[selected_proxy]
44064410

44074411
else: # Remove errorcounts
44084412
if selected_proxy in self.proxy_error_counts:

0 commit comments

Comments
 (0)