Skip to content

Instantly share code, notes, and snippets.

@gwen001
Last active August 1, 2022 11:14
Show Gist options
  • Save gwen001/55b1c8ceb006482983480eaa802d778f to your computer and use it in GitHub Desktop.
Save gwen001/55b1c8ceb006482983480eaa802d778f to your computer and use it in GitHub Desktop.
oneliner to retrieve AS Numbers of a company
(ls /tmp/GeoLite2-ASN-CSV.zip||wget --quiet -P /tmp "https://geolite.maxmind.com/download/geoip/database/GeoLite2-ASN-CSV.zip") 2>&1|grep X; unzip -c /tmp/GeoLite2-ASN-CSV.zip|grep -i airbnb|cut -d ',' -f 2|sort -fu
amass intel -org paypal | cut -d ',' -f 1
output:
133850
137437
206695
206704
394941
395762
54229
function oasn {
# asn
grep -i $1 /home/gwen/Security/tools/Discovery/Ip/asnlookup/GeoLite2-ASN-Blocks-IPv4.csv | cut -d "," -f 2 | sort -fu
}
function oasnr {
# ip ranges
grep -i $1 /home/gwen/Security/tools/Discovery/Ip/asnlookup/GeoLite2-ASN-Blocks-IPv4.csv | cut -d "," -f 1 | sort -fu
}
ALTERNATIVES:
@_harleo
github.com/harleo/asnip
@dustyfresh
amass intel -org airbnb | cut -d \, -f1 | while read asn; do whois -h http://whois.radb.net -- "-i origin AS$asn" | grep 'route:'; done | awk {'print $2'} | xargs masscan -p 80,443,20-25,3389
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment