Giter Site home page Giter Site logo

virustotalapi's Introduction

VirusTotal public and private APIv2 Full support - VT APIv3

  • My pypi VT package was transfered to VirusTotal ownership

Before using the tool you must set your api key in one of this file or you can start without creating it and you will be prompted to provide the data:

  • Home Directory:

    • ~.vtapi, ~vtapi.conf
  • or current directory where vt script placed

    • .vtapi, vtapi.conf
  • ~.vtapi file content:

[vt]
apikey=your-apikey-here
type=public
intelligence=False
#coma separated engine list, can be empty
engines=
timeout=60
# as for weblogin, this only required for rule management
username=
password=
  • your type of api access, if private: type=private, if public, you can leave it empty, it will be automatically recognized as public
  • if you have access to VT Intelligence, you need set intelligence=True

Dependencies:

  • requests
  • texttable
  • python-dateutil

These can be installed via PIP or a package manager. Example of installing all dependencies using pip:

pip install -r requirements.txt
  • Thanks to @kellewic and @urbanski
  • Special thanks to @Seifreed for testing and reporting bugs

Example of usage as library can be found here

Few public API functions taken from Chris Clark script
And finally has been added full public and private API support by Andriy Brukhovetskyy (doomedraven)

Small manual with examples http://www.doomedraven.com/2013/11/script-virustotal-public-and-private.html

  • BEAR IN MIND THIS IS AN OLD EXAMPLE, use -h for current help
vt -h
usage: value [-h] [-fi] [-udb USERDB] [-fs] [-f] [-fr] [-u] [-ur] [-d] [-i]
             [-w] [-s] [-si] [-et] [-rai] [-itu] [-cw] [-dep] [-eo] [-snr]
             [-srct] [-tir] [-wir] [-rbgi] [-rbi] [-agi] [-dbc] [-ac] [-gc]
             [--get-comments-before DATE] [-v] [-j] [--csv] [-rr] [-rj] [-V]
             [-r] [--delete] [--date DATE] [--period PERIOD] [--repeat REPEAT]
             [--notify-url NOTIFY_URL] [--notify-changes-only] [-wh] [-wht]
             [-pdns] [--asn] [-aso] [--country] [--subdomains]
             [--domain-siblings] [-cat] [-alc] [-alk] [-opi] [--drweb-cat]
             [-adi] [-wdi] [-tm] [-wt] [-bd] [-wd] [-du] [--pcaps] [--samples]
             [-dds] [-uds] [-dc] [-uc] [-drs] [-urs] [-pe]
             [-esa SAVE_ATTACHMENT] [-peo] [-bh] [-bn] [-bp] [-bs] [-dl]
             [-nm NAME] [-dt DOWNLOAD_THREADS] [--pcap] [--clusters]
             [--distribution-files] [--distribution-urls] [--before BEFORE]
             [--after AFTER] [--reports] [--limit LIMIT] [--allinfo] [--rules]
             [--list] [--create FILE] [--update FILE] [--retro FILE]
             [--delete_rule DELETE_RULE] [--share]
             [--update_ruleset UPDATE_RULESET] [--disable DISABLE]
             [--enable ENABLE]
             [value [value ...]]

Scan/Search/ReScan/JSON parse

positional arguments:
  value                 Enter the Hash, Path to File(s) or Url(s)

