Skip to content

Commit

Permalink
chore: implement requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
leon-schmid committed Sep 27, 2024
1 parent 98e27ae commit 66c50f3
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 37 deletions.
4 changes: 2 additions & 2 deletions admyral/actions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
virus_total_analyze_domain,
virus_total_analyze_ip,
virus_total_analyze_url,
abuseipdb_check_ip,
abuseipdb_analyze_ip,
)
from admyral.actions.integrations.cases import (
create_jira_issue,
Expand Down Expand Up @@ -116,5 +116,5 @@
"list_commit_history_for_pull_request",
"list_review_history_for_pull_request",
"compare_two_github_commits",
"abuseipdb_check_ip",
"abuseipdb_analyze_ip",
]
4 changes: 2 additions & 2 deletions admyral/actions/integrations/enrich/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
virus_total_analyze_ip,
virus_total_analyze_url,
)
from admyral.actions.integrations.enrich.abuseipdb import abuseipdb_check_ip
from admyral.actions.integrations.enrich.abuseipdb import abuseipdb_analyze_ip

__all__ = [
"alienvault_otx_analyze_domain",
Expand All @@ -17,5 +17,5 @@
"virus_total_analyze_domain",
"virus_total_analyze_ip",
"virus_total_analyze_url",
"abuseipdb_check_ip",
"abuseipdb_analyze_ip",
]
6 changes: 4 additions & 2 deletions admyral/actions/integrations/enrich/abuseipdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def get_abuseipdb_client(api_key: str) -> Client:
description="Check an IP address using AbuseIPDB",
secrets_placeholders=["ABUSEIPDB_SECRET"],
)
def abuseipdb_check_ip(
def abuseipdb_analyze_ip(
ip_address: Annotated[
str,
ArgumentMetadata(
Expand All @@ -45,6 +45,8 @@ def abuseipdb_check_ip(
),
] = 30,
) -> JsonValue:
# https://docs.abuseipdb.com/#check-endpoint

secret = ctx.get().secrets.get("ABUSEIPDB_SECRET")
api_key = secret["api_key"]
with get_abuseipdb_client(api_key) as client:
Expand All @@ -57,4 +59,4 @@ def abuseipdb_check_ip(
params["maxAgeInDays"] = max_age_in_days
response = client.get("/check", params=params)
response.raise_for_status()
return response.json()
return response.json().get("data", {})
4 changes: 2 additions & 2 deletions docs/pages/integrations/abuseipdb/abuseipdb.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
| --------- | --------------------------- |
| `api_key` | Paste your **API Key** here |

Alternatively, you can use the following CLI command structure:
7. Click on the **Save** button.

6. Click on the **Save** button.
Alternatively, you can use the following CLI command structure:

```bash
admyral secret set abuseipdb_secret --value api_key=your_key_value
Expand Down
56 changes: 27 additions & 29 deletions docs/pages/integrations/abuseipdb/apis/check_ip.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Retrieve detailed information about the reputation of a specific IP address.
**SDK Import:**

```python
from admyral.actions import abuseipdb_check_ip
from admyral.actions import abuseipdb_analyze_ip
```

## Arguments:
Expand All @@ -36,7 +36,7 @@ A JSON object.
## SDK Example

```python
result = abuseipdb_check_ip(
result = abuseipdb_analyze_ip(
ip_address="118.25.6.39",
verbose="yes",
max_age_in_days=90
Expand All @@ -52,32 +52,30 @@ Typical successful response:

```json
{
"data": {
"ipAddress": "118.25.6.39",
"isPublic": true,
"ipVersion": 4,
"isWhitelisted": false,
"abuseConfidenceScore": 100,
"countryCode": "CN",
"countryName": "China",
"usageType": "Data Center/Web Hosting/Transit",
"isp": "Tencent Cloud Computing (Beijing) Co. Ltd",
"domain": "tencent.com",
"hostnames": [],
"isTor": false,
"totalReports": 1,
"numDistinctUsers": 1,
"lastReportedAt": "2018-12-20T20:55:14+00:00",
"reports": [
{
"reportedAt": "2018-12-20T20:55:14+00:00",
"comment": "Dec 20 20:55:14 srv206 sshd[13937]: Invalid user oracle from 118.25.6.39",
"categories": [18, 22],
"reporterId": 1,
"reporterCountryCode": "US",
"reporterCountryName": "United States"
}
]
}
"ipAddress": "118.25.6.39",
"isPublic": true,
"ipVersion": 4,
"isWhitelisted": false,
"abuseConfidenceScore": 100,
"countryCode": "CN",
"countryName": "China",
"usageType": "Data Center/Web Hosting/Transit",
"isp": "Tencent Cloud Computing (Beijing) Co. Ltd",
"domain": "tencent.com",
"hostnames": [],
"isTor": false,
"totalReports": 1,
"numDistinctUsers": 1,
"lastReportedAt": "2018-12-20T20:55:14+00:00",
"reports": [
{
"reportedAt": "2018-12-20T20:55:14+00:00",
"comment": "Dec 20 20:55:14 srv206 sshd[13937]: Invalid user oracle from 118.25.6.39",
"categories": [18, 22],
"reporterId": 1,
"reporterCountryCode": "US",
"reporterCountryName": "United States"
}
]
}
```

0 comments on commit 66c50f3

Please sign in to comment.