Repository navigation
new: [expansion] ipapi.is lookup module - #927
Merged
Merged
Conversation
Member
|
Thank you. FYI, the documentation is generated from the JSON file per module. Feel free to add one. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds ipapi.is Lookup (
misp_modules/modules/expansion/ipapi_is.py), an expansion and hover module forip-srcandip-dstattributes. It queries the ipapi.is API and returnsmisp_standardresults:geolocationobject (country code, country, region, city, zip code, coordinates) thatlocatesthe attribute;asnobject (AS number, organisation, description, announced route, country) thatincludesit;ipapi-is-ipobject thatdescribesit: the detection flags that are set (VPN, proxy, Tor, datacenter, abuser, crawler, mobile, satellite, anycast), the VPN provider, type and last-seen time, the hosting provider, the crawler name, the company with its abuser score, the AS abuser score, the abuse contact and the registry.api_keyis optional. A free ipapi.is account gets 1,000 requests a day with the full response. Without a key the API answers 30 requests a day per IP address with location and network owner only. The module then returns just those, and the comment of theipapi-is-ipobject says the detection flags were not included, so a missing flag is not mistaken for a clean address.The key is sent in the JSON body of a POST request, never in the URL. Private and reserved addresses are rejected before any request is made. API errors (invalid key, quota, free tier exhausted, a bare 403) are returned as
{"error": ...}without retries; the timeout is 10 s.The
ipapi-is-iptemplate is proposed in MISP/misp-objects#541. Likeipgeolocation, the module carries the template's UUID, version, meta-category and description, and sets each attribute's type and correlation itself, so the object is accepted before a PyMISP release ships the template.Testing:
tests/test_ipapi_is.py: 38 pytest cases withrequests.postmocked: a full VPN exit response, the datacenter and Tor example from the ipapi.is docs, each flag on its own, the crawler name, an unknown location, keyless responses, a bogon, API and HTTP errors and a timeout, invalid input, the key in the JSON body and not in the URL, and nokeyfield without a key.poetry.lock) are clean.misp-modules, and I checked it by hand against the live API with and without a key.Docs: the entries in
documentation/README.md,documentation/mkdocs/expansion.mdanddocumentation/mkdocs/index.mdare thedocumentation/generate.pyoutput for this module; theREADME.mdline is added by hand like the others. The logo isdocumentation/logos/ipapi_is.png.Disclosure: I run ipapi.is.