forked from Velocidex/velociraptor
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Converted import command to artifact (Velocidex#872)
Server.Utils.ImportCollection can now be used to import an offline collector zip file into the server. The artifact will also generate a flow completion event which may trigger other listeners (e.g. elastic upload).
- Loading branch information
Showing
20 changed files
with
558 additions
and
318 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: Server.Utils.ImportCollection | ||
description: | | ||
The Velociraptor offline collector is an automated, preconfigured | ||
collection tool. Users can use the collector to automatically | ||
collect any artifacts on endpoints that do not have the Velociraptor | ||
client (offline endpoints). | ||
The collector creates a ZIP archive with the results of the | ||
collection in JSON files (and any uploaded files). | ||
This artifact allows for these offline collections to be imported | ||
back into the Velociraptor GUI. The collected data can then treated | ||
exactly the same as if it was collected by the regular Velociraptor | ||
client (i.e. post processed through the notebook interface), except | ||
it was collected via the Sneakernet. | ||
NOTE: This artifact reads the collection ZIP from the server's | ||
filesystem. It is up to you to arrange for the file to be stored on | ||
the server (e.g. scp it over). | ||
NOTE: This artifact is still experimental - please provide feedback | ||
on our issue board. | ||
type: SERVER | ||
|
||
parameters: | ||
- name: ClientId | ||
default: auto | ||
description: | | ||
The client id to upload this collection into. The | ||
default is "auto" which will create a new client id. | ||
- name: Hostname | ||
description: If creating a new client, this must contain the hostname. | ||
- name: Path | ||
description: A path on the server containing the zip file to upload. | ||
|
||
sources: | ||
- query: | | ||
LET result = SELECT import_collection( | ||
client_id=ClientId, hostname=Hostname, | ||
filename=Path) AS Import | ||
FROM scope() | ||
SELECT Import.client_id AS ClientId, Import.session_id AS FlowId, | ||
Import.total_collected_rows AS TotalRows, | ||
Import.total_uploaded_files AS UploadedFiles, | ||
Import.total_uploaded_bytes AS UploadedBytes, | ||
Import.artifacts_with_results AS Artifacts | ||
FROM result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package server | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/Velocidex/ordereddict" | ||
vql_subsystem "www.velocidex.com/golang/velociraptor/vql" | ||
"www.velocidex.com/golang/vfilter" | ||
) | ||
|
||
type WhoAmIFunctionArgs struct{} | ||
type WhoAmIFunction struct{} | ||
|
||
func (self *WhoAmIFunction) Call(ctx context.Context, | ||
scope vfilter.Scope, | ||
args *ordereddict.Dict) vfilter.Any { | ||
|
||
return vql_subsystem.GetPrincipal(scope) | ||
} | ||
|
||
func (self WhoAmIFunction) Info(scope vfilter.Scope, type_map *vfilter.TypeMap) *vfilter.FunctionInfo { | ||
return &vfilter.FunctionInfo{ | ||
Name: "whoami", | ||
Doc: "Returns the username that is running the query.", | ||
ArgType: type_map.AddType(scope, &WhoAmIFunctionArgs{}), | ||
} | ||
} | ||
|
||
func init() { | ||
vql_subsystem.RegisterFunction(&WhoAmIFunction{}) | ||
} |
Oops, something went wrong.