#!/bin/bash
#                       /usr/local/bin/web2as
#  http://crystalfaeries.net/posix/bin/web2as
# celeste:crystalfaery 2016-04-07 10:14:54+00:00
# Subject: Lookup autonomous systems of all outgoing http/s traffic
# http://www.commandlinefu.com/commands/view/16093/lookup-autonomous-systems-of-all-outgoing-https-traffic>

echo "AS___   | IP_Adress_______ | Autonomous_System_Name"_
ss -t -o state established '( dport = :443 || dport = :80 )' | grep tcp | awk '{ print $5 }' | sed s/:http[s]*//g | sort -u | netcat whois.cymru.com 43 | grep -v "AS Name" | sort -t'|' -k3



syntax highlighted by Code2HTML, v. 0.9.1