Skip to content

Retrieves ASN numbers for a given domain or organization name

Notifications You must be signed in to change notification settings

Vulnpire/getasn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 

Repository files navigation

getasn

is a simple Go tool that fetches ASN (Autonomous System Number) information from bgp.he.net for a given domain or organization name. It supports input from either stdin or a file and can output results in both standard and verbose modes.

Features

  • Domain and Organization Support: Automatically detects if the input is a domain or an organization name and performs the appropriate search.
  • Input Support: Accepts input via stdin or from a file.
  • Verbose Mode: Provides more detailed output when using the -v flag.

Installation

go install github.com/Vulnpire/getasn@latest

Usage

Fetch ASN for a domain via stdin:

$ echo "domain.tld" | getasn

Fetch ASN for an organization via stdin:

$ echo "organization_name" | getasn

Fetch ASN for multiple domains or organizations from a file:

$ cat urls.txt | getasn

Example

Standard mode:

$ echo "intigriti.com" | getasn

AS16509

Chain with other tools:

Convert domain names to org, get the IP ranges, and subdomains:

$ echo tesla.com | dtoconv | getasn | asnmap -silent | tlsx -san -cn -silent -resp-only

gp-zg.ericssonnikolatesla.com
dal11-gpgw1.tesla.com
93.179.67.13
autodiscover.tesla-sv.ru
mail.tesla-sv.ru
autoconfig.tesla-sv.ru
s3.b.smf11.tcs.tesla.com
x3-prod.obs.tesla.com
x3-eng.obs.tesla.com
teslamotors.com
solarcity.com
sg-1.solarcity.com
..SNIP..

Get the IP ranges of organizations and extract ports (or exposed services, CVEs, queries, etc.) from Shodan:

$ cat orgs.txt | getasn | asnmap -silent | sXtract -ir -q "port:(21 OR 3389 OR 1337 OR 5000 OR 8080)"

205.149.8.234
205.149.15.116
205.149.11.253
205.149.8.242
205.149.8.232
205.149.8.245
205.149.11.31
205.149.11.187
205.149.13.132
205.149.14.61
205.149.15.21
205.149.15.158
205.149.8.26

From a single org (or domain):

$ echo Tesla | getasn | asnmap -silent | sXtract -ir -q "200 OK"

image

Automation:

Using the tool with Axiom

$ cat ~/.axiom/modules/asnrecon.json

[{
        "command":"cat input | dtoconv | getasn | asnmap -silent | tlsx -san -cn -silent -resp-only | anew output",
        "ext":"txt"
}]

Getting IP addresses using Axiom

$ cat ~/.axiom/modules/asnrecon-ips.json

[{
        "command":"cat input | dtoconv | getasn | asnmap -silent | sXtract | anew output",
        "ext":"txt"
}]

About

Retrieves ASN numbers for a given domain or organization name

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages