ethpector package¶
Subpackages¶
Submodules¶
ethpector.analysis module¶
- class ethpector.analysis.ClassificationMatches(symbolic: list[ethpector.classify.classification.InterfaceMatch], disassembly: list[ethpector.classify.classification.InterfaceMatch], bytecode: list[ethpector.classify.classification.KnownBytecode], address: list[ethpector.classify.classification.KnownAddress])[source]¶
Bases:
object
Summarizes the potential matches of a given bytecode with known interfaces , byte-codes of addresses.
- disassembly: list[ethpector.classify.classification.InterfaceMatch]¶
- class ethpector.analysis.CodeAnalysis(address: str, code: str, config: Configuration, online_resolver: DataProvider)[source]¶
Bases:
object
The main class that aggregates all analysis functionality.
- aa¶
Analysis based on the disassembly and simple dataflow.
- Type:
- online_resolver¶
Abstract data provider. Is responsible for fetching data from online sources (node, etherscan, 4bytes etc)
- Type:
- sa¶
Analysis capabilities based on symbolic execution
- Type:
- get_annotated_dissassembly() <ethpector.data.datatypes.ToJsonDecorator object at 0x7f8ff35d2f70> [source]¶
- get_call_summary() list[ethpector.analysis.InstructionOverview] [source]¶
- get_function_summary() FunctionOverview [source]¶
- get_interface_matches(threshold=0.5) ClassificationMatches [source]¶
- get_sender_constraint_functions() FunctionOverview [source]¶
- get_storage_summary() StorageOverview [source]¶
- class ethpector.analysis.FunctionOverview(entry_point: FunctionEntrypoint, detailed_overview: list[ethpector.data.datatypes.FunctionSummary], sender_constraint: Optional[SenderConstraintFunction])[source]¶
Bases:
object
Summary of functions found in the program
- detailed_overview: list[ethpector.data.datatypes.FunctionSummary]¶
- entry_point: FunctionEntrypoint¶
- sender_constraint: Optional[SenderConstraintFunction]¶
- class ethpector.analysis.InstructionOverview(instruction: Instruction, detailed_overview: Optional[AnnotationBase])[source]¶
Bases:
object
Instruction and its annotation.
- detailed_overview: Optional[AnnotationBase]¶
- instruction: Instruction¶
- class ethpector.analysis.StorageOverview(reads: list[ethpector.analysis.InstructionOverview], writes: list[ethpector.analysis.InstructionOverview])[source]¶
Bases:
object
Reads and writes found to permanent storage found in the program.
ethpector.main module¶
- class ethpector.main.OutputWriter(config: Configuration, identifier: str)[source]¶
Bases:
object
The output writer takes care of writing output either to a file or to std out. The behavior depends on the config option config.to_file .. attribute:: config
Configuration of the tool
- type:
Configuration
- header¶
If data is written to stdout headers are inserted between file to make them separable. The field keeps track if header was already written for a particular file.
- Type:
- identifier¶
Defines the folder used to write the output. Usually an address of the hash of the bytecode
- Type:
- ethpector.main.extract_information(address: str, code: str, config: Configuration) CodeAnalysis [source]¶
Provides a high level interface to the ethpector functionality.
- Parameters:
address (str) – Hex-string of an address prefixed with 0x. The address is used to acquire the bytecode to analyze for etherscan or a rpc node connection.
code (str) – Hex-string of the bytecode
config (Configuration) – Configuration to use.
- Returns:
Object wrapping the available data extraction functions.
- Return type:
- ethpector.main.main(args)[source]¶
Main entry point of the ethpector command-line tool.
- Parameters:
args (TYPE) – Description
- ethpector.main.output_result(report: CodeAnalysis, config: Configuration)[source]¶
Writes the output based on the current configuration provided.
- Parameters:
report (CodeAnalysis) – Interface to the analysis data.
config (Configuration) – The configuration defines what data should be produced