Last active
January 7, 2024 22:03
-
-
Save AnonymerNiklasistanonym/fe49b389ff1943424983c699860f5864 to your computer and use it in GitHub Desktop.
Block APEX LEGENDS servers that have package loss using Telekom internet in Germany
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env pwsh | |
# Block Apex Package Loss servers in Germany/EU with Telekom (Fiber!) | |
# Certain servers somehow give huge amounts of package loss without any reason or pattern. | |
# | |
# Other people with the same problem: | |
# - https://www.reddit.com/r/apexlegends/comments/siuiox/workaround_for_package_loss_when_using_telekom/ | |
# - https://www.youtube.com/watch?v=60z7LhHtIr8 | |
# Run this command if you can't execute any scripts | |
# > Set-ExecutionPolicy -ExecutionPolicy RemoteSigned | |
# When you get an 'object not found' close Apex and if ther error comes up again restart the PC | |
# If you only want to remove the rules run the script with the arguments "-CreateFirewallRules $false" | |
Param ( | |
[string]$FirewallRuleBaseName = "Apex Legends Block Package Loss Servers", | |
[bool]$CreateFirewallRules = $true, | |
[string[]]$PackageLossIpSubnets = @( | |
"23.109", # 51.116 (20.09.2023 - Trios), 6.84 (26.09.2023 - Ranked) | |
"31.204", # 158.56 (26.07.2023 - Ranked), 158.102 (27.07.2023 - Trios), 158.138 (26.07.2023 - Ranked) | |
"46.23", # 78.138 (26.07.2023 - Ranked), 78.142 (16.11.2023 - Mixtape), 78.141 (30.11.2023 - Mixtape), 78.174 (30.11.2023 - Mixtape), 78.143 (01.12.2023 - Mixtape), 78.190 (03.12.2023 - Mixtape), 78.160 (03.12.2023 - Mixtape), 78.222 (06.12.2023 - LTM) | |
"63.251", # 232.246 (04.11.2023 - Ranked) | |
"72.251", # 246.113 (26.07.2023 - Ranked), 246.72 (06.12.2023 - LTM) | |
"88.202", # 177.82 (15.08.2023 - Mixtape), 177.11 (10.12.2023 - Trios) | |
"95.179", # 205.60 (15.09.2023 - Trios) | |
"96.127", # 186.142 (15.09.2023 - Mixtape), 186.158 (30.11.2023 - Mixtape) | |
"108.181", # 125.95 (15.09.2023 - Ranked), 126.170 (16.09.2023 - Ranked), 126.49 (23.09.2023 - Ranked), 126.59 (10.12.2023 - Trios) | |
"172.107", # 237.166 (28.08.2023 - Ranked) | |
"172.255", # 5.236 (02.10.2023 - Ranked) | |
"185.169", # 196.190 (13.08.2023 - Ranked), 197.158 (26.07.2023 - Ranked) | |
"185.212", # 201.170 (27.07.2023 - Ranked) | |
"185.225", # 208.16 (13.08.2023 - Ranked), 208.219 (10.09.2023 - Ranked), 208.45 (27.09.2023 - Ranked), 208.218 (26.11.2023 - 3 Strikes), 208.212 (26.11.2023 - 3 Strikes), 209.13 (01.12.2023 - Trios), 208.8 (09.12.2023 - LTM) | |
"185.251", # 117.190 (27.07.2023 - Trios) | |
"194.126" # 172.42 (26.11.2023 - 3 Strikes) | |
## OLD | |
## 2023.03 > Control | |
#"23.90.144", | |
## 2022.07 (https://www.youtube.com/watch?v=60z7LhHtIr8) | |
#"23.109.0", | |
## 2023.02 > BR (Pubs) | |
#"31.204.158", | |
## Unknown (before 2023.02) | |
#"46.23.78", | |
#"85.225.209", | |
## 2022.07 (https://www.youtube.com/watch?v=60z7LhHtIr8), 2023.04 > TDM | |
#"88.202.177", | |
## 2023.02 > TDM | |
#"95.172.83", | |
## 2023.03 > Gun Run | |
#"96.127.186", | |
## 2023.04 > TDM | |
#"107.6.162", | |
## 2023.06 > Control | |
#"107.6.163" | |
## 2022.07 (https://www.youtube.com/watch?v=60z7LhHtIr8) | |
#"109.123.102", | |
## Unknown (before 2023.02) | |
#"172.107.98", | |
## 2023.03 > Control & TDM | |
#"172.107.225", | |
## 2023.03 > BR | |
#"172.107.237", | |
#"172.107.244", | |
## 2022.07 (https://www.youtube.com/watch?v=60z7LhHtIr8) | |
#"172.255.13", | |
## 2023.04 > BR | |
#"172.107.225", | |
## 2023.03 > TDM | |
#"185.80.220", | |
## 2023.03 > BR | |
#"185.169.196", | |
## 2022.07 (https://www.youtube.com/watch?v=60z7LhHtIr8) | |
#"185.225.208", | |
#"185.225.209", | |
## 2023.02 > BR | |
#"185.169.196", | |
#"185.169.197", | |
#"185.169.199", | |
#"185.212.201", | |
#"185.212.202", | |
## Unknown (before 2023.02) | |
#"185.225.208", | |
#"185.225.209", | |
## 2023.02 > BR | |
#"185.251.117", | |
#"185.251.118", | |
## 2023.05 > TDM | |
#"198.20.101", | |
## 2023.04 > Gun Run | |
#"198.20.109", | |
## 2023.05 > Gun Run | |
#"198.20.114" | |
) | |
) | |
# Stop script on error | |
$ErrorActionPreference = "Stop" | |
# Check if script is run with admin privilidges | |
if (-Not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) { | |
Throw "Not running script as administrator!" | |
} | |
# Create a list of all IPs to be blocked | |
$PackageLossIps = [string[]] @() | |
foreach ($PackageLossIpSubnet in $PackageLossIpSubnets) { | |
# Blocks the whole subnet range x.y.0.0 -> x.y.255.255 | |
$PackageLossIps += "$PackageLossIpSubnet.0.0/16" | |
} | |
# Add an inbound and outbound firewall rule for all these IPs | |
$RuleConfigs = [string[]] @("inbound", "outbound") | |
foreach ($RuleConfig in $RuleConfigs) { | |
$FirewallRuleName = "$FirewallRuleBaseName ($RuleConfig)" | |
try { | |
Write-Output "Try to remove existing firewall rule '$FirewallRuleName'" | |
Remove-NetFirewallRule -DisplayName $FirewallRuleName | |
} catch { | |
Write-Output "Found no existing firewall rule '$FirewallRuleName'" | |
} | |
if ($CreateFirewallRules) { | |
Write-Output "Try to add new firewall rule '$FirewallRuleName' (blocks the IPs: $PackageLossIpSubnets)" | |
try { | |
New-NetFirewallRule -DisplayName $FirewallRuleName -Direction $RuleConfig -RemoteAddress $PackageLossIps -Profile Any -Action Block | |
} catch { | |
Throw "Unable to add firewall rule! Try restarting your PC if an 'object not found' error was thrown (Error: $error)" | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# TODO maybe add later support for Linux | |
package_loss_ip_subnets=('23.109' '31.204') | |
for package_loss_ip_subnet in "${package_loss_ip_subnets[@]}" | |
do | |
iptables -A INPUT -s "$package_loss_ip_subnet.0.0/16" -j DROP | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment