cbs_utils package

Submodules

cbs_utils.global_vars module

Some global variable definitions

cbs_utils.mail module

class cbs_utils.mail.CBS_SMTP_Message(sender: str, adressee: str, subject: str = '', body: str = '', mail_server: str = 'mail.cbsp.nl')[source]

Bases: cbs_utils.mail.EmailFormat

CBS SMTP based email message.

Notes

  • [NL] CBS SMTP gebaseerd email bericht. Dit bericht object maakt het eenvoudig om een email bericht naar een gebruiker te sturen. Je kan mails verstuurt vanuit elk e-mail account waarvoor je gerechtigd bent vanuit de centrale server.

  • [EN] CBS SMTP based email message. This message object makes it easy to send messages to email recipients. By creating this object mails can be sent from any address the user is allowed to use according to the central server.

send()[source]

Send the prepared email message.

class cbs_utils.mail.EmailFormat[source]

Bases: abc.ABC

add_to_recipients(to)[source]
abstract send()[source]
cbs_utils.mail.asbase64(msg)[source]

cbs_utils.misc module

cbs_utils.network module

class cbs_utils.network.ActiveDirectory(server: Optional[str] = None)[source]

Bases: object

Active Directory representation. This object is intended to have all functionality that one would normally want/have from an Active Directory.

default_attrs = ['name', 'member', 'objectClass', 'adspath', 'primaryGroupToken', 'primaryGroupID']
default_groups = ['Administrators', 'Account Operators', 'Backup Operators', 'Server Operators', 'DnsAdmins', 'Domain Admins', 'Exchange Administrators', 'Exchange Services', 'DHCP Administrators']
get_group_info(name, searchRoot: Optional[str] = None, category: str = 'Group', attributes: Optional[list] = None)Dict[str, str][source]

Obtain the group information for the given name :param name: profile name :param searchRoot: where to start looking :param category: what category to look in (by default the Group) :param attributes: additional attributes, examples are ‘name’, ‘member’, ‘objectClass’ :return: A Field : Value dictionary of all found information

get_group_members(strLdap: str, attributes: Optional[list] = None)List[Dict[str, object]][source]

Look up a group’s members. :param strLdap: groups adspath attribute. :param attributes: attributes to append to the search query :return: List of dictionaries, each dictionary item has a name and indicator of whether it is a group.

get_member_info(member: str, strLdap: Optional[str] = None, attributes: Optional[List[str]] = None)Dict[str, str][source]

Returns user info. If there is no list of attributes given, it will use a default list (for testing purposes).

get_primary_group(token, searchRoot: Optional[str] = None, header='   ')[source]

Used to look up Users whose Primary Group is set to one of the groups we’re looking up. This is necessary as AD uses that attribute to calculate a group’s membership. These type of users do not show up if you query the group’s member field directly.

searchRoot is the part of the LDAP tree that you want to start searching from. token is the groups primaryGroupToken.

cbs_utils.plotting module

cbs_utils.readers module

cbs_utils.regular_expressions module

This modules contains a collection of often used regular expressions

cbs_utils.sql_server_utils module

cbs_utils.string_measures module

cbs_utils.web_scraping module

Module contents