-
Notifications
You must be signed in to change notification settings - Fork 59
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
New call to edit files (rules, decoders, lists and ossec.conf) #299
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…pi into fix-3.9-escape-xml-command
Hi, |
Hi, This is an example using a file with # cat test_no_utf8
<!-- NEW Local Decoders -->
<!-- Modify it at your will. -->
<decoder name="local_decoder_example">
<program_name>ÃdasdfdfweóñNEW DECODER</program_name>
</decoder>
# curl -u foo:bar -X POST -H 'Content-type: application/xml' -d @/home/druizz/test_no_utf8 "http://localhost:55000/manager/files?path=etc/decoders/new_decoders.xml"
{"error":0,"data":"File updated successfully"}
# curl -u foo:bar -X GET "http://localhost:55000/manager/files?path=etc/decoders/new_decoders.xml"
{"error":0,"data":" <!-- NEW Local Decoders -->\n <!-- Modify it at your will. -->\n <decoder name=\"local_decoder_example\">\n <program_name>ÃdasdfdfweóñNEW DECODER</program_name>\n </decoder>\n"}
# cat /var/ossec/etc/decoders/new_decoders.xml
<!-- NEW Local Decoders -->
<!-- Modify it at your will. -->
<decoder name="local_decoder_example">
<program_name>ÃdasdfdfweóñNEW DECODER</program_name>
</decoder> This is other example with a wrong curl -u foo:bar -X POST -H 'Content-type: application/xml' -d @/home/druizz/test_no_utf8 "http://localhost:55000/manager/files?path=etc/directory/new_decoders.xml"
{"error":704,"message":"Invalid path"} |
Unit testspython3 -m pytest -v
================================================ test session starts =================================================
platform linux -- Python 3.6.3, pytest-4.2.0, py-1.7.0, pluggy-0.8.1 -- /usr/bin/python3
cachedir: .pytest_cache
rootdir: wazuh/framework, inifile:
collected 2 items
tests/test_manager.py::TestManager::test_get_file PASSED [ 50%]
tests/test_manager.py::TestManager::test_upload_file PASSED [100%] Mocha tests$ mocha test/test_manager.js
Manager
POST/manager/files
✓ Upload rules (239ms)
✓ Upload decoder (234ms)
✓ Upload list (259ms)
✓ Upload malformed list
✓ Upload malformed rule
✓ Upload malformed decoder
✓ Upload malformed list
/manager/files
✓ Request rules (228ms)
✓ Request decoders (249ms)
✓ Request lists (231ms)
✓ Request wrong path 1
✓ Request wrong path 2
✓ Request wrong path 3
✓ Request unexisting file (257ms) |
crd1985
approved these changes
Feb 1, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi team,
This PR is closes #283. I added two calls for getting and editing files (rules, decoders, lists and
ossec.conf
).The last commit I added closes #302.
Below there are some examples:
Best regards,
Demetrio.