# Kali Linux Course #557: Sigma-CLI$ Mastery

## Section 1: Introduction & Installation of Sigma-CLI$

### Overview of Sigma-CLI$

**Sigma-CLI$** is an open-source tool that allows security professionals to convert Sigma rules into various detection formats for multiple SIEM tools. It simplifies the process of translating YAML-based Sigma rules into formats that can be easily consumed by security applications, thus enabling automated threat detection and response strategies.

### Installation on Kali Linux

To get started with **sigma-cli$**, you need to install it on your Kali Linux distribution. Kali Linux is equipped with various security tools, and sigma-cli$ can be easily integrated into this environment. Follow these steps for installation:

#### Prerequisites

Ensure you have the following installed on your Kali Linux machine:

– **Python 3.x**: Sigma-CLI$ requires Python version 3.x. You can verify your Python version by running:

– **Pip**: This is the package installer for Python. It generally comes pre-installed on Kali Linux. You can check if it’s installed using:

#### Installation Steps

1. **Installing Sigma-CLI$**

Open a terminal window and run the following command to clone the sigma-cli$ repository from GitHub:


git clone https://github.com/Neo23x0/sigma-cli.git

Navigate to the cloned directory:

Next, install the required dependencies using pip:

2. **Configuring Sigma-CLI$**

Sigma-CLI$ requires a configuration file to define how it converts Sigma rules. The default configuration file can be found at `config/config.yaml`. You may want to customize the output formats and rules directory according to your environment.

Open the configuration file using your favorite text editor:

Here is an example of how you might configure it:

[/dm_code_snippet]yaml
rules:
location: "rules" # Path to your Sigma rules
outputs:
default: "elastic" # Specify the default output format
[/dm_code_snippet]

3. **Verify Installation**

Run the following command to ensure sigma-cli$ is properly installed:

This should display a help message with available commands and options.

### Step-by-Step Usage of Sigma-CLI$

Once installed and configured, let’s dive into how to effectively use sigma-cli$ for various tasks, using step-by-step instructions and real-world use cases.

#### Basic Command Structure

The basic command structure looks like this:

"`bash
python3 sigma-cli.py -r -t
"`

– `-r` specifies the path to your Sigma rule.
– `-t` defines the target output format (like `elastic`, `splunk`, etc.).

#### Example Usage: Converting Sigma Rules to a Specific Format

1. **Creating a Sample Sigma Rule**

Before performing any conversions, let’s create a simple Sigma rule. Save the following YAML file as `sample_rule.yml` in your rules directory:

[/dm_code_snippet]yaml
title: Sample Sigma Rule
id: abc12345-6789-0000-0000-000000000000
description: Detects suspicious activity
status: experimental
logsource:
product: windows
service: security
detection:
selection:
EventID: 4625
condition: selection
fields:
– EventID
– AccountName
[/dm_code_snippet]

2. **Converting to ElasticSearch Format**

Use the following command to convert the `sample_rule.yml` to ElasticSearch format:


python3 sigma-cli.py -r rules/sample_rule.yml -t elastic

3. **Output Verification**

Upon successful conversion, sigma-cli$ will output the converted rule to the console. You can save it to a file by redirecting the output:


python3 sigma-cli.py -r rules/sample_rule.yml -t elastic > output_rule.json

This JSON file can now be integrated into your ElasticSearch environment.

#### Real-world Use Case: Integrating Sigma Rules with Defence Tools

Imagine you are a security analyst tasked with monitoring user login attempts in a Windows environment. You could use the Sigma rule we created to detect multiple failed login attempts (Event ID 4625) indicating possible brute force attacks.

1. **Converting Rules for SIEMs**

Most SIEM tools accept specific formats. To integrate our rule into a SIEM, you might convert it into different formats:

– For **Splunk**:


python3 sigma-cli.py -r rules/sample_rule.yml -t splunk

– For **LogPoint**:


python3 sigma-cli.py -r rules/sample_rule.yml -t logpoint

#### Detailed Technical Explanations

– **Sigma Rule Structure**: Sigma rules consist of various sections like `title`, `id`, `description`, and particularly `detection`. Each section should be carefully crafted to ensure accurate detection.

– **Log Source Consideration**: When writing a rule, understanding which log source to target is crucial for effective monitoring.

– **Condition Evaluation**: The `condition` section defines under which conditions your detection should trigger an alert. Condition syntax can vary depending on the complexity of the detection required.

### External References

For further reading and advanced topics related to sigma-cli$, you can visit:

– [Sigma Documentation](https://sigmahq.github.io/sigma/) – Official documentation for writing and structuring Sigma rules.
– [GitHub Repository for sigma-cli$](https://github.com/Neo23x0/sigma-cli) – Source code and release information.

### Conclusion

In this section, we covered the installation and basic usage of sigma-cli$. We established a foundational understanding of how to convert Sigma rules into various formats that are suitable for deployment in SIEM tools. As you progress through this course, you will learn more advanced operational techniques to enhance your penetration testing workflow.

Made by pablo rotem / פבלו רותם

Pablo Guides