Advertisement
Sweetening

block tor nodes powershell

Jan 21st, 2024
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. # Download a list of Tor exit nodes
  2. Invoke-WebRequest -Uri "https://check.torproject.org/exit-addresses" -OutFile "$env:TEMP\tor-exit-nodes.txt"
  3.  
  4. # Extract IP addresses from the file
  5. $torIPs = Get-Content "$env:TEMP\tor-exit-nodes.txt" | Select-String -Pattern "ExitAddress" | ForEach-Object { $_.ToString().Split(" ")[1] }
  6.  
  7. # Create firewall rules to block Tor exit nodes
  8. foreach ($ip in $torIPs) {
  9. New-NetFirewallRule -DisplayName "Block Tor - $ip" -Direction Inbound -Action Block -RemoteAddress $ip
  10. New-NetFirewallRule -DisplayName "Block Tor - $ip" -Direction Outbound -Action Block -RemoteAddress $ip
  11. }
  12.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement