ExEcrime

An Elixir client library for interacting with the eCrime API (https://ecrime.ch/api/v1). This library provides a convenient interface for managing events, leaksites, screenshots, and actors through the API.

Installation

Add ex_ecrime to your list of dependencies in mix.exs:

def deps do
  [
    {:ex_ecrime, "~> 0.1.0"},
    {:req, "~> 0.3.0"}  # Required HTTP client dependency
  ]
end

Then run:

$ mix deps.get

Configuration

The library requires an API key to be set in the environment variable ECRIME_API_KEY. You can set this in your shell:

export ECRIME_API_KEY="your-api-key-here"

Or in your config/config.exs:

config :ex_ecrime,
  api_key: "your-api-key-here"

If using the config file approach, update the ExEcrime.Client.new/0 function to read from the config if the environment variable isn't set.

Usage

The library is organized into modules based on functionality:

Basic Example

# Create a new client
client = ExEcrime.Client.new()

# Login
ExEcrime.Client.login(client)

# List all events
events = ExEcrime.Events.list_events(client)

# Search for ransomware events
ransomware_events = ExEcrime.Events.search_events(client, "ransomware")

# List online leaksites
online_leaksites = ExEcrime.Leaksites.list_online_leaksites(client)

# Download a screenshot
screenshot = ExEcrime.Screenshots.download_screenshot(client, "screen.jpg")

# View an actor
actor = ExEcrime.Actors.view_actor(client, "123")

Using the Facade Module

If you prefer a single module interface:

client = ExEcrime.new()
ExEcrime.list_events(client)
ExEcrime.search_events(client, "ransomware")
ExEcrime.list_online_leaksites(client)
ExEcrime.download_screenshot(client, "screen.jpg")
ExEcrime.view_actor(client, "123")

Error Handling

API calls return the response body directly on HTTP 200 status. For other status codes, the full Req.Response struct is returned, allowing you to handle errors:

case ExEcrime.Events.view_event(client, "nonexistent-id") do
  %Req.Response{status: status} = response ->
    IO.puts("Error #{status}: #{inspect(response.body)}")
  body ->
    IO.puts("Success: #{inspect(body)}")
end

Features

Events

  • Add/delete comments
  • View events
  • List events by status or date range
  • Search events and history

Leaksites

  • List all or online leaksites
  • Search leaksites

Screenshots

  • Download screenshots (latest or specific version)
  • List screenshots
  • View screenshot history

Actors

  • View actor details
  • List actors
  • Search actors

Documentation

Full documentation is available in the code using Elixir's @doc attributes. You can generate HTML documentation with:

$ mix docs

Development

To work on the library:

  1. Clone the repository
  2. Install dependencies: mix deps.get
  3. Compile: mix compile
  4. Run tests: mix test (after adding tests)

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -am 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Create a new Pull Request

License

This project is licensed under the BSD 3-Clause License - see the LICENSE file for details.

Contact

For issues or questions, please file an issue on the GitHub repository.