> For the complete documentation index, see [llms.txt](https://docs.panther.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.panther.com/ko/enrichment/ipinfo.md).

# IPinfo

## 개요

Panther는 다음과 파트너십을 맺었습니다 [IPinfo](https://ipinfo.io/), IP 주소 데이터의 신뢰할 수 있는 출처인 곳과 협력하여 Panther 고객에게 통합 IP 관련 보강 정보를 제공합니다.

Panther 디택션에서 IPinfo 보강 데이터를 사용하여 오탐 알러트를 줄이는 방법:

* 의심스러운 사용자의 현재 IP 지리 위치 세부 정보를 교차 검토하여 프로필 정보의 불일치를 찾아내고 차단합니다.
* 고위험 위치 또는 네트워크에서 오는 트래픽이 도달하기 전에 미리 식별하고 차단합니다.
* 보안 위험을 초래할 수 있는 대상과 관련된 다른 엔터티를 정확하고 신뢰성 있게 찾아냅니다.

IPinfo 데이터 세트는 모든 Panther 계정에서 추가 비용 없이 사용할 수 있으며 기본적으로 비활성화되어 있습니다. 방법 알아보기 [저장된 enrichment 데이터를 여기에서 보기](/ko/enrichment.md#viewing-and-managing-enrichments), 그리고 방법 [보강 데이터가 포함된 로그 이벤트를 여기에서 확인하세요](/ko/enrichment.md#viewing-log-events-with-enrichment-data).

### IPinfo 작동 방식

알러트 이벤트는 다음 내에서 IPinfo 데이터로 자동 보강됩니다: `p_enrichment` JSON 이벤트의 필드.

IPinfo 데이터는 다음을 사용하여 디택션에서 액세스할 수 있습니다 [사전 구축된 Python 헬퍼](#available-methods) (및 [`deep_get`](/ko/detections/rules/python/globals.md#deep_get)).

[IPinfo 데이터 세트](#ipinfo-datasets) 는 대량으로 보강 테이블로 저장되므로, 디택션 로직이나 알러트에서 이 보강 정보를 활용하기 위해 API 호출을 할 필요가 없습니다.

IPinfo의 데이터는 하루에 한 번 업데이트됩니다.

### IPinfo 데이터 세트

IP 주소에 대한 맥락 정보를 추가하는 IPinfo의 데이터 유형은 세 가지입니다:

* [지리 위치 데이터](https://ipinfo.io/developers/data-types#geolocation-data)
* [ASN 데이터](https://ipinfo.io/developers/data-types#asn-data)
* [프라이버시 데이터](https://ipinfo.io/developers/data-types#privacy-data)

## IPinfo 데이터 세트 활성화 방법

CI/CD 워크플로를 사용 중이라면 다음을 참조하세요 [아래의 CI/CD 사용자 섹션](#ci-cd-users) 에서 추가 고려 사항을 확인하세요.

{% hint style="info" %}
Panther Console에서 Analyst 역할이 IPinfo 패키지를 보고 관리할 수 있도록 하려면 다음 권한이 할당되어야 합니다 **Lookups 보기** 그리고 **Lookups 관리** 권한.
{% endhint %}

IPinfo 보강을 활성화하려면:

1. Panther 콘솔의 왼쪽 탐색 표시줄에서 다음을 클릭합니다: **디택션.**
2. 다음을 클릭합니다: **디택션 팩** 탭.
   * 이 페이지에서 IPinfo에 사용할 수 있는 내장 팩을 볼 수 있습니다.
3. 활성화하려는 IPInfo 타일 오른쪽에서 토글을 클릭하여 팩을 활성화합니다.
4. 다음을 클릭합니다: **계속** 나타나는 대화 상자에서.

   <figure><img src="/files/06cca3535d9e3bf3ac0cbcef47546f365240cac6" alt=""><figcaption></figcaption></figure>

   * CI/CD를 통해 추가 변경을 하고 싶다면 다음을 사용하여 [Panther Analysis Tool (PAT)](/ko/panther/detections-repo/pat.md), 자세한 내용은 Panther 담당자에게 문의하세요.
5. IPinfo 데이터 세트가 활성화되었는지 확인하려면 왼쪽 사이드바 메뉴에서 다음을 클릭하세요 **구성** > **보강 제공자.**
   * 이 페이지에서 모든 보강 소스와 각 소스의 현재 활성화/비활성화 상태, 그리고 소스 데이터가 마지막으로 새로 고침된 시점을 확인할 수 있습니다.
   * 6개의 IPinfo 소스 테이블과 마지막으로 새로 고친 시간이 표시됩니다. 비활성화된 데이터 세트는 새로 고쳐지지 않습니다.

     * 해당 `ipinfo_asn` ,`ipinfo_location` 그리고 `ipinfo_privacy` 테이블은 디택션 엔진에서 실시간 조회에 사용됩니다.
     * 해당 `ipinfo_asn_datalake` , `ipinfo_location_datalake` 그리고 `ipinfo_privacy_datalake` 테이블은 데이터 레이크에서 IPinfo 데이터를 조회하고 조인하는 데 사용됩니다.

     <figure><img src="/files/ecdb9c2fa86fed0443ac435c91764e0911ed5484" alt=""><figcaption></figcaption></figure>

### CI/CD 사용자

CLI 워크플로에서 IPinfo 보강을 활성화하려면 다음을 참조하세요 [Panther Analysis Tool로 보강 관리](/ko/panther/detections-repo/pat/managing-enrichment.md) 가이드.

다음 고려 사항을 참고하세요:

* CI/CD 사용자는 IPinfo 테이블을 가져오기 위해 디택션 팩을 사용할 필요가 없습니다. 최신 릴리스를 가져와 [`panther-analysis`](https://github.com/panther-labs/panther-analysis) 을 가져와 `panther_analysis_tool` (PAT)를 사용하여 IPinfo 보강 정보를 업로드할 수 있습니다.
  * 다음을 사용하여 IPinfo 테이블을 활성화하려면 [`panther-analysis`](https://github.com/panther-labs/panther-analysis) 리포지토리에서 해당 YAML 구성 파일을 각각 열어 다음을 설정하세요 `enabled: true`.
* PAT를 사용하여 IPinfo 테이블을 사용자 지정하지 않는 한, CI/CD 사용자는 디택션 팩을 통해 IPinfo 보강을 활성화할 수 있습니다.
  * Panther Console에서 활성화한 후 PAT를 통해 IPinfo를 관리하려면 먼저 Panther Console에서 디택션 팩을 비활성화해야 합니다. Panther Console과 PAT를 동시에 사용하여 IPinfo를 관리하는 것은 지원되지 않습니다.
* IPinfo 보강 관리 방법에 대한 자세한 내용은 다음을 참조하세요 [Panther의 GitHub 리포지토리에 있는 IPinfo 파일](https://github.com/panther-labs/panther-analysis/tree/master/lookup_tables/ipinfo).

## 데이터 레이크에서 IPinfo 데이터를 조회하는 방법

데이터 레이크에는 IPinfo 테이블이 세 개 있습니다:

* `ipinfo_asn_datalake`
  * 참조 [IPinfo의 ASN API 문서](https://ipinfo.io/products/asn-api).
* `ipinfo_location_datalake`
  * 참조 [IPinfo의 IP 지리 위치 API 문서](https://ipinfo.io/products/ip-geolocation-api).
* `ipinfo_privacy_datalake`
  * 참조 [IPinfo의 프라이버시 디택션 API 문서](https://ipinfo.io/products/proxy-vpn-detection-api).

위의 각 테이블에는 다음도 있습니다 `<table>_history` 모든 변경 사항을 기록하는 테이블.

### 다음을 사용하여 `조인 키`

데이터 레이크에서 IPinfo 데이터를 조회할 때는 다음을 사용해야 합니다 `조인 키` 쿼리를 효율적으로 만들기 위해. 다음 사용자 정의 함수는 설정을 `조인 키` 더 쉽게 합니다:

* `PANTHER_LOOKUPS.PUBLIC.IPINFO_RANGE_TO_CIDR`
* `PANTHER_LOOKUPS.PUBLIC.IPINFO_TO_INT`
* `PANTHER_LOOKUPS.PUBLIC.IPINFO_TO_IP`
  * 참고: IPinfo의 코드 `TO_IP` 는 IPv4만 지원합니다.
* `PANTHER_LOOKUPS.PUBLIC.IPINFO_TO_JOIN_KEY`

예제를 [데이터 레이크를 조회하는 방법을 보여주는 예제 `조인 키` 아래](#example-query-the-data-lake-for-ipinfo-data-using-a-joinkey).

## 예시

### 예시: IPinfo 위치 데이터를 기반으로 한 알러트

이 예시에서는 예상치 못한 국가에서 수행된 AWS 콘솔 로그인마다 알러트를 발생시키는 룰을 만듭니다.

```python
def 룰(event):
    global ipinfo_location
    ipinfo_location = IPInfoLocation(event)
    match_field = ""
    if event.get("p_log_type") == "AWS.Cloudtrail":
        match_field = "sourceIPAddress"
    
    if event.get("eventname") == 'ConsoleLogin' and ipinfo_location.country(match_field) != "US":
        return True
    return False
```

### 예시: 다음을 사용하여 데이터 레이크에서 IPinfo 데이터를 조회 `조인 키`

IP를 조회하려면 `71.114.47.25`다음을 지정해야 합니다 `조인 키` 및 범위.

```sql
SELECT
   *
FROM
   panther_lookups.public.ipinfo_asn_datalake
WHERE 
   PANTHER_LOOKUPS.PUBLIC.IPINFO_TO_JOIN_KEY(joinkey) = PANTHER_LOOKUPS.PUBLIC.IPINFO_TO_JOIN_KEY('71.114.47.25')
   AND 
   PANTHER_LOOKUPS.PUBLIC.IPINFO_TO_INT('71.114.47.25') BETWEEN 
     PANTHER_LOOKUPS.PUBLIC.IPINFO_TO_INT(startip) 
       AND PANTHER_LOOKUPS.PUBLIC.IPINFO_TO_INT(endip)

```

다른 테이블과 조인하려면 위와 동일한 패턴을 따르되, 로그 테이블의 IP 주소를 사용하세요.

```sql
SELECT
   log.*, 
   ipinfo.* EXCLUDE (p_schema_version,p_event_time, p_parse_time,p_log_type,p_row_id,p_source_id,p_source_label)
FROM
   panther_logs.public.panther_audit log 
     LEFT OUTER JOIN panther_lookups.public.ipinfo_asn_datalake ipinfo
   ON (
     PANTHER_LOOKUPS.PUBLIC.IPINFO_TO_JOIN_KEY(joinkey) = PANTHER_LOOKUPS.PUBLIC.IPINFO_TO_JOIN_KEY(log.sourceIP)
     AND 
     PANTHER_LOOKUPS.PUBLIC.IPINFO_TO_INT(log.sourceIP) BETWEEN 
       PANTHER_LOOKUPS.PUBLIC.IPINFO_TO_INT(startip) AND PANTHER_LOOKUPS.PUBLIC.IPINFO_TO_INT(endip)
   )
WHERE
   p_occurs_since('1 day', log)
LIMIT 10
```

## IPinfo Python 헬퍼 함수 사용법 및 메서드

Panther는 실시간 디택션 엔진에서 IPInfo 데이터 사용을 간소화하기 위해 통합 헬퍼 함수를 제공합니다.

### Python 룰에서 IPinfo 객체 만들기

데이터 세트에서 관련 데이터를 반환하기 위해 호출할 수 있는 메서드를 가진 객체를 만드는 헬퍼 함수가 있습니다.

아래는 이러한 객체의 생성을 보여 주는 예제 코드 스니펫입니다:

{% code overflow="wrap" %}

```python
from panther_ipinfo_helpers import (IPInfoASN, IPInfoLocation, geoinfo_from_ip)

def 룰(event):
    global ipinfo_location
    global ipinfo_asn
    ipinfo_location = IPInfoLocation(event) 
    ipinfo_asn = IPInfoASN(event)
```

{% endcode %}

해당 `global` 키워드는 선언된 함수 외부에서 객체를 사용하려는 경우에만 필요합니다.

### IPinfo 객체에서 메서드 호출하기

IPinfo 데이터 세트의 다양한 구성 요소는 다음의 메서드를 통해 사용할 수 있습니다 `_location` 그리고 `_asn` 객체에서 사용할 수 있습니다. 룰이 처리하는 하나의 이벤트에 여러 필드(예: 네트워크 로그의 IP 주소, source 및 destination IP)가 있을 수 있습니다. IPInfo 객체를 호출할 때는 어떤 필드를 찾고 있는지 반드시 지정하세요.

아래 예시는 다음에서 모든 헬퍼 메서드를 호출하는 방법을 보여줍니다 `ipinfo_location` 그리고 `ipinfo_asn` 이전 예시에서 만든 객체를 사용하여 디택션의 룰에서 사용할 수 있는 모든 보강 정보를 가져옵니다.

```python
    match_field = ""
    if event.get("p_log_type") == "AWS.Cloudtrail":
        match_field = "sourceIPAddress"
    
    if ipinfo_location:
        city = ipinfo_location.city(match_field)
        country = ipinfo_location.country(match_field)
        latitude = ipinfo_location.latitude(match_field)
        longitude = ipinfo_location.longitude(match_field)
        postal_code = ipinfo_location.postal_code(match_field)
        region = ipinfo_location.region(match_field)
        region_code = ipinfo_location.region_code(match_field)
        timezone = ipinfo_location.timezone(match_field)
    
    if ipinfo_asn:
        asn = ipinfo_asn.asn(match_field)
        domain = ipinfo_asn.domain(match_field)
        name = ipinfo_asn.name(match_field)
        route = ipinfo_asn.route(match_field)
        asn_type = ipinfo_asn._type(match_field)
```

다음 예시는 다음을 사용합니다 `geoinfo_from_ip()` 지리 위치 정보가 포함된 딕셔너리를 반환하는 함수로, 형식은 다음과 동일합니다 `panther_oss_helper.geoinfo_from_ip()`단 다음은 제공하지 않습니다 `hostname` 그리고 `anycast` 필드.

```python
result = geoinfo_from_ip(event, "sourceIPAddress")
```

참조 중인 이벤트 필드가 배열인 경우, 헬퍼 함수는 일치하는 값의 배열을 반환합니다. 예를 들면:

```python
countries_of_all_ips = ipinfo_location.country('p_any_ip_addresses')
for country in countries_of_all_ips:
    if country == 'some unusual country':
        return True
```

### 사용 가능한 메서드

다음 표는 IPinfo Location, ASN 및 Privacy 객체의 사용 가능한 메서드, 설명, 그리고 예상 반환 값을 보여줍니다.

모든 메서드는 검색하려는 필드 인수를 받습니다.

#### 위치

<table><thead><tr><th width="185">Location 메서드</th><th width="152">반환 유형</th><th>예시</th></tr></thead><tbody><tr><td>city</td><td>문자열</td><td>"샌프란시스코"</td></tr><tr><td>country</td><td>문자열</td><td>"US"</td></tr><tr><td>latitude</td><td>문자열</td><td>"37.7812"</td></tr><tr><td>longitude</td><td>문자열</td><td>"-122.4614"</td></tr><tr><td>postal_code</td><td>문자열</td><td>"94118"</td></tr><tr><td>리전</td><td>문자열</td><td>"캘리포니아"</td></tr><tr><td>region_code</td><td>문자열</td><td>"CA"</td></tr><tr><td>timezone</td><td>문자열</td><td>"America/Los_Angeles"</td></tr><tr><td>context</td><td>객체</td><td><p>위의 모든 필드를 포함하고, 대문자로 시작하는 메서드 이름을 키로 사용하는 딕셔너리입니다. 예: {</p><p>"City":"샌프란시스코",<br>...</p><p>}</p></td></tr></tbody></table>

#### ASN

<table><thead><tr><th width="152">ASN 메서드</th><th width="137">반환 유형</th><th width="419">예시</th></tr></thead><tbody><tr><td>asn</td><td>문자열</td><td>"AS7018"</td></tr><tr><td>domain</td><td>문자열</td><td>"att.com"</td></tr><tr><td>이름</td><td>문자열</td><td>"AT&#x26;T Services, Inc."</td></tr><tr><td>route</td><td>문자열</td><td>"107.128.0.0/12"</td></tr><tr><td>유형</td><td>문자열</td><td>"isp"</td></tr><tr><td>context</td><td>객체</td><td><p>위의 모든 필드를 포함하고, 대문자로 시작하는 메서드 이름을 키로 사용하는 딕셔너리입니다. 예: {</p><p>"ASN":"AS7018",</p><p>"Domain" : "att.com",<br>...</p><p>}</p></td></tr></tbody></table>

#### 프라이버시

<table><thead><tr><th width="178.66666666666666">Privacy 메서드</th><th width="138">반환 유형</th><th>예시</th></tr></thead><tbody><tr><td>hosting</td><td>불리언</td><td>true</td></tr><tr><td>proxy</td><td>불리언</td><td>false</td></tr><tr><td>tor</td><td>불리언</td><td>true</td></tr><tr><td>vpn</td><td>불리언</td><td>false</td></tr><tr><td>relay</td><td>불리언</td><td>true</td></tr><tr><td>서비스</td><td>string</td><td>"NordVPN"</td></tr></tbody></table>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.panther.com/ko/enrichment/ipinfo.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
