Skip to content

Instantly share code, notes, and snippets.

View andresperezl's full-sized avatar

Andres Perez andresperezl

View GitHub Profile
@andresperezl
andresperezl / trackers-resolvs.rb
Last active September 5, 2018 02:03 — forked from anonymous/trackers-resolvs.rb
Little script that you feed a list of trackers and will eliminate the duplicates that point to the same IP addresses and try to group the trackers by domain name.
require 'uri'
require 'resolv'
text = File.open("trackers.txt").read.split(/\n|(\r\n)/)
hosts = text.map{ |uri| [URI(uri).host, uri] }.to_h
resolvs = {}
hosts.each do |h, uri|
if /\d+\.\d+\.\d+\.\d+/.match(h)
resolvs[h] = h