Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
<a href="https://github.com/psf/black"><img alt="Code style: black" src="https://img.shields.io/badge/code%20style-black-000000.svg"></a>

# Zelos
Zelos is a Python-based binary emulation platform. Linux x86, x86_64, ARMv7 and MIPS binaries are supported.
Zelos (**Z**eropoint **E**mulated **L**ightweight **O**perating **S**ystem) is a python-based binary emulation platform. One use of zelos is to quickly assess the dynamic behavior of binaries via command-line or python scripts. All syscalls are emulated to isolate the target binary. Linux x86_64 (32- and 64-bit), ARM and MIPS binaries are supported.

## Documentation
![Image](/docs/_static/hello_zelos.png)

All of the documentation can be found on [readthedocs](https://zelos.readthedocs.io/en/latest/index.html)
[Full documentation](https://zelos.readthedocs.io/en/latest/index.html) is available [here](https://zelos.readthedocs.io/en/latest/index.html).

## Installation

Expand Down
Binary file added docs/_static/hello_zelos.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions docs/args/args.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.. _flag-label:

Flags
=================

Available Flags & Usage
-----------------------

.. argparse::
:ref: zelos.config_gen.generate_parser
:prog: zelos
9 changes: 8 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#

import fileinput
import os
import shutil
import sys
Expand All @@ -26,7 +28,11 @@


shutil.copyfile(os.path.join("..", "README.md"), "README.md")

for line in fileinput.input("README.md", inplace=True):
if "![Image](/docs/_static/hello_zelos.png)" in line:
print("![Image](_static/hello_zelos.png)")
else:
print(line, end="")

# -- Project information -----------------------------------------------------

Expand All @@ -51,6 +57,7 @@
"sphinx.ext.doctest",
"sphinx.ext.todo",
"sphinx.ext.intersphinx",
"sphinxarg.ext",
]

intersphinx_mapping = {"python": ("https://docs.python.org/3", None)}
Expand Down
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Zelos Documentation
:maxdepth: 1

api/zelos.api
args/args

.. toctree::
:caption: Internal Package Docs
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"sphinx_rtd_theme",
"sphinxcontrib-apidoc",
"recommonmark",
"sphinx-argparse",
],
"tests": [
"coverage",
Expand Down
22 changes: 21 additions & 1 deletion src/zelos/api/zelos_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,29 @@

class Zelos:
"""
Class that provides access to core api wrappers. These core APIs
Class that provides access to the core APIs. These core APIs
are event hooking, debugging, memory access, register access, and
emulation context.

Args:
filename: Specifies the name of the file to emulate.
cmdline_args: Arguments that are passed to the emulated binary.
flags: Parameters for zelos. To see the list of all flags, refer
to :ref:`flag-label`

Example:
.. code-block:: python

from zelos import Zelos

# initialize zelos with binary name, 2 cmdline args, and
# verbosity flag set to 1
z = Zelos(
"binary_to_emulate"
"ARG1",
"ARG2",
verbosity=1,
)
"""

def __init__(self, filename, *cmdline_args, **flags):
Expand Down
7 changes: 6 additions & 1 deletion src/zelos/config_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def _generate_without_binary(**kwargs):
return config


def generate_config_from_cmdline(cmdline_string):
def generate_parser():
parser = configargparse.ArgumentParser()
group_logging = parser.add_argument_group("logging")
group_reporting = parser.add_argument_group("reporting")
Expand Down Expand Up @@ -220,6 +220,11 @@ def generate_config_from_cmdline(cmdline_string):
parser.add_argument(
"cmdline_args", type=str, nargs="*", help="Arguments to the executable"
)
return parser


def generate_config_from_cmdline(cmdline_string):
parser = generate_parser()
config = parser.parse_args(cmdline_string)

return config