Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go/cmd/triage/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ func (c *Cli) submitSampleFile(arg0, target string, interactive bool, profiles [
}
defer fd.Close()
name := filepath.Base(sampleFile)
sample, submitErr = c.client.SubmitSampleFile(context.Background(), name, fd, interactive, profileSelections, nil)
sample, submitErr = c.client.SubmitSampleFile(context.Background(), name, fd, interactive, profileSelections, nil, nil, nil)

} else if sampleURL != "" {
sample, submitErr = c.client.SubmitSampleURL(context.Background(), sampleURL, interactive, profileSelections)
Expand Down
4 changes: 4 additions & 0 deletions go/example/submit_sample_private.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ const (

var password = "password"
var fname = "some-sample-path"
var timeout = 150
var network = "internet"

func main() {
client := triage.NewPrivateClient(Token)
Expand All @@ -32,6 +34,8 @@ func main() {
false,
nil,
&password,
&timeout,
&network,
)
if err != nil {
panic(err)
Expand Down
4 changes: 4 additions & 0 deletions go/example/submit_sample_public.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ const (

var password = "password"
var fname = "some-sample-path"
var timeout = 150
var network = "internet"

func main() {
client := triage.NewClient(Token)
Expand All @@ -32,6 +34,8 @@ func main() {
false,
nil,
&password,
&timeout,
&network,
)
if err != nil {
panic(err)
Expand Down
21 changes: 20 additions & 1 deletion go/sample.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,26 +71,45 @@ type ProfileSelection struct {
Pick string `json:"pick"`
}

type Defaults struct {
Timeout int `json:"timeout"`
Network string `json:"network"`
}

type SampleEvent struct {
Sample
Error error
}

func (c *Client) SubmitSampleFile(ctx context.Context, filename string, file io.Reader, interactive bool, profiles []ProfileSelection, password *string) (*Sample, error) {
func (c *Client) SubmitSampleFile(ctx context.Context, filename string, file io.Reader, interactive bool, profiles []ProfileSelection, password *string, timeout *int, network *string) (*Sample, error) {
var pw string
net := "internet"
tmo := 150
if password != nil && *password != "" {
pw = *password
}
if network != nil && *network != "" {
net = *network
}
if timeout != nil && *timeout != 0 {
tmo = *timeout
}

request, err := json.Marshal(struct {
Kind string `json:"kind"`
Interactive bool `json:"interactive"`
Profiles []ProfileSelection `json:"profiles"`
Password string `json:"password,omitempty"`
Defaults Defaults `json:"defaults"`
}{
Kind: "file",
Interactive: interactive,
Profiles: profiles,
Password: pw,
Defaults: Defaults{
Timeout: tmo,
Network: net,
},
})
if err != nil {
return nil, err
Expand Down