doomedraven / VirusTotalApi

VirusTotal Full api
MIT License
290 stars 85 forks source link

File size failure should happen first #11

Closed rmenessec closed 7 years ago

rmenessec commented 7 years ago

Given this:

john@malkovich ~ $ vt -v -f test.txt

Calculating hash for: test.txt
[!] Ignored file: test.txt, size is to big, permitted size is 128Mb

vt should fail on file size first, and not bother to calculate the hash.

doomedraven commented 7 years ago

I prefer not spam vt with big files as they willl be rejected in any way

rmenessec commented 7 years ago

I'm asking if vt can fail more gracefully in this case, without wasting a lot of CPU time. I'm using vt in a case where I don't always have control over the input files.

doomedraven commented 7 years ago

what you mean more gracefully exactly?, it use less cpu with prechecking size, instead of upload a big file to vt and vt rejects it, so it would be wasting of your time and vt

rmenessec commented 7 years ago

Before vt rejects the file, it calculates the hash. I'm asking if you can move the file size check in front of the hash computation.

doomedraven commented 7 years ago

make sense, I will push update it probably in few hours

rmenessec commented 7 years ago

Thanks !

doomedraven commented 7 years ago

done, https://github.com/doomedraven/VirusTotalApi/commit/72b7fcfe752c120473ee5ab46c23cff2b025eadb

the pip will be updated later

doomedraven commented 7 years ago

thanks