Skip to content

Commit

Permalink
reports: add syslog options
Browse files Browse the repository at this point in the history
  • Loading branch information
doronz88 committed Feb 28, 2022
1 parent cb54513 commit 9aaaba2
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/rpcclient/rpcclient/darwin/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from functools import lru_cache

from cached_property import cached_property

from rpcclient.client import Client
from rpcclient.darwin import objective_c_class
from rpcclient.darwin.consts import kCFNumberSInt64Type, kCFNumberDoubleType, CFStringEncoding, kCFAllocatorDefault
Expand All @@ -20,6 +19,7 @@
from rpcclient.darwin.structs import utsname
from rpcclient.darwin.symbol import DarwinSymbol
from rpcclient.darwin.xpc import Xpc
from rpcclient.darwin.syslog import Syslog
from rpcclient.exceptions import RpcClientException, MissingLibraryError
from rpcclient.structs.consts import RTLD_NOW

Expand Down Expand Up @@ -65,6 +65,7 @@ def __init__(self, sock, sysname: str, hostname: str, port: int = None):
self.ioregistry = IORegistry(self)
self.location = Location(self)
self.xpc = Xpc(self)
self.syslog = Syslog(self)

@property
def modules(self) -> typing.List[str]:
Expand Down
26 changes: 26 additions & 0 deletions src/rpcclient/rpcclient/darwin/syslog.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import datetime


class Syslog:
"""" manage syslog """

def __init__(self, client):
self._client = client

def set_unredacted_logs(self, enable: bool = True):
"""
enable/disable unredacted logs (allows seeing the <private> strings)
https://github.com/EthanArbuckle/unredact-private-os_logs
"""
with self._client.preferences.sc.get_preferences_object(
'/Library/Preferences/Logging/com.apple.system.logging.plist') as pref:
pref.set_dict({'Enable-Logging': True, 'Enable-Private-Data': enable})

def set_har_capture_global(self, enable: bool = True):
"""
enable/disable HAR logging
https://github.com/doronz88/harlogger
"""
self._client.preferences.cf.set('har-capture-global',
self._client.cf(datetime.datetime(9999, 12, 31, 23, 59, 59)),
'com.apple.CFNetwork')

0 comments on commit 9aaaba2

Please sign in to comment.