diff --git a/ci/hooks/hook-vivisect.py b/.github/pyinstaller/hooks/hook-vivisect.py similarity index 100% rename from ci/hooks/hook-vivisect.py rename to .github/pyinstaller/hooks/hook-vivisect.py diff --git a/ci/logo.ico b/.github/pyinstaller/logo.ico similarity index 100% rename from ci/logo.ico rename to .github/pyinstaller/logo.ico diff --git a/ci/logo.png b/.github/pyinstaller/logo.png similarity index 100% rename from ci/logo.png rename to .github/pyinstaller/logo.png diff --git a/ci/pyinstaller.spec b/.github/pyinstaller/pyinstaller.spec similarity index 91% rename from ci/pyinstaller.spec rename to .github/pyinstaller/pyinstaller.spec index 785db528..10fa2b13 100644 --- a/ci/pyinstaller.spec +++ b/.github/pyinstaller/pyinstaller.spec @@ -5,16 +5,25 @@ import subprocess import wcwidth +# when invoking pyinstaller from the project root, +# this gets run from the project root. with open('./capa/version.py', 'wb') as f: f.write("__version__ = '%s'" % subprocess.check_output(["git", "describe", "--always"]).strip()) a = Analysis( - ['../capa/main.py'], + # when invoking pyinstaller from the project root, + # this gets invoked from the directory of the spec file, + # i.e. ./.github/pyinstaller + ['../../capa/main.py'], pathex=['capa'], binaries=None, datas=[ - ('../rules', 'rules'), + # when invoking pyinstaller from the project root, + # this gets invoked from the directory of the spec file, + # i.e. ./.github/pyinstaller + ('../../rules', 'rules'), + # capa.render.default uses tabulate that depends on wcwidth. # it seems wcwidth uses a json file `version.json` # and this doesn't get picked up by pyinstaller automatically. @@ -144,7 +153,9 @@ a = Analysis( "vstruct.defs.windows.win_6_3_wow64", "vstruct.defs.windows.win_6_3_wow64.ntdll", ], - hookspath=['ci/hooks'], + # when invoking pyinstaller from the project root, + # this gets run from the project root. + hookspath=['.github/pyinstaller/hooks'], runtime_hooks=None, excludes=[ # ignore packages that would otherwise be bundled with the .exe. diff --git a/ci/tox.ini b/.github/tox.ini similarity index 100% rename from ci/tox.ini rename to .github/tox.ini diff --git a/capa/features/extractors/ida/__init__.py b/capa/features/extractors/ida/__init__.py index c994faad..b40310d9 100644 --- a/capa/features/extractors/ida/__init__.py +++ b/capa/features/extractors/ida/__init__.py @@ -7,7 +7,6 @@ import capa.features.extractors.ida.file import capa.features.extractors.ida.insn import capa.features.extractors.ida.function import capa.features.extractors.ida.basicblock - from capa.features.extractors import FeatureExtractor diff --git a/capa/features/extractors/ida/basicblock.py b/capa/features/extractors/ida/basicblock.py index 00ff9859..c9eb601e 100644 --- a/capa/features/extractors/ida/basicblock.py +++ b/capa/features/extractors/ida/basicblock.py @@ -5,7 +5,6 @@ import struct import idaapi import capa.features.extractors.ida.helpers - from capa.features import Characteristic from capa.features.basicblock import BasicBlock from capa.features.extractors.ida import helpers diff --git a/capa/features/extractors/ida/file.py b/capa/features/extractors/ida/file.py index a227c82e..650ec775 100644 --- a/capa/features/extractors/ida/file.py +++ b/capa/features/extractors/ida/file.py @@ -7,7 +7,6 @@ import idautils import capa.features.extractors.helpers import capa.features.extractors.strings import capa.features.extractors.ida.helpers - from capa.features import String, Characteristic from capa.features.file import Export, Import, Section diff --git a/capa/features/extractors/ida/function.py b/capa/features/extractors/ida/function.py index fd5d91b1..31d12920 100644 --- a/capa/features/extractors/ida/function.py +++ b/capa/features/extractors/ida/function.py @@ -2,7 +2,6 @@ import idaapi import idautils import capa.features.extractors.ida.helpers - from capa.features import Characteristic from capa.features.extractors import loops diff --git a/capa/features/extractors/ida/insn.py b/capa/features/extractors/ida/insn.py index f6fa2dac..ba237766 100644 --- a/capa/features/extractors/ida/insn.py +++ b/capa/features/extractors/ida/insn.py @@ -4,7 +4,6 @@ import idautils import capa.features.extractors.helpers import capa.features.extractors.ida.helpers - from capa.features import MAX_BYTES_FEATURE_SIZE, Bytes, String, Characteristic from capa.features.insn import Number, Offset, Mnemonic diff --git a/capa/ida/ida_capa_explorer.py b/capa/ida/ida_capa_explorer.py index c5468b31..ad1c7a7f 100644 --- a/capa/ida/ida_capa_explorer.py +++ b/capa/ida/ida_capa_explorer.py @@ -1,16 +1,15 @@ import os import logging import collections -from PyQt5 import QtGui, QtCore, QtWidgets import idaapi +from PyQt5 import QtGui, QtCore, QtWidgets import capa.main import capa.rules import capa.ida.helpers import capa.render.utils as rutils import capa.features.extractors.ida - from capa.ida.explorer.view import CapaExplorerQtreeView from capa.ida.explorer.model import CapaExplorerDataModel from capa.ida.explorer.proxy import CapaExplorerSortFilterProxyModel diff --git a/scripts/hooks/post-commit b/scripts/hooks/post-commit index 42953c4f..e3334be5 100755 --- a/scripts/hooks/post-commit +++ b/scripts/hooks/post-commit @@ -12,7 +12,7 @@ if [[ "$STASH_LIST" == *"$MSG"* ]]; then fi # Run style checker and print state (it doesn't block the commit) -pycodestyle --config=./ci/tox.ini ./capa/ > style-checker-output.log 2>&1; +pycodestyle --config=./.github/tox.ini ./capa/ > style-checker-output.log 2>&1; if [ $? == 0 ]; then echo 'Style checker succeeds!! 💘'; else diff --git a/scripts/hooks/pre-push b/scripts/hooks/pre-push index edab4689..620c5a78 100755 --- a/scripts/hooks/pre-push +++ b/scripts/hooks/pre-push @@ -19,7 +19,7 @@ restore_stashed() { } # Run style checker and print state -pycodestyle --config=./ci/tox.ini ./capa/ > style-checker-output.log 2>&1; +pycodestyle --config=./.github/tox.ini ./capa/ > style-checker-output.log 2>&1; if [ $? == 0 ]; then echo 'Style checker succeeds!! 💘'; else