Skip to content

Commit

Permalink
Merge pull request #30 from quarkslab/refactor/improve-naming
Browse files Browse the repository at this point in the history
Improve naming
  • Loading branch information
cnheitman authored May 21, 2024
2 parents 5fac618 + acb1117 commit 395ed92
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion doc/api/explorator.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ SymbolicExplorator
SeedManager
-----------

.. autoclass:: tritondse.seeds_manager.SeedManager
.. autoclass:: tritondse.seed_manager.SeedManager
:members:
:undoc-members:
:exclude-members:
4 changes: 2 additions & 2 deletions doc/api/loaders.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ QuokkaProgram
:undoc-members:
:exclude-members:

MonolithicLoader
RawBinaryLoader
----------------

.. autoclass:: tritondse.MonolithicLoader
.. autoclass:: tritondse.RawBinaryLoader
:members:
:inherited-members:
:undoc-members:
Expand Down
8 changes: 4 additions & 4 deletions doc/dev_doc/seedscheduling.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ Seed Scheduling
===============

Seed scheduling algorithm, are classes basically providing the next seed input
to execute. They can be given to the :py:obj:`tritondse.seeds_manager.SeedManager`
to execute. They can be given to the :py:obj:`tritondse.seed_manager.SeedManager`
constructor. The scheduling of seeds might be different depending on the need.
All strategies should satisfy the interface defined by :py:obj:`tritondse.seeds_manager.SeedManager`.
All strategies should satisfy the interface defined by :py:obj:`tritondse.seed_manager.SeedManager`.

