Skip to content

Commit

Permalink
Add the ability to specify the index when forwarding to splunk #61
Browse files Browse the repository at this point in the history
Update docs
Update rules
  • Loading branch information
wagga40 committed Jun 9, 2023
1 parent db73ed4 commit c947671
Show file tree
Hide file tree
Showing 13 changed files with 158,355 additions and 124,669 deletions.
5 changes: 4 additions & 1 deletion docs/Advanced.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,12 @@ As of v1.3.5, Zircolite can forward detections to a Splunk instance with Splunk

```shell
python3 zircolite.py --evtx /sample.evtx --ruleset rules/rules_windows_sysmon.json \
--remote "https://x.x.x.x:8088" --token "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--remote "https://x.x.x.x:8088" --token "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" \
[--index myindex]
```

Since Splunk HEC default to the first associated index, `--index` is optional but can be used to specify the choosen index among the available ones.

:warning: On Windows do not forget to put quotes

#### Forward to ELK
Expand Down
Binary file modified docs/Zircolite_manual.pdf
Binary file not shown.
2,679 changes: 1,435 additions & 1,244 deletions rules/rules_linux.json

Large diffs are not rendered by default.

25,914 changes: 14,926 additions & 10,988 deletions rules/rules_windows_generic.json

Large diffs are not rendered by default.

45,712 changes: 25,096 additions & 20,616 deletions rules/rules_windows_generic_full.json

Large diffs are not rendered by default.

25,914 changes: 14,926 additions & 10,988 deletions rules/rules_windows_generic_high.json

Large diffs are not rendered by default.

42,618 changes: 23,502 additions & 19,116 deletions rules/rules_windows_generic_medium.json

Large diffs are not rendered by default.

25,914 changes: 14,926 additions & 10,988 deletions rules/rules_windows_sysmon.json

Large diffs are not rendered by default.

45,712 changes: 25,096 additions & 20,616 deletions rules/rules_windows_sysmon_full.json

Large diffs are not rendered by default.

25,914 changes: 14,926 additions & 10,988 deletions rules/rules_windows_sysmon_high.json

Large diffs are not rendered by default.

42,618 changes: 23,502 additions & 19,116 deletions rules/rules_windows_sysmon_medium.json

Large diffs are not rendered by default.

12 changes: 8 additions & 4 deletions zircolite.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def __init__(
self.remoteHost = remote
self.token = token
self.localHostname = socket.gethostname()
self.userAgent = "zircolite/2.8.x"
self.userAgent = "zircolite/2.x"
self.index = index
self.login = login
self.password = password
Expand Down Expand Up @@ -225,9 +225,13 @@ def disableESDefaultLogging(self):

async def HECWorker(self, session, queue, sigmaEvents):
while True:
if self.index:
providedIndex = f"?index={self.index}"
else:
providedIndex = ""
data = await queue.get() # Pop data from Queue
resp = await session.post(
f"{self.remoteHost}/services/collector/event",
f"{self.remoteHost}/services/collector/event{providedIndex}",
headers={"Authorization": f"Splunk {self.token}"},
json=data,
) # Exec action from Queue
Expand Down Expand Up @@ -411,7 +415,7 @@ def initESSession(self):
)
return session

async def testESession(self, session):
async def testESSession(self, session):
try:
await session.info()
except Exception as e:
Expand Down Expand Up @@ -452,7 +456,7 @@ async def sendAllAsyncQueue(

if mode == "ES":
session = self.initESSession()
await self.testESession(session)
await self.testESSession(session)
if self.connectionFailed:
return
fnformatEvent = self.formatEventForES
Expand Down
12 changes: 8 additions & 4 deletions zircolite_dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def __init__(self, remote, timeField, token, logger=None, index=None, login='',
self.remoteHost = remote
self.token = token
self.localHostname = socket.gethostname()
self.userAgent = "zircolite/2.8.x"
self.userAgent = "zircolite/2.x"
self.index = index
self.login = login
self.password = password
Expand Down Expand Up @@ -158,8 +158,12 @@ def disableESDefaultLogging(self):

async def HECWorker(self, session, queue, sigmaEvents):
while True:
if self.index:
providedIndex = f"?index={self.index}"
else:
providedIndex = ""
data = await queue.get() # Pop data from Queue
resp = await session.post(f"{self.remoteHost}/services/collector/event", headers={'Authorization': f"Splunk {self.token}"}, json=data) # Exec action from Queue
resp = await session.post(f"{self.remoteHost}/services/collector/event{providedIndex}", headers={'Authorization': f"Splunk {self.token}"}, json=data) # Exec action from Queue
queue.task_done() # Notify Queue action ended
if str(resp.status)[0] in ["4", "5"]:
self.logger.error(f"{Fore.RED} [-] Forwarding failed for event {Fore.RESET}")
Expand Down Expand Up @@ -263,7 +267,7 @@ def initESSession(self):
session = AsyncElasticsearch(hosts=[self.remoteHost], verify_certs=False, basic_auth=(self.login, self.password))
return session

async def testESession(self, session):
async def testESSession(self, session):
try:
await session.info()
except Exception as e:
Expand Down Expand Up @@ -291,7 +295,7 @@ async def sendAllAsyncQueue(self, payloads, timeField="", sigmaEvents=False, mod

if mode == "ES":
session = self.initESSession()
await self.testESession(session)
await self.testESSession(session)
if self.connectionFailed: return
fnformatEvent = self.formatEventForES
fnWorker = self.ESWorker
Expand Down

0 comments on commit c947671

Please sign in to comment.