Skip to content

Commit b30305c

Browse files
Merge remote-tracking branch 'origin/develop'
2 parents 93b2dc5 + 470d050 commit b30305c

Some content is hidden

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

91 files changed

+4956
-2537
lines changed

.env

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,8 @@ CONFIG_DIR=./deployment
99
CONFIG_FILE=./config.hjson
1010
SYSLOG_ADDRESS=localhost:514
1111
DB_ADDRESS=localhost:9000
12+
CLICKHOUSE_USERNAME=default
13+
CLICKHOUSE_PASSWORD=
1214
LOGGING_ENABLED=true
1315
LOG_LEVEL=1
16+

.env.production

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ CONFIG_FILE=/etc/rita/config.hjson
99
SYSLOG_ADDRESS=syslogng:5514
1010
APP_LOGS=/var/log/rita
1111
DB_ADDRESS=db:9000
12+
CLICKHOUSE_USERNAME=default
13+
CLICKHOUSE_PASSWORD=
1214
LOGGING_ENABLED=true
1315
LOG_LEVEL=1
1416

.github/workflows/build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
push:
99
branches:
1010
- "main"
11+
- "develop"
1112
tags:
1213
- "v*.*.*"
1314
workflow_dispatch:

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ on:
1616

1717
workflow_run:
1818
workflows: ["Build Docker Images"]
19-
branches: [main]
19+
branches: [main, develop]
2020
types:
2121
- completed
2222

.github/workflows/test.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ name: Tests
33
on:
44
pull_request:
55
push:
6-
branches: 'main'
6+
branches:
7+
- 'main'
8+
- 'develop'
79

810
# Temporarily splitting out tests into separate jobs for improving workflow execution time
911
jobs:
@@ -16,7 +18,7 @@ jobs:
1618
- name: Setup Go
1719
uses: actions/setup-go@v5
1820
with:
19-
go-version: '1.22'
21+
go-version: '1.24'
2022
- name: Install dependencies
2123
run: go get .
2224
- name: Build
@@ -41,7 +43,7 @@ jobs:
4143
- name: Setup Go
4244
uses: actions/setup-go@v5
4345
with:
44-
go-version: '1.22'
46+
go-version: '1.24'
4547
- name: Install dependencies
4648
run: go get .
4749
- name: Build
@@ -67,7 +69,7 @@ jobs:
6769
- name: Setup Go
6870
uses: actions/setup-go@v5
6971
with:
70-
go-version: '1.22'
72+
go-version: '1.24'
7173
- name: Install dependencies
7274
run: go get .
7375
- name: Build
@@ -92,7 +94,7 @@ jobs:
9294
- name: Setup Go
9395
uses: actions/setup-go@v5
9496
with:
95-
go-version: '1.22'
97+
go-version: '1.24'
9698
- name: Install dependencies
9799
run: go get .
98100
- name: Build
@@ -118,7 +120,7 @@ jobs:
118120
- name: Setup Go
119121
uses: actions/setup-go@v5
120122
with:
121-
go-version: '1.22'
123+
go-version: '1.24'
122124
- name: Install dependencies
123125
run: go get .
124126
- name: Build

.vscode/launch.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
8+
{
9+
"name": "Launch RITA Import",
10+
"type": "go",
11+
"request": "launch",
12+
"mode": "auto",
13+
"program": "${workspaceFolder}/rita.go",
14+
"args": [
15+
"import",
16+
"--database=${input:dbName}",
17+
"--logs=${input:logPath}",
18+
"--rebuild"
19+
]
20+
}
21+
],
22+
"inputs": [
23+
{
24+
"type": "promptString",
25+
"id": "dbName",
26+
"description": "Enter the database name"
27+
},
28+
{
29+
"type": "promptString",
30+
"id": "logPath",
31+
"description": "Enter the path to the logs"
32+
}
33+
]
34+
}

.vscode/rita.code-workspace

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"golang.go",
1212
"hjson.hjson",
1313
"Tanh.hjson-formatter",
14+
"redhat.vscode-yaml",
1415
]
1516
},
1617
"settings": {
@@ -51,5 +52,9 @@
5152
"space": 4,
5253
"eol": "auto",
5354
},
55+
"[yaml]": {
56+
"editor.defaultFormatter": "redhat.vscode-yaml",
57+
"editor.formatOnSave": true,
58+
}
5459
}
5560
}

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM --platform=$BUILDPLATFORM golang:1.22-alpine as rita-builder
1+
FROM --platform=$BUILDPLATFORM golang:1.24-alpine AS rita-builder
22

