From eb294dd9ae4ab8dde07806c12e262ad82d0426c1 Mon Sep 17 00:00:00 2001 From: Kevin Froman Date: Thu, 19 Dec 2019 23:28:12 -0600 Subject: [PATCH] fix big brother docstrings and disable_hooks default arg --- src/bigbrother/__init__.py | 11 ++++++----- src/bigbrother/ministry/ofcommunication.py | 8 ++++---- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/bigbrother/__init__.py b/src/bigbrother/__init__.py index c8250ad7..1ffb7036 100644 --- a/src/bigbrother/__init__.py +++ b/src/bigbrother/__init__.py @@ -1,7 +1,6 @@ -""" - Onionr - Private P2P Communication +"""Onionr - Private P2P Communication. - Processes interpreter hook events to detect security leaks +Processes interpreter hook events to detect security leaks """ import sys from typing import Iterable @@ -33,6 +32,7 @@ def _auditing_supported(): def sys_hook_entrypoint(event, info): + """Entrypoint for big brother sys auditors.""" if event == 'socket.connect': ministry.ofcommunication.detect_socket_leaks(info) elif event == 'exec': @@ -42,7 +42,8 @@ def sys_hook_entrypoint(event, info): ministry.ofexec.block_system(info) -def enable_ministries(disable_hooks: Iterable = []): - """Enable auditors""" +def enable_ministries(disable_hooks: Iterable = None): + """Enable auditors.""" + disable_hooks = disable_hooks or [] _auditing_supported() # raises PythonVersion exception if <3.8 sys.addaudithook(sys_hook_entrypoint) diff --git a/src/bigbrother/ministry/ofcommunication.py b/src/bigbrother/ministry/ofcommunication.py index ad4c0ffb..c29848ed 100644 --- a/src/bigbrother/ministry/ofcommunication.py +++ b/src/bigbrother/ministry/ofcommunication.py @@ -1,7 +1,6 @@ -""" - Onionr - Private P2P Communication +"""Onionr - Private P2P Communication. - Ensure sockets don't get made to non localhost +Ensure sockets don't get made to non localhost """ import ipaddress @@ -24,7 +23,8 @@ from onionrexceptions import NetworkLeak def detect_socket_leaks(socket_event): - """is called by the big brother broker whenever + """Is called by the big brother broker whenever. + a socket connection happens. raises exception & logs if not to loopback """