.. autoclass:: tritondse.worklist.SeedScheduler
.. autoclass:: tritondse.seed_scheduler.SeedScheduler
:members:
:undoc-members:
:exclude-members:
Expand All @@ -15,7 +15,7 @@ All strategies should satisfy the interface defined by :py:obj:`tritondse.seeds_
Existing strategies
-------------------

.. automodule:: tritondse.worklist
.. automodule:: tritondse.seed_scheduler
:members:
:show-inheritance:
:inherited-members:
Expand Down
18 changes: 9 additions & 9 deletions doc/practicals/json_parser/solve.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from tritondse.arch import Architecture
from tritondse.config import Config
from tritondse.loaders.loader import LoadableSegment
from tritondse.loaders.loader import MonolithicLoader
from tritondse.loaders.loader import RawBinaryLoader
from tritondse.process_state import ProcessState
from tritondse.seed import CompositeData
from tritondse.seed import Seed
Expand Down Expand Up @@ -78,17 +78,17 @@ def hook_start(se: SymbolicExecutor, pstate: ProcessState):

raw_firmware = Path("./bugged_json_parser.bin").read_bytes()

ldr = MonolithicLoader(Architecture.ARM32,
cpustate={"pc": ENTRY_POINT,
ldr = RawBinaryLoader(Architecture.ARM32,
cpustate={"pc": ENTRY_POINT,
"r0": BUFFER_ADDR,
"r2": STRUC_ADDR,
"sp": STACK_ADDR+STACK_SIZE},
set_thumb=True,
maps=[LoadableSegment(BASE_ADDRESS, len(raw_firmware), Perm.R | Perm.X, content=raw_firmware, name="bugged_json_parser"),
LoadableSegment(BUFFER_ADDR, 40, Perm.R | Perm.W, name="input"),
LoadableSegment(STRUC_ADDR, 512, Perm.R | Perm.W, name="JSON_ctx"),
LoadableSegment(USER_CB, 1000, Perm.R | Perm.X, name="user_cb"),
LoadableSegment(STACK_ADDR, STACK_SIZE, Perm.R | Perm.W, name="[stack]")])
set_thumb=True,
maps=[LoadableSegment(BASE_ADDRESS, len(raw_firmware), Perm.R | Perm.X, content=raw_firmware, name="bugged_json_parser"),
LoadableSegment(BUFFER_ADDR, 40, Perm.R | Perm.W, name="input"),
LoadableSegment(STRUC_ADDR, 512, Perm.R | Perm.W, name="JSON_ctx"),
LoadableSegment(USER_CB, 1000, Perm.R | Perm.X, name="user_cb"),
LoadableSegment(STACK_ADDR, STACK_SIZE, Perm.R | Perm.W, name="[stack]")])

dse = SymbolicExplorator(conf, ldr, executor_stop_at=EXIT_POINT)

Expand Down
6 changes: 3 additions & 3 deletions doc/tutos/loaders.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
"## Firmware Loading\n",
"\n",
"Performing symbolic execution on low-level firmware requires a specific loader.\n",
"TritonDSE provides the ``MonolithicLoader`` that enables loading monolithic firmware by defining the memory segments manually.\n",
"TritonDSE provides the ``RawBinaryLoader`` that enables loading monolithic firmware by defining the memory segments manually.\n",
"\n",
"The following example shows how to load a small firmware:"
]
Expand All @@ -165,7 +165,7 @@
"metadata": {},
"outputs": [],
"source": [
"from tritondse import Architecture, MonolithicLoader, LoadableSegment\n",
"from tritondse import Architecture, RawBinaryLoader, LoadableSegment\n",
"\n",
"BASE_ADDRESS= 0x8000000\n",
"ENTRY_POINT = 0x81dc46e\n",
Expand All @@ -174,7 +174,7 @@
"\n",
"raw_f = Path(\"./bugged_json_parser.bin\").read_bytes()\n",
"\n",
"ldr = MonolithicLoader(Architecture.ARM32,\n",
"ldr = RawBinaryLoader(Architecture.ARM32,\n",
" cpustate = {\"pc\": ENTRY_POINT, \n",
" \"sp\": STACK_ADDR+STACK_SIZE},\n",
" set_thumb=True,\n",
Expand Down
2 changes: 1 addition & 1 deletion tritondse/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from .loaders.program import Program
from .loaders.quokkaprogram import QuokkaProgram
from .loaders.cle_loader import CleLoader
from .loaders.loader import Loader, MonolithicLoader, LoadableSegment
from .loaders.loader import Loader, RawBinaryLoader, LoadableSegment
from .process_state import ProcessState
from .coverage import CoverageStrategy, BranchSolvingStrategy, CoverageSingleRun, GlobalCoverage
from .symbolic_executor import SymbolicExecutor
Expand Down
4 changes: 2 additions & 2 deletions tritondse/loaders/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def find_function_addr(self, name: str) -> Optional[Addr]:
return None


class MonolithicLoader(Loader):
class RawBinaryLoader(Loader):
"""
Monolithic loader. It helps loading raw firmware at a given address
in DSE memory space, with the various attributes like architecture etc.
Expand All @@ -153,7 +153,7 @@ def __init__(self,
set_thumb: bool = False,
platform: Platform = None,
endianness: Endian = Endian.LITTLE):
super(MonolithicLoader, self).__init__("")
super(RawBinaryLoader, self).__init__("")

self._architecture = architecture
self._platform = platform if platform else None
Expand Down
2 changes: 1 addition & 1 deletion tritondse/seeds_manager.py → tritondse/seed_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from tritondse.seed import Seed, SeedStatus
from tritondse.callbacks import CallbackManager
from tritondse.coverage import GlobalCoverage, CovItem
from tritondse.worklist import FreshSeedPrioritizerWorklist, SeedScheduler
from tritondse.seed_scheduler import FreshSeedPrioritizerWorklist, SeedScheduler
from tritondse.workspace import Workspace
from tritondse.symbolic_executor import SymbolicExecutor
from tritondse.types import SolverStatus, SymExType
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions tritondse/symbolic_explorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
from tritondse.coverage import GlobalCoverage
from tritondse.types import Addr
from tritondse.exception import StopExplorationException
from tritondse.seeds_manager import SeedManager
from tritondse.worklist import SeedScheduler
from tritondse.seed_manager import SeedManager
from tritondse.seed_scheduler import SeedScheduler
from tritondse.callbacks import CallbackManager
import tritondse.logging

Expand Down

0 comments on commit 395ed92

Please sign in to comment.