Last active
August 1, 2022 11:14
-
-
Save gwen001/55b1c8ceb006482983480eaa802d778f to your computer and use it in GitHub Desktop.
oneliner to retrieve AS Numbers of a company
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
(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