Skip to main content

Quickstart

About IP Intel

Pangea’s IP Intel service enables your app to add IP monitoring capabilities, helping to enhance its security and usability. Some of these capabilities include tracking IP address reputations, domains, geolocation data, and more.

Configuring the IP Intel service

These steps are a basic outline of how to configure IP Intel in order to begin integrating the service with your application. For more in-depth information and a complete set of step-by-step instructions, refer to our configuration guide.

  1. Navigate to the Pangea User Console .
  2. Sign up to Pangea. As part of the sign up process, an Organization and initial token will be created.
  3. Configure the token for use with the Intel service. For more information, go to Get Started with Intel.
  4. Set any desired settings in the Intel Settings page.

Add IP Intel to your app

The steps below will walk you through the basics of integrating IP Intel with a Python app, including a completed code sample for getting started with geolocation of IP addresses. For a more in-depth explanation of the sample app, you can visit our Python SDK.

Set your environment variables

Before starting to code, it is necessary to export your token and domain variables to your project if you have not already added them to your environment.

  1. Open up a bash terminal window.
  2. Type the following commands, replacing 'yourServiceDomain' and 'yourAccessToken' with your Domain and Default Token copied from the IP Intel page in the Pangea User Console.
export PANGEA_DOMAIN="yourServiceDomain"
export PANGEA_INTEL_TOKEN="yourAccessToken"

Writing the IP Intel code

  1. In order to be ready to code, you must first install the Pangea SDK. To add the Pangea Python SDK to your project, you will need to run one of the following commands in your project root directory based on your preferred installation method.

Install SDK via Pip:

pip3 install pangea-sdk

or

Install SDK via Poetry:

poetry add pangea-sdk
  1. Next, import the Pangea libraries into your code.
import os
import pangea.exceptions as pe
from pangea.config import PangeaConfig
from pangea.services import IpIntel
  1. The following loads the client configuration while adding the token and domain from your environment variables so you can authenticate with Pangea. You can read more about how Pangea uses tokens on our Getting Started page.
token = os.getenv("PANGEA_INTEL_TOKEN")
assert token
domain = os.getenv("PANGEA_DOMAIN")
assert domain
config = PangeaConfig(domain=domain)
intel = IpIntel(token, config=config)
  1. Once the environment is configured, run the geolocation service and indicate which IP addresses to use, separated by commas.
def main():
    print("Geolocate IP...")

    try:
        response = intel.geolocate_bulk(ips=["93.231.182.110", "24.235.114.61"], verbose=True, raw=True)
        print("Result:")
        for ip, data in response.result.data.items():
            print(f"\tIP: {ip}")
            print(f"\t\tCountry: {data.country}")
            print(f"\t\tCity: {data.city}")
            print(f"\t\tLatitude: {data.latitude}")
            print(f"\t\tLongitude: {data.longitude}")
            print(f"\t\tPostal_code: {data.postal_code}")
            print(f"\t\tCountry_code: {data.country_code}")
    except pe.PangeaAPIException as e:
        print(e)

Completed code

The code sample below is a usable, copy & paste resource for this application that will work on its own. For best results, be sure to edit placeholder IP addresses in the request with your own, and experiment with IP Intel configuration in your Pangea User Console to explore more of its capabilities.

import os

import pangea.exceptions as pe
from pangea.config import PangeaConfig
from pangea.services import IpIntel

token = os.getenv("PANGEA_INTEL_TOKEN")
assert token
domain = os.getenv("PANGEA_DOMAIN")
assert domain
config = PangeaConfig(domain=domain)
intel = IpIntel(token, config=config)


def main():
    print("Geolocate IP...")

    try:
        response = intel.geolocate_bulk(ips=["93.231.182.110", "24.235.114.61"], verbose=True, raw=True)
        print("Result:")
        for ip, data in response.result.data.items():
            print(f"\tIP: {ip}")
            print(f"\t\tCountry: {data.country}")
            print(f"\t\tCity: {data.city}")
            print(f"\t\tLatitude: {data.latitude}")
            print(f"\t\tLongitude: {data.longitude}")
            print(f"\t\tPostal_code: {data.postal_code}")
            print(f"\t\tCountry_code: {data.country_code}")
    except pe.PangeaAPIException as e:
        print(e)


if __name__ == "__main__":
    main()

Improving your app

The purpose of this guide is to provide the minimum steps required to demonstrate the IP Intel service. However, there are additional features that can be added to this process, such as identifying IPs that have a proxy or VPN setup to circumnavigate your site preferences. IP Intel can also be integrated with other Pangea services, such as storing IP addresses and their reputations in your app's Secure Audit Log. Read more about the capabilities on our IP Intel Overview page.

Pangea has based Vault on years of experience building compliant enterprise applications. This service helps to ensure that builders have the necessary tools to meet the security needs of their application’s users.

Next steps

  • Check out our Admin Guide if you have a specific task you would like to complete
  • If you are feeling confident, you can browse our APIs or explore our Github repo, which has libraries for supported languages, SDKs, sample apps, etc.
  • For any questions, you can connect with our Pangea Slack for Builders

Was this article helpful?

Contact us