Skip to main content

A Python library for the MythX platform

Project description

PythX

https://img.shields.io/pypi/v/pythx.svg https://travis-ci.org/dmuhs/pythx.svg?branch=master https://readthedocs.org/projects/pythx/badge/?version=latest https://coveralls.io/repos/github/dmuhs/pythx/badge.svg?branch=master

PythX is a library for the MythX smart contract security analysis platform.

What is MythX?

MythX is a security analysis API that allows anyone to create purpose-built security tools for smart contract developers. Tools built on MythX integrate seamlessly into the development environments and continuous integration pipelines used throughout the Ethereum ecosystem.

Installation

PythX runs on Python 3.6+ and PyPy3.

To get started, simply run

$ pip3 install pythx

Alternatively, clone the repository and run

$ pip3 install .

Or directly through Python’s setuptools:

$ python3 setup.py install

Example

PythX aims to provide an easy-to-use interface to the official MythX API. Its goal is to turbocharge tool development and make it easy to deal with even complex use cases.

from pythx import Client


c = Client(api_key="...")

# submit bytecode, source files, their AST and more!
resp = c.analyze(bytecode="0xfe")

# wait for the analysis to finish
while not c.analysis_ready(resp.uuid):
    time.sleep(1)

# have all your security report data at your fingertips
for issue in c.report(resp.uuid):
    print(issue.swc_title or "Undefined", "-", issue.description_short)

# Output:
# Assert Violation - A reachable exception has been detected.

The PythX CLI has now become the MythX CLI!

Originally, the PythX CLI was a proof of concept to display to interested developers what can be done using the library. The interest in the CLI grew so large that a lot of developers contacted me and asked for support and new features.

This is the PSA that I will no longer maintain the PythX CLI. But wait! There’s more!

Because a PoC is not exactly what you would call future-proof and maintainable software, I have decided to do a complete revamp. It is called mythx-cli and incorporates all feature requests I have gotten so far. Check it out here and let me know what you think!

Enjoy! :)

History

1.6.1 [2020-06-16]

  • Update mythx-models dependency to omit stale warning

1.6.0 [2020-06-16]

  • Disable model json schema validation and tests

  • Various dependency upgrades

1.5.7 [2020-04-27]

  • Add property checking middleware and tests

  • Various dependency upgrades

1.5.6 [2020-04-21]

  • Various critical dependency upgrades

  • Fix bug where tests failed due to a data mismatch

1.5.5 [2020-02-24]

  • Allow direct injection of domain model into client analyze method

1.5.4 [2020-02-20]

  • Fix various dependency conflicts

  • Add better documentation to readme file

  • Update middleware type hints and documentation

  • Update API module type hints and documentation

  • Various dependency upgrades

1.5.3 [2020-02-10]

  • Handle ambiguous MYTHX_API_URL declarations

  • Various dependency upgrades

1.5.2 [2020-01-30]

  • Add additional analysis/group list filter parameters

  • Various dependency upgrades

1.5.1 [2020-01-29]

  • Remove trial user support as it has been dropped from the API

1.5.0 [2020-01-29]

  • Add pypy3 tests in Travis CI

  • Add additional query param support to analysis list handler

  • Add various test suite improvements

  • Drop support for Python 3.5 and add support for Python 3.8

  • Remove stale parameter config options

  • Remove stale configuration object support

  • Improve PyPI trove classifiers

  • Various dependency upgrades

1.4.1 [2019-11-19]

  • Extend status code range for failure check in API handler

1.4.0 [2019-11-19]

  • Fix bug where empty query parameters were sent to the API

  • Introduce group ID/name middleware

  • Add group status support in client

  • Add group creation/sealing support in client

  • Add group list support in client

  • Fix dependency conflict between mythx-cli and mythx-models

  • Various dependency upgrades

1.3.2 [2019-10-04]

  • Update mythx-models to 1.4.1

1.3.1 [2019-10-04]

  • Update pytest from 5.1.2 to 5.2.0

  • Update mythx-models to 1.4.0

1.3.0 [2019-09-20]

  • Remove the PythX CLI PoC

  • Add PSA about deprecation and link to new mythx-cli repository

1.2.6 [2019-09-19]

  • Update twine from 1.14.0 to 1.15.0

  • Bump mythx-models to 1.3.5

1.2.5 [2019-09-15]

  • Update twine from 1.13.0 to 1.14.0

  • Clean up dependencies

  • Bump mythx-models to 1.3.3

1.2.4 [2019-09-06]

  • Bump mythx-models to 1.3.2

  • Add support to fetch analysis result input by UUID

1.2.3 [2019-09-05]

  • Add an auth check override to handle situations where only the access token is given

1.2.2 [2019-08-30]

  • Update mythx-models to 1.3.1

1.2.1 [2019-08-29]

  • Update mythx-models to 1.3.0

1.2.0 [2019-08-26]

1.1.8 [2019-06-05]

  • Add debug flag to CLI

  • Add support for the clientToolName response field

  • Add support for the new source list format validation

  • Update the bumpversion expression to support black formatting

1.1.7 [2019-04-20]

  • Add main docstring description

1.1.6 [2019-04-19]

  • Add mainSource support to CLI

  • Fix bug where submission object was malformed (“AST” -> “ast”)

  • Upgrade pytest dependency

1.1.5 [2019-04-16]

  • Add middleware to disable analysis cache

  • Add CLI support to analyze compiled Truffle projects

  • Fix bug where reports were not completely shown

  • Update the authentication data format

  • Add support for the mainSource field

  • Add shortcut to inject middlewares in Client

1.1.4 [2019-03-28]

  • Fix issue in schema detection

  • Upgrade Sphinx dependency

1.1.3 [2019-03-25]

  • Initial release!

  • 100% branch coverage achieved

  • 100% doc coverage achieved

  • Examples provided in repo readme

  • Automatic PyPI deployment on version tag change

Project details


Download files

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

Source Distribution

pythx-1.7.3.tar.gz (182.8 kB view details)

Uploaded Source

Built Distribution

pythx-1.7.3-py2.py3-none-any.whl (41.5 kB view details)

Uploaded Python 2Python 3

File details

Details for the file pythx-1.7.3.tar.gz.

File metadata

  • Download URL: pythx-1.7.3.tar.gz
  • Upload date:
  • Size: 182.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/35.0 requests/2.25.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.64.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.7.13

File hashes

Hashes for pythx-1.7.3.tar.gz
Algorithm Hash digest
SHA256 e2346d47c984f577636eef79f0c860eb091f3198861851c537443792a64643fd
MD5 11ea9b6cbd67d7bf0f7a379eb8393b63
BLAKE2b-256 fc497d8c870405211489c9fa2c266c9296849ffa6a06f75fd5cf18eb3bc0d35b

See more details on using hashes here.

File details

Details for the file pythx-1.7.3-py2.py3-none-any.whl.

File metadata

  • Download URL: pythx-1.7.3-py2.py3-none-any.whl
  • Upload date:
  • Size: 41.5 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/35.0 requests/2.25.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.64.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.7.13

File hashes

Hashes for pythx-1.7.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 91566851468f807d93e492225ede106d27e6017f4ee72e7ca626518896ae446a
MD5 89a9f2b64b27af5b22743e8b3e1b1e0d
BLAKE2b-256 25f693ec99d123ed099591089493c5298a9bba0183a274e341ef0818e281fb94

See more details on using hashes here.

Supported by

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