shodan

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 13, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

README

shodan

Shodan host, domain, and search lookups for the gollem LLM agent framework.

github.com/gollem-dev/tools/shodan

Tools

Name Description
shodan_host Search host information from Shodan by IP.
shodan_domain Search domain information from Shodan.
shodan_search Search the internet using a Shodan query.

Usage

ts, err := shodan.New("YOUR_API_KEY")
if err != nil {
	return err
}
if err := ts.Ping(ctx); err != nil { // optional preflight
	return err
}

Options

Option Default
WithBaseURL(string) https://api.shodan.io
WithHTTPClient(*http.Client) http.DefaultClient
WithLogger(*slog.Logger) slog.Default()

Testing

Mock tests run unconditionally. The live-service test runs only when TEST_SHODAN_API_KEY is set:

TEST_SHODAN_API_KEY=... go test ./...

Documentation

Overview

Package shodan provides a gollem.ToolSet for Shodan internet-facing asset and service lookups (host, domain, search).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*ToolSet)

Option configures a ToolSet.

func WithBaseURL

func WithBaseURL(baseURL string) Option

WithBaseURL overrides the Shodan API base URL.

func WithHTTPClient

func WithHTTPClient(client *http.Client) Option

WithHTTPClient overrides the HTTP client used for requests.

func WithLogger

func WithLogger(logger *slog.Logger) Option

WithLogger sets the logger. A nil logger keeps the default (slog.Default()).

type ToolSet

type ToolSet struct {
	// contains filtered or unexported fields
}

ToolSet implements gollem.ToolSet for Shodan. Fields are unexported; configure via Option.

func New

func New(apiKey string, opts ...Option) (*ToolSet, error)

New constructs the ToolSet. It only validates static configuration; use Ping to verify connectivity and credentials.

func (*ToolSet) Ping

func (t *ToolSet) Ping(ctx context.Context) error

Ping verifies connectivity and credentials by querying the well-known Google DNS host (8.8.8.8) via shodan_host.

func (*ToolSet) Run

func (t *ToolSet) Run(ctx context.Context, name string, args map[string]any) (map[string]any, error)

Run executes the named Shodan lookup.

func (*ToolSet) Specs

func (t *ToolSet) Specs(ctx context.Context) ([]gollem.ToolSpec, error)

Specs returns the Shodan tool specifications.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL