Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python external bot support #347

Merged
merged 1 commit into from
Oct 13, 2023

Conversation

haseebrabbani
Copy link
Collaborator

first need to set FORTA_API_KEY env variable. example usage:

response = send_alerts([{
    "bot_id": "0x42265c815a3f2cc137bcd30f6688860ac0201911ce6006576b4b3e7f6e62ddc6",
    "finding": Finding({
        "name": f'haseeb python test {datetime.now()}',
        "description": "this is a python test",
        "alert_id": "HASEEB_PY_TEST_1",
        "type": FindingType.Exploit,
        "severity": FindingSeverity.Info,
        "labels": [
            Label({
              "entityType": EntityType.Address,
              "entity": "0x87fb424282bd043de413aa74153af073d8c9bbb5",
              "confidence": 0.95,
              "label": "Attackerrr",
              "metadata": {
                  "some": "data",
              },
            }),
            Label({
                "entityType": EntityType.Unknown,
                "entity": "bla",
                "confidence": 0.15,
                "label": "Hacker",
            }),
        ],
        "source": {
            "chains": [
                {
                    "chainId": 137,
                },
            ],
            "transactions": [
                {
                    'chainId': 137,
                    'hash': "0xcc8dedfbc2c2757e793ccc781746a8996658541885017314ced5138ae6009f26",
                },
                {
                    'chainId': 1,
                    'hash': "0x0ce941aae4eecdd1cae0fe4c90e8c3b14a84f346b669c60e654b2eecd736b9b6",
                },
            ],
        },
        "addresses": ["0x87fb424282bd043de413aa74153af073d8c9bbb5"],
        "metadata": {
            "chain": "137",
        },
        "uniqueKey": f'HASEEB-{datetime.now().timestamp()}',
        "timestamp": datetime.fromtimestamp(1694214981)
    })
}, {
    "bot_id":  "0x075384e577be5c17efdc6cec5e80b3f84fb5b40257d8ecdd8ab0a542f8a6e084",
    "finding": Finding({
        "name": f'haseeb python test {datetime.now()}',
        "description": "this is a python test",
        "alert_id": "HASEEB_PY_TEST_1",
        "type": FindingType.Exploit,
        "severity": FindingSeverity.Info
    })
}
])
print(response)

@haseebrabbani haseebrabbani merged commit 70f3219 into master Oct 13, 2023
1 check failed
@haseebrabbani haseebrabbani deleted the forta-1260-py-external-bot-support branch October 13, 2023 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant