Metadata-Version: 2.1
Name: pysymbolcheck
Version: 2.3
Summary: ELF symbol check
Home-page: https://github.com/priv-kweihmann/pysymcheck
Author: Konrad Weihmann
Author-email: kweihmann@outlook.com
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Natural Language :: English
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Software Development :: Quality Assurance
Description-Content-Type: text/x-rst
License-File: LICENSE

Purpose
=======

This tool does check compiled elf-files (and all dependencies) against
given rules. Objectives are

-  check for discouraged functions (e.g. strcpy)
-  check for combinations of symbols (e.g. mutex and pthreads)

Usage
-----

.. code:: shell

   usage: pysymbolcheck [-h] [--libpath LIBPATH] rules file

   Eval symbols of a binary against given rules

   positional arguments:
     rules              Path to a rule file
     file               File to parse

   optional arguments:
     -h, --help         show this help message and exit
     --libpath LIBPATH  ":" separated path to lookup libraries

Rule file format
----------------

a rule file consists of a json-array, like this

.. code:: json

   []

within this **n** element of the following can be added

.. code:: json

   { "severity": "error", "id": "A_Unique_ID", "msg": "some message", "rule", "<rule>" }

for **severity** it is advised to use only **info**, **warning** or
**error**

Rule definition
---------------

A rule can consist of any logical combined operation such as

.. code:: text

   ((A && B) || (C && D )) && !E

to get the needed information following keywords are implemented

+------+------+-------------------------------------------+-----------+
| keyw | vari | purpose                                   | example   |
| ord  | able |                                           |           |
|      | s    |                                           |           |
+======+======+===========================================+===========+
| AVAI | symb | check if a symbol is defined in the       | AVAILABLE |
| LABL | ol-n | binary or any referenced lib              | (strncpy) |
| E()  | ame  |                                           |           |
+------+------+-------------------------------------------+-----------+
| USED | symb | check if a symbol is used by some binary  | USED(strn |
| ()   | ol-n | or lib                                    | cpy)      |
|      | ame  |                                           |           |
+------+------+-------------------------------------------+-----------+
| SIZE | symb | get the size in bytes of a symbol         | SIZE(strn |
| ()   | ol-n |                                           | cpy)      |
|      | ame  |                                           |           |
+------+------+-------------------------------------------+-----------+
| TYPE | symb | get the type in bytes of a symbol         | TYPE(strn |
| ()   | ol-n |                                           | cpy)      |
|      | ame  |                                           |           |
+------+------+-------------------------------------------+-----------+
| &&   | n.a. | logical and                               | A && B    |
+------+------+-------------------------------------------+-----------+
| \|\| | n.a. | logical or                                | A \|\| B  |
+------+------+-------------------------------------------+-----------+
| !    | n.a. | not operator                              | !A        |
+------+------+-------------------------------------------+-----------+
