Skip to content

Commit

Permalink
darwin: syslog: bugfix: set_har_capture_global option
Browse files Browse the repository at this point in the history
  • Loading branch information
doronz88 committed Mar 1, 2022
1 parent 0f3c7be commit bf2e030
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/rpcclient/rpcclient/darwin/syslog.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import datetime

from rpcclient.exceptions import BadReturnValueError


class Syslog:
"""" manage syslog """
Expand All @@ -21,6 +23,14 @@ 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')
if enable:
self._client.preferences.cf.set('har-capture-global',
self._client.cf(datetime.datetime(9999, 12, 31, 23, 59, 59)),
'com.apple.CFNetwork')
else:
self._client.preferences.cf.set('har-capture-global',
self._client.cf(datetime.datetime(1970, 1, 1, 1, 1, 1)),
'com.apple.CFNetwork')

if self._client.symbols.notify_post('com.apple.CFNetwork.har-capture-update'):
raise BadReturnValueError('notify_post() failed')

0 comments on commit bf2e030

Please sign in to comment.