mythx_cli.payload package

mythx_cli.payload.bytecode

This module contains functions to generate bytecode-only analysis request payloads.

mythx_cli.payload.bytecode.generate_bytecode_payload(code: str) → Dict[str, str][source]

Generate a payload containing only the creation bytecode.

Parameters:code – The creation bytecode as hex string starting with 0x
Returns:The payload dictionary to be sent to MythX

mythx_cli.payload.solidity

This module contains functions to generate Solidity-related payloads.

mythx_cli.payload.solidity.generate_solidity_payload(file: str, version: Optional[str], contracts: List[str] = None, remappings: Tuple[str] = None) → Dict[source]

Generate a MythX analysis request from a given Solidity file.

This function will open the file, try to detect the used solc version from the pragma definition, and automatically compile it. If the given solc version is not installed on the client’s system, it will be automatically downloaded.

From the solc output, the following data is sent to the MythX API for analysis:

  • abi
  • ast
  • bin
  • bin-runtime
  • srcmap
  • srcmap-runtime
Parameters:
  • file – The path pointing towards the Solidity file
  • version – The solc version to use for compilation
  • contracts – The contract name(s) to submit
  • remappings – Import remappings to pass to solcx
Returns:

The payload dictionary to be sent to MythX

mythx_cli.payload.truffle

This module contains functions to generate payloads for Truffle projects.

mythx_cli.payload.truffle.generate_truffle_payload(file: str) → Dict[str, Any][source]

Generate a MythX analysis request payload based on a truffle build artifact.

This will send the following artifact entries to MythX for analysis:

  • contractName
  • bytecode
  • deployedBytecode
  • sourceMap
  • deployedSourceMap
  • sourcePath
  • source
  • ast
  • legacyAST
  • the compiler version
Parameters:file – The path to the Truffle build artifact
Returns:The payload dictionary to be sent to MythX