Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ASN support #495

Closed
atlassion opened this issue Jan 13, 2022 · 2 comments · Fixed by #562 or #568
Closed

ASN support #495

atlassion opened this issue Jan 13, 2022 · 2 comments · Fixed by #562 or #568
Assignees
Labels
Priority: Low This issue can probably be picked up by anyone looking to contribute to the project, as an entry fix Status: Completed Nothing further to be done with this issue. Awaiting to be closed. Type: Enhancement Most issues will probably ask for additions or changes.

Comments

@atlassion
Copy link

atlassion commented Jan 13, 2022

Add function Whois from files IPASN.DAT, asn.json like
pyasn : https://github.com/hadiasghari/pyasn/

Example for python:
pyasn_util_asnames.py > asn.json; pyasn_util_download.py -4; rib=$(ls -t rib.*.bz2 | head -1); pyasn_util_convert.py --single $rib IPASN.DAT; rm -f $rib

import pyasn
asndb = pyasn.pyasn('IPASN.DAT',as_names_file='asn.json')
#whois
asn,cidr = asndb.lookup(ipaddrr)
asn_name = asndb.get_as_name(asn)
Who = f"{cidr} AS{asn} {asn_name}"
print(Who)

ip google for example:

[142.250.187.206 142.250.0.0/15 AS15169 GOOGLE, US]

@atlassion atlassion added the Type: Enhancement Most issues will probably ask for additions or changes. label Jan 13, 2022
@atlassion atlassion changed the title Function Whois from files Whois Function from files Jan 13, 2022
@ehsandeep ehsandeep changed the title Whois Function from files ASN support Mar 24, 2022
@ehsandeep ehsandeep added the Priority: Low This issue can probably be picked up by anyone looking to contribute to the project, as an entry fix label Mar 24, 2022
@ehsandeep
Copy link
Member

Suggested or similar maintained FOSS library/project can be used to process ASN information passively on IP data of httpx.

echo google.com | httpx -asn -silent
https://google.com [AS15169, GOOGLE, 172.217.0.0/16,142.250.0.0/15]
echo google.com | httpx -asn -silent -json

{
  "timestamp": "2022-03-24T18:10:53.615425+05:30",
  "scheme": "https",
  "port": "443",
  "path": "/",
  "a": [
    "172.217.167.174",
    "2404:6800:4009:828::200e"
  ],
  "url": "https://google.com:443",
  "input": "google.com",
  "location": "https://www.google.com/",
  "title": "301 Moved",
  "webserver": "gws",
  "content-type": "text/html",
  "method": "GET",
  "host": "172.217.167.174",
  "content-length": 220,
  "status-code": 301,
  "response-time": "2.315970917s",
  "failed": false,
  "hashes": {
    "body-md5": "276bbb20c29087e88db63899fd8f9129",
    "body-mmh3": "1084612514",
    "body-sha256": "5b61b0c2032b4aa9519d65cc98c6416c12415e02c7fbbaa1be5121dc75162edb",
    "body-simhash": "17956186510721919950",
    "header-md5": "f1b695a12720378ef999aaad48a3f70e",
    "header-mmh3": "-1328090999",
    "header-sha256": "7a44ce25915213e28972a12c9ad2a25ed39fd19000a34d8538252efa4611d8f8",
    "header-simhash": "9814089188539869125"
  },
  "asn": {
    "as-number": "AS15169",
    "as-name": "Gogole",
    "as-country": "US",
    "as-range": [
    "172.217.0.0/16",
    "142.250.0.0/15"
  ]
  },
  "lines": 7,
  "words": 9
}

@LuitelSamikshya LuitelSamikshya self-assigned this Mar 31, 2022
@LuitelSamikshya LuitelSamikshya added the Status: In Progress This issue is being worked on, and has someone assigned. label Mar 31, 2022
@LuitelSamikshya LuitelSamikshya linked a pull request Apr 1, 2022 that will close this issue
@ehsandeep ehsandeep added Status: Completed Nothing further to be done with this issue. Awaiting to be closed. and removed Status: In Progress This issue is being worked on, and has someone assigned. labels Apr 7, 2022
@ehsandeep ehsandeep linked a pull request Apr 8, 2022 that will close this issue
@ehsandeep
Copy link
Member

@atlassion, this is now supported in the latest release, thanks for the feature request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: Low This issue can probably be picked up by anyone looking to contribute to the project, as an entry fix Status: Completed Nothing further to be done with this issue. Awaiting to be closed. Type: Enhancement Most issues will probably ask for additions or changes.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants