#!/bin/bash /usr/scripts/python.sh # -*- coding: utf-8 -*- from lc_ldap import shortcuts ldap = shortcuts.lc_ldap_readonly() machines = ldap.search(u"(|(portTCPin=*)(portTCPout=*)(portUDPin=*)(portUDPout=*))") txts = [] for m in machines : # On se fiche des machines crans if m['objectClass'][0] not in ["machineFixe","machineWifi"]: continue # texte pour la machine txt = u'' txt += u'PropriƩtaire : %s\n' % str(m.proprio()).decode('utf8') txt += u'Machine : %s\n' % m['host'][0] if m['portTCPin']: txt += u'ports TCP in : %s\n' % ' '.join([unicode(port) for port in m['portTCPin']]) if m['portTCPout']: txt += u'ports TCP out : %s\n' % ' '.join([unicode(port) for port in m['portTCPout']]) if m['portUDPin']: txt += u'ports UDP in : %s\n' % ' '.join([unicode(port) for port in m['portUDPin']]) if m['portUDPout']: txt += u'ports UDP out : %s\n' % ' '.join([unicode(port) for port in m['portTCPout']]) txts.append(txt.strip()) print '\n- - - - - - = = = = = = # # # # # # # # = = = = = = - - - - - -\n'.join(txts)