Skip to content

Instantly share code, notes, and snippets.

@sasqwatch
Forked from gwen001/oasn.sh
Created August 18, 2020 04:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sasqwatch/e80504f7cb0487bc262084782c0e2587 to your computer and use it in GitHub Desktop.
Save sasqwatch/e80504f7cb0487bc262084782c0e2587 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