How oz9un/log-slapper works
1. What this repo is
- log-slapper is a Go-based CLI tool for offensive log injection into Splunk/SIEM environments.
- Its core job is to generate plausible security/log telemetry, then deliver it to a target Splunk indexer/heavy forwarder or HEC endpoint.
2. Top-level execution path
- main.go is the entrypoint and hands off to the CLI framework in pkg/cmd/root.go.
- From there, user input is routed into command handlers in pkg/command, which choose between interactive use, direct attack execution, or raw transport modes.
3. CLI and command boundary
- pkg/cmd/root.go defines the main command surface.
- pkg/command/execute.go and pkg/command/execute_raw.go separate “normal” scenario execution from lower-level/raw injection paths.
- This is the main boundary between user intent and the attack-generation pipeline.
4. Bootstrap and environment detection
- pkg/initialize handles first-run and host setup concerns:
- detect.go likely discovers the target Splunk endpoint or local network context.
- prereqs.go checks runtime dependencies.
- iptables.go suggests network/path manipulation or traffic handling when root privileges are available.
- README indicates a log.settings file stores the target indexer/HF IP and optional HEC token.
5. Attack definition layer
- The repo supports both built-in attacks and custom scenarios.
- example-attack-templates/*.yaml shows the custom scenario format used to describe sequences of logs/events.
- pkg/replacer/replacer.go likely performs template-variable substitution so attack definitions can be parameterized and reused.
6. Built-in attack generators
- pkg/attacks contains concrete payload generators for specific telemetry types:
- win_loginspam.go
- win_processcreate.go
- nix_execve.go
- raw_tcp.go
- These represent the “event semantics” layer: they create believable Windows/Linux security events or raw traffic patterns rather than directly handling transport details.
7. Splunk event modeling
- pkg/splunk is the formatting and serialization layer that turns attack intent into Splunk-compatible records.
- Files like event.go, logfile.go, encodings.go, randomip.go, and rawtraffic.go suggest responsibilities such as:
- shaping log/event fields,
- encoding them for transport,
- generating plausible source IPs,
- and preparing raw traffic payloads.
8. Transport and delivery
- The repo supports multiple delivery styles:
- direct TCP communication to Splunk ingestion endpoints,
- HEC-based submission when a token is available,
- and raw traffic-oriented injection paths.
- pkg/network/listen.go and callback.go imply a listener/callback channel used for interactive or “target shell playzone” style workflows.
9. Data flow through the system
- User chooses an attack interactively or via CLI flags/YAML.
- Command layer loads config and initializes the environment.
- Attack/template logic generates one or more synthetic events.
- Splunk formatting converts those events into the expected wire format.
- Network/transport code sends the logs to the target Splunk service.
10. Extensibility model
- The design is deliberately modular: new attack types can be added under pkg/attacks, while new scenario templates can be added in YAML without changing the CLI surface.
- That makes the repo useful both as a fixed set of demos and as a framework for composing custom telemetry injection scenarios.
11. External boundaries
- The main external dependency is the target Splunk environment itself: indexer/heavy forwarder and optionally HEC.
- The tool also depends on OS/network capabilities for some modes, especially where packet handling or interface detection is needed.
- There is no evidence of a backend database or web service; the architecture is primarily a local CLI orchestrator plus network emitter.
12. How to draw it
- A good architecture diagram would center on the CLI orchestrator, split into:
- configuration/bootstrap,
- attack generation,
- Splunk event formatting,
- transport delivery,
- and optional interactive/listener support.
- The only persistent artifact worth showing is the local settings/template files; the rest is runtime orchestration toward Splunk.
Main entry points: execute.go execute · event.go event model · root.go root cmd · execute_raw.go raw execute
Components 21
CLI entry
Command-line entrypoint and command routing
- main · Program startup and handoff to CLI command handling
main.go - root cmd · Defines the top-level command interface and user options
pkg/cmd/root.go - execute · Runs the standard attack execution path
pkg/command/execute.go - raw execute · Handles lower-level or raw injection execution
pkg/command/execute_raw.go
Setup
Environment detection and host preparation
Attack defs
Built-in and template-driven attack generation
- replacer · Substitutes variables in attack definitions and payloads
pkg/replacer/replacer.go - win login · Generates Windows login-style telemetry
pkg/attacks/win_loginspam.go - win process · Generates Windows process creation telemetry
pkg/attacks/win_processcreate.go - nix exec · Generates Linux execve-style telemetry
pkg/attacks/nix_execve.go - raw tcp · Generates raw TCP-oriented traffic patterns
pkg/attacks/raw_tcp.go
Splunk model
Event shaping and serialization for Splunk delivery
- event model · Shapes synthetic events into Splunk-compatible records
pkg/splunk/event.go - logfile · Wraps events in log file style output for delivery
pkg/splunk/logfile.go - encodings · Encodes payloads for transport and wire compatibility
pkg/splunk/encodings.go - random ip · Produces plausible source IP values for synthetic telemetry
pkg/splunk/randomip.go - raw traffic · Prepares raw traffic payload representations
pkg/splunk/rawtraffic.go
Delivery
Transport and callback/listener paths
Artifacts
Persistent local templates and runtime settings
- settings · Persistent target and token settings used at runtime
- attack templates · Example scenario templates for custom attack definitions
example-attack-templates/template.yaml
Connections 21
- main → root cmd: starts · Entry point initializes the CLI command surface
- root cmd → execute: routes · Standard command path executes the main scenario flow
- root cmd → raw execute: routes · Raw mode is dispatched through a separate command path
- execute → detect: prepares · Execution may detect target or host context before running
- execute → prereqs: checks · Runtime prerequisites are validated before use
- execute → replacer: parameterizes · Templates and scenarios are expanded with variable substitution
- raw execute → raw tcp: emits · Raw execution uses the raw TCP attack path
- execute → win login: generates · Built-in scenarios can produce Windows login telemetry
- execute → win process: generates · Built-in scenarios can produce process creation telemetry
- execute → nix exec: generates · Built-in scenarios can produce Linux execve telemetry
- replacer → attack templates: loads · Scenario definitions are sourced from YAML templates
- execute → event model: formats · Generated intent is shaped into Splunk records
- event model → logfile: wraps · Events are packaged for log-file style output
- logfile → encodings: encodes · Payloads are serialized into transport-friendly forms
- event model → random ip: enriches · Synthetic events can be assigned plausible source IPs
- event model → raw traffic: maps · Raw telemetry is represented in a transport-specific model
- execute → listen: may listen · Some workflows use a local listener or callback channel
- listen → callback: supports · Listener and callback paths support interactive flows
- execute → settings: reads · Runtime uses local settings for target and token configuration
- raw execute → settings: reads · Raw mode also depends on local target settings
- iptables → listen: affects · Host network setup can influence listener and callback behavior