Skip to content

Commit

Permalink
Monitoring Flow attaches client id to uploads. (Velocidex#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
scudette authored Jul 25, 2019
1 parent f59b1a0 commit 7b06a6c
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ sources:

- name: ShimCache
queries:
- SELECT * FROM Artifact.Windows.Registery.AppCompatCache()
- SELECT * FROM Artifact.Windows.Registry.AppCompatCache()

- name: Prefetch
queries:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ parameters:

sources:
- queries:
- SELECT * FROM foreach(
- |
SELECT * FROM foreach(
row={ SELECT * FROM Artifact.Windows.Detection.PsexecService() },
query={
SELECT ServiceName, PathName, Modified, FileSize, Timestamp,
Expand Down
2 changes: 1 addition & 1 deletion artifacts/definitions/Windows/Packs/LateralMovement.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ sources:
WHERE Executable =~ "wmic.exe"
- name: ShimCache
queries:
- SELECT * FROM Artifact.Windows.Registery.AppCompatCache()
- SELECT * FROM Artifact.Windows.Registry.AppCompatCache()
WHERE Name =~ "wmic.exe"
- name: BAM
queries:
Expand Down
3 changes: 2 additions & 1 deletion flows/artifacts.go
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,7 @@ func appendDataToFile(

row := vfilter.NewDict().
Set("Timestamp", time.Now().UTC().Unix()).
Set("ClientId", flow_obj.RunnerArgs.ClientId).
Set("VFSPath", file_path).
Set("UploadName", file_buffer.Pathspec.Path).
Set("Accessor", file_buffer.Pathspec.Accessor).
Expand All @@ -360,7 +361,7 @@ func appendDataToFile(
ClientId: flow_obj.RunnerArgs.ClientId,
QueryName: "System.Upload.Completion",
Response: string(serialized),
Columns: []string{"Timestamp",
Columns: []string{"Timestamp", "ClientId",
"VFSPath", "UploadName",
"Accessor", "Size"},
}
Expand Down
2 changes: 2 additions & 0 deletions flows/monitoring.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ func (self *MonitoringFlow) ProcessMessage(
return err
}

flow_obj.RunnerArgs.ClientId = message.Source

switch message.RequestId {
case constants.TransferWellKnownFlowId:
return appendDataToFile(
Expand Down

0 comments on commit 7b06a6c

Please sign in to comment.