MCPcopy Create free account
hub / github.com/VirusTotal/vt-cli / NewMonitorItemsDownloadCmd

Function NewMonitorItemsDownloadCmd

cmd/monitor.go:135–168  ·  view source on GitHub ↗

NewMonitorItemsDownloadCmd returns a command for downloading files from your monitor account.

()

Source from the content-addressed store, hash-verified

133// NewMonitorItemsDownloadCmd returns a command for downloading files from your
134// monitor account.
135func NewMonitorItemsDownloadCmd() *cobra.Command {
136 cmd := &cobra.Command{
137 Use: "download [monitor_id]...",
138 Short: "Download files from your monitor account",
139 Long: monitorItemsDownloadCmdHelp,
140 Example: monitorItemsDownloadCmdExample,
141 RunE: func(cmd *cobra.Command, args []string) error {
142 var argReader utils.StringReader
143 if len(args) == 0 {
144 return errors.New("No item provided")
145 } else if len(args) == 1 && args[0] == "-" {
146 argReader = utils.NewStringIOReader(os.Stdin)
147 } else {
148 argReader = utils.NewStringArrayReader(args)
149 }
150 client, err := NewAPIClient()
151 if err != nil {
152 return err
153 }
154 re, _ := regexp.Compile(base64RegExp)
155 monitorItemIDs := utils.NewFilteredStringReader(argReader, re)
156
157 c := utils.NewCoordinator(viper.GetInt("threads"))
158 c.DoWithStringsFromReader(
159 &monitorDownloader{fileDownloader: newFileDownloader(client)},
160 monitorItemIDs)
161 return err
162 },
163 }
164
165 addThreadsFlag(cmd.Flags())
166 addOutputFlag(cmd.Flags())
167 return cmd
168}
169
170var monitorItemsSetDetailsCmdHelp = `Set details metadata for a file.
171

Callers 1

NewMonitorCmdFunction · 0.85

Calls 9

NewStringIOReaderFunction · 0.92
NewStringArrayReaderFunction · 0.92
NewFilteredStringReaderFunction · 0.92
NewCoordinatorFunction · 0.92
newFileDownloaderFunction · 0.85
addThreadsFlagFunction · 0.85
addOutputFlagFunction · 0.85
NewAPIClientFunction · 0.70

Tested by

no test coverage detected