Skip to content

Commit 788d29b

Browse files
authored
Merge branch 'master' into master
2 parents cac14e6 + 2c04498 commit 788d29b

File tree

81 files changed

+4838
-2397
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+4838
-2397
lines changed

.github/workflows/linters.yml

+2-24
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
strategy:
1111
matrix:
1212
os: [ubuntu-20.04, ubuntu-22.04]
13-
python-version: ['3.9', '3.10']
13+
python-version: ["3.9", "3.10"]
1414

1515
steps:
1616
- uses: actions/checkout@v2
@@ -36,28 +36,6 @@ jobs:
3636
- uses: actions/checkout@v2
3737
- uses: psf/black@stable
3838

39-
ESLint-frontend:
40-
runs-on: ubuntu-latest
41-
defaults:
42-
run:
43-
working-directory: ./timesketch/frontend
44-
strategy:
45-
matrix:
46-
os: [ubuntu-20.04, ubuntu-22.04]
47-
node-version: ["18"]
48-
steps:
49-
- uses: actions/checkout@v2
50-
- name: Set up Node ${{ matrix.node-version }}
51-
uses: actions/setup-node@v2
52-
with:
53-
node-version: ${{ matrix.node-version }}
54-
- name: Install dependencies
55-
run: yarn add eslint@5.16.0
56-
- name: Run eslint
57-
run: |
58-
git config pull.rebase false && git fetch -p origin master
59-
for FILE in `git --no-pager diff origin/master --name-only --diff-filter=ACMR | grep -e \.vue$ -e \.js$ | grep -v dist\/js | grep ^timesketch\/frontend\/ | sed s/'^timesketch\/frontend\/'/''/`; do echo "Running eslint against ${FILE}"; yarn run eslint ${FILE}; done
60-
6139
ESLint-frontend-ng:
6240
runs-on: ubuntu-latest
6341
defaults:
@@ -66,7 +44,7 @@ jobs:
6644
strategy:
6745
matrix:
6846
os: [ubuntu-20.04, ubuntu-22.04]
69-
node-version: ["18"]
47+
node-version: ["20"]
7048
steps:
7149
- uses: actions/checkout@v2
7250
- name: Set up Node ${{ matrix.node-version }}

.github/workflows/unit-tests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
strategy:
3939
matrix:
4040
os: [ubuntu-20.04, ubuntu-22.04]
41-
node-version: ["18"]
41+
node-version: ["20"]
4242
steps:
4343
- uses: actions/checkout@v2
4444
- name: Set up Node ${{ matrix.node-version }}

api_client/python/timesketch_api_client/version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"""Version information for Timesketch API Client."""
1515

1616

17-
__version__ = "20241129"
17+
__version__ = "20250112"
1818

1919

2020
def get_version():

cli_client/python/timesketch_cli_client/version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414
"""Version information for the Timesketch CLI client."""
1515

16-
__version__ = "20230721"
16+
__version__ = "20250112"
1717

1818

1919
def get_version():

contrib/nginx.conf

