Open cborla opened 2 days ago
1) *Windows Event Log API** (EvtQuery, EvtNext, etc.) :
2) Event Tracing for Windows (ETW):
3) krabsetw:
4) Integrating PowerShell:
Some basic design and tentative approach on how can this be achieved, this should be double checked based on the different libraries limitations and needs:
Class Diagram:
classDiagram
class EventChannelQuerySystem {
- Session session
- Provider provider
- Consumer consumer
-BookmarkManager bookmarkMgr
-QueryBuilder queryBuilder
+initialize()
+startQuery(channelName, queryString)
+stopQuery()
+getResults()
+setReconnectTime(time)
+rotateLog()
}
class Session {
-sessionName
-sessionProperties
+open()
+close()
+enableProvider(provider)
}
class Provider {
}
class Consumer {
-eventCallback
+processEvent(event)
+setEventCallback(callback)
}
class BookmarkManager {
-bookmarks
+createBookmark(event)
+getBookmark(id)
+saveBookmarks()
+loadBookmarks()
}
class QueryBuilder {
+buildQuery(channelName, conditions)
+addWildcardMatch(field, pattern)
}
EventChannelQuerySystem -- Session
EventChannelQuerySystem -- Provider
EventChannelQuerySystem -- Consumer
EventChannelQuerySystem -- BookmarkManager
EventChannelQuerySystem -- QueryBuilder
EventChannelQuerySystem
: The main class that orchestrates the entire querying process.Session
: Manages the ETW session, including opening, closing, and enabling providers.Provider
: Represents an ETW provider, which can be enabled or disabled.Consumer
: Processes the events received from the ETW session.BookmarkManager
: Handles the creation, saving, and loading of bookmarks.QueryBuilder
: Constructs queries, including support for wildcard matches.Flow chart:
ETWQuerySystem
.QueryBuilder
, incorporating channel name and specific query conditions.graph TD
A[init] --> B[Initialize - ETWQuerySystem]
B --> C[Open - ETWSession]
C --> D[Enable - ETWProvider]
D --> E[Set up - ETWConsumer]
E --> F[Load Bookmarks -> store]
E --> W[(Store)]
F --> G[Build N Queries]
G --> H[run]
H --> I{While Event Received?}
I -->|Yes| J[Process Event]
J --> K[Update Bookmark]
K --> I
I -->|No| N{Query Stopped or shutdown signal ?}
N -->|Yes| O[Save Bookmarks]
O --> P[Close Session]
P --> Q[End]
N -->|No| R{Reconnect Needed?}
R -->|Yes| S[Reconnect]
S --> I
R -->|No| I
Description
This issue is a section of #201, focuses on implementing the Windows Logcollector module in the Wazuh Agent 5.0.0. The Windows collector will utilize the Event Channel (eventchannel) API to gather system logs, ensuring seamless integration and log management on Windows platforms.
Functional Requirements
Non-functional Requirements
Deliverables
Acceptance Criteria