Skip to content

Commit

Permalink
ruff lint
Browse files Browse the repository at this point in the history
  • Loading branch information
DennyDai committed Dec 18, 2023
1 parent 4f6ea1b commit 3829129
Show file tree
Hide file tree
Showing 15 changed files with 64 additions and 17 deletions.
3 changes: 3 additions & 0 deletions src/patcherex2/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# ruff: noqa
from .patcherex import Patcherex
from .patches import *

__all__ = ["Patcherex"] + patches.__all__
1 change: 0 additions & 1 deletion src/patcherex2/components/allocation_managers/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
from .allocation_manager import *
7 changes: 6 additions & 1 deletion src/patcherex2/components/binfmt_tools/elf.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@
from elftools.elf.constants import P_FLAGS, SH_FLAGS
from elftools.elf.elffile import ELFFile

from ..allocation_managers import *
from ..allocation_managers.allocation_manager import (
FileBlock,
MappedBlock,
MemoryBlock,
MemoryFlag,
)
from .binfmt_tool import BinFmtTool

logger = logging.getLogger(__name__)
Expand Down
1 change: 0 additions & 1 deletion src/patcherex2/components/binfmt_tools/ihex.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

import intelhex

from ..allocation_managers import *
from .binfmt_tool import BinFmtTool

logger = logging.getLogger(__name__)
Expand Down
2 changes: 2 additions & 0 deletions src/patcherex2/components/patch_managers/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from .builtin import BuiltIn
from .imp import Imp
from .patch_manager import PatchManager

__all__ = ["BuiltIn", "Imp", "PatchManager"]
3 changes: 1 addition & 2 deletions src/patcherex2/patcherex.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import logging

from .components.allocation_managers import *
from .patches import *
from .patches import InsertDataPatch, ModifyDataPatch, RemoveDataPatch
from .targets import Target

logger = logging.getLogger(__name__)
Expand Down
35 changes: 30 additions & 5 deletions src/patcherex2/patches/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,33 @@
from .data_patches import *
from .dummy_patches import *
from .function_patches import *
from .instruction_patches import *
from .raw_patches import *
from .data_patches import InsertDataPatch, ModifyDataPatch, RemoveDataPatch
from .dummy_patches import InsertLabelPatch, ModifyLabelPatch, RemoveLabelPatch
from .function_patches import (
InsertFunctionPatch,
ModifyFunctionPatch,
RemoveFunctionPatch,
)
from .instruction_patches import (
InsertInstructionPatch,
ModifyInstructionPatch,
RemoveInstructionPatch,
)
from .patch import Patch
from .raw_patches import ModifyRawBytesPatch

__all__ = [
"ModifyDataPatch",
"InsertDataPatch",
"RemoveDataPatch",
"InsertLabelPatch",
"ModifyLabelPatch",
"RemoveLabelPatch",
"ModifyFunctionPatch",
"InsertFunctionPatch",
"RemoveFunctionPatch",
"ModifyInstructionPatch",
"InsertInstructionPatch",
"RemoveInstructionPatch",
"ModifyRawBytesPatch",
]


# Other Patches
Expand Down
9 changes: 9 additions & 0 deletions src/patcherex2/targets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,12 @@
from .elf_leon3_bare import ElfLeon3Bare
from .ihex_ppc_bare import IHex_PPC_Bare
from .target import Target

__all__ = [
"ElfAArch64Linux",
"ElfArmLinux",
"ElfArmMimxrt1052",
"ElfLeon3Bare",
"IHex_PPC_Bare",
"Target",
]
3 changes: 1 addition & 2 deletions src/patcherex2/targets/elf_aarch64_linux.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from ..components.allocation_managers.allocation_manager import \
AllocationManager
from ..components.allocation_managers.allocation_manager import AllocationManager
from ..components.assemblers.keystone import Keystone, keystone
from ..components.binary_analyzers.angr import Angr
from ..components.binfmt_tools.elf import ELF
Expand Down
3 changes: 1 addition & 2 deletions src/patcherex2/targets/elf_arm_linux.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from ..components.allocation_managers.allocation_manager import \
AllocationManager
from ..components.allocation_managers.allocation_manager import AllocationManager
from ..components.assemblers.keystone_arm import KeystoneArm
from ..components.binary_analyzers.angr import Angr
from ..components.binfmt_tools.elf import ELF
Expand Down
2 changes: 1 addition & 1 deletion src/patcherex2/targets/elf_arm_mimxrt1052.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import copy

from ..components.allocation_managers.allocation_manager import *
from ..components.allocation_managers.allocation_manager import MappedBlock, MemoryFlag
from ..components.binfmt_tools.elf import ELF
from .elf_arm_linux import ElfArmLinux

Expand Down
6 changes: 5 additions & 1 deletion src/patcherex2/targets/elf_leon3_bare.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import logging

from ..components.allocation_managers.allocation_manager import *
from ..components.allocation_managers.allocation_manager import (
AllocationManager,
MappedBlock,
MemoryFlag,
)
from ..components.assemblers.bcc import Bcc as BccAssembler
from ..components.assemblers.keystone_sparc import KeystoneSparc, keystone
from ..components.binary_analyzers.angr import Angr
Expand Down
4 changes: 3 additions & 1 deletion src/patcherex2/targets/ihex_ppc_bare.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import logging

from ..components.allocation_managers.allocation_manager import *
import archinfo

from ..components.allocation_managers.allocation_manager import AllocationManager
from ..components.assemblers.ppc_vle import PpcVle as PpcVleAssembler
from ..components.binary_analyzers.angr import Angr
from ..components.binfmt_tools.ihex import IHex
Expand Down
1 change: 1 addition & 0 deletions tests/test_aarch64.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env python

# ruff: noqa
import logging
import os
import shutil
Expand Down
1 change: 1 addition & 0 deletions tests/test_arm.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env python

# ruff: noqa
import logging
import os
import shutil
Expand Down

0 comments on commit 3829129

Please sign in to comment.