+28
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,20 @@ http {
88
listen [::]:80;
99
client_max_body_size 0m;
1010
location / {
11+
# Unauthenticated ReDoS prevention
12+
set $redos_check "";
13+
if ($request_uri ~* "(/login)"){
14+
set $redos_check U;
15+
}
16+
if ($request_method = POST){
17+
set $redos_check "${redos_check}M";
18+
}
19+
if ($http_content_type != "application/x-www-form-urlencoded"){
20+
set $redos_check "${redos_check}CT";
21+
}
22+
if ($redos_check = UMCT){
23+
return 403;
24+
}
1125
proxy_buffer_size 128k;
1226
proxy_buffers 4 256k;
1327
proxy_busy_buffers_size 256k;
@@ -18,6 +32,20 @@ http {
1832
proxy_set_header X-Forwarded-Proto $scheme;
1933
}
2034
location /legacy/ {
35+
# Unauthenticated ReDoS prevention
36+
set $redos_check "";
37+
if ($request_uri ~* "(/login)"){
38+
set $redos_check U;
39+
}
40+
if ($request_method = POST){
41+
set $redos_check "${redos_check}M";
42+
}
43+
if ($http_content_type != "application/x-www-form-urlencoded"){
44+
set $redos_check "${redos_check}CT";
45+
}
46+
if ($redos_check = UMCT){
47+
return 403;
48+
}
2149
proxy_buffer_size 128k;
2250
proxy_buffers 4 256k;
2351
proxy_busy_buffers_size 256k;

data/intelligence_tag_metadata.yaml

+21-6
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,36 @@
1010

1111
malware:
1212
weight: 100
13-
class: 'danger'
13+
type: 'danger'
14+
15+
bad:
16+
weight: 90
17+
type: 'danger'
1418

1519
suspicious:
1620
weight: 50
17-
class: 'warning'
21+
type: 'warning'
22+
23+
good:
24+
weight: 10
25+
type: 'legit'
1826

1927
legit:
2028
weight: 10
21-
class: 'success'
29+
type: 'legit'
2230

2331
default:
2432
weight: 0
25-
class: 'info'
33+
type: 'default'
34+
35+
export:
36+
weight: 100
37+
type: 'info'
2638

2739
regexes:
2840
'^GROUPNAME':
29-
weight: 100
30-
class: 'danger'
41+
weight: 100
42+
type: 'danger'
43+
'^inv_':
44+
weight: 80
45+
type: 'warning'

data/timesketch.conf

+4-4
Original file line numberDiff line numberDiff line change
@@ -379,16 +379,16 @@ LLM_PROVIDER_CONFIGS = {
379379
'project_id': '',
380380
},
381381
},
382-
'llm_summarization': {
382+
'llm_summarize': {
383383
'aistudio': {
384384
'model': 'gemini-2.0-flash-exp',
385385
'project_id': '',
386386
},
387387
},
388388
'default': {
389-
'aistudio': {
390-
'api_key': '',
391-
'model': 'gemini-2.0-flash-exp',
389+
'ollama': {
390+
'server_url': 'http://ollama:11434',
391+
'model': 'gemma:7b',
392392
},
393393
}
394394
}

docker/dev/build/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
3030
&& rm -rf /var/lib/apt/lists/*
3131

3232
# Install NodeJS for frontend development
33-
RUN curl -sL https://deb.nodesource.com/setup_18.x -o nodesource_setup.sh
33+
RUN curl -sL https://deb.nodesource.com/setup_20.x -o nodesource_setup.sh
3434
RUN bash nodesource_setup.sh
3535
RUN apt-get update && apt-get install -y --no-install-recommends \
3636
nodejs \

docker/release/config.env

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Timesketch version to run. Latest is build from the master branch and a release
22
# number is build from a release tag. Using latest means that you are running
33
# the bleeding edge version and we cannot guarantee that it will not be broken.
4-
TIMESKETCH_VERSION=20241009
4+
TIMESKETCH_VERSION=20250112
55

66
# Timesketch PATH local etc/timesketch
77
TIMESKETCH_CONFIG_PATH=./etc/timesketch
631 KB
Loading

docs/guides/admin/admin-cli.md

+92
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,98 @@ Corresponding Timeline id: 3 in Sketch Id: 2
508508
Corresponding Sketch id: 2 Sketch name: asdasd
509509
```
510510
511+
### Timeline status
512+
513+
The `tsctl timeline-status` command allows to get or set a timeline status.
514+
This can be useful in the following scenarios:
515+
516+
* Monitoring processing In large-scale investigations, timelines can take a considerable amount of time to process.
517+
This feature allows administrators or automated scripts to monitor the processing status of timelines, ensuring that they are progressing as expected.
518+
519+
* Automated Status updates: Scripts can be used to automatically update the status of timelines based on the results of automated analysis or processing steps. For example, if an automated script detects a critical error during analysis, it can set the timeline status to "fail."
520+
521+
* Toubeshooting and Error handling:
522+
** Quickly identifying timelines with a "fail" status allows investigators to troubleshoot issues and re-process data if necessary.
523+
** By monitoring the status of timelines, administrators can identify potential bottlenecks or errors in the processing pipeline.
524+
** Set the status to `fail` is a task is stuck.
525+
526+
Usage:
527+
528+
```bash
529+
tsctl timeline-status [OPTIONS] TIMELINE_ID
530+
--action [get|set]
531+
Specify whether to get or set the timeline status.
532+
- "get": Retrieves the current status of the timeline.
533+
- "set": Sets the status of the timeline to the value specified by "--status".
534+
(Required)
535+
536+
--status [ready|processing|fail]
537+
The desired status to set for the timeline.
538+
This option is only valid when "--action" is set to "set".
539+
Valid options are:
540+
- "ready": Indicates that the timeline is ready for analysis.
541+
- "processing": Indicates that the timeline is currently being processed.
542+
- "fail": Indicates that the timeline processing failed.
543+
(Required when --action is set to set)
544+
```
545+
546+
Examples:
547+
```bash
548+
# Get the status of timeline with ID 123:
549+
tsctl timeline-status --action get 123
550+
551+
# Set the status of timeline with ID 456 to "ready":
552+
tsctl timeline-status --action set --status ready 456
553+
554+
# Set the status of timeline with ID 789 to "fail":
555+
tsctl timeline-status --action set --status fail 789
556+
557+
# Try to set a status without the action set to set.
558+
tsctl timeline-status --status fail 789
559+
# This will fail and display an error message.
560+
```
561+
562+
### Searchindex-status
563+
564+
The `tsctl searchindex-status` command allows to get or set a searchindex status.
565+
566+
Usage:
567+
```
568+
tsctl searchindex-status --help
569+
Usage: tsctl searchindex-status [OPTIONS] SEARCHINDEX_ID
570+
571+
Get or set a searchindex status
572+
573+
If "action" is "set", the given value of status will be written in the
574+
status.
575+
576+
Args: action: get or set searchindex status. status: searchindex
577+
status. Only valid choices are ready, processing, fail.
578+
579+
Options:
580+
--action [get|set] get or set timeline status.
581+
--status [ready|processing|fail]
582+
get or set timeline status.
583+
--searchindex_id TEXT Searchindex ID to search for e.g.
584+
4c5afdf60c6e49499801368b7f238353.
585+
[required]
586+
--help Show this message and exit.
587+
```
588+
589+
590+
Examples:
591+
```bash
592+
tsctl searchindex-status --action set 1 --status fail
593+
Searchindex 1 status set to fail
594+
To verify run: tsctl searchindex-status 1 --action get
595+
tsctl searchindex-status --action set --status fail 1
596+
Searchindex 1 status set to fail
597+
To verify run: tsctl searchindex-status 1 --action get
598+
tsctl searchindex-status 1 --action get
599+
searchindex_id index_name created_at user_id description status
600+
1 f609b138aa1e4c448ece6c012dcb2bab 2025-03-07 09:23:37.172143 1 # fail
601+
```
602+
511603
### Sigma
512604
513605
#### List Sigma rules

docs/guides/admin/llm-features.md

+88
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
---
2+
hide:
3+
- footer
4+
---
5+
6+
# LLM Features Configuration
7+
8+
Timesketch includes experimental features leveraging Large Language Models (LLMs) to enhance analysis capabilities. These features include event summarization and AI-generated queries (NL2Q - Natural Language to Query). This document outlines the steps required to configure these features for Timesketch administrators.
9+
10+
## LLM Provider Configuration
11+
12+
To utilize the LLM features, the Timesketch **administrator** must configure an LLM provider in the `timesketch.conf` file. It's possible to configure a specific LLM provider and model per LLM powered feature, or to use a default provider. For most features we recommend using a fast model (such as `gemini-2.0-flash-001` ) for optimal performance, especially for the event summarization feature.
13+
14+
Edit your `timesketch.conf` file to include the `LLM_PROVIDER_CONFIGS` dictionary. Below is a sample configuration with explanations for each parameter.
15+
16+
```python
17+
# LLM provider configs
18+
LLM_PROVIDER_CONFIGS = {
19+
# Configure a LLM provider for a specific LLM enabled feature, or the
20+
# default provider will be used.
21+
# Supported LLM Providers:
22+
# - ollama: Self-hosted, open-source.
23+
# To use the Ollama provider you need to download and run an Ollama server.
24+
# See instructions at: https://ollama.ai/
25+
# - vertexai: Google Cloud Vertex AI. Requires Google Cloud Project.
26+
# To use the Vertex AI provider you need to:
27+
# 1. Create and export a Service Account Key from the Google Cloud Console.
28+
# 2. Set the GOOGLE_APPLICATION_CREDENTIALS environment variable to the full path
29+
# to your service account private key file by adding it to the docker-compose.yml
30+
# under environment:
31+
# GOOGLE_APPLICATION_CREDENTIALS=/usr/local/src/timesketch/<key_file>.json
32+
# 3. Verify your instance has the `google-cloud-aiplatform` lib installed.
33+
# * $ sudo docker exec timesketch-web pip list | grep google-cloud-aiplatform
34+
# * You can install it manually using:
35+
# $ sudo docker exec timesketch-web pip install google-cloud-aiplatform==1.70.0
36+
#
37+
# IMPORTANT: Private keys must be kept secret. If you expose your private key it is
38+
# recommended to revoke it immediately from the Google Cloud Console.
39+
# - aistudio: Google AI Studio (API key). Get API key from Google AI Studio website.
40+
# To use Google's AI Studio simply obtain an API key from https://aistudio.google.com/
41+
# Verify your instance runs the required library:
42+
# * $ sudo docker exec timesketch-web pip list | grep google-generativeai
43+
# * You can install it manually using:
44+
# $ sudo docker exec timesketch-web pip install google-generativeai==0.8.4
45+
'nl2q': {
46+
'vertexai': {
47+
'model': 'gemini-2.0-flash-001',
48+
'project_id': '', # Required if using vertexai
49+
},
50+
},
51+
'llm_summarization': {
52+
'aistudio': {
53+
'model': 'gemini-2.0-flash-001', # Recommended model
54+
'api_key': '', # Required if using aistudio
55+
},
56+
},
57+
'default': {
58+
'ollama': {
59+
'server_url': 'http://localhost:11434',
60+
'model': 'gemma2-2b-it',
61+
},
62+
}
63+
}
64+
```
65+
66+
**Note:** While [users can enable/disable these features](../user/llm-features-user.md), the underlying LLM provider and its configuration are managed by the Timesketch administrator. Enabling these features may incur costs depending on the chosen LLM provider. Please review the pricing details of your selected provider before enabling these features.
67+
68+
## Prompt and Data Configuration
69+
70+
Administrators can further customize the behavior of the LLM features by configuring the paths to various prompt and data files within the `timesketch.conf` file.
71+
72+
```python
73+
# LLM nl2q configuration
74+
DATA_TYPES_PATH = '/etc/timesketch/nl2q/data_types.csv'
75+
PROMPT_NL2Q = '/etc/timesketch/nl2q/prompt_nl2q'
76+
EXAMPLES_NL2Q = '/etc/timesketch/nl2q/examples_nl2q'
77+
78+
# LLM event summarization configuration
79+
PROMPT_LLM_SUMMARIZATION = '/etc/timesketch/llm_summarize/prompt.txt'
80+
```
81+
82+
* `DATA_TYPES_PATH`: Specifies the path to a CSV file defining common Timesketch data types for the NL2Q feature.
83+
* `PROMPT_NL2Q`: Specifies the path to the prompt file used by the NL2Q feature to translate a natural language into a Timesketch search query.
84+
* `EXAMPLES_NL2Q`: Specifies the path to the examples file used by the NL2Q feature. This file provides the LLM with examples of natural language queries and their corresponding Timesketch search queries, which help improve the accuracy of the NL2Q feature.
85+
* `PROMPT_LLM_SUMMARIZATION`: Specifies the path to the prompt file used by the event summarization feature. Administrators can modify this file to customize the summarization output to their specific needs. This template allows for injecting the event data into the prompt using Python-style string formatting using curly braces `{}`.
86+
Timesketch provides some default configuration files for both features:
87+
* [NL2Q default configuration](https://github.com/google/timesketch/tree/master/data/nl2q).
88+
* [LLM Summarization default configuration](https://github.com/google/timesketch/tree/master/data/llm_summarize).

0 commit comments

Comments
 (0)