Skip to content

intelowlproject/go-intelowl

Repository files navigation

go-intelowl

GitHub issues GitHub license

go-banner go-intelowl is a client library/SDK that allows developers to easily automate and integrate IntelOwl with their own set of tools!

Table of Contents

Getting Started

Pre requisites

  • Go 1.17+

Installation

Use go get to retrieve the SDK to add it to your GOPATH workspace, or project's Go module dependencies.

$ go get github.com/intelowlproject/go-intelowl

Usage

This library was built with ease of use in mind! Here are some quick examples to get you started. If you need more example you can go to the examples directory

To start using the go-intelowl library you first need to import it:

import "github.com/intelowlproject/go-intelowl/gointelowl"

Construct a new IntelOwlClient, then use the various services to easily access different parts of Intelowl's REST API. Here's an example of getting all jobs:

clientOptions := gointelowl.IntelOwlClientOptions{
	Url:         "your-cool-URL-goes-here",
	Token:       "your-super-secret-token-goes-here",
	// This is optional
	Certificate: "your-optional-certificate-goes-here",
}

intelowl := gointelowl.NewIntelOwlClient(
	&clientOptions,
	nil
)

ctx := context.Background()

// returns *[]Jobs or an IntelOwlError!
jobs, err := intelowl.JobService.List(ctx)

For easy configuration and set up we opted for options structs. Where we can customize the client API or service endpoint to our liking! For more information go here. Here's a quick example!

// ...Making the client and context!

tagOptions = gointelowl.TagParams{
  Label: "NEW TAG",
  Color: "#ffb703",
}

createdTag, err := intelowl.TagService.Create(ctx, tagOptions)
if err != nil {
	fmt.Println(err)
} else {
	fmt.Println(createdTag)
}

Examples

The examples directory contains a couple for clear examples, of which one is partially listed here as well:

package main

import (
	"fmt"

	"github.com/intelowlproject/go-intelowl/gointelowl"
)

func main(){
	intelowlOptions := gointelowl.IntelOwlClientOptions{
		Url:         "your-cool-url-goes-here",
		Token:       "your-super-secret-token-goes-here",
		Certificate: "your-optional-certificate-goes-here",
	}	

	client := gointelowl.NewIntelOwlClient(
		&intelowlOptions,
		nil,
	)

	ctx := context.Background()

	// Get User details!
	user, err := client.UserService.Access(ctx)
	if err != nil {
		fmt.Println("err")
		fmt.Println(err)
	} else {
		fmt.Println("USER Details")
		fmt.Println(*user)
	}
}

For complete usage of go-intelowl, see the full package docs.

Contribute

If you want to follow the updates, discuss, contribute, or just chat then please join our slack channel we'd love to hear your feedback!

License

Licensed under the GNU AFFERO GENERAL PUBLIC LICENSE.

Links

FAQ

Generate API key

You need a valid API key to interact with the IntelOwl server.

v4.0 and above

You can get an API by doing the following:

  1. Log / Signin into intelowl
  2. At the upper right click on your profile from the drop down select API Access/ Sessions
  3. Then generate an API key or see it!

v4.0 below

Keys should be created from the admin interface of IntelOwl: you have to go in the Durin section (click on Auth tokens) and generate a key there.