mirror of
https://github.com/Velocidex/velociraptor.git
synced 2026-10-12 02:09:59 +00:00
Flow IDs have the requirements that they are sortable with creation time. We can reuse the hunt id in this context.
22 lines
397 B
Go
22 lines
397 B
Go
package utils
|
|
|
|
import "strings"
|
|
|
|
func ExtractHuntId(flow_id string) (string, bool) {
|
|
parts := strings.Split(flow_id, ".")
|
|
if len(parts) < 3 || parts[2] != "H" {
|
|
return "", false
|
|
}
|
|
|
|
return "H." + parts[1], true
|
|
}
|
|
|
|
func CreateFlowIdFromHuntId(hunt_id string) string {
|
|
parts := strings.SplitN(hunt_id, ".", 2)
|
|
if len(parts) != 2 {
|
|
return "F." + hunt_id
|
|
}
|
|
return "F." + parts[1] + ".H"
|
|
|
|
}
|