def read_os_detection(remote_read):
 try:
  linux1 = remote_read('/etc/passwd')
  linux2 = remote_read('/etc/mtab')
  linux3 = remote_read('/proc/sys/kernel/ostype')
 except:
  pass
 else:
  if (('/bin/' in linux1) or ('rw' in linux2) or ('linux' in linux3.lower())):
   om.out.debug('Identified remote OS as Linux, returning "linux".')
   return 'linux'
 try:
  win1 = remote_read('%SYSTEMROOT%\\win.ini')
  win2 = remote_read('C:\\windows\\win.ini')
  win3 = remote_read('C:\\win32\\win.ini')
  win4 = remote_read('C:\\win\\win.ini')
 except:
  pass
 else:
  if ('[fonts]' in (((win1 + win2) + win3) + win4)):
   om.out.debug('Identified remote OS as Windows, returning "windows".')
   return 'windows'
 raise OSDetectionException('Failed to get/identify the remote OS.')

def read_os_detection ( remote_read ) : try : linux1 = remote_read ( '/etc/passwd' ) linux2 = remote_read ( '/etc/mtab' ) linux3 = remote_read ( '/proc/sys/kernel/ostype' ) except : pass else : if ( ( '/bin/' in linux1 ) or ( 'rw' in linux2 ) or ( 'linux' in linux3 . lower ( ) ) ) : om . out . debug ( 'Identified remote OS as Linux, returning "linux".' ) return 'linux' try : win1 = remote_read ( '%SYSTEMROOT%\\win.ini' ) win2 = remote_read ( 'C:\\windows\\win.ini' ) win3 = remote_read ( 'C:\\win32\\win.ini' ) win4 = remote_read ( 'C:\\win\\win.ini' ) except : pass else : if ( '[fonts]' in ( ( ( win1 + win2 ) + win3 ) + win4 ) ) : om . out . debug ( 'Identified remote OS as Windows, returning "windows".' ) return 'windows' raise OSDetectionException ( 'Failed to get/identify the remote OS.' )
uses the remote_read method to read remote files and determine what the remote os is .