Skip to content

Commit 78adda5

Browse files
committed
Update Linux compilation guide and Docker helper script; enhance fallback logic in drive enumeration
1 parent e5765c1 commit 78adda5

File tree

4 files changed

+28
-10
lines changed

4 files changed

+28
-10
lines changed

README.linux-compilation.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,11 @@ sudo dnf install -y \
7171
gcc \
7272
pkgconf \
7373
git \
74-
openssl-devel
74+
openssl-devel \
75+
zlib-devel
7576
```
7677

77-
> ⚠️ **Fedora-specific workaround**: After installing YARA, you may encounter library linking issues. See the [troubleshooting section](#fedora-library-workaround) below for the required additional steps.
78+
> ⚠️ **Fedora-specific workaround**: Depending on your Fedora version, after installing YARA, you may encounter library linking issues. See the [troubleshooting section](#fedora-library-workaround) below for the required additional steps.
7879
7980
### Arch Linux
8081

@@ -99,7 +100,7 @@ sudo pacman -S \
99100
mkdir -p ~/build && cd ~/build
100101

101102
# Download latest stable release
102-
YARA_VERSION="4.5.0" # Check https://github.com/VirusTotal/yara/releases for latest
103+
YARA_VERSION="4.5.5" # Check https://github.com/VirusTotal/yara/releases for latest
103104
wget https://github.com/VirusTotal/yara/archive/v${YARA_VERSION}.tar.gz
104105
tar -xzf v${YARA_VERSION}.tar.gz
105106
cd yara-${YARA_VERSION}
@@ -134,6 +135,7 @@ sudo ldconfig
134135
yara --version
135136

136137
# Verify library linking
138+
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
137139
pkg-config --cflags --libs yara
138140

139141
# Test with simple rule
@@ -150,7 +152,6 @@ CGO requires specific flags to link with the YARA library:
150152
# Add to your ~/.bashrc or ~/.profile
151153
export CGO_CFLAGS="-I/usr/local/include"
152154
export CGO_LDFLAGS="-L/usr/local/lib -lyara"
153-
export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH"
154155

155156
# Reload environment
156157
source ~/.bashrc

docker/docker-helper.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ function Run-Runtime {
255255
$entrypointArgs = @("--entrypoint", "/bin/bash")
256256
$commandArgs = @()
257257
} else {
258-
$commandArgs = @("-c", $configFileInContainer)
258+
$commandArgs = @("-c", $configFileInContainer, "--root", "/scan")
259259
if ($Triage) {
260260
$commandArgs += "-t"
261261
Write-Info "Triage mode enabled - continuous monitoring active"

main.go

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ func RunProgramWithParameters(pConfigPath string, pSfxPath string, pSilentMode b
9393
go MainFastfinderRoutine(config, pConfigPath, false, pSfxPath, pTriage, pLogVerbosity, pRootPath)
9494
MainWindow()
9595
} else {
96-
LogMessage(LOG_INFO, LineBreak+"================================================"+LineBreak+RenderFastfinderLogo()+"================================================"+LineBreak)
96+
fmt.Print(LineBreak + "================================================" + LineBreak + RenderFastfinderLogo() + "================================================" + LineBreak)
9797
MainFastfinderRoutine(config, pConfigPath, false, pSfxPath, pTriage, pLogVerbosity, pRootPath)
9898
}
9999

@@ -186,8 +186,17 @@ func MainFastfinderRoutine(config Configuration, pConfigPath string, pNoAdvUI bo
186186
for _, basePath := range baseDrives {
187187
LogMessage(LOG_VERBOSE, "(INFO)", "Enumerating files in", basePath)
188188

189+
// Calculate excluded paths for this base path
190+
var currentExcludedPaths []string
191+
currentExcludedPaths = append(currentExcludedPaths, excludedPaths...)
192+
189193
if runtime.GOOS != "windows" {
190-
excludedPaths = append(excludedPaths, basePath)
194+
// Exclude other base drives that are subdirectories of the current base path
195+
for _, otherPath := range baseDrives {
196+
if otherPath != basePath && strings.HasPrefix(otherPath, basePath) {
197+
currentExcludedPaths = append(currentExcludedPaths, otherPath)
198+
}
199+
}
191200
}
192201

193202
// Prepare path regex patterns
@@ -205,7 +214,7 @@ func MainFastfinderRoutine(config Configuration, pConfigPath string, pNoAdvUI bo
205214

206215
// Start enumeration in a separate goroutine
207216
LogMessage(LOG_VERBOSE, "(INFO)", "Starting file enumeration in", basePath)
208-
pipeline.StartEnumeration([]string{basePath}, excludedPaths)
217+
pipeline.StartEnumeration([]string{basePath}, currentExcludedPaths)
209218

210219
// Start scanning based on configuration
211220
if len(config.Input.Content.Grep) > 0 || len(config.Input.Content.Checksum) > 0 || len(config.Input.Content.Yara) > 0 {

utils_linux.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,16 +143,24 @@ func EnumLogicalDrives() (drivesInfo []DriveInfo, excludedPaths []string) {
143143

144144
// Fallback for containers: if nothing was found, use a mounted scan root
145145
if len(drivesInfo) == 0 {
146+
LogMessage(LOG_VERBOSE, "[COMPAT]", "No block devices found - checking for container environment")
147+
146148
root := os.Getenv("FASTFINDER_SCAN_ROOT")
147149
if root == "" {
148150
root = "/scan"
149151
}
150152

153+
LogMessage(LOG_VERBOSE, "[COMPAT]", "Attempting to use fallback scan root:", root)
154+
151155
if info, err := os.Stat(root); err == nil && info.IsDir() {
152-
LogMessage(LOG_INFO, "[COMPAT]", "No block devices found; using fallback scan root", root)
156+
LogMessage(LOG_INFO, "[COMPAT]", "Container detected: using fallback scan root", root)
153157
drivesInfo = append(drivesInfo, DriveInfo{Name: root, Type: DRIVE_FIXED})
154158
} else {
155-
LogMessage(LOG_ERROR, "[COMPAT]", "Fallback scan root not accessible", root)
159+
if err != nil {
160+
LogMessage(LOG_ERROR, "[COMPAT]", "Fallback scan root not accessible (stat error):", root, "Error:", err.Error())
161+
} else {
162+
LogMessage(LOG_ERROR, "[COMPAT]", "Fallback scan root exists but is not a directory:", root)
163+
}
156164
}
157165
}
158166

0 commit comments

Comments
 (0)