Giter Club home page Giter Club logo

vthunting's Introduction

VT Hunting

VThunting is now featured on VirusTotal.

Virus Total Hunting is a tiny tool based on the VT api version 3 to run daily, weekly or monthly report about malware hunting. The report can be send via email, Slack channel or Telegram. The tool can also be used in cli to get a report anytime. The default number of result is 10 but it can be increase or decrease in the config part. This tool is only working with a Virus Total Intelligence API.

Report Example

The below extract is an example of generated report.

    __     _______   _   _             _   _            
    \ \   / /_   _| | | | |_   _ _ __ | |_(_)_ __   __ _ 
     \ \ / /  | |   | |_| | | | | '_ \| __| | '_ \ / _` |
      \ V /   | |   |  _  | |_| | | | | |_| | | | | (_| |
       \_/    |_|   |_| |_|\__,_|_| |_|\__|_|_| |_|\__, |
                                                    |___/ 
        
            McAfee ATR | Thomas Roccia | @fr0gger_
        Get latest hunting notification from VirusTotal 


Latest report from 2018-12-24 10:20:30.158831
-------------------------------------------------------------------------------------
Rule name: FancyBear_ComputraceAgent
Match date: 2018-12-24 17:38:17
SHA256: f5157e5b8afe1f79f29c947449477d13ede3d7341699256e62966474a7ee1eb5
Tags: [apt28, fancybear_computraceagent]
-------------------------------------------------------------------------------------
Rule name: Winexe_RemoteExecution
Match date: 2018-12-24 15:01:15
SHA256: 1e194647c05b0068c31cd443b5bcacc2dd41799e5d21a40e0c58adbad01c28c6
Tags: [winexe_remoteexecution, apt28]
-------------------------------------------------------------------------------------
Rule name: hatman_compiled_python: hatman
Match date: 2018-12-24 00:28:21
SHA256: 14c64fc93ae68f01989db992bf8ee47ffd33edf66223b84f3fae52f9a843a03f
Tags: [triton, hatman, hatman_compiled_python]
-------------------------------------------------------------------------------------
Rule name: Stuxnet_unpacked
Match date: 2018-12-24 15:00:00
SHA256: 86b05279bf4930ffc0c00e4fd22c8ab9e964e8d45d39bfca42e129b95dc33481
Tags: [stuxnet, stuxnet_unpacked]
-------------------------------------------------------------------------------------
Rule name: Stuxnet
Match date: 2018-12-24 14:59:59
SHA256: 86b05279bf4930ffc0c00e4fd22c8ab9e964e8d45d39bfca42e129b95dc33481
Tags: [stuxnet]
-------------------------------------------------------------------------------------
[truncated]

Getting Started

Just download the script:

git clone https://github.com/fr0gger/vthunting

Then configure the config part with your API keys and info:

# Virus Total API
VTAPI = "<API_KEY>"
number_of_result = "" # 10 by default

# Email configuration 
smtp_serv = "<SMTP_SERV>"
smtp_port = ""
gmail_login = "<EMAIL>"
gmail_pass = "<APP_PASS>"  # pass from APP
gmail_dest = "<DEST_EMAIL>"

# Slack Bot config
SLACK_BOT_TOKEN = "<API>"
SLACK_CHANNEL = "<SLACK_CHANNEL>"

# Telegram Bot config
TOKEN = "<API>"
chat_id = "<CHAT_ID>"

# Microsoft Teams Bot config
TEAMS_CHANNEL_WEBHOOK = ""

Once the config is ready you can run the file with:

python vthunting.py --help
usage: vthunting.py [OPTION]
    -h, --help              Print this help
    -r, --report            Print the VT hunting report
    -s, --slack_report      Send the report to a Slack channel
    -e, --email_report      Send the report by email
    -t, --telegram_report   Send the report to Telegram
    -m, --teams_report      Send the report to Microsoft Teams
    -j, --json              Get full JSON report

Prerequisites

Requirements

You first need to install the requirement:

  • requests
  • slackclient
  • pymsteams
pip install -r requirements.txt

VT API

Get your API key from Virus Total. https://developers.virustotal.com/v3.0/reference

Email Configuration (gmail)

To create an app you can find the documentation here: https://support.google.com/accounts/answer/185833

Slack Bot Configuration

To generate a token you need to go here and follow the step: https://api.slack.com/custom-integrations/legacy-tokens

Telegram Bot Configuration

To get a token you need to create a Telegram bot by talking to @BotFather, it will help you to configure your bot and get your token. Once you get your token visit https://api.telegram.org/bot<YOUR_TOKEN>/getUpdates to get the channel id.

Microsoft Teams Bot Configuration

Add a webhook connector to the Microsoft Teams Channel that you'd like to receive the reports. https://docs.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/connectors-using#setting-up-a-custom-incoming-webhook

Install in your system

If you want to access to this script anywhere you can copy it without the extension into:

cp vthunting.py /usr/local/bin/vthunting

Configure the task scheduler with crontab

You can use crontab to run the script and receive report periodically.

crontab -e 

Below is an example to receive the report every day at 10:15am.

# Example of job definition:
# .---------------- minute (0 - 59)
# |  .------------- hour (0 - 23)
# |  |  .---------- day of month (1 - 31)
# |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ...
# |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# |  |  |  |  |
# *  *  *  *  *  user command to be executed

15 10  * * * /usr/local/bin/vthunting -r -t -e -s >> vthunt.log

Using Docker

Git clone the repo and configure your API for the reporting in the script. Add your VirusTotal API in the dockerfile.

Then run the following commands:

# Build the container
docker build -t vthunting:latest .

# run the script:
docker run -t vthunting -r

License

This project is licensed under the MIT License - see the LICENSE.md file for details

vthunting's People

Contributors

fareedfauzi avatar fr0gger avatar jsman avatar korrosivesec 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

vthunting's Issues

Enhancement: Add rule whitelisting and blacklisting

Some people would like to get notifications for all their hunting rules, others would like to see notifications only for special specific rules (whitelisting), and some would like to not get notifications for specific rules.

By now, VTHunting does not support the filtering of rules. I suggest adding two lists for the configuration:

RULES_WHITELIST = [ ] // default: all rules allowed
RULES_BLACKLIST = [ ]

Then you can do something like:

# Report notifications only if the rule is not blacklisted and the user didn't
# specify specific rules to be whitelisted
if (not RULES_WHITELIST or rule_name in RULES_WHITELIST) 
        and (rule_name not in RULES_BLACKLIST):
    # report is valid

Enhancement - JSON Output

Implement a flag like “—to-json” to pull as json structure and integrate into collections based databases TinyDB, MongoDB, Elasticsearch. This allows analysits to add this tool to our toolkits for integrations into our toolkits.

For example, if this available, the CRON JOBS will be json files that are easy to PIPE to JQ.

Nice work fr0gger_

Error with the VT API: 'data'

Hello Folks,

This script looks awesome and I am trying to test it out. However, when I run it I am getting the below error:

so-@IR01:~/vthunting$ sudo python -s vthunting.py

__     _______   _   _             _   _
\ \   / /_   _| | | | |_   _ _ __ | |_(_)_ __   __ _
 \ \ / /  | |   | |_| | | | | '_ \| __| | '_ \ / _` |
  \ V /   | |   |  _  | |_| | | | | |_| | | | | (_| |
   \_/    |_|   |_| |_|\__,_|_| |_|\__|_|_| |_|\__, |
                                                |___/
    
             ATR | Thomas Roccia | @fr0gger_
    Get latest hunting notification from VirusTotal

[!] Error with the VT API: 'data'

Thanks,
Eddie

Enhancement - Paginate Results

Implement a pagination request for Private API Key users. If I have a private API and can pull thousands of results, can I throttle my pulls with this tool?

Enhancement: Support multiple Slack channels

It would be great to support multiple slack channels when sending the report.

Currently, the config for Slack looks like this:

vthunting/vthunting.py

Lines 56 to 60 in ef8c1ec

# Slack Bot config
SLACK_BOT_TOKEN = ""
SLACK_EMOJI = ":rooster:"
SLACK_BOT_NAME = "VT Hunting Bot by @fr0gger_"
SLACK_CHANNEL = ""

SLACK_CHANNEL can become SLACK_CHANNELS=[ ]

And then, here you can simply iterate over all channels:

vthunting/vthunting.py

Lines 93 to 99 in ef8c1ec

sc.api_call(
"chat.postMessage",
icon_emoji=SLACK_EMOJI,
username=SLACK_BOT_NAME,
channel=SLACK_CHANNEL,
text=report
)

something like:

for channel in SLACK_CHANNELS:
    sc.api_call(
    "chat.postMessage",
    icon_emoji=SLACK_EMOJI,
    sername=SLACK_BOT_NAME,
    channel=channel,
    text=report
    )

I might as well send a PR, will find the time for it (mostly setting up the bot and playground), if you'd not implement it before :)

Idea: GitHub Action

What might be cool - as part of a github action would be able to create an action that could be added to any repository CI/CD process to check hashes of 3rd party libraries and fail the build if any of the 3rd party libraries come back with "bad" results from VT...

This could be added to any repositories build process and point itself at any folder/lib/etc...

Enhancement: VTI API STATS in report

Add a metadata section to the report that provides a status of available queries from daily limits.

Something that says like:
——
VTI Queries: 25/100 (Daily Quota)
Last Run Results: 10
Last Run: 12/12/2018 GMT 00:00:00
——

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.