Skip to content
KitploitKITPLOIT
उपकरणब्लॉग
जमा करें
उपकरणब्लॉग
जमा करें

हैकिंग, पेनटेस्ट और साइबर सुरक्षा उपकरण आपके सुरक्षा शस्त्रागार के लिए!

Kitploit हैकिंग, साइबर सुरक्षा और पेंटेस्टिंग टूल्स की एक निर्देशिका है। कमजोरियों को खोजने, सिस्टम का विश्लेषण करने, परीक्षण को स्वचालित करने और अपनी सुरक्षा को मजबूत करने के लिए नवीनतम प्रोजेक्ट अपडेट खोजें।

··फ़ीड·संपर्क·गोपनीयता·© 2026 Kitploit

टूल निर्देशिका

श्रेणियाँ

सभी श्रेणियाँ देखें
Loading categories
pySigma-backend-opensearch — pySigma OpenSearch बैकएंड | Kitploit
उपकरण/GitHubGitHub/sigmahq/pysigma-backend-opensearch
रक्षात्मक उपकरणउपयोगिताएँ और फ्रेमवर्कघुसपैठ का पता लगानालॉग विश्लेषण
GitHubsigmahq/pysigma-backend-opensearch

pySigma-backend-opensearch

pySigma OpenSearch बैकएंड

रिपॉजिटरी देखें
146624 दिन पहलेअभी तक समीक्षित नहीं

सबसे लोकप्रिय

सभी देखें →

हमारे समुदाय द्वारा सबसे अधिक उपयोग किए जाने वाले उपकरण खोजें।

सभी उपकरण खोजें

हमारे उपकरणों का संग्रह ब्राउज़ करें

सभी उपकरण देखें →
साझा करें

Tests Coverage
Badge Status

pySigma OpenSearch Backend

यह pySigma के लिए OpenSearch बैकएंड है। यह sigma.backends.opensearch पैकेज प्रदान करता है, जिसमें दो बैकएंड क्लास हैं:

  • OpensearchLuceneBackend - Sigma नियमों को Lucene क्वेरी सिंटैक्स में बदलता है
  • OpenSearchPPLBackend - Sigma नियमों को PPL (Piped Processing Language) क्वेरीज़ में बदलता है

Lucene बैकएंड

Lucene बैकएंड निम्नलिखित आउटपुट प्रारूपों का समर्थन करता है:

  • default: Lucene सिंटैक्स में सादे Opensearch क्वेरीज़
    • संकेत: डैशबोर्ड में आपको DQL से Lucene पर स्विच करना होगा
  • monitor_rule: Opensearch अलर्टिंग नियमों को आयात करने के लिए JSON संरचना

यह बैकएंड वर्तमान में इनके द्वारा अनुरक्षित है:

  • Hendrik Bäcker

पृष्ठभूमि

Lucene बैकएंड

चूंकि Lucene-आधारित क्वेरीज़ Elasticsearch Lucene क्वेरीज़ से बहुत समान हैं, इस बैकएंड का अधिकांश कोड pySigma-backend-elasticsearch से आता है।

Opensearch-विशिष्ट परिवर्तन और आउटपुट प्रारूप इस बैकएंड में किए गए हैं (जैसे, Monitor Rules)।

PPL बैकएंड

PPL (Piped Processing Language) बैकएंड OpenSearch की मूल क्वेरी भाषा का समर्थन करने के लिए शुरू से लागू किया गया है। PPL निम्न प्रदान करता है:

  • सहसंबंध समर्थन - Sigma सहसंबंध नियमों के लिए अंतर्निहित समर्थन

सहसंबंध नियम समर्थन

