Skip to content

Commit 57c1e0b

Browse files
committed
Implement memory scanning feature and enhance configuration options; update examples and documentation
1 parent bd5cc8b commit 57c1e0b

20 files changed

+653
-19
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ fastfinder [OPTIONS]
133133
> 💡 **Tip**: FastFinder can run with standard user privileges, but administrative rights provide access to all system files.
134134
135135
### Scan and export file match according to your needs
136-
configuration examples are available [there](./examples)
136+
configuration examples are available [there](./examples). Here is a full configuration blank example. You do not need to implement every attribute if you are not using everything.
137137

138138
```yaml
139139
input:
@@ -143,7 +143,7 @@ input:
143143
yara: [] # use yara rule and specify rules path(s) for more complex pattern search (wildcards / regex / conditions)
144144
checksum: [] # parse for md5/sha1/sha256 in file content
145145
options:
146-
contentMatchDependsOnPathMatch: true # if true, paths are a pre-filter for content searchs. If false, paths and content both generate matchs
146+
contentMatchDependsOnPathMatch: true # if true, paths are a pre-filter for grep (string) searches only. YARA and Checksums are always evaluated.
147147
findInHardDrives: true # enumerate hard drive content
148148
findInRemovableDrives: true # enumerate removable drive content
149149
findInNetworkDrives: true # enumerate network drive content
@@ -215,7 +215,7 @@ project/
215215
### Important notes
216216
* input path are always case INSENSITIVE
217217
* content search on string (grep) are always case SENSITIVE
218-
* backslashes SHOULD NOT be escaped (except with regular expressions)
218+
* backslashes HAVE TO be escaped (except with regular expressions)
219219
* **YARA rules must exist** - missing rules will cause FastFinder to exit with an error
220220
For more informations, take a look at the [examples](./examples)
221221

configuration.go

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@ type Configuration struct {
2828
}
2929

3030
type Input struct {
31-
Path []string `yaml:"path"`
32-
Content Content `yaml:"content"`
31+
Path []string `yaml:"path"`
32+
DirectPaths []string `yaml:"-"`
33+
Content Content `yaml:"content"`
3334
}
3435

3536
type Content struct {
@@ -44,6 +45,7 @@ type Options struct {
4445
FindInRemovableDrives bool `yaml:"findInRemovableDrives"`
4546
FindInNetworkDrives bool `yaml:"findInNetworkDrives"`
4647
FindInCDRomDrives bool `yaml:"findInCDRomDrives"`
48+
ScanMemory bool `yaml:"scanMemory"`
4749
}
4850

4951
type Output struct {
@@ -135,6 +137,8 @@ func (c *Configuration) getConfiguration(configFile string) *Configuration {
135137

136138
// parsing input paths
137139
environmentVariables := GetEnvironmentVariables()
140+
allPathsAreDirect := true
141+
var directPaths []string
138142

139143
for i := 0; i < len(c.Input.Path); i++ {
140144
// replace environment variables
@@ -144,6 +148,20 @@ func (c *Configuration) getConfiguration(configFile string) *Configuration {
144148
}
145149
}
146150

151+
// check for direct paths validity
152+
if allPathsAreDirect {
153+
rawPath := c.Input.Path[i]
154+
if strings.Contains(rawPath, "*") || strings.Contains(rawPath, "?") || (strings.HasPrefix(rawPath, "/") && strings.HasSuffix(rawPath, "/")) {
155+
allPathsAreDirect = false
156+
} else {
157+
if _, err := os.Stat(rawPath); err != nil {
158+
allPathsAreDirect = false
159+
} else {
160+
directPaths = append(directPaths, rawPath)
161+
}
162+
}
163+
}
164+
147165
// handle regex and simple find strings
148166
if c.Input.Path[i][0] != '/' || c.Input.Path[i][len(c.Input.Path[i])-1] != '/' {
149167
c.Input.Path[i] = regexp.QuoteMeta(strings.ToLower(c.Input.Path[i]))
@@ -165,6 +183,10 @@ func (c *Configuration) getConfiguration(configFile string) *Configuration {
165183

166184
}
167185

186+
if allPathsAreDirect && len(directPaths) > 0 {
187+
c.Input.DirectPaths = directPaths
188+
}
189+
168190
// normalize checksums
169191
for i := 0; i < len(c.Input.Content.Checksum); i++ {
170192
c.Input.Content.Checksum[i] = strings.ToLower(c.Input.Content.Checksum[i])

examples/CISA-AA21-259A/CISA-AA21-259A.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ options:
2929
findInRemovableDrives: false
3030
findInNetworkDrives: false
3131
findInCDRomDrives: false
32+
scanMemory: false
3233
output:
3334
copyMatchingFiles: false
3435
base64Files: false

examples/React2Shell/react2shell.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ options:
2424
findInRemovableDrives: true
2525
findInNetworkDrives: true
2626
findInCDRomDrives: true
27+
scanMemory: true
2728
output:
2829
copyMatchingFiles: false
2930
base64Files: false

examples/example_configuration_api_triage.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ options:
1111
findInRemovableDrives: false
1212
findInNetworkDrives: false
1313
findInCDRomDrives: false
14+
scanMemory: false
1415
output:
1516
copyMatchingFiles: false
1617
base64Files: false

examples/example_configuration_distant.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ options:
1212
findInRemovableDrives: false
1313
findInNetworkDrives: false
1414
findInCDRomDrives: false
15+
scanMemory: false
1516
output:
1617
copyMatchingFiles: false
1718
base64Files: false

examples/example_configuration_docker_triage.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ options:
3838
findInRemovableDrives: false
3939
findInNetworkDrives: false
4040
findInCDRomDrives: false
41-
41+
scanMemory: false
4242
output:
4343
copyMatchingFiles: true
4444
base64Files: true

examples/example_configuration_linux.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ options:
1414
findInRemovableDrives: false
1515
findInNetworkDrives: false
1616
findInCDRomDrives: false
17+
scanMemory: true
1718
output:
1819
copyMatchingFiles: false
1920
base64Files: false

examples/example_configuration_windows.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ options:
2020
findInRemovableDrives: false
2121
findInNetworkDrives: false
2222
findInCDRomDrives: false
23+
scanMemory: true
2324
output:
2425
copyMatchingFiles: false
2526
base64Files: false

examples/linux-fontonlake/eset_fontonlake_linux.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ options:
4848
findInRemovableDrives: false
4949
findInNetworkDrives: false
5050
findInCDRomDrives: false
51+
scanMemory: false
5152
output:
5253
copyMatchingFiles: false
5354
base64Files: false

0 commit comments

Comments
 (0)