Git Product home page Git Product logo

solhydra's Introduction

Solhydra

License Version Node Version

Solhydra is a cli tool to run solidity smart contract(s) through several analysis tools and generating a html report.

sample report of cryptokitties-bounty

sample report screenshot

Description

There are a number of smart contract analysis tools which can give you valuable information about your smart contracts. Just installing all these tools on your machine is quite the challenge. If you manage to install all these tools next challenge will be finding out how to execute each of these tools. After execution you are left with a number of files per tool, which you can then open and inspect one-by-one. Wouldn't it be nice if there was a tool which takes care of installing (in Docker containers) and executing all the analysis tools on a given directory with smart contracts + transforming the output of each tool (per smart contract) into 1 HTML report which you can open in the browser so you can easily inspect all output per tool, per smart contract. That's what this tool tries to accomplish ๐ŸŽ†.

Analysis tools included:

Prerequisites

  • docker (tested on 17.12.0-ce)

Requirements

node version >= 8.0.0

Install

npm install -g solhydra

Usage

NAME
  solhydra        cli tool to run solidity smart contract(s) through several analysis
                  tools and generating a html report

SYNOPSIS
  solhydra --contract-dir=dirPath --dest-dir=dirPath [--dep-dir=dirPath] [tool1, tool2, ..]
  solhydra --truffle=dirPath --dest-dir=dirPath [tool1, tool2, ..]

TOOLS
  mythril, oyente, solhint, solidity-coverage, solidity-analyzer, solgraph, solium

REQUIRED ARGUMENTS
  --contract-dir  path of contracts directory (only when not specifying --truffle)
  --truffle       path of truffle project (only when not specifying --contract-dir)
  --dest-dir      path of the directory to write the result HTML report to,
                  will be named solhydra_report.html

OPTIONAL ARGUMENTS
  --dep-dir      path of directory with dependencies (node_modules),
                 only used with --contract-dir
  tool           you can optionally specify a subset of tools to run, if you don't
                 specify any tools, all tools will be executed

NOTES
  solidity-coverage only works on truffle projects, so only when using --truffle,
  it will be skipped automatically for non-truffle runs

EXAMPLES
  solhydra --contract-dir=./contracts --dep-dir=./node_modules --dest-dir=./out
  solhydra --contract-dir=./contracts --dep-dir=./node_modules --dest-dir=./out mythril oyente
  solhydra --truffle=./mytruffleproject --dest-dir=./out
  solhydra --truffle=./mytruffleproject --dest-dir=./out solidity-coverage solium

To display help (the above shown excerpt) type: solhydra.

Notes

soljitsu flatten

The smart contracts are run through soljitsu flatten, since some analysis tools don't work with node_modules dependencies. So to keep reports consistent all tools are executed on the flatten version of the smart contracts.

html report

  • the generated HTML report has all it's internal js/css inlined, therefore it can be moved to any folder/machine and still work
  • the generated HTML report fetches some external js/css from a cdn so an internet connection is required

Todo

  • oyente reports usage of an untested z3 + solc + evm, fix this
  • add slither when it becomes available
  • add rattle if/when it becomes available (blogpost)
  • enable maian when issue is resolved
  • enable echidna with a special option since it requires manually adding tests to solidity files
  • add manticore as described here
  • fix highlightjs-solidity highlighting, doesn't seem to work, it uses php highlighting?!

License

MIT

solhydra's People

Watchers

aaron liu avatar  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.