PPL बैकएंड Sigma सहसंबंध नियमों को पूरी तरह से समर्थन करता है, जिससे जटिल मल्टी-इवेंट परिदृश्यों का पता लगाना संभव होता है:

  • event_count - घटनाओं की संख्या गिनता है (जैसे, ब्रूट फोर्स पहचान)
  • value_count - किसी फ़ील्ड के अद्वितीय मानों की संख्या गिनता है (जैसे, पासवर्ड स्प्रेइंग)
  • temporal - समय विंडो के भीतर कई अलग-अलग घटनाएँ (जैसे, मल्टी-स्टेज हमले)

कैसे करें

आउटपुट बनाएं - sigma-cli

Lucene बैकएंड

root@kitploit:~
sigma convert \
  -t opensearch \
  -p ecs_windows \
  -f monitor_rule \
  /data/sigma/rules/windows/process_creation/proc_creation_win_whoami_priv.yml

PPL बैकएंड

root@kitploit:~
sigma convert \
  -t opensearch-ppl \
  -p ecs_windows \
  /data/sigma/rules/windows/process_creation/proc_creation_win_whoami_priv.yml

अलर्टिंग नियम बनाएं - Python

Lucene बैकएंड

root@kitploit:~
from sigma.backends.opensearch import OpensearchLuceneBackend

from sigma.pipelines.sysmon import sysmon_pipeline
from sigma.pipelines.elasticsearch.windows import ecs_windows

from sigma.collection import SigmaCollection
from sigma.processing.resolver import ProcessingPipelineResolver

# Create our pipeline resolver
piperesolver = ProcessingPipelineResolver()

# Add wanted pipelines
piperesolver.add_pipeline_class(ecs_windows())
piperesolver.add_pipeline_class(sysmon_pipeline())

# Create a single sorted and prioritzed pipeline
resolved_pipeline = piperesolver.resolve(piperesolver.pipelines)

# Instantiate backend, using our resolved pipeline
# and some backend parameter
backend = OpensearchLuceneBackend(resolved_pipeline, index_names=['logs-*-*', 'beats-*'], monitor_interval=10, monitor_interval_unit="MINUTES")

rules = SigmaCollection.from_yaml("""
title: Run Whoami Showing Privileges
id: 97a80ec7-0e2f-4d05-9ef4-65760e634f6b
status: experimental
description: Detects a whoami.exe executed with the /priv command line flag instructing the tool to show all current user privieleges. This is often used after a privilege escalation attempt. 
references:
    - https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/whoami
author: Florian Roth
date: 2021/05/05
modified: 2022/05/13
tags:
    - attack.privilege_escalation
    - attack.discovery
    - attack.t1033
logsource:
    category: process_creation
    product: windows
detection:
    selection_img:
        - Image|endswith: '\whoami.exe'
        - OriginalFileName: 'whoami.exe'
    selection_cli:
        CommandLine|contains: '/priv'
    condition: all of selection*
falsepositives:
    - Administrative activity (rare lookups on current privileges)
level: high
""")

# Print converted rule in Lucene syntax
print("Lucene Result: \n" + "\n".join(backend.convert(rules)))

# Print converted rule ready for dsl syntax
print("DSL Result: \n" + json.dumps(backend.convert(rules, output_format="dsl_lucene")[0], indent=2))

# Generate a JSON structure to be imported as monitor rule
print("Monitor Rule Result: \n" + backend.convert(rules, output_format="monitor_rule"))

Lucene परिणाम:

root@kitploit:~
winlog.channel:Microsoft\-Windows\-Sysmon\/Operational AND (event.code:1 AND ((process.executable:*\\whoami.exe OR process.pe.original_file_name:whoami.exe) AND process.command_line:*\/priv*))

DSL परिणाम:

root@kitploit:~
{
  "query": {
    "bool": {
      "must": [
        {
          "query_string": {
            "query": "winlog.channel:Microsoft\\-Windows\\-Sysmon\\/Operational AND (event.code:1 AND (winlog.channel:Microsoft\\-Windows\\-Sysmon\\/Operational AND (event.code:1 AND ((process.executable:*\\\\whoami.exe OR process.pe.original_file_name:whoami.exe) AND process.command_line:*\\/priv*))))",
            "analyze_wildcard": true
          }
        }
      ]
    }
  }
}

