Skip to main content

A python3 library for interacting with EclecticIQ

Reason this release was yanked:

This project is no longer maintained, uses an undocumented/unstable API and will be deleted in the future.

Project description

eiqlib

a python3 library for interacting with EclecticIQ

eiqjson

a simple python3 library for generating EIQ API json bodies. only compatible with EclecticIQ 2.2

dependencies

  • python3
  • standard python3 libraries (json, time, uuid, urllib.request)
  • EclecticIQ 2.2 (as server for the API to communicate with)

example usage of eiqjson.EIQEntity

from eiqlib.eiqjson import EIQEntity
indicator = EIQEntity()

# General entity settings
indicator.set_entity(indicator.ENTITY_INDICATOR)
indicator.set_entity_title('[tag1] [tag2] <domain> - <iso-8601 timestamp>')
indicator.set_entity_description('<from email-address>\n<email subject>\n<notes about sighting type>')
indicator.set_entity_observed_time('YYYY-MM-DDTHH:MM:SSZ')
indicator.set_entity_confidence('Unknown')
indicator.set_entity_tlp('AMBER')
indicator.set_entity_source('<uuid of ingestion source>')

# Indicator-specific required fields
indicator.set_entity_impact('Unknown')
indicator.add_indicator_type(indicator.INDICATOR_C2)
indicator.add_indicator_type(indicator.INDICATOR_HOST_CHARACTERISTICS)

# Adding observables
indicator.add_observable(indicator.OBSERVABLE_IPV4, '127.0.0.1')
indicator.add_observable(indicator.OBSERVABLE_DOMAIN, 'www.example.org')
indicator.add_observable(indicator.OBSERVABLE_URI, 'https://www.example.org/test.php')
indicator.add_observable(indicator.OBSERVABLE_EMAIL, 'postmaster@example.org')

with open('EntityTitle.json', 'w') as f:
  f.write(indicator.get_as_json())

example usage of eiqjson.EIQRelation

from eiqlib.eiqjson import EIQEntity, EIQRelation
rel = EIQRelation()
rel.set_relation(rel.RELATION_STIX_UPDATE)
rel.set_source('<uuid of updated entity>', EIQEntity.ENTITY_SIGHTING)
rel.set_target('<uuid of superseded entity>', EIQEntity.ENTITY_SIGHTING)
rel.set_ingest_source('<uuid of ingestion source>')

with open('UpdateCall.json', 'w') as f:
  f.write(rel.get_as_json())

eiqcalls

python3 bindings to the EclecticIQ REST api

dependencies

  • python3
  • standard python3 libraries (json, urllib.request)

example usage

from eiqlib.eiqcalls import EIQApi
api = EIQApi()
api.set_host('https://eiq.lan/private')
api.set_credentials('<username>', '<password>')

# entity_json can be generated with the help of eiqjson.EIQEntity
response = api.create_entity(entity_json)
if not response or 'errors' in response:
  if response:
    for err in response['errors']:
      print('[error %d] %s' % (err['status'], err['title']))
      print('\t%s' % (err['detail'],))
  else:
    print('unable to get a response from host')

example of auto-updating previous entities

from eiqlib.eiqcalls import EIQApi
api = EIQApi()
api.set_host('https://eiq.lan/private')
api.set_credentials('<username>', '<password>')
# [optional] generating a token this way allows you to pass it manually to all other
# calls of EIQApi. If you do not pass a token to EIQApi methods, it does a do_auth
# call internally.
token = api.do_auth()

# entity_json can be generated with the help of eiqjson.EIQEntity
# if you use create_entity this way, every subsequently created entity using the same update_identifier
# will update the latest version already in EIQ
response = api.create_entity(entity_json, token=token, update_identifier="Event-000")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

eiqlib-1.0.0.tar.gz (12.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

eiqlib-1.0.0-py3-none-any.whl (12.0 kB view details)

Uploaded Python 3

File details

Details for the file eiqlib-1.0.0.tar.gz.

File metadata

  • Download URL: eiqlib-1.0.0.tar.gz
  • Upload date:
  • Size: 12.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6

File hashes

Hashes for eiqlib-1.0.0.tar.gz
Algorithm Hash digest
SHA256 8987980f057fef877979d71ebf1a2896013969b85cc76fe4a3c6d784158d764f
MD5 a3b95561ec56cf514c3e34e329a490f3
BLAKE2b-256 3218a3b4e5e199c5b9cd7d321ddfc8bb1898adf04260d7d33e68802bef10d8f0

See more details on using hashes here.

File details

Details for the file eiqlib-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: eiqlib-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 12.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6

File hashes

Hashes for eiqlib-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 57e64cced4881f8f7e207aa9446354bf7a60966a511e03174ed9ae143c35e870
MD5 4f5f30d698d4e082868917aeeb71279f
BLAKE2b-256 994d6d12f240e33b9a4ee0cc87f7a37bfe202af2d4ca8ada7a7a7aed2f1b6996

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page