Giter VIP home page Giter VIP logo

tanfire's Introduction

TanFire

TanFire is a Python script that leverages pyTan and Tanium Index to check the hashes of all new executables in an environment against WildFire and VirusTotal optionally uploading unanalyzed executables to WildFire.

Script Flow

  • TanFire.main() Calls script's functions
  • TanFire.Credentials() Retrieve credentials from the config specified location
  • TanFire.Tanium_Connect() Create Tanium handler to use when interacting with the Tanium API
  • TanFire.Import_Index() Retrieve list of new hashes in the environment using a Tanium Index Saved Question, process exclusions, and setup list to track hashes with the following fields: computer,file,path,size,md5,sha256,source,wf_malware,wf_new,wf_upload,vt_positive,vt_total,vt_link,vt_new,vt_upload
  • wildfire.WildFire() Processes Dictionary of unique hashes returning a Dictionary of unique hashes with their WildFire results.
    • wildfire.Cache() Read in WF results from local file cache
    • wildfire.Check() Check new hashes against WF
    • wildfire.Copy() Prep list of files to be copied and call Tanium_Copy()
      • wildfire.Tanium_Copy() Use Tanium copy file package to copy all the new files from a single endpoint to a central share
    • wildfire.Upload() Upload new files to WF
    • wildfire.Check() Recheck recently uploaded files for WF result
    • wildfire.Update_Cache() Update local cache file with new WF results
    • wildfire.Download_Reports() Download WF PDF report of malware hashes
  • virustotal.VirusTotal() Processes Dictionary of unique hashes returning a Dictionary of unique hashes with their VirusTotal results.
    • virustotal.Cache() Read in VT results from local file cache
    • virustotal.Check() Check new hashes against VT
    • virustotal.Update_Cache() Update local cache file with new VT results
  • TanFire.Check() Update list of hashes with results of WildFire and VirusTotal checks
  • output.Output() Output results to local csv, Splunk, Slack, and/or Email
    • output.Email() Send statistics and details email

Notes

  • Authenticated Computers need to have permissions to write to the file share in order for the Copy Files package to work.
  • The Index Saved Question only filters for files with the executable magic number (4D5A). Index of course may have its own exclusions set. It is still advisable to appropriately configure exclusions in config.cfg.
  • The username and/or password can either be stored in the config or if they're set to "prompt" the script will prompt for them at runtime. Either will work with 2FA.
  • If the Tanium environment uses 2FA there is a Tanium option to enable a secondary password field only useable via the API allowing 2FA for API access from that account to be disabled. Talk to your TAM about configuring.
  • This script is designed for Windows Executables. It's worth noting WildFire does support additional file types including Mach-O, DMG, and PKG files for Mac.

Authentication

  • To run TanFire without copying and uploading unkown files the Tanium account can use the "Read-Only User" Role.
  • To be able to copy and upload unknown files the tanium account needs the "Action User" Role in order to kick off the copy package.
  • You can either store the Tanium username in the config or prompt at runtime.
  • The Tanium password can be stored in the config, set to prompt at runtime, or be AES encrypted.
  • If you choose AES encryption use the createCipherText.py script to create a file with the ciphertext for the password. This file needs to be placed where specified in the config file. Ideally in a separate folder from the script. The AES key is specified and stored in the config file. The IV is based off the SN of the system running the script so the ciphertext won't decode on another system unless an attacker also knows the original SN.
  • On the todo list is to add KMS/Vault encryption for the Tanium password. Until that is implemented using an account with the "Action User" roll may not be advisable due to the risk of credential exposure.
  • When RBAC support is released an account will be able to be locked down to just the SQ and Copy Package.

Requirements

Todo

  • Run in AWS
  • Encrypt Password using KMS/Vault
  • Option to upload new files to VirusTotal
  • Import hashes from running processes
  • Package to upload unknown files directly from clients rather than copying them centrally first

License

Licensed under the MIT License

Copyright 2017 Move, Inc

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Author

Jason Javier

tanfire's People

Contributors

jjavier16 avatar efitch avatar

Watchers

James Cloos avatar

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.