Monitor Rule परिणाम:

root@kitploit:~
{
  "type": "monitor",
  "name": "SIGMA - Run Whoami Showing Privileges",
  "description": "Detects a whoami.exe executed with the /priv command line flag instructing the tool to show all current user privieleges. This is often used after a privilege escalation attempt.",
  "enabled": true,
  "schedule": {
    "period": {
      "interval": 10,
      "unit": "MINUTES"
    }
  },
  "inputs": [
    {
      "search": {
        "indices": [
          "logs-*-*",
          "beats-*"
        ],
        "query": {
          "size": 1,
          "query": {
            "bool": {
              "must": [
                {
                  "query_string": {
                    "query": "winlog.channel:Microsoft\\-Windows\\-Sysmon\\/Operational AND (event.code:1 AND (winlog.channel:Microsoft\\-Windows\\-Sysmon\\/Operational AND (event.code:1 AND (winlog.channel:Microsoft\\-Windows\\-Sysmon\\/Operational AND (event.code:1 AND ((process.executable:*\\\\whoami.exe OR process.pe.original_file_name:whoami.exe) AND process.command_line:*\\/priv*))))))",
                    "analyze_wildcard": true
                  }
                }
              ]
            }
          }
        }
      }
    }
  ],
  "tags": [
    "attack-privilege_escalation",
    "attack-discovery",
    "attack-t1033"
  ],
  "triggers": [
    {
      "name": "generated-trigger",
      "severity": 2,
      "condition": {
        "script": {
          "source": "ctx.results[0].hits.total.value > 0",
          "lang": "painless"
        }
      },
      "actions": []
    }
  ],
  "sigma_meta_data": {
    "rule_id": "97a80ec7-0e2f-4d05-9ef4-65760e634f6b",
    "threat": []
  },
  "references": [
    "https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/whoami"
  ]
}

PPL बैकएंड

root@kitploit:~
from sigma.backends.opensearch.opensearch_ppl import OpenSearchPPLBackend
from sigma.collection import SigmaCollection

# Instantiate PPL backend
backend = OpenSearchPPLBackend()

# Use the same rule as above
rules = SigmaCollection.from_yaml("""
title: Run Whoami Showing Privileges
id: 97a80ec7-0e2f-4d05-9ef4-65760e634f6b
status: experimental
description: Detects a whoami.exe executed with the /priv command line flag instructing the tool to show all current user privieleges. This is often used after a privilege escalation attempt. 
references:
    - https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/whoami
author: Florian Roth
date: 2021/05/05
modified: 2022/05/13
tags:
    - attack.privilege_escalation
    - attack.discovery
    - attack.t1033
logsource:
    category: process_creation
    product: windows
detection:
    selection_img:
        - Image|endswith: '\whoami.exe'
        - OriginalFileName: 'whoami.exe'
    selection_cli:
        CommandLine|contains: '/priv'
    condition: all of selection*
falsepositives:
    - Administrative activity (rare lookups on current privileges)
level: high
""")

# Print converted rule in PPL syntax
print("PPL Result: \n" + "\n".join(backend.convert(rules)))

PPL परिणाम:

root@kitploit:~
source=windows-process_creation-* | where (LIKE(Image, "%\whoami.exe") OR OriginalFileName="whoami.exe") AND LIKE(CommandLine, "%/priv%")

PPL सहसंबंध नियम उदाहरण

root@kitploit:~
from sigma.backends.opensearch.opensearch_ppl import OpenSearchPPLBackend
from sigma.collection import SigmaCollection

backend = OpenSearchPPLBackend()

