Skip to content

Instantly share code, notes, and snippets.

@frikky
Created May 20, 2019 22:03
Show Gist options
  • Save frikky/f30aa2ab26fbd8c6137b240586c6671d to your computer and use it in GitHub Desktop.
Save frikky/f30aa2ab26fbd8c6137b240586c6671d to your computer and use it in GitHub Desktop.
TheHive alert creation test script
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import uuid
import time
from thehive4py.api import TheHiveApi
from thehive4py.models import Alert, AlertArtifact, CustomFieldHelper
api = TheHiveApi('http://127.0.0.1:9000', 'CHANGEME :)')
artifacts = []
def makealert(input_title):
# Prepare the sample Alert
sourceRef = str(uuid.uuid4())[0:6]
alert = Alert(title=input_title,
tlp=3,
tags=['TheHive4Py'],
description='N/A',
type='external',
source='instance1',
sourceRef=sourceRef)
# Create the Alert
response = api.create_alert(alert)
print(response.text)
print(response.status_code)
timeout=8
print('Create Alert - should be changed')
makealert("Testing walkoff portscan title")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment