Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
Wazuh + VAT Evidence Collector
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MEDINA
Public
Wazuh + VAT Evidence Collector
Commits
d13f5ba7
Commit
d13f5ba7
authored
3 years ago
by
Zitnik, Anze
Browse files
Options
Downloads
Patches
Plain Diff
initial
parents
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitignore
+4
-0
4 additions, 0 deletions
.gitignore
verifier.py
+20
-0
20 additions, 0 deletions
verifier.py
wazuhclient.py
+37
-0
37 additions, 0 deletions
wazuhclient.py
with
61 additions
and
0 deletions
.gitignore
0 → 100644
+
4
−
0
View file @
d13f5ba7
__pycache__/
*.pyc
*$py.class
.idea/
This diff is collapsed.
Click to expand it.
verifier.py
0 → 100644
+
20
−
0
View file @
d13f5ba7
from
wazuhclient
import
WazuhClient
wc
=
WazuhClient
(
'
192.168.33.10
'
,
55000
,
'
wazuh-wui
'
,
'
wazuh-wui
'
)
agents
=
wc
.
req
(
'
GET
'
,
'
agents
'
)
rules
=
wc
.
req
(
'
GET
'
,
'
rules
'
)
print
(
agents
)
print
(
rules
)
syscheck1
=
wc
.
req
(
'
GET
'
,
'
manager/configuration/mail/global
'
)
# check if mail or any integration service (integrator/integrations) are enabled -> automatic monitoring
print
(
syscheck1
)
rules1
=
wc
.
req
(
'
GET
'
,
'
agents/001/config/syscheck/internal
'
)
# SYSCHECK
print
(
rules1
)
print
(
wc
.
req
(
'
GET
'
,
'
agents/001/config/syscheck/rootcheck
'
))
# ROOTCHECK
print
(
wc
.
req
(
'
GET
'
,
'
sca/001
'
))
# TODO how to check integration with virustotal and/or ClamAV ??
\ No newline at end of file
This diff is collapsed.
Click to expand it.
wazuhclient.py
0 → 100644
+
37
−
0
View file @
d13f5ba7
import
json
import
urllib3
class
WazuhClient
:
def
__init__
(
self
,
ip
,
port
,
username
,
password
):
self
.
_ip
=
ip
self
.
_port
=
port
self
.
_username
=
username
self
.
_password
=
password
self
.
_auth_token
=
None
def
req
(
self
,
method
,
resource
,
data
=
None
,
headers
=
{},
auth_retry
=
True
):
# TODO add cert verification
c
=
urllib3
.
HTTPSConnectionPool
(
self
.
_ip
,
port
=
self
.
_port
,
cert_reqs
=
'
CERT_NONE
'
,
assert_hostname
=
False
)
url
=
"
https://%s:%i/%s
"
%
(
self
.
_ip
,
self
.
_port
,
resource
)
headers
[
'
Content-Type
'
]
=
'
application/json
'
if
self
.
_auth_token
:
headers
[
'
Authorization
'
]
=
'
Bearer %s
'
%
self
.
_auth_token
resp
=
c
.
request
(
method
,
url
,
headers
=
headers
,
body
=
data
)
if
resp
.
status
==
401
:
if
not
auth_retry
:
raise
Exception
(
"
Authentication Error
"
)
self
.
_auth_token
=
None
self
.
_login
()
return
self
.
req
(
method
,
resource
,
data
,
headers
,
auth_retry
=
False
)
return
json
.
loads
(
resp
.
data
)
def
_login
(
self
):
login_endpoint
=
'
security/user/authenticate
'
basic_auth
=
"
%s:%s
"
%
(
self
.
_username
,
self
.
_password
)
resp
=
self
.
req
(
'
GET
'
,
login_endpoint
,
headers
=
urllib3
.
make_headers
(
basic_auth
=
basic_auth
),
auth_retry
=
False
)
self
.
_auth_token
=
resp
[
'
data
'
][
'
token
'
]
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment