Last active
November 9, 2018 08:04
-
-
Save emad-elsaid/8743f3a7acefa6ea3a41cc19c57e9ec6 to your computer and use it in GitHub Desktop.
this shows you the connections from your machine to the outside world and where every connection leads to, the company that owns this IP and which country is it
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 ruby | |
require 'json' | |
ips = `ss -4 | awk '// { print($6) }' | cut -d':' -f1`.lines.map(&:strip).uniq | |
markers = [] | |
ips.each do |ip| | |
info = `curl -s ipinfo.io/#{ip}` | |
json = JSON.parse(info) | |
if if json.key?('loc') | |
puts "#{ip} -> #{json["org"]} in #{json["city"]} #{json["region"]} - #{json["country"]}" | |
longlat = json["loc"].to_s.split(",").reverse.join(";") | |
markers << [json['org'], longlat].join(';') | |
end | |
end | |
params = markers.map { |marker| 'm=' + marker }.join('&') | |
puts "https://olanod.github.io/do-map/?#{params}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment