From c58cb3d574bd2df532b654cb678726c1111b5730 Mon Sep 17 00:00:00 2001 From: Jonathan Becker <64037729+Jon-Becker@users.noreply.github.com> Date: Sat, 14 May 2022 15:44:41 -0400 Subject: [PATCH] v1.0.1rc6 PyPi finally works --- .gitignore | 5 +- MANIFEST.in | 1 + __main__.py | 6 + dist/eth_heimdall-1.0.0rc3.tar.gz | Bin 4912 -> 0 bytes eth_heimdall.egg-info/PKG-INFO | 7 +- eth_heimdall.egg-info/SOURCES.txt | 37 +++++- eth_heimdall.egg-info/entry_points.txt | 1 + eth_heimdall.egg-info/top_level.txt | 8 ++ heimdall.py | 90 ------------- heimdall/__init__.py | 0 heimdall/__main__.py | 18 +-- heimdall/env/__init__.py | 0 {env => heimdall/env}/conf.json | 2 +- heimdall/lib/__init__.py | 1 - heimdall/lib/config.py | 30 ++++- heimdall/lib/menus/__init__.py | 1 - heimdall/lib/menus/header.py | 4 +- heimdall/lib/menus/help.py | 6 +- heimdall/lib/modules/__init__.py | 0 heimdall/lib/modules/decompile.py | 16 +-- heimdall/lib/modules/modules.py | 11 +- heimdall/lib/modules/redeploy.py | 139 --------------------- heimdall/lib/modules/trace.py | 2 +- heimdall/lib/utils/__init__.py | 2 - heimdall/lib/utils/apis/__init__.py | 1 - heimdall/lib/utils/apis/etherscan.py | 6 +- heimdall/lib/utils/apis/sigdir.py | 4 +- heimdall/lib/utils/eth/__init__.py | 1 - heimdall/lib/utils/eth/builder.py | 14 +-- heimdall/lib/utils/eth/classes/__init__.py | 1 - heimdall/lib/utils/eth/classes/function.py | 12 +- heimdall/lib/utils/eth/classes/vm.py | 10 +- heimdall/lib/utils/eth/disassembler.py | 8 +- heimdall/lib/utils/eth/functions.py | 14 +-- heimdall/lib/utils/eth/version.py | 2 +- heimdall/lib/utils/io.py | 4 +- heimdall/lib/utils/logger.py | 2 +- heimdall/lib/utils/logic.py | 2 +- heimdall/lib/utils/postprocess.py | 2 +- heimdall/lib/utils/version.py | 4 +- setup.py | 16 ++- 41 files changed, 173 insertions(+), 317 deletions(-) create mode 100644 MANIFEST.in create mode 100644 __main__.py delete mode 100644 dist/eth_heimdall-1.0.0rc3.tar.gz delete mode 100644 heimdall.py create mode 100644 heimdall/__init__.py create mode 100644 heimdall/env/__init__.py rename {env => heimdall/env}/conf.json (89%) create mode 100644 heimdall/lib/modules/__init__.py delete mode 100644 heimdall/lib/modules/redeploy.py diff --git a/.gitignore b/.gitignore index 5de17c1..7c65e8a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,8 @@ __pycache__/ output/ .vscode -lib/modules/redeploy.py lib/modules/trace.py +dist +dist/* +eth_heimdall.egg-info +eth_heimdall.egg-info/* \ No newline at end of file diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..d7124fe --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1 @@ +include heimdall/env/conf.json \ No newline at end of file diff --git a/__main__.py b/__main__.py new file mode 100644 index 0000000..3392f8a --- /dev/null +++ b/__main__.py @@ -0,0 +1,6 @@ +import sys + +from heimdall.__main__ import main + +if __name__ == '__main__': + sys.exit(main(sys.argv)) \ No newline at end of file diff --git a/dist/eth_heimdall-1.0.0rc3.tar.gz b/dist/eth_heimdall-1.0.0rc3.tar.gz deleted file mode 100644 index 53d3bd2aac1a70e7d5202cedc93dd4cc0c3d33d1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4912 zcmV-06VL1)iwFo<)qY|E|7CP&Uub1%ZDe6=Y%MV^FfK51V>2#vVR8WNJ^gdqy0ZP* ze}$UPTwn$qKJwAST<*IxaU0%ALIy~CJ9!x*Yymzowx4B_GHw6&yDQ1Y5W-1&a&ym| zNRt+Sd<-TQZB?8Ee%J_Un6xzclJqv$5Z3H0llGl}>;8#Nz32%G{YlJ+D$Tt7bK_ z8@o?G{}1=~<>!I?tk&1&{L1{_->cSMk^SeK|Gx!3ji=NfG5dCtB7|z=@n4Vs=AS|T z*AMRN|AyB8&!Ye9IsIP)#a}%%t6KBF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mn)|Z(1;u!LQ z3L?jl!NQ8TU~U!iqEtwKYD?|?w+ceGDv@nAva;N-khBVajv%5LZb{^|3XeMg%-ZDd z$G5%~)^1i8n&c|mX=!b~T3xvQo&vj7VMJS3g*1*Rp4+gw_*lmGRGDNoXLZQ;bI5%F z+be7iE?T%w(Um_2(<*EWrCM06JQN{STZK&_RkNy|j9%I*oOK3SW=QQ@I$=ngj0qVg z>SsBJ>21Z= max_title_length: max_title_length = len(meta['title']) if len(meta['description']) >= max_description_length: diff --git a/heimdall/lib/modules/redeploy.py b/heimdall/lib/modules/redeploy.py deleted file mode 100644 index 474679d..0000000 --- a/heimdall/lib/modules/redeploy.py +++ /dev/null @@ -1,139 +0,0 @@ -import os -import datetime - -import lib.config -from lib.utils.eth.builder import build -from web3 import Web3 - -from lib.utils.logger import log, query -from lib.utils.colors import colorLib -from lib.utils.io import outputDirectory, write -from lib.utils.eth.disassembler import disassemble -from lib.utils.apis.etherscan import fetchSourceCode, fetchDeploymentBytecode -from lib.utils.eth.version import detectVersion, resolve - -meta = { - "title": "Redeploy", - "description": "Download and redeploy the target smart contract", - "author": "Jonathan Becker ", - "version": "v1.0.0", -} - - -def main(args): - if args.target: - target = args.target - output = args.output - - localRPC = lib.config.getConfig()['defaults']['providers']['local'] - - if not args.provider: - args.provider = lib.config.getConfig()['defaults']['providers']['remote'] - log('warning', f'Provider not set! Using default remote provider from configuration.') - - log('info', 'Establishing connection to remote provider...') - if "http" in args.provider.lower(): - web3fetch = Web3(Web3.HTTPProvider(args.provider)) - elif "wss" in args.provider.lower(): - web3fetch = Web3(Web3.WebsocketProvider(args.provider)) - else: - log('critical', f'Provider {colorLib.RED}{args.provider}{colorLib.RESET} doesn\'t seem valid.') - return - - if web3fetch.isConnected(): - log('success', 'Connection established!') - else: - log('critical', f'Connection to {colorLib.RED}{args.provider}{colorLib.RESET} failed!') - return - - log('info', 'Establishing connection to local network...') - if "http" in localRPC.lower(): - web3 = Web3(Web3.HTTPProvider(localRPC)) - elif "wss" in localRPC.lower(): - web3 = Web3(Web3.WebsocketProvider(localRPC)) - else: - log('critical', f'Provider {colorLib.RED}{localRPC}{colorLib.RESET} doesn\'t seem valid.') - return - - if web3.isConnected(): - log('success', 'Connection established!') - else: - log('critical', f'Connection to {colorLib.RED}{localRPC}{colorLib.RESET} failed!') - return - - - - log('info', f'Fetching target {colorLib.CYAN}{target}{colorLib.RESET}...') - if not 'eth' in target: - target = Web3.toChecksumAddress(target.lower()) - rawBytecode = web3fetch.eth.get_code(target) - bytecode = "".join(["{:02x}".format(v) for v in rawBytecode]) - - if len(bytecode) <= 1: - log('warn', f'Target {colorLib.CYAN}{target}{colorLib.RESET} doesn\'t appear to be a contract address.') - return - - output = outputDirectory(output, target) - - write(f'{output}/bytecode.evm' , f'0x{bytecode}') - fetchFromEtherscan = "Y" - - if not args.default: - fetchFromEtherscan = query('info', "N", f'Would you like to attempt to fetch contract ABI from EtherScan? Otherwise, we will build it from assembly. [Y/n]: ') - else: - log('info', f'Would you like to attempt to fetch contract ABI from EtherScan? Otherwise, we will build it from assembly. [Y/n]: Y') - - abi = None - if fetchFromEtherscan == "Y": - abi = fetchSourceCode(args, output, True) - - if not abi: - assembly = disassemble(bytecode, output, args) - version = detectVersion(assembly, args) - - if args.verbose: - log('info', f'Assembly heuristics suggest {colorLib.CYAN}{resolve(version[0][0])} <= EVM < {resolve(version[1][0])}{colorLib.RESET} and {colorLib.CYAN}Solidity >= {version[0][1]}{colorLib.RESET}.') - - if version[0][0] < 2: - log('warning', f'Heimdall currently only has support for EVM versions after Constantinople.') - return - - log('info', 'Attempting to build source files from assembly...') - - abi = build(assembly, args, output, web3fetch, onlyAbi=True)['abi'] - - if abi: - bytecode = fetchDeploymentBytecode(args, output) - try: - contract = web3.eth.contract(abi=abi, bytecode=bytecode,) - tx = { - 'from': web3.eth.accounts[0] - } - constructor_args = [] - for i, constructor_arguments in enumerate(abi[0]['inputs']): - if i == 0: - log('info', 'This contract has required constructor arguements: ') - constructor_arg = input(f'{" "*25}{"├" if i+1 < len(abi[0]["inputs"]) else "└"}─({colorLib.CYAN}{constructor_arguments["type"]}{colorLib.RESET}) {constructor_arguments["name"]}: ') - constructor_args.append( bytes.fromhex(constructor_arg[2:]) if "0x" in constructor_arg else bytes.fromhex(hex(int(constructor_arg))[2:]) ) - - print(*constructor_args) - tx_hash = contract.constructor(*constructor_args).transact(tx) - if args.verbose: - log('info', f'Contract deployment submitted with TXID: {colorLib.CYAN}{tx_hash.hex()}{colorLib.RESET}.') - tx_receipt = web3.eth.wait_for_transaction_receipt(tx_hash) - if tx_receipt.contractAddress: - log('info', f'Transaction confirmed! Contract redeployed on development environment as {colorLib.CYAN}{tx_receipt.contractAddress}{colorLib.RESET}.') - - if args.verbose: - log('info', f'Transaction included in block {colorLib.CYAN}{tx_receipt.blockNumber}{colorLib.RESET}. Total gas consumption was {colorLib.CYAN}{tx_receipt.cumulativeGasUsed}{colorLib.RESET}.') - return - return - - except Exception as e: - log('critical', f'Redeploying bytecode failed! Logs saved to {colorLib.CYAN}{output.replace(os.getcwd(), ".")}/{datetime.date.today().strftime("%m-%d-%Y")}.log{colorLib.RESET}') - return - else: - log('critical', f'Could not read contract ABI.') - else: - print('heimdall: error: Missing a mandatory option -t. Use -h to show the help menu.\n') - return \ No newline at end of file diff --git a/heimdall/lib/modules/trace.py b/heimdall/lib/modules/trace.py index 5680e29..3e231b3 100644 --- a/heimdall/lib/modules/trace.py +++ b/heimdall/lib/modules/trace.py @@ -2,7 +2,7 @@ from timeit import default_timer as timer -from lib.utils.logger import log +from ..utils.logger import log meta = { "title": "Trace", diff --git a/heimdall/lib/utils/__init__.py b/heimdall/lib/utils/__init__.py index a317091..e69de29 100644 --- a/heimdall/lib/utils/__init__.py +++ b/heimdall/lib/utils/__init__.py @@ -1,2 +0,0 @@ - -pass \ No newline at end of file diff --git a/heimdall/lib/utils/apis/__init__.py b/heimdall/lib/utils/apis/__init__.py index fc80254..e69de29 100644 --- a/heimdall/lib/utils/apis/__init__.py +++ b/heimdall/lib/utils/apis/__init__.py @@ -1 +0,0 @@ -pass \ No newline at end of file diff --git a/heimdall/lib/utils/apis/etherscan.py b/heimdall/lib/utils/apis/etherscan.py index 59b1274..f291c9e 100644 --- a/heimdall/lib/utils/apis/etherscan.py +++ b/heimdall/lib/utils/apis/etherscan.py @@ -4,9 +4,9 @@ import time import requests -from lib.utils.logger import log -from lib.utils.colors import colorLib -from lib.utils.io import outputDirectory, write, makePath +from ..logger import log +from ..colors import colorLib +from ..io import outputDirectory, write, makePath def fetchSourceCode(args, output, onlyAbi=False): log('info', 'Attempting to fetch source from EtherScan...') diff --git a/heimdall/lib/utils/apis/sigdir.py b/heimdall/lib/utils/apis/sigdir.py index c1a296d..eb39f95 100644 --- a/heimdall/lib/utils/apis/sigdir.py +++ b/heimdall/lib/utils/apis/sigdir.py @@ -2,8 +2,8 @@ import json import requests -from lib.utils.logger import log -from lib.utils.colors import colorLib +from ..logger import log +from ..colors import colorLib def resolve(args, signature, type="signatures"): try: diff --git a/heimdall/lib/utils/eth/__init__.py b/heimdall/lib/utils/eth/__init__.py index a317091..8b13789 100644 --- a/heimdall/lib/utils/eth/__init__.py +++ b/heimdall/lib/utils/eth/__init__.py @@ -1,2 +1 @@ -pass \ No newline at end of file diff --git a/heimdall/lib/utils/eth/builder.py b/heimdall/lib/utils/eth/builder.py index 48493dd..5dd7714 100644 --- a/heimdall/lib/utils/eth/builder.py +++ b/heimdall/lib/utils/eth/builder.py @@ -6,13 +6,13 @@ from bidict import bidict -from lib.utils.logger import log, progress_bar -from lib.utils.version import getLocalVersion -from lib.utils.colors import colorLib -from lib.utils.postprocess import postProcess -from lib.utils.version import getLatestSolidityRelease -from lib.utils.io import appendLine, write -from lib.utils.eth.functions import resolveFunctions +from ..logger import log, progress_bar +from ..version import getLocalVersion +from ..colors import colorLib +from ..postprocess import postProcess +from ..version import getLatestSolidityRelease +from ..io import appendLine, write +from ..eth.functions import resolveFunctions def build(assembly, args, output, web3, onlyAbi=False): sys.setrecursionlimit(5000) diff --git a/heimdall/lib/utils/eth/classes/__init__.py b/heimdall/lib/utils/eth/classes/__init__.py index fc80254..e69de29 100644 --- a/heimdall/lib/utils/eth/classes/__init__.py +++ b/heimdall/lib/utils/eth/classes/__init__.py @@ -1 +0,0 @@ -pass \ No newline at end of file diff --git a/heimdall/lib/utils/eth/classes/function.py b/heimdall/lib/utils/eth/classes/function.py index 9b7399b..29faf5e 100644 --- a/heimdall/lib/utils/eth/classes/function.py +++ b/heimdall/lib/utils/eth/classes/function.py @@ -2,12 +2,12 @@ import re from web3 import Web3 -from lib.utils.logic import Any, Logic, _match, bytesToType, commonTypes, determineType, solidify_wrapped, offsetToMemoryName, solidify -from lib.utils.apis.sigdir import resolve -from lib.utils.eth.classes.vm import VirtualMachine -from lib.utils.eth.classes.stack import Stack -from lib.utils.logger import log, query, progress_bar -from lib.utils.colors import colorLib +from ...logic import Any, Logic, _match, bytesToType, commonTypes, determineType, solidify_wrapped, offsetToMemoryName, solidify +from ...apis.sigdir import resolve +from ...eth.classes.vm import VirtualMachine +from ...eth.classes.stack import Stack +from ...logger import log, query, progress_bar +from ...colors import colorLib class Function(): def __init__(self, args, signature, assembly, endDispatcher, index=None, indices=None, potentialNames=None, params=None): diff --git a/heimdall/lib/utils/eth/classes/vm.py b/heimdall/lib/utils/eth/classes/vm.py index 2e539ca..df452bc 100644 --- a/heimdall/lib/utils/eth/classes/vm.py +++ b/heimdall/lib/utils/eth/classes/vm.py @@ -8,11 +8,11 @@ web3 = Web3(Web3.HTTPProvider("https://mainnet.infura.io/v3/422705d85b5c4923b841a60ba0c01129")) -from lib.utils.logger import log -from lib.utils.colors import colorLib -from lib.utils.logic import Logic, offsetToMemoryName -from lib.utils.eth.classes.stack import Stack -from lib.utils.eth.classes.memory import Memory +from ...logger import log +from ...colors import colorLib +from ...logic import Logic, offsetToMemoryName +from ...eth.classes.stack import Stack +from ...eth.classes.memory import Memory from Crypto.Hash import keccak sha3 = lambda x: keccak.new(digest_bits=256, data=x).digest() diff --git a/heimdall/lib/utils/eth/disassembler.py b/heimdall/lib/utils/eth/disassembler.py index 85a0733..a7d34a7 100644 --- a/heimdall/lib/utils/eth/disassembler.py +++ b/heimdall/lib/utils/eth/disassembler.py @@ -2,10 +2,10 @@ import math import json -from lib.utils.logger import log -from lib.utils.colors import colorLib -from lib.utils.io import outputDirectory, write -from lib.utils.eth.opdict import opcodeDict +from ..logger import log +from ..colors import colorLib +from ..io import outputDirectory, write +from ..eth.opdict import opcodeDict def disassemble(bytecode, output, args): diff --git a/heimdall/lib/utils/eth/functions.py b/heimdall/lib/utils/eth/functions.py index d60fbed..2b72ce2 100644 --- a/heimdall/lib/utils/eth/functions.py +++ b/heimdall/lib/utils/eth/functions.py @@ -7,14 +7,14 @@ import traceback from bidict import bidict -from lib.config import loadFileAsPickle -from lib.utils.apis.sigdir import resolve +from ...config import loadFileAsPickle +from ..apis.sigdir import resolve -from lib.utils.logger import log, progress_bar -from lib.utils.io import makePath, outputDirectory, write, pathExists, writeObj -from lib.utils.colors import colorLib -from lib.utils.eth.classes.vm import VirtualMachine -from lib.utils.eth.classes.function import Function +from ..logger import log, progress_bar +from ..io import makePath, outputDirectory, write, pathExists, writeObj +from ..colors import colorLib +from ..eth.classes.vm import VirtualMachine +from ..eth.classes.function import Function def traceHistory(trace, _i=0): return trace[-1*(_i+1)] diff --git a/heimdall/lib/utils/eth/version.py b/heimdall/lib/utils/eth/version.py index efef7a2..9959727 100644 --- a/heimdall/lib/utils/eth/version.py +++ b/heimdall/lib/utils/eth/version.py @@ -1,4 +1,4 @@ -from lib.utils.logic import listContainsList +from ..logic import listContainsList def resolve(int): versions = ['Homestead', 'Byzantium', 'Constantinople', 'Istanbul', 'London', 'ArrowGlacier'] diff --git a/heimdall/lib/utils/io.py b/heimdall/lib/utils/io.py index 38fd956..3c372d4 100644 --- a/heimdall/lib/utils/io.py +++ b/heimdall/lib/utils/io.py @@ -1,7 +1,7 @@ import os import pickle -from lib.utils.logger import log -from lib.utils.colors import colorLib +from .logger import log +from .colors import colorLib def outputDirectory(outpath, target): if outpath: diff --git a/heimdall/lib/utils/logger.py b/heimdall/lib/utils/logger.py index 026dd8b..132c92e 100644 --- a/heimdall/lib/utils/logger.py +++ b/heimdall/lib/utils/logger.py @@ -1,7 +1,7 @@ import datetime from alive_progress import alive_it -from lib.utils.colors import colorLib +from .colors import colorLib def log(type, message): if(type == "warning"): diff --git a/heimdall/lib/utils/logic.py b/heimdall/lib/utils/logic.py index 295b2c4..4677a6a 100644 --- a/heimdall/lib/utils/logic.py +++ b/heimdall/lib/utils/logic.py @@ -15,7 +15,7 @@ class Match: from Crypto.Hash import keccak sha3 = lambda x: keccak.new(digest_bits=256, data=x).digest() -from lib.utils.eth.opdict import opcodeDict, opArgNs, _offsetToMemoryName +from .eth.opdict import opcodeDict, opArgNs, _offsetToMemoryName class Logic: def __init__(self): diff --git a/heimdall/lib/utils/postprocess.py b/heimdall/lib/utils/postprocess.py index a8fba02..8fac947 100644 --- a/heimdall/lib/utils/postprocess.py +++ b/heimdall/lib/utils/postprocess.py @@ -1,7 +1,7 @@ import re import traceback -from lib.utils.logic import Logic +from .logic import Logic def postProcess(_line, signatures, events, constantStorage): diff --git a/heimdall/lib/utils/version.py b/heimdall/lib/utils/version.py index cdc65ae..50da409 100644 --- a/heimdall/lib/utils/version.py +++ b/heimdall/lib/utils/version.py @@ -1,10 +1,10 @@ import requests import json -import lib.config +from ..config import * def getLocalVersion(): - return lib.config.getConfig()['build']['version'] + return getConfig()['build']['version'] def getLatestRelease(): try: diff --git a/setup.py b/setup.py index e4c13f4..98dbccb 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import setup setup(name='eth_heimdall', - version='1.0.0-rc.3', + version='1.0.1-rc6', description='Heimdall is an advanced and modular smart-contract toolkit which aims to make dealing with smart contracts on EVM based chains easier.', url='https://github.com/Jon-Becker/heimdall', entry_points={'console_scripts': ['heimdall=heimdall.__main__:main']}, @@ -10,7 +10,17 @@ author='Jonathan Becker (jon-becker)', author_email='jonathan@jbecker.dev', license='MIT', - packages=['heimdall'], + packages=[ + 'heimdall', + 'heimdall/lib', + 'heimdall/lib/menus', + 'heimdall/lib/modules', + 'heimdall/env', + 'heimdall/lib/utils', + 'heimdall/lib/utils/apis', + 'heimdall/lib/utils/eth', + 'heimdall/lib/utils/eth/classes' + ], install_requires=[ 'requests', 'web3', @@ -22,3 +32,5 @@ 'eth_abi' ], ) + +# Md36&deveZgNiJqN6HAXn \ No newline at end of file