Skip to content

Commit

Permalink
customise ipasn service
Browse files Browse the repository at this point in the history
Add a `custom_api` configuration parameter to allow for customisation of the [IPASN-History](https://github.com/D4-project/IPASN-History) instance queried.

Default use of `https://ipasnhistory.circl.lu/` is preserved.
  • Loading branch information
DocArmoryTech authored Feb 20, 2025
1 parent 625bc68 commit 2dded40
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion misp_modules/modules/expansion/ipasn.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
'input': 'An IP address MISP attribute.',
'output': 'Asn object(s) objects related to the IP address used as input.',
}
moduleconfig = [
"custom_api"
]


def parse_result(attribute, values):
Expand Down Expand Up @@ -53,7 +56,9 @@ def handler(q=False):

toquery = request['attribute']['value']

ipasn = IPASNHistory()
ipasn_url = request["config"].get("custom_api") or "https://ipasnhistory.circl.lu/"

ipasn = IPASNHistory(root_url=ipasn_url)
values = ipasn.query(toquery)

if not values:
Expand All @@ -67,4 +72,5 @@ def introspection():


def version():
moduleinfo["config"] = moduleconfig
return moduleinfo

0 comments on commit 2dded40

Please sign in to comment.