optional arguments:
  -h, --help            show this help message and exit
  -fi, --file-info      Get PE file info, all data extracted offline, for work
                        you need have installed PEUTILS library
  -udb USERDB, --userdb USERDB
                        Path to your userdb file, works with --file-info
                        option only
  -fs, --file-search    File(s) search, this option, don't upload file to
                        VirusTotal, just search by hash, support linux name
                        wildcard, example: /home/user/*malware*, if file was
                        scanned, you will see scan info, for full scan report
                        use verbose mode, and dump if you want save already
                        scanned samples
  -f, --file-scan       File(s) scan, support linux name wildcard, example:
                        /home/user/*malware*, if file was scanned, you will
                        see scan info, for full scan report use verbose mode,
                        and dump if you want save already scanned samples
  -fr, --file-scan-recursive
                        Recursive dir walk, use this instead of --file-scan if
                        you want recursive
  -u, --url-scan        Url scan, support space separated list, Max 4 urls (or
                        25 if you have private api), but you can provide more
                        urls, for example with public api, 5 url - this will
                        do 2 requests first with 4 url and other one with only
                        1, or you can specify file filename with one url per
                        line
  -ur, --url-report     Url(s) report, support space separated list, Max 4 (or
                        25 if you have private api) urls, you can use --url-
                        report --url-scan options for analyzing url(s) if they
                        are not in VT data base, read preview description
                        about more then max limits or file with urls
  -d, --domain-info     Retrieves a report on a given domain (PRIVATE API
                        ONLY! including the information recorded by
                        VirusTotal's Passive DNS infrastructure)
  -i, --ip-info         A valid IPv4 address in dotted quad notation, for the
                        time being only IPv4 addresses are supported.
  -w, --walk            Work with domain-info, will walk through all detected
                        ips and get information, can be provided ip parameters
                        to get only specific information
  -s, --search          A md5/sha1/sha256 hash for which you want to retrieve
                        the most recent report. You may also specify a scan_id
                        (sha256-timestamp as returned by the scan API) to
                        access a specific report. You can also specify a space
                        separated list made up of a combination of hashes and
                        scan_ids Public API up to 4 items/Private API up to 25
                        items, this allows you to perform a batch request with
                        one single call.
  -si, --search-intelligence
                        Search query, help can be found here -
                        https://www.virustotal.com/intelligence/help/
  -et, --email-template
                        Table format template for email
  -ac, --add-comment    The actual review, you can tag it using the "#"
                        twitter-like syntax (e.g. #disinfection #zbot) and
                        reference users using the "@" syntax (e.g.
                        @VirusTotalTeam). supported hashes MD5/SHA1/SHA256
  -gc, --get-comments   Either a md5/sha1/sha256 hash of the file or the URL
                        itself you want to retrieve
  --get-comments-before DATE
                        A datetime token that allows you to iterate over all
                        comments on a specific item whenever it has been
                        commented on more than 25 times. Token format
                        20120725170000 or 2012-07-25 17 00 00 or 2012-07-25
                        17:00:00
  -v, --verbose         Turn on verbosity of VT reports
  -j, --dump            Dumps the full VT report to file (VTDL{md5}.json), if
                        you (re)scan many files/urls, their json data will be
                        dumped to separated files
  --csv                 Dumps the AV's detections to file (VTDL{scan_id}.csv)
  -rr, --return-raw     Return raw json, in case if used as library and want
                        parse in other way
  -rj, --return-json    Return json with parts activated, for example -p for
                        passive dns, etc
  -V, --version         Show version and exit

All information related:
  -rai, --report-all-info
                        If specified and set to one, the call will return
                        additional info, other than the antivirus results, on
                        the file being queried. This additional info includes
                        the output of several tools acting on the file (PDFiD,
                        ExifTool, sigcheck, TrID, etc.), metadata regarding
                        VirusTotal submissions (number of unique sources that
                        have sent the file in the past, first seen date, last
                        seen date, etc.), and the output of in-house
                        technologies such as a behavioural sandbox.
  -itu, --ITW-urls      In the wild urls
  -cw, --compressedview
                        Contains information about extensions, file_types,
                        tags, lowest and highest datetime, num children
                        detected, type, uncompressed_size, vhash, children
  -dep, --detailed-email-parents
                        Contains information about emails, as Subject, sender,
                        receiver(s), full email, and email hash to download it
  -eo, --email-original
                        Will retrieve original email and process it
  -snr, --snort         Get Snort results
  -srct, --suricata     Get Suricata results
  -tir, --traffic-inspection
                        Get Traffic inspection info
  -wir, --wireshark-info
                        Get Wireshark info
  -rbgi, --rombios-generator-info
                        Get RomBios generator info
  -rbi, --rombioscheck-info
                        Get RomBiosCheck info
  -agi, --androidguard-info
                        Get AndroidGuard info
  -dbc, --debcheck-info
                        Get DebCheck info, also include ios IPA

Rescan options:
  -r, --rescan          Allows you to rescan files in VirusTotal's file store
                        without having to resubmit them, thus saving
                        bandwidth, support space separated list, MAX 25
                        hashes, can be local files, hashes will be generated
                        on the fly, support linux wildmask
  --delete              A md5/sha1/sha256 hash for which you want to delete
                        the scheduled scan
  --date DATE           A Date in one of this formats (example: 20120725170000
                        or 2012-07-25 17 00 00 or 2012-07-25 17:00:00) in
                        which the rescan should be performed. If not specified
                        the rescan will be performed immediately.
  --period PERIOD       Period in days in which the file should be rescanned.
                        If this argument is provided the file will be
                        rescanned periodically every period days, if not, the
                        rescan is performed once and not repeated again.
  --repeat REPEAT       Used in conjunction with period to specify the number
                        of times the file should be rescanned. If this
                        argument is provided the file will be rescanned the
                        given amount of times, if not, the file will be
                        rescanned indefinitely.

File scan/Rescan shared options:
  --notify-url NOTIFY_URL
                        An URL where a POST notification should be sent when
                        the scan finishes.
  --notify-changes-only
                        Used in conjunction with --notify-url. Indicates if
                        POST notifications should be sent only if the scan
                        results differ from the previous one.

Domain/IP shared verbose mode options, by default just show resolved IPs/Passive DNS:
  -wh, --whois          Whois data
  -wht, --whois-timestamp
                        Whois timestamp
  -pdns, --resolutions  Passive DNS resolves
  --asn                 ASN number
  -aso, --as-owner      AS details
  --country             Country
  --subdomains          Subdomains
  --domain-siblings     Domain siblings
  -cat, --categories    Categories
  -alc, --alexa-cat     Alexa category
  -alk, --alexa-rank    Alexa rank
  -opi, --opera-info    Opera info
  --drweb-cat           Dr.Web Category
  -adi, --alexa-domain-info
                        Just Domain option: Show Alexa domain info
  -wdi, --wot-domain-info
                        Just Domain option: Show WOT domain info
  -tm, --trendmicro     Just Domain option: Show TrendMicro category info
  -wt, --websense-threatseeker
                        Just Domain option: Show Websense ThreatSeeker
                        category
  -bd, --bitdefender    Just Domain option: Show BitDefender category
  -wd, --webutation-domain
                        Just Domain option: Show Webutation domain info
  -du, --detected-urls  Just Domain option: Show latest detected URLs
  --pcaps               Just Domain option: Show all pcaps hashes
  --samples             Will activate -dds -uds -dc -uc -drs -urs
  -dds, --detected-downloaded-samples
                        Domain/Ip options: Show latest detected files that
                        were downloaded from this ip
  -uds, --undetected-downloaded-samples
                        Domain/Ip options: Show latest undetected files that
                        were downloaded from this domain/ip
  -dc, --detected-communicated
                        Domain/Ip Show latest detected files that communicate
                        with this domain/ip
  -uc, --undetected-communicated
                        Domain/Ip Show latest undetected files that
                        communicate with this domain/ip
  -drs, --detected-referrer-samples
                        Undetected referrer samples
  -urs, --undetected-referrer-samples
                        Undetected referrer samples

Process emails:
  -pe, --parse-email    Parse email, can be string or file
  -esa SAVE_ATTACHMENT, --save-attachment SAVE_ATTACHMENT
                        Save email attachment, path where to store
  -peo, --parse-email-outlook
                        Parse outlook .msg, can be string or file

Behaviour options:
  -bh, --behaviour      The md5/sha1/sha256 hash of the file whose dynamic
                        behavioural report you want to retrieve. VirusTotal
                        runs a distributed setup of Cuckoo sandbox machines
                        that execute the files we receive. Execution is
                        attempted only once, upon first submission to
                        VirusTotal, and only Portable Executables under 10MB
                        in size are ran. The execution of files is a best
                        effort process, hence, there are no guarantees about a
                        report being generated for a given file in our
                        dataset. a file did indeed produce a behavioural
                        report, a summary of it can be obtained by using the
                        file scan lookup call providing the additional HTTP
                        POST parameter allinfo=1. The summary will appear
                        under the behaviour-v1 property of the additional_info
                        field in the JSON report.This API allows you to
                        retrieve the full JSON report of the files execution
                        as outputted by the Cuckoo JSON report encoder.
  -bn, --behavior-network
                        Show network activity
  -bp, --behavior-process
                        Show processes
  -bs, --behavior-summary
                        Show summary

Download options:
  -dl, --download       The md5/sha1/sha256 hash of the file you want to
                        download or txt file with .txt extension, with hashes,
                        or hash and type, one by line, for example: hash,pcap
                        or only hash. Will save with hash as name, can be
                        space separated list of hashes to download
  -nm NAME, --name NAME
                        Name with which file will saved when download it
  -dt DOWNLOAD_THREADS, --download-threads DOWNLOAD_THREADS
                        Number of simultaneous downloaders

Additional options:
  --pcap                The md5/sha1/sha256 hash of the file whose network
                        traffic dump you want to retrieve. Will save as
                        hash.pcap
  --clusters            A specific day for which we want to access the
                        clustering details, example: 2013-09-10
  --distribution-files  Timestamps are just integer numbers where higher
                        values mean more recent files. Both before and after
                        parameters are optional, if they are not provided the
                        oldest files in the queue are returned in timestamp
                        ascending order.
  --distribution-urls   Timestamps are just integer numbers where higher
                        values mean more recent urls. Both before and after
                        parameters are optional, if they are not provided the
                        oldest urls in the queue are returned in timestamp
                        ascending order.

Distribution options:
  --before BEFORE       File/Url option. Retrieve files/urls received before
                        the given timestamp, in timestamp descending order.
  --after AFTER         File/Url option. Retrieve files/urls received after
                        the given timestamp, in timestamp ascending order.
  --reports             Include the files' antivirus results in the response.
                        Possible values are 'true' or 'false' (default value
                        is 'false').
  --limit LIMIT         File/Url option. Retrieve limit file items at most
                        (default: 1000).
  --allinfo             will include the results for each particular URL scan
                        (in exactly the same format as the URL scan retrieving
                        API). If the parameter is not specified, each item
                        returned will only contain the scanned URL and its
                        detection ratio.

Rules management options:
  --rules               Manage VTI hunting rules, REQUIRED for rules management
  --list                List names/ids of Yara rules stored on VT
  --create FILE         Add a Yara rule to VT (File Name used as RuleName
  --update FILE         Update a Yara rule on VT (File Name used as RuleName
                        and must include RuleName
  --retro FILE          Submit Yara rule to VT RetroHunt (File Name used as
                        RuleName and must include RuleName
  --delete_rule DELETE_RULE
                        Delete a Yara rule from VT (By Name)
  --share               Shares rule with user
  --update_ruleset UPDATE_RULESET
                        Ruleset name to update
  --disable DISABLE     Disable a Yara rule from VT (By Name)
  --enable ENABLE       Enable a Yara rule from VT (By Name)

virustotalapi's People

Contributors

antelox avatar asch513 avatar doomedraven avatar fossabot avatar itayc0hen avatar monkeywithacupcake avatar paralax avatar pbnj avatar rdil avatar shoeper avatar thedr1ver avatar treed593 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

virustotalapi's Issues

Error didnt solve...

vikram@vikram:~/VirusTotalApi/vt$ python vt.py -ur google.com virustotal.com
Traceback (most recent call last):
File "vt.py", line 3204, in
main()
File "vt.py", line 3131, in main
vt.url_scan_and_report(**options)
File "vt.py", line 1719, in url_scan_and_report
url_upload = url_upload.strip()
AttributeError: 'list' object has no attribute 'strip'
Sorry sir the error still persist

VirtusTotalAPI - ValueError: invalid literal for int() with base 10: '60 \t\t#default 60, if you want change it, specify number here'

[root@localhost ~]# vt -h
Traceback (most recent call last):
File "/usr/bin/vt", line 9, in
load_entry_point('vt==2.2.2', 'console_scripts', 'vt')()
File "/usr/lib/python2.7/site-packages/vt-2.2.2-py2.7.egg/vt/vt.py", line 2883, in main
req_timeout = int(vt_config.get('timeout'))
ValueError: invalid literal for int() with base 10: '60 \t\t#default 60, if you want change it, specify number here'

vim /usr/lib/python2.7/site-packages/vt-2.2.2-py2.7.egg/vt/vt.py

2876
2877 def main():
2878
2879 vt_config = read_conf()
2880
2881 if vt_config.get('timeout'):
2882 global req_timeout
2883 req_timeout = int(vt_config.get('timeout'))
2884
2885 opt = argparse.ArgumentParser('value', description='Scan/Search/ReScan/JSON parse')

[root@localhost ~]# cat .vtapi.conf
[vt]
apikey= [ MY API KEY HERE ]
type=public
intelligence=False
engines= #put there coma separated engine list, or only one, or leave it empty
timeout=60 #default 60, if you want change it, specify number here

[root@localhost ~]# cat .vtapi
[vt]
apikey= [ MY API KEY HERE ]
type=public
intelligence=False
engines= #put there coma separated engine list, or only one, or leave it empty
timeout=60 #default 60, if you want change it, specify number here

Misc:

  • I correctly I configured the value for timeout variable in the configuration files for both root as a regular user. I used the physical and virtual machines and also python 2.x and 3.x, without success.
    -I used a commit of the day July 29, 2016 and was fucionando correctly.
  • My both virtual environment as a physical are Fedora 23 and 24 x86_64 no case can only use this distro unfortunately at the moment.

Fedora 24 x86_64

Linux localhost.localdomain 4.7.4-200.fc24.x86_64 #1 SMP Thu Sep 15 18:42:09 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
Python 2.7.12

Fedora 23 x86_64

Linux localhost.localdomain 4.7.4-100.fc23.x86_64+debug #1 SMP Thu Sep 15 18:31:53 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
Python 2.7.11

Thansk, bro!

Follow up on #39 still get error with utf-8

THX for beeing so fast ;-)

But.... there is a new one. See ....

internet@internet:~/Schreibtisch/VirusTotalApi-master/vt$ python vt.py -s db349b97c37d22f5ea1d1841e3c89eb4 -v
/home/internet/.local/lib/python2.7/site-packages/requests/init.py:83: RequestsDependencyWarning: Old version of cryptography ([1, 2, 3]) may cause slowdown.
warnings.warn(warning, RequestsDependencyWarning)

[+] Basic

     Name                                               Value                                    

=====================================================================================================
size 3723264
authentihash 1646cad4fe91337460de0d4c2c5451095023e74bdab331642aaca12647b72f46
sha1 e889544aff85ffaf8b0d0da705105dee7c97fe26
magic PE32 executable for MS Windows (GUI) Intel 80386 32-bit
vhash 036046651d6570b8z201cpz31zd025z
last_analysis_date 2019-04-24 03:28:36
meaningful_name lhdfrgui.exe
times_submitted 170
last_submission_date 2019-04-10 23:17:13
creation_date 2010-11-20 10:03:08
unique_sources 127
first_submission_date 2017-05-12 10:57:51
type_description Win32 EXE
reputation -1623
last_modification_date 2019-05-01 12:11:37
type_tag peexe
ssdeep 98304:wDqPoBhz1aRxcSUDk36SAEdhvxWa9P593R8yAVp2g3R:wDqPe1Cxcxk3ZAEUadzR8yc4gB
sha256 24d004a104d4d54034dbcffc2a4b19a11f39008a575aa614ea04703480b1022c
total_votes {u'harmless': 1, u'malicious': 82}
md5 db349b97c37d22f5ea1d1841e3c89eb4

[+] Names
lhdfrgui.exe
C:\Users\Flowzn\Desktop\wannacry.exe
24d004a104d4d540_mssecsvc.exe
24d004a104d4d54034dbcffc2a4b19a11f39008a575aa614ea04703480b1022c.exe
ColetaniaPlayboy.exe
content_96594.exe
M:/ransom/24d004a104d4d54034dbcffc2a4b19a11f39008a575aa614ea04703480b1022c
wannacry__ransomware (37)
WannaCry_mssecsvc.exe
wcry1.exe
VirusShare_db349b97c37d22f5ea1d1841e3c89eb4
mssecsvc.exe
mssecsvckkk.exe
WannaCry.exe
24d004a104d4d54034dbcffc2a4b19a11f39008a575aa614ea04703480b1022c.bin
24d0.vir.DNvir
localfile~
wannacry2.bin
Ransomware(WannaCry01).exe
/home/joonwoo/Desktop/malwr/malware4/db349b97c37d22f5ea1d1841e3c89eb4
WannaWanna.docx
WanaCrypt0r_2.0_2.exe
mssecsvc_exe
№2.exe
D6C60B8F22F89CBD1262C0AA7AE240577A82002FB149E9127D4EDF775A25ABCDA4E585B6113E79AB4A24BB65F4280532529C2F06F7FFE4D5DB45C0CAF74FEA38.bin
Win32 Exploit.CVE-2017-0147.A.exe
mssecsvc.exe_
c.bin
db349b97c37d22f5ea1d1841e3c89eb4.virus
Exploit.dll
wcryptv2.exe
ixP8Fx8n.exe
db349b97c37d22f5ea1d1841e3c89eb4_mssecsvc.exe
test.exe
db349b97c37d22f5ea1d1841e3c89eb4.exe
ransomware06.exe
c:_WorkPlace\todo\24D004A104D4D54034DBCFFC2A4B19A11F39008A575AA614EA04703480B1022C.dat
mssecsvc.exe.vir
trz5289.tmp
mssecsvc.$$$
mssecsvc.ex_
%systemroot%\mssecsvc.exe
C:\Windows\mssecsvc.exe
c:\windows\mssecsvc.exe
C:/WINDOWS/mssecsvc.exe
c://windows//mssecsvc.exe
C:\Users\omiguelr\Desktop\odbg110\mssecsvckkk.exe
C:\Users\test\Desktop\mw\10\mssecsvc.exe

[+] Tags
peexe
cve-2017-0147
exploit

[+] Signature info
Traceback (most recent call last):
File "vt.py", line 3457, in
main()
File "vt.py", line 3417, in main
vt.getReport(**options)
File "vt.py", line 694, in getReport
self._parse_aux(jdata['data']['attributes'], **kwargs)
File "vt.py", line 596, in _parse_aux
self._print_complex_dict(block, key, **{'email_template':True})
File "vt.py", line 498, in _print_complex_dict
key_s, key_v = get_sizes(jdata[key])
File "vt.py", line 111, in get_sizes
value_s = max([len(str(value)) for value in list(dictionary.values())])
UnicodeEncodeError: 'ascii' codec can't encode character u'\xae' in position 9: ordinal not in range(128)

Originally posted by @KlausItem in #39 (comment)

Problem with -si switch

Hello,
if i querry a hash with the -s switch everything is ok, but if i use -si i got this error:

python vt.py -si 767b877e735c425bf05c34683356abfde4070b092f17a4741ea5ac490611f3de
/home/internet/.local/lib/python2.7/site-packages/requests/init.py:83: RequestsDependencyWarning: Old version of cryptography ([1, 2, 3]) may cause slowdown.
warnings.warn(warning, RequestsDependencyWarning)
Traceback (most recent call last):
File "vt.py", line 3458, in
main()
File "vt.py", line 3418, in main
vt.getReport(**options)
File "vt.py", line 643, in getReport
if 'next' in jdata.get('data', dict).get('links', dict()) and kwargs.get('search_intelligence_limit', 1) > 1:
TypeError: descriptor 'get' requires a 'dict' object but received a 'str'

I do have a intelligence acount and set it up with the vtapi.conf

Please help.

No result on -rai

Hey! Thanks for the great script.
I'm getting results when I use -s but when any attempts at using the -rai option come up empty. Have tried all of the following with no results.
vt -s -rai
vt -s --report-all-info
vt -rai
vt --report-all-info

Wrong Time Format

Hello,

i got a Problem with te result of creation Time. See example:

last_submission_date 2019-04-27 20:10:27
creation_date 1.420e+09
unique_sources 206
first_submission_date 2015-01-12 23:53:44
type_description Win32 EXE
reputation 116
last_modification_date 2019-04-28 16:55:28
type_tag peexe
ssdeep 1

Any idea ???

Rescan URL's when "The requested resource is not among the finished, queued or pending scans"

Hi,
I have a URL list i want to scan with VT API.
My current command is:

vt.py -r --rescan -ur urls_for_scan.txt > GP-000-Results.txt

This works well, and returns back the report from the URL scan.
But within the report, about 1/3 (a third) of all the URLs scanned, come back with the response:

[!] Status : The requested resource is not among the finished, queued or pending scans

See attached.
2016-02-19_10-31-48

Many are not scanned for me, so we are missing out on many URL scan reports.

Example out put in my:

Searching for url(s) report: http://www.xyz.com
[!] Status : The requested resource is not among the finished, queued or pending scans

Am i implementing this rescan incorrectly?
Thanks,
Darren.

get error "ValueError: zero length field name in format"

python vt/vt.py -u https://dl.wandoujia.com/files/jupiter/latest/wandoujia-wandoujia_web.apk
Submitting url(s) for analysis:
    https://dl.wandoujia.com/files/jupiter/latest/wandoujia-wandoujia_web.apk
Traceback (most recent call last):
  File "vt/vt.py", line 3090, in <module>
    main()
  File "vt/vt.py", line 2999, in main
    vt.url_scan_and_report(**options)
  File "vt/vt.py", line 1702, in url_scan_and_report
    url = self.base.format('url/scan')
ValueError: zero length field name in format

all good on my mac with python 2.7
got this issue on centos 6 with python 2.6

misspelling

Minor issue, you have a misspelling:

~/testids/VirusTotalApi/vt$ fgrep -R 'few minuts'
vt.py: print '[+] Check rescan result with sha256 in few minuts : \n\tSHA256 : {sha256}'.format(sha256=jdata['sha256'])
vt3.py: print('[+] Check rescan result with sha256 in few minuts : \n\tSHA256 : {sha256}'.format(sha256=jdata['sha256']))

Python 3 compatibility

I see some python3 related commits. Is module still incompatible with python3?

Collecting vt
  Downloading vt-3.1.3.3.tar.gz (42kB)
    100% |████████████████████████████████| 51kB 591kB/s
    Complete output from command python setup.py egg_info:
    running egg_info
    creating pip-egg-info/vt.egg-info
    writing pip-egg-info/vt.egg-info/PKG-INFO
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/f3/5tjmk_d56cs7s6v_0yfrl2n00000gn/T/pip-build-so9d0qi6/vt/setup.py", line 40, in <module>
        "six",
      File "/Users/mb/.virtualenvs/pr/lib/python3.6/site-packages/setuptools/__init__.py", line 129, in setup
        return distutils.core.setup(**attrs)
      File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/dist.py", line 955, in run_commands
        self.run_command(cmd)
      File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/Users/mb/.virtualenvs/pr/lib/python3.6/site-packages/setuptools/command/egg_info.py", line 271, in run
        writer(self, ep.name, os.path.join(self.egg_info, ep.name))
      File "/Users/mb/.virtualenvs/pr/lib/python3.6/site-packages/setuptools/command/egg_info.py", line 604, in write_pkg_info
        metadata.write_pkg_info(cmd.egg_info)
      File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/dist.py", line 1106, in write_pkg_info
        self.write_pkg_file(pkg_info)
      File "/Users/mb/.virtualenvs/pr/lib/python3.6/site-packages/setuptools/dist.py", line 67, in write_pkg_file
        long_desc = rfc822_escape(self.get_long_description())
      File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/util.py", line 474, in rfc822_escape
        lines = header.split('\n')
    TypeError: a bytes-like object is required, not 'str'

Screenshots

It would be profitable for your project to show some screenshots of how the results look.
(The doomedraven manual does load pictures for some reason.)

Download from search not documented

Please describe the Search Intelligence / Download functionality in the help for the -si and -dl.

Because the VirusTotal Top N Downloader failed, I used this package from PyPI (version 3.1.3.7). But I only found this capability when searching issues (#14); it is not documented in the help.

My draft help strings are below.

https://github.com/doomedraven/VirusTotalApi/blob/master/vt/vt.py#L3224
Search query, can be paired with the download option. Search help can be found here - https://www.virustotal.com/intelligence/help/

https://github.com/doomedraven/VirusTotalApi/blob/master/vt/vt.py#L3320
The md5/sha1/sha256 hash of the file(s) you want to download. Can be space separated list of hashes to download, will save with hash as name. Alternatively provide txt file with .txt extension, with hashes, or hash and type, one by line, for example: hash,pcap or only hash. When paired with the search-intelligence option, downloads hashes returned from the search.

File size failure should happen first

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.

search and download files by query

I'd like to download files fetched using a query string (similarly to the way described here using a search modifier (and not just hashes) and download all (or some) matching files.

Doing so from the command line as VirusTotalApi allows would be most convenient for me and I assume others as well.

No such file or directory: 'VTDL_/home/a/Desktop...json'

When I run this command I get the following error:

python /home/a/anaconda3/lib/python3.7/site-packages/vt/vt.py -f /home/a/Desktop/2018/part1/binaries/dealply --dump

File "/home/a/anaconda3/lib/python3.7/site-packages/vt/vt.py", line 257, in jsondump
    jsondumpfile = open('VTDL_{name}.json'.format(name=sha1), 'w')

FileNotFoundError: [Errno 2] No such file or directory: 'VTDL_/home/a/Desktop/2018/part1/binaries/dealply/5824308a4e84fd3bfa16d555785751819dfac749c6aa95f11150601813d0e129.json

it seems like instead of getting the (name = sha1) it writes the path of the file?!

I'm working on python Python 3.7.1 and ubuntu

Can't resolv hostname

Hi, when I try to send a file to scan to Virustotal with the option -f I have this error:

Can't resolv hostname, check your internet conection

My internet connection it's fine and when I use the script with the option -fs, to obtain only the report, it's work fine.

Thank's

Unable to scan / upload

Unfortunately, I can't provide a sample of the file that's failing. I can only provide Python output. Test environment is Ubuntu 16.04.

On one machine, output is:

Calculating hash for: ab.zip
Traceback (most recent call last):
  File "/usr/local/bin/vt", line 9, in <module>
    load_entry_point('vt==2.2.3', 'console_scripts', 'vt')()
  File "/usr/local/lib/python2.7/dist-packages/vt/vt.py", line 3038, in main
    vt.fileScan(**options)
  File "/usr/local/lib/python2.7/dist-packages/vt/vt.py", line 1626, in fileScan
    method="post"
  File "/usr/local/lib/python2.7/dist-packages/vt/vt.py", line 456, in get_response
    response = getattr(requests, method)(url, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 110, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 56, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 475, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 596, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/adapters.py", line 423, in send
    timeout=timeout
  File "/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py", line 595, in urlopen
    chunked=chunked)
  File "/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py", line 363, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/lib/python2.7/httplib.py", line 1057, in request
    self._send_request(method, url, body, headers)
  File "/usr/lib/python2.7/httplib.py", line 1097, in _send_request
    self.endheaders(body)
  File "/usr/lib/python2.7/httplib.py", line 1053, in endheaders
    self._send_output(message_body)
  File "/usr/lib/python2.7/httplib.py", line 897, in _send_output
    self.send(msg)
  File "/usr/lib/python2.7/httplib.py", line 873, in send
    self.sock.sendall(data)
  File "/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/contrib/pyopenssl.py", line 253, in sendall
    sent = self._send_until_done(data[total_sent:total_sent + SSL_WRITE_BLOCKSIZE])
  File "/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/contrib/pyopenssl.py", line 242, in _send_until_done
    return self.connection.send(data)
  File "/usr/lib/python2.7/dist-packages/OpenSSL/SSL.py", line 1271, in send
    self._raise_ssl_error(self._ssl, result)
  File "/usr/lib/python2.7/dist-packages/OpenSSL/SSL.py", line 1178, in _raise_ssl_error
    raise SysCallError(errno, errorcode.get(errno))
OpenSSL.SSL.SysCallError: (32, 'EPIPE')

On another 16.04 machine, the output is:

Calculating hash for: ab.apk

[!] Can't resolv hostname, check your internet conection

Traceback (most recent call last):
  File "/usr/local/bin/vt", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/dist-packages/vt/vt.py", line 3038, in main
    vt.fileScan(**options)
  File "/usr/local/lib/python2.7/dist-packages/vt/vt.py", line 1640, in fileScan
    self.simple_print(jdata, simple_list)
  File "/usr/local/lib/python2.7/dist-packages/vt/vt.py", line 82, in simple_print
    if block.get(key) and block[key]:
AttributeError: 'str' object has no attribute 'get'

Both machines are able to process other files normally.

Rescan dont work

Result is on(vt -r -f file):
Scanned on :
2017-07-25 08:08:27

I need to 2017-11-10
--date parameter dont work

Rescan fails with error in vt.py

$ vt -r setup.exe 
Traceback (most recent call last):
  File "/usr/local/bin/vt", line 9, in <module>
    load_entry_point('vt==2.1.3.3', 'console_scripts', 'vt')()
  File "/usr/local/lib/python2.7/dist-packages/vt-2.1.3.3-py2.7.egg/vt/vt.py", line 3019, in main
    if options['date']:
KeyError: 'date'

Submitting files normally with -f appears to work fine.

vtapi.conf

i did:
python setup.py build
then
python setup.py install
, but i dont see any:
`* Home Dicrectory:
* ~.vtapi, ~vtapi.conf

  • or current directory where vt script placed
    • .vtapi, vtapi.conf

UTF-8

For some reason i got somtimes....
UnicodeEncodeError: 'ascii' codec can't encode character xxxxx in position 10: ordinal not in range(128)
Do you have any Idea??

BTW
Thanks for the Help by Ticket 37 and 38. Works great

bulk domain scan

is there a built in option to scan a large list of domains in a file?

Error while executing

Traceback (most recent call last):
File "vt.py", line 3204, in
main()
File "vt.py", line 3122, in main
vt.url_scan_and_report(**options)
File "vt.py", line 1703, in url_scan_and_report
if len(urls) > end + increment:
NameError: global name 'urls' is not defined

Error still persist.

vikram@vikram:~/VirusTotalApi/vt$ python vt.py -ur google.com virustotal.com
Traceback (most recent call last):
File "vt.py", line 3203, in
main()
File "vt.py", line 3130, in main
vt.url_scan_and_report(**options)
File "vt.py", line 1725, in url_scan_and_report
print '\nSearching for url(s) report: \n\t{url}'.format(url=url_upload.replace(', ', '\n\t'))
AttributeError: 'list' object has no attribute 'replace'

Certain type of files crushes the tool

I'm scanning a folder of 1000 binaries. However, I have noticed that certain types of files cause the tool to crush and give the same error massage.

Error Massage

Traceback (most recent call last):
  File "C:\Users\A\Anaconda2\Lib\site-packages\vt\vt.py", line 3760, in <module>
    main()
  File "C:\Users\A\Anaconda2\Lib\site-packages\vt\vt.py", line 3667, in main
    vt.fileScan(**options)
  File "C:\Users\A\Anaconda2\Lib\site-packages\vt\vt.py", line 2045, in fileScan
    result = self.getReport(**kwargs)
  File "C:\Users\A\Anaconda2\Lib\site-packages\vt\vt.py", line 930, in getReport
    hashes_report = hashlib.sha256(open(hashes_report, 'rb').read()).hexdigest()
IOError: [Errno 22] invalid mode ('rb') or filename: 'C:\\Users\\A\\Downloads\\Binaries\\3000\\532b923cbfe56c4225b163bcc8f44a076c2853a556f11c832225b3d3a56fa3ac'

Examples:

SHA-256 67bf7969abe5ada19e78c8f3090eb8cfa3bab3c4ffc585ac5b8ad5f113ebff2f
SHA-256 2eb7912fc2bae52e035b26a70c1b846fbf544cfb08f098847d2630c927fc6cbc

All are:
Magic PE32 executable for MS Windows (GUI) Intel 80386 32-bit

Also some files end up being deleted from the folder after running the tool.
such as:

SHA-256 | 4a56bd3af6df1246286b9eebfd055cc060851e71346709628d3ff72175085693
SHA-256 | 4d26aff3a73f49423aad2fa6eb2b7b7dcd6af918c1b1e9b89115e9928963b7b8

Is there any logical reason behind such occurrence?

WindowsError: [Error 126] The specified module could not be found

When I run vt.exe on windows 10, I get the following error:

Traceback (most recent call last):
File "C:\Python27\Scripts\vt-script.py", line 11, in
load_entry_point('vt==3.0.0', 'console_scripts', 'vt')()
File "C:\Python27\lib\site-packages\pkg_resources_init_.py", line 587, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "C:\Python27\lib\site-packages\pkg_resources_init_.py", line 2800, in load_entry_point
return ep.load()
File "C:\Python27\lib\site-packages\pkg_resources_init_.py", line 2431, in load
return self.resolve()
File "C:\Python27\lib\site-packages\pkg_resources_init_.py", line 2437, in resolve
module = import(self.module_name, fromlist=['name'], level=0)
File "C:\Python27\lib\site-packages\vt-3.0.0-py2.7.egg\vt_main_.py", line 8, in
from .vt import main
File "C:\Python27\lib\site-packages\vt-3.0.0-py2.7.egg\vt\vt.py", line 72, in
import magic
File "C:\Python27\lib\site-packages\magic.py", line 159, in
libmagic = ctypes.CDLL(dll)
File "C:\Python27\lib\ctypes_init_.py", line 366, in init
self._handle = _dlopen(self._name, mode)
WindowsError: [Error 126] The specified module could not be found

So far I tried reinstalling the vt module, updating required modules and reinstalling python. Without success.

Multiple issues with download

Hi

When I download a file, vt doesn't exit after download:

$ vt -dl ebf27a5ff315e5d78245ec3a7144e6c896f6a0be9122c16a46fad8ecea84cb5d
	Downloaded to File -- ebf27a5ff315e5d78245ec3a7144e6c896f6a0be9122c16a46fad8ecea84cb5d
^C
$ sha2 ebf27a5ff315e5d78245ec3a7144e6c896f6a0be9122c16a46fad8ecea84cb5d 
ebf27a5ff315e5d78245ec3a7144e6c896f6a0be9122c16a46fad8ecea84cb5d  ebf27a5ff315e5d78245ec3a7144e6c896f6a0be9122c16a46fad8ecea84cb5d

When I download a pcap, vt download strange files, and not the expected pcap:

$ vt --pcap ebf27a5ff315e5d78245ec3a7144e6c896f6a0be9122c16a46fad8ecea84cb5d
[-] Downloaded content has not the same hash as requested
[-] Downloaded content has not the same hash as requested
[-] Downloaded content has not the same hash as requested
[-] Downloaded content has not the same hash as requested
[-] Downloaded content has not the same hash as requested
[-] Downloaded content has not the same hash as requested
[-] Downloaded content has not the same hash as requested
[-] Downloaded content has not the same hash as requested
[-] Downloaded content has not the same hash as requested
[-] Downloaded content has not the same hash as requested
[-] Downloaded content has not the same hash as requested
[-] Downloaded content has not the same hash as requested
[-] Downloaded content has not the same hash as requested
	Downloaded to File -- setled {CAMNUM | c[urrent]} MODE	set LED (0=off
[-] Downloaded content has not the same hash as requested
[-] Downloaded content has not the same hash as requested
	Downloaded to File -- getlogi {CAMNUM | c[urrent]}	get Logitech properties
[-] Downloaded content has not the same hash as requested
	Downloaded to File -- set {CAMNUM | c[urrent]} CONTROLIND {VAL | a[uto]}	set controls
[-] Downloaded content has not the same hash as requested
	Downloaded to File -- get {CAMNUM | c[urrent]}	get controls
[-] Downloaded content has not the same hash as requested
	Downloaded to File -- savegraph	save current graph to C:\z.grf
[-] Downloaded content has not the same hash as requested
[-] Downloaded content has not the same hash as requested
	Downloaded to File -- list	verbose list
[-] Downloaded content has not the same hash as requested
[-] Downloaded content has not the same hash as requested
[-] Downloaded content has not the same hash as requested
[-] Downloaded content has not the same hash as requested
[-] Downloaded content has not the same hash as requested
[-] Downloaded content has not the same hash as requested
[-] Downloaded content has not the same hash as requested
[-] Downloaded content has not the same hash as requested
[-] Downloaded content has not the same hash as requested
[-] Downloaded content has not the same hash as requested
[-] Downloaded content has not the same hash as requested
[-] Downloaded content has not the same hash as requested
[-] Downloaded content has not the same hash as requested
[-] Downloaded content has not the same hash as requested
[-] Downloaded content has not the same hash as requested
[-] Downloaded content has not the same hash as requested
[-] Downloaded content has not the same hash as requested
[-] Downloaded content has not the same hash as requested
[-] Downloaded content has not the same hash as requested
[-] Downloaded content has not the same hash as requested
[-] Downloaded content has not the same hash as requested
[-] Downloaded content has not the same hash as requested
[-] Downloaded content has not the same hash as requested
 [-] Downloaded content has not the same hash as requested
[-] Downloaded content has not the same hash as requested
[-] Downloaded content has not the same hash as requested
[-] Downloaded content has not the same hash as requested
[-] Downloaded content has not the same hash as requested
[-] Downloaded content has not the same hash as requested
[-] Downloaded content has not the same hash as requested
[-] Downloaded content has not the same hash as requested
[-] Downloaded content has not the same hash as requested
[-] Downloaded content has not the same hash as requested
[-] Downloaded content has not the same hash as requested
[-] Downloaded content has not the same hash as requested
[-] Downloaded content has not the same hash as requested
[-] Downloaded content has not the same hash as requested
[-] Downloaded content has not the same hash as requested
[-] Downloaded content has not the same hash as requested
[-] Downloaded content has not the same hash as requested
	Downloaded to File -- ??????	?u??
[-] Downloaded content has not the same hash as requested
[-] Downloaded content has not the same hash as requested
[-] Downloaded content has not the same hash as requested
[-] Downloaded content has not the same hash as requested
 [-] Downloaded content has not the same hash as requested
[-] Downloaded content has not the same hash as requested
[-] Downloaded content has not the same hash as requested
[-] Downloaded content has not the same hash as requested
[-] Downloaded content has not the same hash as requested
[-] Downloaded content has not the same hash as requested
	Downloaded to File -- ??љ??f?^C???$???????????x>?????9?}?1?f?^C???~?????????E 9???????????
[-] Downloaded content has not the same hash as requested
[-] Downloaded content has not the same hash as requested
	Downloaded to File -- ????
                                  ???R?�?????~???????1ۉ$?????????????M???4
[-] Downloaded content has not the same hash as requested
	Downloaded to File -- B????
                                   ???
[-] Downloaded content has not the same hash as requested
	Downloaded to File -- B????
                                   ???
[-] Downloaded content has not the same hash as requested
	Downloaded to File -- B????
                                   ???
[-] Downloaded content has not the same hash as requested
	Downloaded to File -- B????
                                   ???
[-] Downloaded content has not the same hash as requested
	Downloaded to File -- B????
                                   ???
[-] Downloaded content has not the same hash as requested
	Downloaded to File -- B????
                                   ???
[-] Downloaded content has not the same hash as requested
[-] Downloaded content has not the same hash as requested
[-] Downloaded content has not the same hash as requested
[-] Downloaded content has not the same hash as requested
[-] Downloaded content has not the same hash as requested
[-] Downloaded content has not the same hash as requested
[-] Downloaded content has not the same hash as requested
^C

$ ls
%83%C1%80%89?%83%C3??%B6R?%83?%89?%83%C3?%83%FE?~%8D%8D%85%E8%FE%FF%FF1ۉ?$%FF%95%E0%FE%FF%FF%8B%95%DC%FE%FF%FF%8BM?%C1%E2?%8D4
%89%C8?%9F%C2%C1%E8??%C2u?%83%F9
%EB?%89љ%F7%F9f%89?^C%83%FB??$%8B%84%9D%E8%FE%FF%FF%8B?%9F%85%C0x>%89%D1%D1%F9?%C89%D0}%D91%C0f%89?^C%83%FB?~%DC%FF%85%DC%FE%FF%FF%83E??%8BE 9%85%DC%FE%FF%FF?%82?%FF%FF%FF%81%C4
B%83%C1%80%89?%83%C3??%B6
ebf27a5ff315e5d78245ec3a7144e6c896f6a0be9122c16a46fad8ecea84cb5d
get {CAMNUM | c[urrent]}?get controls
getlogi {CAMNUM | c[urrent]}?get Logitech properties
list?verbose list
savegraph?save current graph to C:\z.grf
set {CAMNUM | c[urrent]} CONTROLIND {VAL | a[uto]}?set controls
setled {CAMNUM | c[urrent]} MODE?set LED (0=off

These issues were found on current master, on up-to-date OS X El Capitan, with private API and intelligence access.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.