Skip to content

Commit

Permalink
v1.0.1rc6
Browse files Browse the repository at this point in the history
PyPi finally works
  • Loading branch information
Jon-Becker committed May 14, 2022
1 parent bbac0a7 commit c58cb3d
Show file tree
Hide file tree
Showing 41 changed files with 173 additions and 317 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -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/*
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include heimdall/env/conf.json
6 changes: 6 additions & 0 deletions __main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import sys

from heimdall.__main__ import main

if __name__ == '__main__':
sys.exit(main(sys.argv))
Binary file removed dist/eth_heimdall-1.0.0rc3.tar.gz
Binary file not shown.
7 changes: 4 additions & 3 deletions eth_heimdall.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
Metadata-Version: 2.1
Metadata-Version: 1.0
Name: eth-heimdall
Version: 1.0.0rc3
Version: 1.0.1rc6
Summary: Heimdall is an advanced and modular smart-contract toolkit which aims to make dealing with smart contracts on EVM based chains easier.
Home-page: https://github.com/Jon-Becker/heimdall
Author: Jonathan Becker (jon-becker)
Author-email: [email protected]
License: MIT
Description: UNKNOWN
Keywords: ethereum,evm,decompiler,evm decompiler,smart contract,smart contract decompiler,evm smart contract decompiler,eth contract decompiler
License-File: LICENSE
Platform: UNKNOWN
37 changes: 35 additions & 2 deletions eth_heimdall.egg-info/SOURCES.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
LICENSE
MANIFEST.in
README.md
setup.py
eth_heimdall.egg-info/PKG-INFO
Expand All @@ -7,4 +7,37 @@ eth_heimdall.egg-info/dependency_links.txt
eth_heimdall.egg-info/entry_points.txt
eth_heimdall.egg-info/requires.txt
eth_heimdall.egg-info/top_level.txt
heimdall/__main__.py
heimdall/__init__.py
heimdall/__main__.py
heimdall/env/__init__.py
heimdall/env/conf.json
heimdall/lib/__init__.py
heimdall/lib/config.py
heimdall/lib/menus/__init__.py
heimdall/lib/menus/header.py
heimdall/lib/menus/help.py
heimdall/lib/modules/__init__.py
heimdall/lib/modules/decompile.py
heimdall/lib/modules/modules.py
heimdall/lib/modules/trace.py
heimdall/lib/utils/__init__.py
heimdall/lib/utils/colors.py
heimdall/lib/utils/io.py
heimdall/lib/utils/logger.py
heimdall/lib/utils/logic.py
heimdall/lib/utils/postprocess.py
heimdall/lib/utils/version.py
heimdall/lib/utils/apis/__init__.py
heimdall/lib/utils/apis/etherscan.py
heimdall/lib/utils/apis/sigdir.py
heimdall/lib/utils/eth/__init__.py
heimdall/lib/utils/eth/builder.py
heimdall/lib/utils/eth/disassembler.py
heimdall/lib/utils/eth/functions.py
heimdall/lib/utils/eth/opdict.py
heimdall/lib/utils/eth/version.py
heimdall/lib/utils/eth/classes/__init__.py
heimdall/lib/utils/eth/classes/function.py
heimdall/lib/utils/eth/classes/memory.py
heimdall/lib/utils/eth/classes/stack.py
heimdall/lib/utils/eth/classes/vm.py
1 change: 1 addition & 0 deletions eth_heimdall.egg-info/entry_points.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
[console_scripts]
heimdall = heimdall.__main__:main

8 changes: 8 additions & 0 deletions eth_heimdall.egg-info/top_level.txt
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
heimdall
heimdall/env
heimdall/lib
heimdall/lib/menus
heimdall/lib/modules
heimdall/lib/utils
heimdall/lib/utils/apis
heimdall/lib/utils/eth
heimdall/lib/utils/eth/classes
90 changes: 0 additions & 90 deletions heimdall.py

This file was deleted.

Empty file added heimdall/__init__.py
Empty file.
18 changes: 9 additions & 9 deletions heimdall/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
import importlib
import traceback

from lib.modules.modules import getModules

from timeit import default_timer as timer

from lib.utils.colors import colorLib
from lib.menus.header import getHeader
from lib.menus.help import getHelp
from lib.utils.logger import log
from lib.utils.version import getLocalVersion, getRemoteVersion
from .lib.modules.modules import getModules
from .lib.utils.colors import colorLib
from .lib.menus.header import getHeader
from .lib.menus.help import getHelp
from .lib.utils.logger import log
from .lib.utils.version import getLocalVersion, getRemoteVersion

def main(argv=None):
command = 'clear'
Expand Down Expand Up @@ -44,7 +44,7 @@ def main(argv=None):
heimdall.add_argument('--flush', help="Flushes the cache", action="store_true")
heimdall.add_argument('--ignore-cache', help="Ignores the cache (SLOWER!)", action="store_true")

args = heimdall.parse_args(argv[1:])
args = heimdall.parse_args()
try:
if args.help:
print(getHelp())
Expand All @@ -56,7 +56,7 @@ def main(argv=None):

available_modules = getModules(args)
if args.module.lower().isdigit() and (int(args.module) <= len(available_modules[0])-1):
selected_module = importlib.import_module(available_modules[0][int(args.module)]['import'])
selected_module = importlib.import_module(available_modules[0][int(args.module)]['import'], package='heimdall')
handled = True
try:
selected_module.main(args)
Expand All @@ -66,7 +66,7 @@ def main(argv=None):
else:
for module in available_modules[0]:
if args.module.lower() == module["title"].lower():
selected_module = importlib.import_module(module['import'])
selected_module = importlib.import_module(module['import'], package='heimdall')
handled = True
try:
selected_module.main(args)
Expand Down
Empty file added heimdall/env/__init__.py
Empty file.
2 changes: 1 addition & 1 deletion env/conf.json → heimdall/env/conf.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"build": {
"version": "v1.0.0-rc.3"
"version": "v1.0.1-rc.6"
},
"defaults": {

Expand Down
1 change: 0 additions & 1 deletion heimdall/lib/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
pass
30 changes: 28 additions & 2 deletions heimdall/lib/config.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,34 @@
import json
import pickle
import pathlib

def getConfig():
return loadFileAsJson('env/conf.json')
from .utils.io import write

def getConfig():
try:
return loadFileAsJson(f'{pathlib.Path(__file__).parent.parent.resolve()}/env/conf.json')
except:
conf = {
"build": {
"version": "1.0.1-rc.6"
},
"defaults": {

"providers": {
"local": "http://127.0.0.1:7545",
"remote": "https://mainnet.infura.io/v3/"
}

},

"environment": {
"apis": {
"etherscan": ""
}
}
}
json.dump(conf, f'{pathlib.Path(__file__).parent.parent.resolve()}/env/conf.json')
return conf

def loadFileAsJson(path):
with open(path) as pathFile:
Expand Down
1 change: 0 additions & 1 deletion heimdall/lib/menus/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
pass
4 changes: 2 additions & 2 deletions heimdall/lib/menus/header.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from lib.utils.colors import colorLib
from lib.utils.version import getLocalVersion
from ..utils.colors import colorLib
from ..utils.version import getLocalVersion

def getHeader():
return (
Expand Down
6 changes: 3 additions & 3 deletions heimdall/lib/menus/help.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import os
import importlib

from lib.modules.modules import getModules
from lib.utils.colors import colorLib
from lib.utils.version import getLocalVersion
from ..modules.modules import getModules
from ..utils.colors import colorLib
from ..utils.version import getLocalVersion

def getHelp():

Expand Down
Empty file.
16 changes: 8 additions & 8 deletions heimdall/lib/modules/decompile.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
import os
import datetime
import re
import lib.config

from web3 import Web3

from lib.utils.logger import log, query
from lib.utils.colors import colorLib
from lib.utils.io import outputDirectory, pathExists, readFile, write
from lib.utils.eth.disassembler import disassemble
from lib.utils.eth.builder import build
from lib.utils.apis.etherscan import fetchSourceCode
from lib.utils.eth.version import detectVersion, resolve
from ..config import *
from ..utils.logger import log, query
from ..utils.colors import colorLib
from ..utils.io import outputDirectory, pathExists, readFile, write
from ..utils.eth.disassembler import disassemble
from ..utils.eth.builder import build
from ..utils.apis.etherscan import fetchSourceCode
from ..utils.eth.version import detectVersion, resolve

meta = {
"title": "Decompile",
Expand Down
11 changes: 6 additions & 5 deletions heimdall/lib/modules/modules.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
import os
import importlib
import pathlib
from lib.utils.colors import colorLib
from struct import pack

from lib.utils.logger import log
from ..utils.colors import colorLib
from ..utils.logger import log

def getModules(args=None):
mods = []
max_title_length = 0
max_description_length = 0
for item in os.listdir(pathlib.Path(__file__).parent.resolve()):
if item.endswith('.py') and not "modules" in item:
if item.endswith('.py') and not "modules" in item and not "__init__" in item:
try:
temp = importlib.import_module(f'lib.modules.{item.replace(".py", "")}')
temp = importlib.import_module(f'.lib.modules.{item.replace(".py", "")}', package='heimdall')
meta = temp.meta
meta['import'] = f'lib.modules.{item.replace(".py", "")}'
meta['import'] = f'.lib.modules.{item.replace(".py", "")}'
if len(meta['title']) >= max_title_length:
max_title_length = len(meta['title'])
if len(meta['description']) >= max_description_length:
Expand Down
Loading

0 comments on commit c58cb3d

Please sign in to comment.