diff --git a/README.md b/README.md index bf4929e..b3a4cf6 100644 --- a/README.md +++ b/README.md @@ -7,11 +7,11 @@ Code style: black # 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 diff --git a/docs/_static/hello_zelos.png b/docs/_static/hello_zelos.png new file mode 100644 index 0000000..e9c9100 Binary files /dev/null and b/docs/_static/hello_zelos.png differ diff --git a/docs/args/args.rst b/docs/args/args.rst new file mode 100644 index 0000000..a0f5c86 --- /dev/null +++ b/docs/args/args.rst @@ -0,0 +1,11 @@ +.. _flag-label: + +Flags +================= + +Available Flags & Usage +----------------------- + +.. argparse:: + :ref: zelos.config_gen.generate_parser + :prog: zelos diff --git a/docs/conf.py b/docs/conf.py index f279390..4363be9 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -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 @@ -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 ----------------------------------------------------- @@ -51,6 +57,7 @@ "sphinx.ext.doctest", "sphinx.ext.todo", "sphinx.ext.intersphinx", + "sphinxarg.ext", ] intersphinx_mapping = {"python": ("https://docs.python.org/3", None)} diff --git a/docs/index.rst b/docs/index.rst index 45a39e5..eca3eee 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -23,6 +23,7 @@ Zelos Documentation :maxdepth: 1 api/zelos.api + args/args .. toctree:: :caption: Internal Package Docs diff --git a/setup.py b/setup.py index 2075f51..dacfde5 100644 --- a/setup.py +++ b/setup.py @@ -56,6 +56,7 @@ "sphinx_rtd_theme", "sphinxcontrib-apidoc", "recommonmark", + "sphinx-argparse", ], "tests": [ "coverage", diff --git a/src/zelos/api/zelos_api.py b/src/zelos/api/zelos_api.py index 021a4b3..fcdef38 100644 --- a/src/zelos/api/zelos_api.py +++ b/src/zelos/api/zelos_api.py @@ -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): diff --git a/src/zelos/config_gen.py b/src/zelos/config_gen.py index ffa586b..3ae707b 100644 --- a/src/zelos/config_gen.py +++ b/src/zelos/config_gen.py @@ -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") @@ -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