Skip to content

Commit

Permalink
Sync Kapefiles (#3160)
Browse files Browse the repository at this point in the history
  • Loading branch information
scudette committed Dec 12, 2023
1 parent 21b841d commit badd34f
Show file tree
Hide file tree
Showing 10 changed files with 714 additions and 674 deletions.
6 changes: 3 additions & 3 deletions accessors/s3/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@ import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/session"
"www.velocidex.com/golang/velociraptor/constants"
vql_subsystem "www.velocidex.com/golang/velociraptor/vql"
"www.velocidex.com/golang/velociraptor/vql/networking"
"www.velocidex.com/golang/vfilter"
)

const (
S3_CREDENTIALS = "S3_CREDENTIALS"
S3_TAG = "_S3_TAG"
S3_TAG = "_S3_TAG"
)

func GetS3Session(scope vfilter.Scope) (*session.Session, error) {
// Empty credentials are OK - they just mean to get creds from the
// process env
setting, pres := scope.Resolve(S3_CREDENTIALS)
setting, pres := scope.Resolve(constants.S3_CREDENTIALS)
if !pres {
setting = ordereddict.NewDict()
}
Expand Down
3 changes: 2 additions & 1 deletion accessors/smb/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/hirochachacha/go-smb2"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
"www.velocidex.com/golang/velociraptor/constants"
vql_subsystem "www.velocidex.com/golang/velociraptor/vql"
"www.velocidex.com/golang/vfilter"
)
Expand Down Expand Up @@ -179,7 +180,7 @@ func getCreadentials(
ctx context.Context, scope vfilter.Scope, hostname string) (
*smb2.NTLMInitiator, error) {

credentials, pres := scope.Resolve("SMB_CREDENTIALS")
credentials, pres := scope.Resolve(constants.SMB_CREDENTIALS)
if !pres {
return nil, errors.New("No credentials provided for smb connections")
}
Expand Down
7 changes: 2 additions & 5 deletions accessors/ssh/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,15 @@ import (
"fmt"

"golang.org/x/crypto/ssh"
"www.velocidex.com/golang/velociraptor/constants"
vql_subsystem "www.velocidex.com/golang/velociraptor/vql"
"www.velocidex.com/golang/vfilter"
)

const (
SSH_CONFIG = "SSH_CONFIG"
)

func GetSSHClient(scope vfilter.Scope) (*ssh.Client, func() error, error) {
// Empty credentials are OK - they just mean to get creds from the
// process env
setting, pres := scope.Resolve(SSH_CONFIG)
setting, pres := scope.Resolve(constants.SSH_CONFIG)
if !pres {
return nil, nil, errors.New("Configure the 'ssh' accessor using 'LET SSH_CONFIG <= dict(...)'")
}
Expand Down
672 changes: 343 additions & 329 deletions artifacts/definitions/Linux/KapeFiles/CollectFromDirectory.yaml

Large diffs are not rendered by default.

672 changes: 343 additions & 329 deletions artifacts/definitions/Windows/KapeFiles/Targets.yaml

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions artifacts/definitions/Windows/Search/FileFinder.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ parameters:
- registry
- file
- ntfs
- ntfs_vss

- name: YaraRule
type: yara
Expand All @@ -76,6 +77,11 @@ parameters:
default: ""
type: timestamp

- name: VSS_MAX_AGE_DAYS
type: int
description: |
If larger than 0 we restrict VSS age to this many days
ago. Otherwise we find all VSS.
sources:
- query: |
Expand Down
9 changes: 4 additions & 5 deletions bin/artifacts.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,11 +260,10 @@ func doArtifactCollect() error {
}

query := `
SELECT * FROM collect(artifacts=Artifacts, output=Output, report=Report,
level=Level, template=Template,
timeout=Timeout, progress_timeout=ProgressTimeout,
cpu_limit=CpuLimit,
password=Password, args=Args, format=Format)`
SELECT * FROM collect(
artifacts=Artifacts, output=Output,
level=Level, timeout=Timeout, progress_timeout=ProgressTimeout,
cpu_limit=CpuLimit, password=Password, args=Args, format=Format)`
err = eval_local_query(
sm.Ctx, config_obj,
*artifact_command_collect_format, query, scope)
Expand Down
9 changes: 9 additions & 0 deletions constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,15 @@ const (
USN_FREQUENCY = "USN_FREQUENCY"
ZIP_FILE_CACHE_SIZE = "ZIP_FILE_CACHE_SIZE"

// Used by the SSH accessor to configure access
SSH_CONFIG = "SSH_CONFIG"

// Used by the SMB accessor to configure credentials.
SMB_CREDENTIALS = "SMB_CREDENTIALS"

// Used by the S3 accessor to configure credentials.
S3_CREDENTIALS = "S3_CREDENTIALS"

// VQL tries to balance memory/cpu tradeoffs and also place limits
// on memory use. These parameters control this behavior. You can
// set them in the VQL environment to influence how the engine
Expand Down
1 change: 0 additions & 1 deletion gui/velociraptor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"@fortawesome/react-fontawesome": "0.2.0",
"@popperjs/core": "^2.11.8",
"axios": ">=1.6.2",
"axios": ">=1.6.1",
"ace-builds": "1.31.2",
"axios-retry": "3.9.0",
"bootstrap": "^4.6.2",
Expand Down
3 changes: 2 additions & 1 deletion services/repository/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,8 @@ func (self *Repository) List(ctx context.Context,
}
}

sort.Strings(results)

return results, nil
}

Expand All @@ -492,7 +494,6 @@ func (self *Repository) list() []string {
for k := range self.Data {
result = append(result, k)
}
sort.Strings(result)
return result
}

Expand Down

0 comments on commit badd34f

Please sign in to comment.