Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make command.action.args field object-type #209

Merged
merged 8 commits into from
Jan 10, 2025

Conversation

f-galland
Copy link
Member

Description

This PR updates the commands template to make command.action.args field object-type, accommodating for various data types aside from arrays

Issues Resolved

wazuh/wazuh-indexer#618

@f-galland f-galland self-assigned this Jan 9, 2025
@f-galland f-galland marked this pull request as ready for review January 10, 2025 03:53
@f-galland f-galland requested a review from a team as a code owner January 10, 2025 03:53
Copy link
Member

@QU3B1M QU3B1M left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Event is correctly created through the API (using the event_generator)

% python command/event-generator/event_generator.py --protocol http                                                                                   
How many events do you want to generate? 1
Do you want to inject the generated data into your indexer/command manager? (y/n) y
Enter the IP of your Indexer (default: '127.0.0.1'): 
Enter the port of your Indexer (default: '9200'): 
Username (default: 'admin'): 
Password (default: 'admin'): 
% curl -sku admin:admin http://127.0.0.1:9200/.commands/_search                                                                                      
{"took":4,"timed_out":false,"_shards":{"total":1,"successful":1,"skipped":0,"failed":0},"hits":{"total":{"value":1,"relation":"eq"},"max_score":1.0,"hits":[{"_index":".commands","_id":"Ix-UUJQBOo9D19TxUCav","_score":1.0,"_source":{"agent":{"groups":["groups000"]},"command":{"source":"Users/Services","user":"user97","target":{"type":"agent","id":"target8"},"action":{"name":"update","args":{"arg1":"/path/to/executable/arg9"},"version":"v5"},"timeout":91,"status":"pending","order_id":"Ih-UUJQBOo9D19TxUCat","request_id":"IR-UUJQBOo9D19TxUCat"},"@timestamp":"2025-01-10T14:18:04Z","delivery_timestamp":"2025-01-10T14:19:35Z"}}]}}

Copy link
Member

@AlexRuiz7 AlexRuiz7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Documents can be indexed:

{
  "commands": [
    {
      "source": "Engine",
      "user": "user53",
      "target": {
        "id": "target4",
        "type": "agent"
      },
      "action": {
        "name": "restart",
        "args": {
          "arg1": "/path/to/executable/arg6"
        },
        "version": "v4"
      },
      "timeout": 30
    },
    {
      "source": "Engine",
      "user": "user53",
      "target": {
        "id": "target4",
        "type": "agent"
      },
      "action": {
        "name": "restart",
        "args": {
          "sint89": "eiusmod amet aliqua",
          "arg1": "/path/to/executable/arg6"
        },
        "version": "v4"
      },
      "timeout": 30
    },
    {
      "source": "Engine",
      "user": "user53",
      "target": {
        "id": "target4",
        "type": "agent"
      },
      "action": {
        "name": "restart",
        "args": {
          "in1_": true,
          "reprehenderit__d5": -45080236.87230298,
          "inc3_": "exercitation labore Duis consectetur",
          "eu4": -32233289.355662987,
          "nulla2": "irure mollit labore nostrud ex",
          "arg1": "/path/to/executable/arg6"
        },
        "version": "v4"
      },
      "timeout": 30
    },
    {
      "source": "Engine",
      "user": "user53",
      "target": {
        "id": "target4",
        "type": "agent"
      },
      "action": {
        "name": "restart",
        "args": {
          "sed_70": 30155352.64732185,
          "elit54": -85199652,
          "utefa": "ea deserunt magna do enim",
          "ea579": true,
          "arg1": "/path/to/executable/arg6"
        },
        "version": "v4"
      },
      "timeout": 30
    }
  ]
}

@AlexRuiz7 AlexRuiz7 merged commit 610f0d9 into master Jan 10, 2025
1 check passed
@AlexRuiz7 AlexRuiz7 deleted the enhancement/618-make-action.args-object branch January 10, 2025 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve interoperability of commands by changing action.args to object
3 participants