Giter Site home page Giter Site logo

andrijasa / sfuzz Goto Github PK

View Code? Open in Web Editor NEW

This project forked from duytai/sfuzz

0.0 0.0 0.0 48.84 MB

License: GNU General Public License v3.0

Shell 1.77% C++ 94.15% Python 0.65% C 0.23% Assembly 0.65% Makefile 0.07% CMake 1.84% Batchfile 0.12% Dockerfile 0.16% Solidity 0.36%

sfuzz's Introduction

Building from source

Get the source code

Git and GitHub are used to maintain the source code. Clone the repository by:

git clone --recursive https://github.com/duytai/sFuzz
cd aleth

The --recursive option is important. It orders git to clone additional submodules to build the project. If you missed --recursive option, you are able to correct your mistake with command git submodule update --init.

Install CMake

CMake is used to control the build configuration of the project. Latest version of CMake is required (at the time of writing 3.4.3 is the minimum). We strongly recommend you to install CMake by downloading and unpacking the binary distribution of the latest version available on the CMake download page.

The CMake package available in your operating system can also be installed and used if it meets the minimum version requirement.

Alternative method

The repository contains the scripts/install_cmake.sh script that downloads a fixed version of CMake and unpacks it to the given directory prefix. Example usage: scripts/install_cmake.sh --prefix /usr/local.

Install dependencies (Linux, macOS)

The following libraries are required to be installed in the system in their development variant:

  • leveldb

They usually can be installed using system-specific package manager. The examples for some systems are shown below:

Operating system Installation command
Debian-based sudo apt-get install libleveldb-dev
RedHat-based dnf install leveldb-devel
macOS brew install leveldb

We also support a "one-button" shell script scripts/install_deps.sh which attempts to aggregate dependencies installation instructions for Unix-like operating systems. It identifies your distro and installs the external packages. Supporting the script is non-trivial task so please inform us if it does not work for your use-case.

Install dependencies (Windows)

We provide prebuilt dependencies to build the project. Download them with the scripts\install_deps.bat script.

scripts\install_deps.bat

Build

Configure the project build with the following command to create the build directory with the configuration.

mkdir build; cd build  # Create a build directory.
cmake ..               # Configure the project.
cd fuzzer; make        # Build fuzzer targets.

On Windows Visual Studio 2015 is required. You should generate Visual Studio solution file (.sln) for 64-bit architecture by adding -G "Visual Studio 14 2015 Win64" argument to the CMake configure command. After configuration is completed, the aleth.sln can be found in the build directory.

cmake .. -G "Visual Studio 14 2015 Win64"

Common Issues Building on Windows

LINK : fatal error LNK1158: cannot run 'rc.exe'

Rc.exe is the Microsoft Resource Compiler. It's distributed with the Windows SDK and is required for generating the Visual Studio solution file. It can be found in the following directory: %ProgramFiles(x86)%\Windows Kits\<OS major version>\bin\<OS full version>\<arch>\

If you hit this error, adding the directory to your path (and launching a new command prompt) should fix the issue.

Fuzz contract

Create two folders assets/ and contracts/ in the same folder as the executable fuzzer file

mkdir assets/
mkdir contracts/

Place two attacker contracts to assets/

# filename: NormalAttacker.sol
pragma solidity ^0.4.2;

contract NormalAttacker {
  uint counter = 0;
  function() payable {
    revert();
  }
}
# filename: ReentrancyAttacker.sol
pragma solidity ^0.4.2;

contract ReentrancyAttacker {
  uint counter = 0;
  function() payable {
    counter ++;
    if (counter <= 2) {
      msg.sender.call(bytes4(255));
    }
    revert();
  }
}

Start fuzzing using the command:

./fuzzer -g -r 0 -d 120 && chmod +x fuzzMe && ./fuzzMe

Note: sfuzz uses Solidity compiler of linux's enviroment, don't forget to install the compiler which is able to compile your smart contracts. If x.sol is the filename, x is the name of a smart contract in file x.sol. Otherwise, no contract will be found

License

License

All contributions are made under the GNU General Public License v3. See LICENSE.

sfuzz's People

Contributors

gavofyork avatar chriseth avatar debris avatar cjentzsch avatar chfast avatar subtly avatar arkpar avatar lefterisjp avatar winsvega avatar yann300 avatar bobsummerwill avatar gluk256 avatar pirapira avatar gumb0 avatar lianahus avatar azawlocki avatar duytai avatar gcolvin avatar tiimjiim avatar caktux avatar axic avatar genoil avatar danielhams avatar halfalicious avatar onepremise avatar cubedro avatar fjl avatar giact avatar obscuren avatar callendorph 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.