# Brute force detection using event_count correlation
rules = SigmaCollection.from_yaml("""
title: Windows Failed Logon Event
name: failed_logon
logsource:
  product: windows
  service: security
detection:
  selection:
    EventID: 4625
  filter:
    SubjectUserName|endswith: $
  condition: selection and not filter
---
title: Brute Force Attack Detection
correlation:
  type: event_count
  rules:
    - failed_logon
  group-by:
    - TargetUserName
    - TargetDomainName
  timespan: 5m
  condition:
    gte: 10
""")

print("Correlation PPL Result: \n" + "\n".join(backend.convert(rules)))

सहसंबंध PPL परिणाम:

root@kitploit:~
| search source=windows-security-* | where EventID=4625 AND NOT LIKE(SubjectUserName, "%$") | stats count() as event_count by TargetUserName, TargetDomainName | where event_count >= 10

कॉन्फ़िगरेशन

आप Sigma नियमों में कस्टम विशेषताओं या बैकएंड इनिशियलाइज़ेशन विकल्पों के माध्यम से PPL बैकएंड व्यवहार को कॉन्फ़िगर कर सकते हैं।

PPL बैकएंड कस्टम विशेषताएँ

PPL बैकएंड निम्नलिखित कस्टम विशेषताओं का समर्थन करता है, जिन्हें Sigma नियम के custom अनुभाग में निर्दिष्ट किया जा सकता है:

root@kitploit:~
custom:
  opensearch_ppl_index: "custom-logs-*"        # Override default index pattern
  opensearch_ppl_min_time: "-30d"              # Set query time window start
  opensearch_ppl_max_time: "now"               # Set query time window end

कस्टम विशेषताओं के साथ उदाहरण

यह उदाहरण दिखाता है कि कस्टम विशेषताएँ सहसंबंध नियमों के साथ कैसे काम करती हैं, जहाँ व्यक्तिगत डिटेक्शन नियमों के अपने समय विंडो हो सकते हैं या वे सहसंबंध नियम से प्राप्त हो सकते हैं:

root@kitploit:~
title: Detection Rule 1 - With Own Time Filter
id: 10000400-0000-0000-0000-000000000004
logsource:
  product: windows
  category: process_creation
detection:
  selection:
    CommandLine|contains: 'malware'
  condition: selection
custom:
  opensearch_ppl_min_time: "-7d"    # This rule uses 7 days
  opensearch_ppl_max_time: "now"
---
title: Detection Rule 2 - No Time Filter
id: 10000401-0000-0000-0000-000000000004
logsource:
  product: windows
  category: network_connection
detection:
  selection:
    DestinationPort: 443
  condition: selection
# No custom attributes - will inherit from correlation
---
title: Correlation - Mixed Time Filters
id: 10000402-0000-0000-0000-000000000004
correlation:
  type: temporal
  rules:
    - 10000400-0000-0000-0000-000000000004
    - 10000401-0000-0000-0000-000000000004
  group-by:
    - Computer
  timespan: 5m
custom:
  opensearch_ppl_min_time: "-30d"   # Rule 2 inherits this (30 days)
  opensearch_ppl_max_time: "now"

परिणाम:

  • डिटेक्शन नियम 1 पिछले 7 दिनों को खोजेगा (अपनी स्वयं की कस्टम विशेषता)
  • डिटेक्शन नियम 2 पिछले 30 दिनों को खोजेगा (सहसंबंध नियम से प्राप्त)

बैकएंड विकल्प

आप बैकएंड को इनिशियलाइज़ करते समय डिफ़ॉल्ट मान भी सेट कर सकते हैं:

root@kitploit:~
backend = OpenSearchPPLBackend(
    custom_logsource="default-logs-*",  # Default index pattern for all rules
    min_time="-24h",                    # Default time window start
    max_time="now"                      # Default time window end
)

व्यक्तिगत नियमों में कस्टम विशेषताएँ इन बैकएंड-स्तरीय डिफ़ॉल्ट मानों को ओवरराइड करेंगी।

टूल डाउनलोड करें