[bug] vt file --help is bugged for subcommands
Closed this issue · 8 comments
When using the --help
option for some subcommands the options shown are often duplicated.
Some examples:
C:\Users\TomLancaster\Documents\Tools\vt-cli>vt-cli version
vt-cli 1.0.0
C:\Users\TomLancaster\Documents\Tools\vt-cli>vt-cli file --help
Get information about one or more files.
This command receives one or more hashes (SHA-256, SHA-1 or MD5) and returns
information about the corresponding files. The information for each file appears
in the same order as the hashes are passed to the command.
If the command receives a single hypen (-) the hashes are read from the standard
input, one per line.
Usage:
vt file [hash]... [flags]
vt file [command]
Examples:
vt file 8739c76e681f900923b900c9df0ef75cf421d39cabb54650c4b9ad19b6a76d85
vt file 76cdb2bad9582d23c1f6f4d868218d6c
vt file 76cdb2bad9582d23c1f6f4d868218d6c 44d88612fea8a8f36de82e1278abb02f
cat list_of_hashes | vt file -
Available Commands:
analyses Analyses for the file.
analyses Analyses for the file.
analyses Analyses for the file.
analyses Analyses for the file.
analyses Analyses for the file.
analyses Analyses for the file.
The same thing happens for some but not all other subcommands. Using the Windows x64 binary in command prompt.
Hello @tlansec,
I currently don't have access to a windows machine at the moment. I tried to reproduce this on Mac OS but I was unable to do it. Do you mind helping me with the fix? The help would be cloning the repository and testing the issue on a given branch where I will upload a possible fix for this issue.
Thank you :).
Hi Marta,
I would be happy to help try to resolve the issue, but I don't have an environment to compile go binaries, so i'd need either a release binary in order to test it, or would have to setup an env to build go binaries.
Cheers,
Tom
Hey @tlansec,
I made a pre-release simply updating the deps and go version (which were pretty old and needed an update). Hopefully that will be enough to fix the problem. Try it out and let me know: https://github.com/VirusTotal/vt-cli/releases/tag/1.0.1
Thanks!
Looks like the CLI library used is v1.1.3 (Feb 2021) of this:
https://github.com/spf13/cobra
The newest release is v1.8.1.
I'd guess this is the most likely thing to resolve this issue.
EDIT: I see this is what you did for v1.0.1 already :/
Hey @tlansec,
I think I found the root cause for this issue (it's a bug on VT's side I think). I'll get back to you shortly :) Thank you for the help, it's very appreciated.
Cheers
Hello again @tlansec,
I fixed the problem :). It was related to how vt-cli extracts metadata from the VT API to fill the help menu.
To fix the problem run the following commands:
$ rm ~/.vt.relationships.cache
$ vt init
The problem was that the VirusTotal API was returning repeated metadata and that's why you saw repeated items on the help menu, so the problem was not related to either vt-cli or Windows in the end :).
Thank you for your help!
Hi,
I can confirm that resolves the issue.
Thanks,
Tom