parameters: (platform)
docstring: Library-based interposition will fail silently if SIP is enabled,
      so this should be detected. You can detect whether SIP is enabled on
      Darwin by checking whether (1) there is a binary called 'csrutil' in
      the path and, if so, (2) whether the output of executing 'csrutil status'
      contains 'System Integrity Protection status: enabled'.
  
      Same problem on linux when SELinux is enabled. The status query program
      'sestatus' and the output when it's enabled 'SELinux status: enabled'.
docstring_summary: Library-based interposition will fail silently if SIP is enabled,
      so this should be detected. You can detect whether SIP is enabled on
      Darwin by checking whether (1) there is a binary called 'csrutil' in
      the path and, if so, (2) whether the output of executing 'csrutil status'
      contains 'System Integrity Protection status: enabled'.
docstring_tokens: Library - based interposition will fail silently if SIP is enabled so this should be detected . You can detect whether SIP is enabled on Darwin by checking whether ( 1 ) there is a binary called csrutil in the path and if so ( 2 ) whether the output of executing csrutil status contains System Integrity Protection status : enabled .
function: def is_preload_disabled(platform):
      """ Library-based interposition will fail silently if SIP is enabled,
      so this should be detected. You can detect whether SIP is enabled on
      Darwin by checking whether (1) there is a binary called 'csrutil' in
      the path and, if so, (2) whether the output of executing 'csrutil status'
      contains 'System Integrity Protection status: enabled'.
  
      Same problem on linux when SELinux is enabled. The status query program
      'sestatus' and the output when it's enabled 'SELinux status: enabled'. """
  
      if platform == 'darwin':
          pattern = re.compile(r'System Integrity Protection status:\s+enabled')
          command = ['csrutil', 'status']
      elif platform in {'linux', 'linux2'}:
          pattern = re.compile(r'SELinux status:\s+enabled')
          command = ['sestatus']
      else:
          return False
  
      try:
          lines = subprocess.check_output(command).decode('utf-8')
          return any((pattern.match(line) for line in lines.splitlines()))
      except:
          return False
function_tokens: def is_preload_disabled ( platform ) : if platform == 'darwin' : pattern = re . compile ( r'System Integrity Protection status:\s+enabled' ) command = [ 'csrutil' , 'status' ] elif platform in { 'linux' , 'linux2' } : pattern = re . compile ( r'SELinux status:\s+enabled' ) command = [ 'sestatus' ] else : return False try : lines = subprocess . check_output ( command ) . decode ( 'utf-8' ) return any ( ( pattern . match ( line ) for line in lines . splitlines ( ) ) ) except : return False