mirror of
https://github.com/chipsec/chipsec
synced 2026-06-08 13:31:00 +00:00
d52ea51fd7
Modified:
docs/create_manual.cmd - Add html command and options to build either html or pdf, or both
docs/sphinx/_templates/scover.tmpl - Update date automatically
docs/sphinx/_templates/sstylesheet.style - remove references to templates that will no longer be used, add format styles
docs/sphinx/conf.py - Add several changes for documentation creation. HTML: main doc, copyright year, version and release numbers, html theme options. PDF: increased toc depth
docs/sphinx/index.rst - Update from Home wiki page
docs/sphinx/removeStrRst.py - change how titles are shown and more information shown for modules and add a function to update version in scover
Deleted:
docs/sphinx/_templates/cover.pdf - no longer used
docs/sphinx/_templates/layout.html - no longer used
docs/sphinx/_templates/page.pdf - no longer used
docs/sphinx/_templates/theme.conf - added in conf.py
docs/sphinx/_images/chipsec.jpg - replaced by architecture.png
Replaced by imported wiki files:
docs/sphinx/compandstruct.rst
docs/sphinx/dalinstall.rst
docs/sphinx/description.rst
docs/sphinx/installation.rst
docs/sphinx/linuxinstall.rst
docs/sphinx/mod.rst
docs/sphinx/options.py
docs/sphinx/options.rst
docs/sphinx/osxinstall.rst
docs/sphinx/uefinstall.rst
docs/sphinx/usage.rst
docs/sphinx/winstall.rst
Added
docs/create_manual.sh - Add script version for linux
the following is a list of files imported from the wiki:
docs/sphinx/Architecture-Overview.rst
docs/sphinx/Configuration-Files.rst
docs/sphinx/Developing.rst
docs/sphinx/Install in DAL Win.rst
docs/sphinx/Install in Linux.rst
docs/sphinx/Install in MacOS.rst
docs/sphinx/Install in Windows.rst
docs/sphinx/Interpreting-Results.rst
docs/sphinx/OS-Helpers-and-Drivers.rst
docs/sphinx/Platform-Detection.rst
docs/sphinx/Running-Chipsec.rst
docs/sphinx/USB with UEFI Shell.rst
docs/sphinx/Using-CHIPSEC-with-Kali-Linux.rst
docs/sphinx/Vulnerabilities-and-CHIPSEC-Modules.rst
docs/sphinx/_images/architecture.png
Signed-off-by: Sae86 <sae.batllori@intel.com>
51 lines
2.7 KiB
ReStructuredText
51 lines
2.7 KiB
ReStructuredText
Writing Your Own Modules
|
|
========================
|
|
|
|
Your module class should subclass BaseModule and implement at least the methods named ``is_supported`` and ``run``. When chipsec_main runs, it will first run ``is_supported`` and if that returns true, then it will call ``run``.
|
|
|
|
As of CHIPSEC version 1.2.0, CHIPSEC implements an abstract name for platform *controls*. Module authors are encouraged to create controls in the XML configuration files for important platform configuration information and then use ``get_control`` and ``set_control`` within modules. This abstraction allows modules to test for the abstract control without knowning which register provides it. (This is especially important for test reuse across platform generations.)
|
|
|
|
Most modules read some platform configuration and then pass or fail based on the result. For example:
|
|
|
|
1. Define the control in the platform XML file (in ``chispec/cfg``):
|
|
|
|
.. code-block:: xml
|
|
|
|
<control name="BiosLockEnable" register="BC" field="BLE" desc="BIOS Lock Enable"/>
|
|
|
|
2. Get the current status of the control:
|
|
|
|
.. code-block:: python
|
|
|
|
ble = chipsec.chipset.get_control( self.cs, 'BiosLockEnable' )
|
|
|
|
3. React based on the status of the control:
|
|
|
|
.. code-block:: python
|
|
|
|
if ble: self.logger.log_passed_check("BIOS Lock is set.")
|
|
else: self.logger.log_failed_check("BIOS Lock is not set.")
|
|
|
|
4. Return:
|
|
|
|
.. code-block:: python
|
|
|
|
if ble: return ModuleResult.PASSED
|
|
else: return ModuleResult.FAILED
|
|
|
|
The CHIPSEC HAL and other APIs are also available within these modules. See the next sections for details about the available functionality.
|
|
|
|
Copy your module into the ``chipsec/modules/`` directory structure
|
|
|
|
- Modules specific to a certain platform should implement ``is_supported`` function which returns ``True`` for the platforms the module is applicable to
|
|
|
|
- Modules specific to a certain platform can also be located in ``chipsec/modules/<platform_code>`` directory, for example ``chipsec/modules/hsw``. Supported plaforms and their code can be found by running ``chipesec_main.py --help``
|
|
|
|
- Modules common to all platform which CHIPSEC supports can be located in ``chipsec/modules/common`` directory
|
|
|
|
If a new platform needs to be added:
|
|
|
|
- Review the platform datasheet and include appropriate information in an XML configuration file for the platform. Place this file in chipsec/cfg/8086. Registers that are correctly defined in ``common.xml`` will be inherited and do not need to be added. Use ``common.xml`` as an example. It is based on the 4th Generation Intel Core platform (Haswell).
|
|
|
|
.. seealso::
|
|
`Creating CHIPSEC modules and commands <https://github.com/chipsec/chipsec/wiki/files/training/OSFC_2018_CHIPSEC_Workshop.pdf>`_ |