33
ARG TARGETOS
44
ARG TARGETARCH

README.md

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,15 @@ The framework ingests [Zeek Logs](https://www.zeek.org/) in TSV or JSON format,
3838

3939

4040
### Supported Platforms
41-
- ✅: Official Support
42-
- ⚠️: Unofficial Support
43-
- ❌: Unsupported
44-
45-
| OS | Versions | Platform | Status |
46-
| :---------------- | :------ | :---- | :----: |
47-
| CentOS | `9 Stream` | `amd64` ||
48-
| Rocky | `9` | `amd64` ||
49-
| Ubuntu | `24.04` | `amd64`||
50-
| Windows | | ||
51-
<!-- TODO: eventually add support -->
52-
<!-- | MacOS | `Sonoma` | `intel\|arm` | ✅ | -->
41+
42+
The following operating systems/versions and CPU architectures are supported:
43+
44+
| OS | Versions | Platform |
45+
| :-------------- | :--------------- | :------- |
46+
| CentOS | `9 Stream` | `amd64` |
47+
| Rocky | `9` | `amd64` |
48+
| RHEL | `9` | `amd64` |
49+
| Ubuntu | `22.04`, `24.04` | `amd64` |
5350

5451
## Installing Zeek
5552
If you do not already have Zeek installed, it can be installed from [docker-zeek](https://github.com/activecm/docker-zeek).

analysis/analysis.go

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -43,39 +43,40 @@ type ThreatMixtape struct {
4343
// Base connection details
4444
AnalysisResult
4545

46-
FinalScore float32 `ch:"final_score"`
46+
FinalScore float64 `ch:"final_score"`
4747
// BEACONS
4848
Beacon
49-
BeaconThreatScore float32 `ch:"beacon_threat_score"` // bucketed beacon score
49+
BeaconThreatScore float64 `ch:"beacon_threat_score"` // bucketed beacon score
5050
BeaconType string `ch:"beacon_type"`
5151

5252
// LONG CONNECTIONS
53-
LongConnScore float32 `ch:"long_conn_score"`
53+
LongConnScore float64 `ch:"long_conn_score"`
5454

5555
// Strobe
5656
Strobe bool `ch:"strobe"`
57-
StrobeScore float32 `ch:"strobe_score"`
57+
StrobeScore float64 `ch:"strobe_score"`
5858

5959
// C2 over DNS
60-
C2OverDNSScore float32 `ch:"c2_over_dns_score"`
61-
C2OverDNSDirectConnScore float32 `ch:"c2_over_dns_direct_conn_score"`
60+
C2OverDNSScore float64 `ch:"c2_over_dns_score"`
61+
C2OverDNSDirectConnScore float64 `ch:"c2_over_dns_direct_conn_score"`
6262

6363
// Threat Intel
6464
ThreatIntel bool `ch:"threat_intel"`
65-
ThreatIntelScore float32 `ch:"threat_intel_score"`
65+
ThreatIntelScore float64 `ch:"threat_intel_score"`
6666

6767
// **** MODIFIERS ****
6868
// for modifiers detected during the modifiers phase
6969
ModifierName string `ch:"modifier_name"`
70-
ModifierScore float32 `ch:"modifier_score"`
70+
ModifierScore float64 `ch:"modifier_score"`
7171
ModifierValue string `ch:"modifier_value"`
7272

7373
// modifiers that are able to be added to the same row as the threat indicator scores
7474
// these are detected during the analysis phase (in the spagooper)
75-
PrevalenceScore float32 `ch:"prevalence_score"`
76-
FirstSeenScore float32 `ch:"first_seen_score"`
77-
ThreatIntelDataSizeScore float32 `ch:"threat_intel_data_size_score"`
78-
MissingHostHeaderScore float32 `ch:"missing_host_header_score"`
75+
PrevalenceScore float64 `ch:"prevalence_score"`
76+
NetworkSize uint64 `ch:"network_size"`
77+
FirstSeenScore float64 `ch:"first_seen_score"`
78+
ThreatIntelDataSizeScore float64 `ch:"threat_intel_data_size_score"`
79+
MissingHostHeaderScore float64 `ch:"missing_host_header_score"`
7980
}
8081

8182
// NewAnalyzer returns a new Analyzer object
@@ -169,6 +170,7 @@ func (analyzer *Analyzer) runAnalysis() error {
169170
ImportID: analyzer.ImportID,
170171
AnalysisResult: entry,
171172
BeaconType: entry.BeaconType,
173+
NetworkSize: analyzer.networkSize,
172174
}
173175

174176
// set the first seen historical value
@@ -213,7 +215,7 @@ func (analyzer *Analyzer) runAnalysis() error {
213215
hasThreatIndicator = true
214216
mixtape.C2OverDNSScore = c2OverDNSScore
215217
// run c2 over dns direct connection analysis
216-
if shouldHaveC2OverDNSDirectConnModifier(entry.DirectConns, entry.QueriedBy) {
218+
if mixtape.HasC2OverDNSDirectConnectionsModifier {
217219
mixtape.C2OverDNSDirectConnScore = analyzer.Config.Modifiers.C2OverDNSDirectConnScoreIncrease
218220
}
219221
}
@@ -260,7 +262,7 @@ func (analyzer *Analyzer) runAnalysis() error {
260262

261263
// Threat Intel Data Size Score
262264
if entry.OnThreatIntel {
263-
if entry.TotalBytes >= analyzer.Config.Modifiers.ThreatIntelDataSizeThreshold {
265+
if entry.TotalBytes >= uint64(analyzer.Config.Modifiers.ThreatIntelDataSizeThreshold) {
264266
mixtape.ThreatIntelDataSizeScore = analyzer.Config.Modifiers.ThreatIntelScoreIncrease
265267
}
266268
}
@@ -274,7 +276,7 @@ func (analyzer *Analyzer) runAnalysis() error {
274276
// use the current time to score against unless useCurrentTime is false
275277
relativeTime := util.GetRelativeFirstSeenTimestamp(analyzer.useCurrentTime, analyzer.firstSeenMaxTS)
276278
timeSince := relativeTime.Sub(entry.FirstSeenHistorical)
277-
daysSinceFirstSeen := float32(timeSince.Hours() / 24)
279+
daysSinceFirstSeen := float64(timeSince.Hours() / 24)
278280

279281
// Historical First Seen Scoring
280282
// only apply to rolling datasets
@@ -307,7 +309,7 @@ func (analyzer *Analyzer) runAnalysis() error {
307309
return nil
308310
}
309311

310-
func calculateBucketedScore(value float64, thresholds config.ScoreThresholds) float32 {
312+
func calculateBucketedScore(value float64, thresholds config.ScoreThresholds) float64 {
311313
base := float64(thresholds.Base)
312314
low := float64(thresholds.Low)
313315
medium := float64(thresholds.Med)
@@ -319,23 +321,23 @@ func calculateBucketedScore(value float64, thresholds config.ScoreThresholds) fl
319321
mediumScore := config.MEDIUM_CATEGORY_SCORE * 100
320322
highScore := config.HIGH_CATEGORY_SCORE * 100
321323

322-
score := float32(0)
324+
score := float64(0)
323325

324326
// interpolate scores between the threat category bucket thresholds
325327
switch {
326328
// (Low) 1-4hrs
327329
case value < base:
328330
return 0
329331
case value < low:
330-
score = float32(noneScore + (value-base)/(low-base)*(lowScore-noneScore))
332+
score = float64(noneScore + (value-base)/(low-base)*(lowScore-noneScore))
331333
// (Medium) 4-8hrs
332334
case value >= low && value < medium:
333-
score = float32(lowScore + (value-low)/(medium-low)*(mediumScore-lowScore))
335+
score = float64(lowScore + (value-low)/(medium-low)*(mediumScore-lowScore))
334336
// (High) 8-12hrs+
335337
case value >= medium:
336338
// cap the maximum duration score value to the High category threshold because we're not scoring any higher than this
337339
cappedValue := math.Min(value, high)
338-
score = float32(mediumScore + (cappedValue-medium)/(high-medium)*(highScore-mediumScore))
340+
score = float64(mediumScore + (cappedValue-medium)/(high-medium)*(highScore-mediumScore))
339341
}
340342
return score / 100
341343
}

0 commit comments

Comments
 (0)