fix big brother docstrings and disable_hooks default arg

master
Kevin Froman 2019-12-19 23:28:12 -06:00
parent 0484655e2e
commit eb294dd9ae
2 changed files with 10 additions and 9 deletions

View File

@ -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)

View File

@ -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
"""