-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathJustfile
More file actions
114 lines (99 loc) · 3.55 KB
/
Justfile
File metadata and controls
114 lines (99 loc) · 3.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# Loki-RS Build System - Justfile
# Modern command runner alternative to Makefile
# Install: cargo install just
# Usage: just <command>
# Default recipe
default:
@just --list
# Build the release binary
build:
#!/usr/bin/env bash
echo "[!] The build has a bunch of dependencies"
echo "[i] For information on how to fulfill these prerequisites see the workflow file in .github/workflows/"
echo "[+] Building LOKI release version ..."
if [[ "$(uname -s)" == "Linux" ]]; then
cargo build --release --target x86_64-unknown-linux-musl
echo "[+] Binary location: target/x86_64-unknown-linux-musl/release/loki"
else
cargo build --release
echo "[+] Binary location: target/release/loki"
fi
echo "[+] Build successful!"
# Create a complete build package
package: build install-signatures
#!/usr/bin/env bash
echo "[+] Creating build package ..."
mkdir -p build/signatures build/config
# Copy binary
if [[ "$(uname -s)" == "Linux" ]]; then
cp target/x86_64-unknown-linux-musl/release/loki build/loki
else
cp target/release/loki build/loki
fi
chmod +x build/loki
echo "[+] Binary copied to build/loki"
# Copy usage guide
if [ -f USAGE.md ]; then
cp USAGE.md build/
else
echo "# Loki-RS Usage Guide" > build/USAGE.md
echo "" >> build/USAGE.md
echo "See README.md for usage instructions." >> build/USAGE.md
fi
# Copy config (create empty config, don't ship with predefined exclusions)
cat > build/config/excludes.cfg << 'EOF'
# Loki-RS Exclusions Configuration
#
# Add regex patterns here to exclude paths from scanning.
# One pattern per line. Lines starting with # are comments.
#
# Examples:
# ^/proc/.* - Exclude everything under /proc
# .*\.log$ - Exclude all .log files
# .*node_modules.* - Exclude node_modules directories
#
# See config/excludes.cfg.example for more examples.
EOF
# Copy LICENSE
[ -f LICENSE ] && cp LICENSE build/ || true
echo ""
echo "[✓] Build package created successfully!"
echo "[✓] Package location: build/"
echo "[✓] Binary: build/loki"
echo "[✓] Signatures: build/signatures/"
echo "[✓] Config: build/config/"
echo "[✓] Usage guide: build/USAGE.md"
# Install or link signatures
install-signatures:
#!/usr/bin/env bash
echo "[+] Setting up signatures ..."
mkdir -p build/signatures
if [ -d "./signatures" ] || [ -L "./signatures" ]; then
echo "[+] Found signatures, copying ..."
cp -rL ./signatures/* build/signatures/ 2>/dev/null || true
else
echo "[!] No local signatures found."
echo " You can:"
echo " 1. Run: ./loki-util update (to download YARA Forge rules + IOCs)"
echo " 2. Run: make fetch-signatures (to download signatures via makefile)"
echo " 3. Or manually copy YARA rules and IOCs to build/signatures/"
mkdir -p build/signatures/yara build/signatures/iocs
echo "# Place YARA rules (.yar files) here" > build/signatures/yara/README.txt
echo "# Place IOC files here" > build/signatures/iocs/README.txt
fi
echo "[+] Signatures setup complete"
# Clean build artifacts
clean:
#!/usr/bin/env bash
echo "[+] Cleaning up ..."
rm -rf target dist tmp build
echo "[+] Clean complete"
# Clean only build directory
clean-build:
#!/usr/bin/env bash
echo "[+] Cleaning build directory ..."
rm -rf build
echo "[+] Build directory cleaned"
# Show help
help:
@just --list