Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Neumenon/cowrie/llms.txt

Use this file to discover all available pages before exploring further.

Cowrie is available for five languages, each with both Gen1 and Gen2 support. Choose your language below for installation instructions.

Go

1

Install via go get

go get github.com/Neumenon/cowrie/gen1
go get github.com/Neumenon/cowrie/gen2
2

Import in your code

import (
    "github.com/Neumenon/cowrie/gen1"
    "github.com/Neumenon/cowrie/gen2"
)
3

Verify installation

cd go
go test ./...

Requirements

  • Go 1.21 or later
  • github.com/klauspost/compress (automatically installed)

Building from source

git clone https://github.com/Neumenon/cowrie
cd cowrie-final/go
go build ./...
go test ./...

Rust

1

Add to Cargo.toml

[dependencies]
cowrie-codec = "0.1.0"
Or for specific features:
[dependencies]
cowrie-codec = { version = "0.1.0", features = ["gen1", "gen2", "zstd"] }
2

Import in your code

use cowrie::{gen1, gen2};
3

Build your project

cargo build

Features

  • gen1: Enable Gen1 codec (included by default)
  • gen2: Enable Gen2 codec (included by default)
  • zstd: Enable zstd compression support for Gen2

Building from source

git clone https://github.com/Neumenon/cowrie
cd cowrie-final/rust
cargo build
cargo test

Python

1

Install via pip

pip install cowrie
2

Import in your code

from cowrie import gen1, gen2
3

Verify installation

python -c "from cowrie import gen1, gen2; print('Cowrie installed successfully')"

Requirements

  • Python 3.8 or later
  • No external dependencies required

Building from source

git clone https://github.com/Neumenon/cowrie
cd cowrie-final/python
pip install -e .
pytest tests/
Use -e flag for editable installation during development.

TypeScript / Node.js

npm install cowrie

Usage

1

Import in your TypeScript/JavaScript code

import { gen1, gen2 } from 'cowrie';
Or with CommonJS:
const { gen1, gen2 } = require('cowrie');
2

Verify installation

node -e "const {gen1} = require('cowrie'); console.log('Cowrie installed')"

Requirements

  • Node.js 16 or later
  • Optional: fzstd for zstd compression support (auto-installed)

Building from source

git clone https://github.com/Neumenon/cowrie
cd cowrie-final/typescript
npm install
npm run build
npm test

C

C installation requires building from source with CMake.
1

Install dependencies

# Ubuntu/Debian
sudo apt-get install build-essential cmake zlib1g-dev libzstd-dev

# macOS
brew install cmake zlib zstd

# Fedora/RHEL
sudo dnf install gcc cmake zlib-devel libzstd-devel
2

Build with CMake

git clone https://github.com/Neumenon/cowrie
cd cowrie-final/c
mkdir build && cd build
cmake ..
make
3

Run tests

ctest
4

Install libraries

sudo make install

Include in your project

#include <cowrie_gen1.h>
#include <cowrie_gen2.h>

CMake integration

Add to your CMakeLists.txt:
find_package(cowrie REQUIRED)
target_link_libraries(your_target cowrie_gen1 cowrie_gen2)

Requirements

  • C11-compatible compiler (GCC 7+, Clang 5+, MSVC 2019+)
  • CMake 3.10 or later
  • zlib (required for Gen2)
  • libzstd (optional for Gen2 zstd compression)
zstd support is optional. If libzstd is not found, Cowrie will build without zstd compression support.

CLI tool

Cowrie includes a command-line tool for encoding/decoding from the terminal:
1

Build the CLI

cd go
go build -o cowrie ./cmd/cowrie
2

Encode JSON to Cowrie

echo '{"name":"Alice","age":30}' | ./cowrie encode --gen2 > data.cowrie
3

Decode Cowrie to JSON

./cowrie decode < data.cowrie
4

Inspect Cowrie files

./cowrie info < data.cowrie

CLI options

# Encode with Gen1
cowrie encode --gen1 < input.json > output.cowrie

# Encode with Gen2 and compression
cowrie encode --gen2 --compress --compression=zstd < input.json > output.cowrie

# Decode to pretty-printed JSON
cowrie decode --pretty < input.cowrie

# Show file info (format, size, compression)
cowrie info < input.cowrie

Docker

Run Cowrie in a container:
docker run -it --rm \
  -v $(pwd):/data \
  ghcr.io/phenomenon0/cowrie:latest \
  encode --gen2 < /data/input.json > /data/output.cowrie
Docker images are built from the Go implementation only. For other languages, install natively.

Verification

After installation, verify Cowrie is working correctly:
cd go
go test ./gen1 ./gen2
All tests should pass. If you encounter issues, check that you have the required dependencies installed.

Next steps

Quickstart

Encode your first message with Cowrie

API Reference

Explore the full API documentation

Getting help

If you encounter installation issues:
  1. Check the GitHub Issues for known problems
  2. Verify you have the required language version and dependencies
  3. Try building from source for the latest fixes
  4. Open a new issue with your error message and environment details

Build docs developers (and LLMs) love