Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a bin stub to the library? #7

Open
shadowbq opened this issue Jul 17, 2015 · 2 comments
Open

Add a bin stub to the library? #7

shadowbq opened this issue Jul 17, 2015 · 2 comments

Comments

@shadowbq
Copy link
Contributor

Should we add a bin with added dependencies like docopt or do this in a separate gem?

add a bin/stub to the gem for basic functionality?

sketch out some thing like with independent bins

metascan-online
metascan-hashlookup
metascan-etc

-or-

Use a single bin with deep commands like git
metascan online
metascan hashlookup

-c --config= [yaml config with api key, and server url]
--api-key= cleartext api key
-o --output-dir= location to store the json output file
[argv] list of files to submit

Hashlookup additional flags

`-f --file= 
-h --hash= md5 sum
-i --ip= IP address
-u --url= URL address

/bin/metascan-online -c ~/.metascan scanthis.exe
/bin/metascan-hashlookup -c ~/.metascan -f scanthis.exe
/bin/metascan-hashlookup -c ~/.metascan -h 31b7b54dc4ec48c2b4aa35767cd9c402
/bin/metascan-hashlookup -c ~/.metascan -ip 10.0.0.1
/bin/metascan-hashlookup -c ~/.metascan -url www.google.com

Additional functions like

--request-rescan

Unix return code match "Definitions - Description of scan_result_i and scan_all_result_i"

https://metascan-online.com/en/public-api#/definitions

0 Clean No threat detection or the file is empty.
1 Infected/Known Threat is found.
2 Suspicious Classified as a possible threat but not identified as a specific threat.
3 Failed To Scan Scanning is not fully performed (e.g., invalid file or no read permission).
4 Cleaned Not Applicable.
5 Unknown Scan result does not exist (only for hash lookups).
6 Quarantined Not Applicable.
[..]

@graysonchao
Copy link
Owner

My understanding is that Git actually uses a hybrid approach - the git command delegates based on the second command to binaries such as git-clone, git-add, etc. For example, try man git-add.

In general I think this is a great idea, and will probably be used mostly in automation (or at least poweruser) type contexts. Therefore the command syntax should be structured around ease of automation.

I do think this should be a separate gem with this gem as a dep as otherwise it's unnecessary baggage for those wishing to use the gem programmatically only.

@shadowbq, thanks a lot for your contributions to date. I can't guarantee that I will have time to start working on this in the next couple of weeks (moving between cities, plus I have a day job which sometimes becomes an all-night job) so if you're interested in taking a more hands-on role here, just submit a PR for anything you want to add.

@graysonchao
Copy link
Owner

Actually, after looking through the existing libraries for this, it probably won't take too long. I've created https://github.com/graysonc/metascan-cli and will push something, probably involving Thor soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants