Home Page do Portal
Brasil, um país de todos

Changeset 437

Show
Ignorar:
Timestamp:
05/12/08 19:49:48
Autor:
rogeriolino@gmail.com
Mensagem:

Ultima modificacao do PyCacic?.

Melhoria no cacic.py.

Acerto na gravado do cacic2.dat em relacao aos ultimos valores coletados UVC.

Rogério A. Lino Filho

Arquivos:

Legenda:

Não modificado
Adicionado
Removido
Modificado
Copiado
Movido
  • cacic/trunk/agente-linux/pycacic/src/cacic.py

    r436 r437  
    2727            # flags do Gerente de Coletas 
    2828            self.gc_stopped = 0 # False 
    29             self.gc_started = 0 # False 
    3029            self.gc_ok = 0 # False 
    3130            self.isforcada = [] 
     
    5352                    print(" `---- Coleta iniciara daqui a %s minutos" % (self.interval/60)) 
    5453                    #self.atualiza() 
    55                 # se nao estiver executando e esta habilitado a executar 
    56                 # ou e uma coleta forcada 
    57                 if not self.gc_started and (self.gc_ok or len(self.isforcada) > 0): 
     54                # se esta habilitado a executar ou e uma coleta forcada 
     55                if self.gc_ok or len(self.isforcada) > 0: 
    5856                    # muda estado para nao habilitado 
    5957                    self.gc_ok = 0 # False 
     
    6361                    # inicia coletas 
    6462                    self.gc.coletas_forcadas = self.isforcada 
    65                     thread.start_new_thread(self.start, ())                 
     63                    self.start() 
    6664                time.sleep(2) 
    6765            # fechando conexao 
    6866            self.udp_sock.close() 
    6967        except Exception, e: 
     68            import traceback 
     69            traceback.print_exc() 
    7070            print e 
    7171     
     
    7474        if os.getuid() != 0: 
    7575            return 0 # False 
    76         return 1 # True     
     76        return 1 # True 
    7777 
    7878    def start(self): 
    7979        """Inicia as coletas""" 
    80         self.gc_started = 1 # True             
    8180        self.isforcada = [] 
    8281        print(" --- INICIO DAS COLETAS ---") 
     
    8685        self.gc.createDat() 
    8786        self.gc.sendColetas() 
    88         self.gc_started = 0 # False 
    8987        print(" --- FIM DAS COLETAS ---") 
    9088 
     
    9391            Espera determinado intervalo de tempo. E apos isto marca o estado 
    9492            do Gerente de Coletas como nao parado e habilita execucao das coletas 
    95         """ 
    96         print '---- esperando intervalo'         
     93        """        
    9794        time.sleep(self.interval) 
    98         print '---- timeout !!!' 
    9995        self.gc_stopped = 0 # False 
    10096        self.gc_ok = 1 # True 
  • cacic/trunk/agente-linux/pycacic/src/coletores/col_hard.py

    r430 r437  
    3030    def getName(self): 
    3131        return "col_hard" 
     32     
     33    def getUVCKey(self): 
     34        return 'Coleta.Hardware' 
    3235 
    3336    def start(self): 
    3437        self.setDicionario() 
    3538        self.createDat(self.dicionario, self.PATH + self.OUTPUT_DAT, 'Col_Hard.') 
    36         self.addChave('Coleta.Hardware', self.getChave('UVC')) 
    3739 
    3840    def setDicionario(self): 
  • cacic/trunk/agente-linux/pycacic/src/coletores/col_network.py

    r430 r437  
    1010class Col_Network(Coletor): 
    1111    """Classe responsavel por coletar os dados de TCP IP""" 
     12     
     13    # nome do arquivo de saida (DAT) 
     14    OUTPUT_DAT = 'col_network.dat' 
    1215 
    1316    def __init__(self, computer): 
     
    2225        return "col_network" 
    2326     
     27    def getUVCKey(self): 
     28        return 'Coleta.Network' 
     29     
    2430    def start(self): 
    2531        self.setDicionario() 
     32        self.createDat(self.dicionario, self.PATH + self.OUTPUT_DAT, 'Col_Network.') 
    2633 
    2734    def setDicionario(self): 
     
    4249            self.addChave('te_gateway', net.getGateway()) 
    4350            self.addChave("te_serv_dhcp", net.getDHCP()) 
     51        self.addChave('UVC', self.getUVC(self.dicionario)) 
    4452     
  • cacic/trunk/agente-linux/pycacic/src/coletores/col_soft.py

    r434 r437  
    66    """Classe responsavel por coletar os dados de Software""" 
    77 
     8    # nome do arquivo de saida (DAT) 
     9    OUTPUT_DAT = 'col_soft.dat' 
     10 
    811    def __init__(self, computer): 
    912        Coletor.__init__(self, computer) 
     
    1215    def getName(self): 
    1316        return "col_soft" 
     17     
     18    def getUVCKey(self): 
     19        return 'Coleta.Software' 
    1420 
    15     def isReady(self, dat=None):         
     21    def isReady(self, dat=None): 
    1622        return 0 
    1723     
    1824    def start(self): 
    1925        self.setDicionario() 
     26        self.createDat(self.dicionario, self.PATH + self.OUTPUT_DAT, 'Col_Soft.') 
    2027 
    2128    def setDicionario(self): 
    22         """Monta o dicionario"""       
    23         return 
     29        """Monta o dicionario""" 
     30        self.addChave('UVC', self.getUVC(self.dicionario)) 
    2431     
  • cacic/trunk/agente-linux/pycacic/src/coletores/coletor.py

    r434 r437  
    1616from lib.ccrypt import * 
    1717from lib.computador import Computador 
    18 from globals import Globals 
    1918 
    2019class Coletor: 
     
    5857        raise Exception("Abstract method getName(), must override") 
    5958     
     59    def getUVCKey(self): 
     60        """ Retorna o nome da chave do UVC """ 
     61        raise Exception("Abstract method getUVCKey(), must override") 
     62     
    6063    def getEncryptedDict(self): 
    6164        """ Retorna o dicionario de dados da coleta encryptado """ 
     
    6366            self.dicionario[key] = self.encripta(self.dicionario[key]) 
    6467        return self.dicionario 
    65      
    6668     
    6769    def isReady(self, dat=None): 
     
    8688        """ 
    8789        data = Arquivo.openFile(path) 
    88         dat = self.decripta(data)         
     90        dat = self.decripta(data)        
    8991        for i in dat.split(self.spd_key): 
    9092            item = i.split(self.spd_value) 
  • cacic/trunk/agente-linux/pycacic/src/coletores/lib/ccrypt.py

    r435 r437  
    3131    """ 
    3232     
    33     KEY = 'CacicBrasil
     33    KEY = 'CacicES2005
    3434    AES_KEY_SIZE = 32 
    3535    AES_BLOCK_SIZE = 16 
  • cacic/trunk/agente-linux/pycacic/src/ger_cols.py

    r433 r437  
    183183        # Coletores 
    184184        self.coletores.clear() 
     185        # adiciona o coletor padrao (Col_Network) 
    185186        self.addColeta(Col_Network(self.computador), 'S') 
    186187        for no in root.childNodes: 
     
    269270        self.coletas_enviar.clear() 
    270271        self.computador.coletar() 
    271         # adiciona o coletor padrao (Col_Network) 
    272272        for col in self.coletores.values(): 
    273273            col.start() 
     274            self.coletor.addChave(col.getUVCKey(), col.getChave('UVC'))             
    274275            if self.all_forcada or (col.getName() in self.coletas_forcadas) or col.isReady(self.OUTPUT_DAT):                 
    275276                page = Reader.getColetor(col.getName())['page'] 
  • cacic/trunk/agente-linux/pycacic/src/run.sh

    r430 r437  
    22CAMINHO="`dirname $0`" 
    33 
     4nome1="rogerio" 
     5nome2="rogerio" 
     6 
     7if [ "$nome1" = "$nome2" ]; then 
     8        echo "Hahaiee"; 
     9fi 
     10 
    411if [ -f "$CAMINHO/gui.py" ]; then 
    5         gksudo python "$CAMINHO/gui.py"; 
     12        echo 'a' 
     13        #gksudo python "$CAMINHO/gui.py";        
    614else 
    715        echo 'Arquivo não encontrado';