Skip to content

Entity Code Structure

maxlandon edited this page Mar 9, 2019 · 3 revisions

The code structure of Entities in EffectiveCouscous is similar to its Transform Code Structure. This is because if we want to integrate various tools and their corresponding entities, we also need to easily maintain/add Entities.

However, there might be slight differences, given the requirements for class inheritance are also slightly different from those of Transforms. The Entity code structure is roughly the following:

  • Each major Entity type has a base directory (eg. host/ for hosts, service/ for services, credential/ for credentials, etc).
  • Each major Entity Type has its own Python module (base.py, for Service, Host, or Credential)
  • For services only, each Service Subtype is regrouped in a directory named after its hierarchical position in the OSI Model (application/, presentation/, transport/, and so on...)
  • Each major Entity Subtype has its own Python module (web.py for Web Services, smb.py for samba services, etc., ntlm.py for NTLM Cred Type, etc...)

A Python import example:

from EffectiveCouscous.entities.service.application.web import MicrosoftHTTPAPI

Where:

  • EffectiveCouscous.entities is the base directory for all entities.
  • service is the major Entity type.
  • application is the OSI Layer, if we consider a Service, like in this example.
  • web is the Entity subtype. (Could have been ssh, smtp, etc...)
  • MicrosoftHTTPAPI is a particular Service Entity.

Another example, this time with a generic Host:

from EffectiveCouscous.entities.host.base import MetasploitHost 

Where:

  • EffectiveCouscous.entities is the base directory for all entities.
  • host is the major Entity type.
  • base is the Entity subtype. (here, therefore, the Subtype is somewhat implicit)
  • MetasploitHost is a generic Host Entity, with the same property set as a Host object in Metasploit (it is therefore a template).