Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Karl

License: MIT CircleCI Codacy Badge PyPI Code style: black

A monitor for smart contracts that checks for security vulnerabilities

Install

$ pip install --user karl

Will make karl available in your shell.

Description

Karl will allow you to monitor a blockchain for vulnerable smart contracts that are being deployed.

It connects to the blockchain, monitors for new blocks and runs mythril for every new smart contract deployed.

The output can be displayed in the console or POSTed to a URL.

Help message

$ karl --help
usage: karl [-h]
            [--rpc HOST:PORT / ganache / infura-{mainnet, rinkeby, kovan, ropsten}]
            [--rpctls RPCTLS] [--output Can be one of: stdout, posturl]
            [--posturl POSTURL]

Smart contract monitor using Mythril to find exploits

optional arguments:
  -h, --help            show this help message and exit

RPC options:
  --rpc HOST:PORT / ganache / infura-{mainnet, rinkeby, kovan, ropsten}
                        Custom RPC settings
  --rpctls RPCTLS       RPC connection over TLS

Output:
  --output Can be one of: stdout, posturl
                        Where to send results
  --posturl POSTURL     Send results to a RESTful url

Mythril modules enabled

  • ether_thief
  • suicide

Examples

Running against the main net

$ karl --rpc infura-mainnet --rpctls true      
Stdout initialized
Running
Scraping block 6745471
Scraping block 6745472
Scraping block 6745473
Analyzing 0xf8c065bB1DafC99eE5476a2b675FAC4a036a4B07
Scraping block 6745474
Analyzing 0xC9e044D76f211E84bA651b30BBA86758ca8017c7
Scraping block 6745475
Scraping block 6745476
Scraping block 6745477
Analyzing 0x19427b8FD32dfEc78393517Da416bC5C583E6065

Running against ganache with standard output enabled

$ karl --rpc ganache --output=stdout
Stdout initialized
Running
Scraping block 5
Analyzing 0x4b8e80acaE3F0db32e5d35925EfaA97D477dBb70
Found 1 issues for 0x4b8e80acaE3F0db32e5d35925EfaA97D477dBb70
==== Ether thief ====
SWC ID: 105
Type: Warning
Contract: 0x4b8e80acaE3F0db32e5d35925EfaA97D477dBb70
Function name: withdrawfunds()
PC address: 722
Estimated Gas Usage: 1138 - 1749
Arbitrary senders other than the contract creator can withdraw ETH from the contract account without previously having sent an equivalent amount of ETH to it. This is likely to be a vulnerability.
--------------------
--------------------
DEBUGGING INFORMATION:

Transaction Sequence: {'1': {'calldata': '0x56885cd8', 'call_value': '0x0', 'caller': '0xaaaaaaaabbbbbbbbbcccccccddddddddeeeeeeee'}, '4': {'calldata': '0x6c343ffe', 'call_value': '0x0', 'caller': '0xaaaaaaaabbbbbbbbbcccccccddddddddeeeeeeee'}}

Running against ganache with posturl enabled

$ karl --rpc ganache --output=posturl --posturl=http://localhost:8080
Posturl initialized
Running
Scraping block 5
Analyzing 0x4b8e80acaE3F0db32e5d35925EfaA97D477dBb70

And it will send this to the listening service

POST / HTTP/1.1
Accept-Encoding: identity
Content-Type: application/x-www-form-urlencoded
Content-Length: 725
Host: localhost:8080
User-Agent: Python-urllib/3.7
Connection: close

{"error": null, "issues": [{"address": 722, "contract": "0x4b8e80acaE3F0db32e5d35925EfaA97D477dBb70", "debug": "Transaction Sequence: {'1': {'calldata': '0x56885cd8', 'call_value': '0x0', 'caller': '0xaaaaaaaabbbbbbbbbcccccccddddddddeeeeeeee'}, '4': {'calldata': '0x6c343ffe', 'call_value': '0x0', 'caller': '0xaaaaaaaabbbbbbbbbcccccccddddddddeeeeeeee'}}", "description": "Arbitrary senders other than the contract creator can withdraw ETH from the contract account without previously having sent an equivalent amount of ETH to it. This is likely to be a vulnerability.", "function": "withdrawfunds()", "max_gas_used": 1749, "min_gas_used": 1138, "swc-id": "105", "title": "Ether thief", "type": "Warning"}], "success": true}

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

karl-0.3.2.dev0.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

karl-0.3.2.dev0-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

File details

Details for the file karl-0.3.2.dev0.tar.gz.

File metadata

  • Download URL: karl-0.3.2.dev0.tar.gz
  • Upload date:
  • Size: 10.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1

File hashes

Hashes for karl-0.3.2.dev0.tar.gz
Algorithm Hash digest
SHA256 df81d813fd7842b99bacbd5ebf60024d0e334fcf2efb6793b9d20f5f12e53410
MD5 56d57070a2d601a0c82660f8cc8bdbc4
BLAKE2b-256 42a85658e59ebd67ce51fab1514f911a69e90058cfb57447f81d8a32b26f7b02

See more details on using hashes here.

File details

Details for the file karl-0.3.2.dev0-py3-none-any.whl.

File metadata

  • Download URL: karl-0.3.2.dev0-py3-none-any.whl
  • Upload date:
  • Size: 12.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1

File hashes

Hashes for karl-0.3.2.dev0-py3-none-any.whl
Algorithm Hash digest
SHA256 8599f51b9d7274967fd3323e3a5b1037a889e0e4323cf41f32f2324b32aa7ea7
MD5 fcf039e0b8b1a5c0c27c6184b0449c7e
BLAKE2b-256 0195eba9118f645d8ab786363c8594116e51dead89ff0707cc365734e9bb12c0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page