Skip to content

Commit 6e23d13

Browse files
authored
Add iocstream command examples (#66)
1 parent e7144e6 commit 6e23d13

File tree

2 files changed

+48
-5
lines changed

2 files changed

+48
-5
lines changed

cmd/collection.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ the standard input, one per line.`
3131

3232
var collectionCmdExample = ` vt collection malpedia_win_emotet
3333
vt collection malpedia_win_emotet alienvault_603eb1abdd4812819c64e197
34-
cat list_of_collections | vt collection -`
34+
cat list_of_collections | vt collection -n [collection_name] -d [collection_description] -`
3535

3636
// NewCollectionCmd returns a new instance of the 'collection' command.
3737
func NewCollectionCmd() *cobra.Command {

cmd/ioc_stream.go

Lines changed: 47 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,52 @@ import (
2828
"github.com/spf13/cobra"
2929
)
3030

31+
var iocStreamCmdExamples = `## List:
32+
# List notifications from a hunting rule by name
33+
vt iocstream list -f "origin:hunting tag:my_rule"
34+
# List notifications from a hunting ruleset by name
35+
vt iocstream list -f "origin:hunting tag:myRuleset"
36+
# List just the entity IDs of your IoC Stream matches
37+
vt iocstream list -I
38+
# List ALL the entity IDs in your IoC Stream and store them in a csv file (this might take a while)
39+
vt iocstream list -I –limit 9999999 > results.csv
40+
# List the first IoC Stream notifications including the hash, last_analysis_stats, size and file type
41+
vt iocstream list -i "_id,last_analysis_stats,size,type_tag"
42+
# Check if a hash is in your IoC Stream matches
43+
vt iocstream list -f "entity_type:file entity_id:hash"
44+
45+
## Delete:
46+
# Delete all notifications matching a filter, e.g. all matches for a YARA rule/ruleset. This process is
47+
# asynchronous, so it can take a while to delete all the notifications.
48+
vt iocstream delete -f "origin:hunting tag:my_rule"
49+
# Delete a single notification with ID 1234568. The notification ID is displayed in the context_attributes.
50+
vt iocstream delete 1234568`
51+
52+
var iocStreamListCmdExamples = `# List notifications from a hunting rule by name
53+
vt iocstream list -f "origin:hunting tag:my_rule"
54+
# List notifications from a hunting ruleset by name
55+
vt iocstream list -f "origin:hunting tag:myRuleset"
56+
# List just the entity IDs of your IoC Stream matches
57+
vt iocstream list -I
58+
# List ALL the entity IDs in your IoC Stream and store them in a csv file (this might take a while)
59+
vt iocstream list -I –limit 9999999 > results.csv
60+
# List the first IoC Stream notifications including the hash, last_analysis_stats, size and file type
61+
vt iocstream list -i "_id,last_analysis_stats,size,type_tag"
62+
# Check if a hash is in your IoC Stream matches
63+
vt iocstream list -f "entity_type:file entity_id:hash"`
64+
65+
var iocStreamDeleteCmdExamples = `# Delete all notifications matching a filter, e.g. all matches for a YARA rule/ruleset
66+
vt iocstream delete -f "origin:hunting tag:my_rule"
67+
# Delete a single notification with ID 1234568. The notification ID is displayed in the context_attributes.
68+
vt iocstream delete 1234568`
69+
3170
// NewIOCStreamCmd returns a new instance of the `ioc
3271
func NewIOCStreamCmd() *cobra.Command {
3372
cmd := &cobra.Command{
3473
Aliases: []string{"is"},
35-
Use: "iocstream [id]...",
74+
Use: "iocstream [notification_id]...",
3675
Short: "Manage IoC Stream notifications",
76+
Example: iocStreamCmdExamples,
3777
Args: cobra.ExactArgs(1),
3878

3979
RunE: func(cmd *cobra.Command, args []string) error {
@@ -65,6 +105,7 @@ func NewIOCStreamListCmd() *cobra.Command {
65105
Aliases: []string{"il"},
66106
Use: "list",
67107
Short: "List IoCs from notifications",
108+
Example: iocStreamListCmdExamples,
68109

69110
RunE: func(cmd *cobra.Command, args []string) error {
70111
p, err := NewPrinter(cmd)
@@ -93,9 +134,10 @@ then all the IoC Stream notifications matching the given filter are deleted.
93134
// NewIOCStreamDeleteCmd returns a new instance of the `ioc_stream delete` command.
94135
func NewIOCStreamDeleteCmd() *cobra.Command {
95136
cmd := &cobra.Command{
96-
Use: "delete [notification id]...",
97-
Short: "Deletes notifications from the IoC Stream",
98-
Long: iocStreamNotificationsDeleteCmdHelp,
137+
Use: "delete [notification id]...",
138+
Short: "Deletes notifications from the IoC Stream",
139+
Long: iocStreamNotificationsDeleteCmdHelp,
140+
Example: iocStreamDeleteCmdExamples,
99141

100142
RunE: func(cmd *cobra.Command, args []string) error {
101143
client, err := NewAPIClient()
@@ -132,6 +174,7 @@ func NewIOCStreamDeleteCmd() *cobra.Command {
132174
if _, err := client.Delete(targetUrl); err != nil {
133175
return err
134176
}
177+
fmt.Println("Notifications being deleted. This can take a while depending on the number of notifications.")
135178
}
136179
return nil
137180
},

0 commit comments

Comments
 (0)