How to find company name by IPv4 or IPv6 using RIPE DB API

Hello!,
awfully sorry if my post is off-topic,
please, would you kindly advise, if/how is it possible to determine Company name having it’s IP/range through the RIPE API?

I tried this: http://rest.db.ripe.net/search.json?query-string=212.166.147.0&flags=no-filtering
it nearly works, but not 100%: there may be organization name in either of “netname”, “org-name”, “org”, but sometimes i’m getting responses without any of them, with only “desc” field. (It may gravely complicate parsing logic, at least, apart from my doubts if i’m on correct curve at all).

Is there some straightforward way to get the organization name by IP ? F.e. i have smarthone, it’s IP and want to find out which mobile operator gave this IP at the moment and place?

Sorry once again, i used whois many times, but now need to go deeper…

1 Like

Hello,
You’re on the right track, the “org:” reference in an inetnum or inet6num object points to an organisation object, which contains an “org-name:” attribute with the organisation’s name.
By default when you search the RIPE database, the referenced organisation is always returned. If there is no “org:” reference then you must perform a less-specific query (i.e. with the flags=L query parameter), and find the closest-matching inetnum or inet6num with an “org:” reference.
For more complete documentation about the RIPE DB REST API, have a look on GitHub:

If you want to include address space that’s not in the RIPE database, then I suggest you use the RDAP API:

Which will also return a reference to the organisation and will redirect to the authoritative RIR.
For example: https://rdap.db.ripe.net/ip/212.166.147.0
And then follow the “registrant” beginning with “ORG-” which references the organisation to:
https://rdap.db.ripe.net/entity/ORG-AMS1-RIPE
Hope this helps.
Regards,
Ed Shryane
RIPE NCC

3 Likes

Hi Ed,

many thanks!, I will try the RDAP, seem to be an interesting option for my task

i also tried to use ‘resource-holder=true’ Q-param,
f.e.: http://rest.db.ripe.net/search.json?query-string=45.86.0.3&resource-holder=true&type-filter=inetnum

it adds smt, looking as what i need:
“resource-holder”: {
“key”: “ORG-TDG1-RIPE”,
“name”: “Telekom Deutschland GmbH”
}

and for getting the correct RIR i use: statDB rir method, like:
https://stat.ripe.net/data/rir/data.json?resource=200.3.12.0/22

it returns: an obj like:
“rirs”: [
{
“rir”: “RIPE NCC”,
“first_time”: “2022-12-19T00:00:00”,
“last_time”: “2022-12-19T00:00:00”
}

IDK, if i’m correctly use the API, these two are just experimental findings, but seems works so far

2 Likes

To find a company name by IPv4 or IPv6 using the RIPE Database API, you can use the following steps:

  1. Determine the IPv4 or IPv6 address that you want to look up.
  2. Use the RIPE Database API to send a query for the IP address. The API supports a variety of query formats, including HTTP, REST, and Whois. Here is an example of a REST API query:

https://rest.db.ripe.net/search.json?query-string=&flags=no-filtering&source=RIPE


Replace `<ip address>` with the IPv4 or IPv6 address that you want to [look](https://www.handy-reparatur-berlin.com/iphone.html) up.

3. Parse the response from the API to extract the company name. The response will include a variety of information about the IP address, including the company name or organization that is associated with it. The specific field that contains this information may vary depending on the query format and API version.

Here is an example of a response from the REST API query:
{
    "objects": [
        {
            "source": "RIPE",
            "type": "inetnum",
            "primary-key": "193.0.0.0 - 195.255.255.255",
            "attributes": [
                {
                    "name": "netname",
                    "value": "EU-ZZ-193-194-195"
                },
                {
                    "name": "descr",
                    "value": "EU Administrative Contact"
                },
                {
                    "name": "org",
                    "value": "ORG-CA1-RIPE"
                },
                {
                    "name": "country",
                    "value": "EU"
                },
                {
                    "name": "admin-c",
                    "value": "CREW-RIPE"
                }
            ]
        }
    ],
    "terms-and-conditions": "https://www.ripe.net/db/support/db-terms-conditions.pdf"
}

In this example, the `org` attribute contains the name of the organization associated with the IP address. So, In case if you need more help you can place below a comment with my mentioned name. I will check it and ans you ASAP!
1 Like

you can determine the IPv4 or IPV6 address that you need look up and hopefully it will be resolved…

you can determine the IPv4 or IPV6 address that you need look up and hopefully it will be resolved…….

Does it works ?

Have you considered exploring other APIs or methods besides the RIPE API for obtaining organization names associated with an IP address? If so, what alternatives have you explored or considered?

The URL you provided seems to be a valid attempt to retrieve information from the RIPE database. However, as you’ve noticed, the organization name may appear in different fields such as “netname,” “org-name,” “org,” or “desc.”

You’ve already attempted to query the RIPE API using the following URL: http://rest.db.ripe.net/search.json?query-string=212.166.147.0&flags=no-filtering.
As you mentioned, the organization name might be present in fields like “netname”, “org-name”, “org”, or “desc”.

  • You'll need to parse the JSON response and check these fields for the organization name.
    
  • If none of these fields contain the organization name, you might need to consider additional fields or fallback options.
    

Since the response structure can vary, you’ll need to handle different cases in your parsing logic. This may involve checking for the presence of each possible field and extracting the relevant information accordingly.