Skip to content
This repository has been archived by the owner on Jun 17, 2023. It is now read-only.
wes edited this page Aug 21, 2018 · 11 revisions

CIF Software Development Kit for Python

The CIF Software Development Kit (SDK) for Python contains library code and examples designed to enable developers to build applications using CIF.

Installation

$ pip install 'cifsdk>=3.0.0,<4.0'

Examples

Client

Config

# ~/.cif.yml
remote: https://localhost
token: 1234

Running out of the box

These plugins are minimal and run out of the box

$ cif --token 1234 --remote 'https://localhost' -q example.com
$ cif --token 1234 --remote 'https://localhost' -q example.com --format csv
$ cif --token 1234 --remote 'https://localhost' -q example.com --format table
$ cif --token 1234 --remote 'https://localhost' -q example.com --format json

API

Search

import logging
from cifsdk.client.http import HTTP as Client
from pprint import pprint

cli = Client(token='1234',
             remote='https://localhost',
             verify_ssl=False)


ret = cli.indicators_search('example.com')

filters = {
  "indicator": "example.com",
  "confidence": 6,
}

ret = cli.indicators_search(filters=filters)
pprint(ret)

Create

import logging
from cifsdk.client.http import HTTP as Client

data = '{"indicator":"example4.com","tlp":"amber","confidence":"8","tags":"malware","provider":"example.com","group":"everyone"}'

cli = Client(token='1234',
            remote='https://localhost',
            verify_ssl=False)

ret = cli.indicators_create(data)
print("submission id: {0}".format(ret))

Ping

from cifsdk.client.http import HTTP as Client
...

ret = cli.ping()
print("roundtrip: %s ms" % ret)
Clone this wiki locally