imports de petits utilisatires pour faire des stats et voir les tats de
certains trucs darcs-hash:20050411210725-4ec08-0edcb7b1d4e46ce310dbffcffd8b07e50690c8a1.gz
This commit is contained in:
parent
21f285fabb
commit
477219f2ed
8 changed files with 260 additions and 0 deletions
38
gestion/tools/list_firewall.py
Executable file
38
gestion/tools/list_firewall.py
Executable file
|
@ -0,0 +1,38 @@
|
|||
#! /usr/bin/env python
|
||||
# -*- coding: iso-8859-15 -*-
|
||||
|
||||
import sys
|
||||
sys.path.append('/usr/scripts/gestion')
|
||||
|
||||
from ldap_crans import crans_ldap, decode, crans
|
||||
|
||||
db = crans_ldap()
|
||||
machines = db.search('portTCPin=*')['machine'] + db.search('portTCPout=*')['machine'] + db.search('portUDPin=*')['machine'] + db.search('portUDPout=*')['machine']
|
||||
|
||||
done = []
|
||||
txts = []
|
||||
|
||||
for m in machines :
|
||||
# on vérifie qu'on l'a pas encore traité
|
||||
if m.ip() in done :
|
||||
continue
|
||||
if m.proprietaire().__class__ == crans :
|
||||
continue
|
||||
done.append(m.ip())
|
||||
|
||||
# texte pour la machine
|
||||
txt = u''
|
||||
txt += u'Propriétaire : %s\n' % m.proprietaire().Nom().encode('iso-8859-1')
|
||||
txt += u'Machine : %s\n' % m.nom()
|
||||
if m.portTCPin() :
|
||||
txt += u'ports TCP in : %s\n' % m.portTCPin()
|
||||
if m.portTCPout() :
|
||||
txt += u'ports TCP out : %s\n' % m.portTCPout()
|
||||
if m.portUDPin() :
|
||||
txt += u'ports UDP in : %s\n' % m.portUDPin()
|
||||
if m.portUDPout() :
|
||||
txt += u'ports UDP out : %s\n' % m.portUDPout()
|
||||
|
||||
txts.append(txt.strip())
|
||||
|
||||
print '\n- - - - - - = = = = = = # # # # # # # # = = = = = = - - - - - -\n'.join(txts)
|
Loading…
Add table
Add a link
Reference in a new issue