Changeset 434
- Timestamp:
- 05/12/08 16:46:42
- Arquivos:
-
- cacic/trunk/agente-linux/pycacic/src/cmdclient.py (added)
- cacic/trunk/agente-linux/pycacic/src/coletores/col_patr.py (modified) (1 diff)
- cacic/trunk/agente-linux/pycacic/src/coletores/col_soft.py (modified) (1 diff)
- cacic/trunk/agente-linux/pycacic/src/coletores/coletor.py (modified) (2 diffs)
- cacic/trunk/agente-linux/pycacic/src/coletores/lib/AES.py (added)
- cacic/trunk/agente-linux/pycacic/src/coletores/lib/Python_AES.py (added)
- cacic/trunk/agente-linux/pycacic/src/coletores/lib/ccrypt.py (modified) (3 diffs)
- cacic/trunk/agente-linux/pycacic/src/coletores/lib/ccrypt_lib.py (deleted)
- cacic/trunk/agente-linux/pycacic/src/coletores/lib/computador.py (modified) (6 diffs)
- cacic/trunk/agente-linux/pycacic/src/coletores/lib/cryptomath.py (added)
- cacic/trunk/agente-linux/pycacic/src/coletores/lib/rijndael.py (added)
- cacic/trunk/agente-linux/pycacic/src/coletores/lib/url.py (modified) (1 diff)
- cacic/trunk/agente-linux/pycacic/src/coletores/lib/x32 (deleted)
- cacic/trunk/agente-linux/pycacic/src/coletores/lib/x64 (deleted)
- cacic/trunk/agente-linux/pycacic/src/config/cacic.conf (modified) (1 diff)
- cacic/trunk/agente-linux/pycacic/src/config/io.py (modified) (1 diff)
- cacic/trunk/agente-linux/pycacic/src/glade/logo.png (modified) (previous)
- cacic/trunk/agente-linux/pycacic/src/glade/main_window.glade (modified) (4 diffs)
- cacic/trunk/agente-linux/pycacic/src/lang/language.py (modified) (5 diffs)
Legenda:
- Não modificado
- Adicionado
- Removido
- Modificado
- Copiado
- Movido
cacic/trunk/agente-linux/pycacic/src/coletores/col_patr.py
r431 r434 14 14 15 15 def isReady(self, dat=None): 16 return False16 return 0 17 17 18 18 def start(self): cacic/trunk/agente-linux/pycacic/src/coletores/col_soft.py
r431 r434 14 14 15 15 def isReady(self, dat=None): 16 return False16 return 0 17 17 18 18 def start(self): cacic/trunk/agente-linux/pycacic/src/coletores/coletor.py
r430 r434 43 43 if not self.dicionario.has_key(chave): 44 44 self.dicionario[chave] = valor 45 return True45 return 1 # True 46 46 self.setChave(chave, valor) 47 return False47 return 0 # False 48 48 49 49 def setChave(self, chave, valor): … … 67 67 def isReady(self, dat=None): 68 68 """ Retorna True se o coletor está pronto/pretende enviar uma coleta, False caso contrário """ 69 return True69 return 1 # True 70 70 71 71 def createDat(self, chaves, path, prefixo=''): cacic/trunk/agente-linux/pycacic/src/coletores/lib/ccrypt.py
r432 r434 19 19 import binascii 20 20 import base64 21 import ccrypt_lib 22 from Crypto.Cipher import AES 21 22 from Python_AES import Python_AES 23 23 24 24 25 class CCrypt: … … 30 31 """ 31 32 32 AES.block_size = 16 # 16 bytes = 128 bits 33 AES.key_size = 32 # 32 bytes = 256 bits 34 mode = AES.MODE_CBC 35 KEY = 'CacicBrasil' 33 KEY = 'CacicES2005' 34 AES_KEY_SIZE = 32 35 AES_BLOCK_SIZE = 16 36 36 IV = 'abcdefghijklmnop' 37 cipher = AES.new37 38 38 39 39 def __init__(self): 40 40 self.char = '@' 41 self.key = self.padding(self.KEY, AES.key_size, self.char)42 self.iv = self.padding(self.IV, AES.block_size, self.char)43 41 self.key = self.padding(self.KEY, self.AES_KEY_SIZE, self.char) 42 self.iv = self.padding(self.IV, self.AES_BLOCK_SIZE, self.char) 43 44 44 def encrypt(self, text): 45 45 """Encrypta uma string com AES (CBC) e depois em BASE64""" 46 cifrado = self.cipher(self.key, self.mode, self.iv).encrypt(self.padding(text, AES.block_size, self.char)) 47 return base64.b64encode(cifrado) 46 self.cipher = Python_AES(self.key, 2, self.iv) 47 cifrado = self.cipher.encrypt(self.padding(text, self.AES_BLOCK_SIZE, self.char)) 48 return base64.encodestring(cifrado)[0:-1] 48 49 49 50 def decrypt(self, text): … … 51 52 # ER para remover o padding da string 52 53 rm = re.compile("(?:"+ self.char +")*$") 53 decifrado = self.cipher(self.key, self.mode, self.iv).decrypt(base64.b64decode(text)) 54 self.cipher = Python_AES(self.key, 2, self.iv) 55 decifrado = self.cipher.decrypt(base64.decodestring(text)) 54 56 return decifrado.replace(rm.findall(decifrado)[0],'') 55 57 cacic/trunk/agente-linux/pycacic/src/coletores/lib/computador.py
r430 r434 299 299 """ 300 300 p = re.compile('[0-9A-F]{2}(?:\:[0-9A-F]{2}){5}') 301 return p.findall(commands.getoutput("ifconfig -a | grep -B 1 -A 1 " + ip) )[0]301 return p.findall(commands.getoutput("ifconfig -a | grep -B 1 -A 1 " + ip).upper())[0] 302 302 303 303 def __getGateway__(self, logicalname): … … 592 592 size = "" 593 593 desc = "" 594 hasSize = False594 hasSize = 0 # False 595 595 for folha in filho.childNodes: 596 596 if folha.nodeName == 'description': … … 600 600 if folha.nodeName == 'size': 601 601 size = (int(folha.firstChild.nodeValue)/1048576) 602 hasSize = True603 if hasSize == True:602 hasSize = 1 # True 603 if hasSize == 1: # True: 604 604 self.ram.setSlot(slot, size, desc) 605 hasSize = False605 hasSize = 0 # False 606 606 607 607 def getCPUInfo(self, no): … … 691 691 if(primeiro > 0 and fim > 0): 692 692 video.setRam(int(s[primeiro:fim])/1024) 693 s = commands.getoutput( "grep -i *Built-in /var/log/Xorg.0.log")694 pesqBus = s.find(" *Built-in mode")693 s = commands.getoutput('grep -i "Virtual size" /var/log/Xorg.0.log') 694 pesqBus = s.find("Virtual size is ") 695 695 if pesqBus > 0: 696 696 primeiro = pesqBus+16 697 fim = s.find(" \n", primeiro)697 fim = s.find(" ", primeiro) 698 698 video.setResolucao(s[primeiro:fim]) 699 699 s = commands.getoutput('grep -i "(--) Depth" /var/log/Xorg.0.log') … … 970 970 if mng == 'dpkg': 971 971 if 'install' in output: 972 return True972 return 1 # True 973 973 else: 974 974 if output != '': 975 return True975 return 1 # True 976 976 return False 977 977 … … 1012 1012 """Retorna se o usuario e root ou nao""" 1013 1013 if os.getuid() != 0: 1014 return False1015 return True1014 return 0 # False 1015 return 1 # True 1016 1016 1017 1017 def coletar(self): cacic/trunk/agente-linux/pycacic/src/coletores/lib/url.py
r430 r434 67 67 status = xml.getElementsByTagName('STATUS')[0].firstChild.nodeValue 68 68 if status != "OK": 69 return False70 return True69 return 0 # False 70 return 1 # True 71 71 72 72 def ftpConecta(self, server, login, senha): cacic/trunk/agente-linux/pycacic/src/config/cacic.conf
r430 r434 14 14 <description>Endereco (address) do servidor Gerente Web para buscar informacoes sobre quais coletas devem ser realizadas, intervalo de tempo entre elas, atualizao, etc. Senha (password) para acesso. E arquivo (file) que efetuara esta resposta.</description> 15 15 </server> 16 <local> 17 <dir>/usr/share/pycacic</dir> 18 <sha1>XXXX</sha1> 19 </local> 16 20 <socket> 17 21 <host>localhost</host> cacic/trunk/agente-linux/pycacic/src/config/io.py
r430 r434 179 179 sv = re_sv.findall(config)[0] 180 180 if len(re_node.findall(sv)) == 0: 181 return False181 return 0 # False 182 182 node = re_node.findall(sv)[0] 183 183 server = sv cacic/trunk/agente-linux/pycacic/src/glade/main_window.glade
r421 r434 1 1 <?xml version="1.0" encoding="UTF-8" standalone="no"?> 2 2 <!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd"> 3 <!--Generated with glade3 3.4.0 on Wed May 7 13:59:412008 -->3 <!--Generated with glade3 3.4.0 on Fri May 9 14:12:30 2008 --> 4 4 <glade-interface> 5 5 <widget class="GtkWindow" id="main_window"> … … 9 9 <property name="default_width">600</property> 10 10 <property name="default_height">400</property> 11 <property name="icon"> ../img/logo.png</property>11 <property name="icon">logo.png</property> 12 12 <signal name="destroy" handler="on_window_destroy"/> 13 13 <child> … … 24 24 <property name="visible">True</property> 25 25 <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> 26 <property name="pixbuf"> ../img/logo.png</property>26 <property name="pixbuf">logo.png</property> 27 27 </widget> 28 28 <packing> … … 37 37 </child> 38 38 <child> 39 <widget class="Gtk ScrolledWindow" id="scrolledwindow1">39 <widget class="GtkHBox" id="hbox2"> 40 40 <property name="visible">True</property> 41 <property name="can_focus">True</property>42 41 <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> 43 <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>44 <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>45 42 <child> 46 <widget class="Gtk TreeView" id="treeview1">43 <widget class="GtkScrolledWindow" id="scrolledwindow1"> 47 44 <property name="visible">True</property> 48 45 <property name="can_focus">True</property> 49 46 <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> 50 <property name="headers_clickable">True</property> 47 <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property> 48 <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> 49 <child> 50 <widget class="GtkTreeView" id="treeview1"> 51 <property name="visible">True</property> 52 <property name="can_focus">True</property> 53 <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> 54 <property name="headers_clickable">True</property> 55 </widget> 56 </child> 51 57 </widget> 58 <packing> 59 <property name="padding">10</property> 60 </packing> 61 </child> 62 <child> 63 <widget class="GtkVBox" id="vbox1"> 64 <property name="visible">True</property> 65 <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> 66 <child> 67 <widget class="GtkCheckButton" id="col_hard"> 68 <property name="visible">True</property> 69 <property name="can_focus">True</property> 70 <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> 71 <property name="label" translatable="yes">Coletor de Hardware</property> 72 <property name="response_id">0</property> 73 <property name="draw_indicator">True</property> 74 </widget> 75 </child> 76 <child> 77 <widget class="GtkCheckButton" id="col_soft"> 78 <property name="visible">True</property> 79 <property name="can_focus">True</property> 80 <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> 81 <property name="label" translatable="yes">Coletor de Software</property> 82 <property name="response_id">0</property> 83 <property name="draw_indicator">True</property> 84 </widget> 85 <packing> 86 <property name="position">1</property> 87 </packing> 88 </child> 89 <child> 90 <widget class="GtkCheckButton" id="col_patr"> 91 <property name="visible">True</property> 92 <property name="can_focus">True</property> 93 <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> 94 <property name="label" translatable="yes">Coletor de Patrimono</property> 95 <property name="response_id">0</property> 96 <property name="draw_indicator">True</property> 97 </widget> 98 <packing> 99 <property name="position">2</property> 100 </packing> 101 </child> 102 </widget> 103 <packing> 104 <property name="expand">False</property> 105 <property name="padding">10</property> 106 <property name="position">1</property> 107 </packing> 52 108 </child> 53 109 </widget> cacic/trunk/agente-linux/pycacic/src/lang/language.py
r423 r434 92 92 no = self.getMode(self.mode) 93 93 if not no: 94 return False94 return 0 # False 95 95 header = {} 96 96 for filho in no.childNodes: … … 106 106 no = self.getMode(self.mode) 107 107 if not no: 108 return False108 return 0 # False 109 109 menu = {} 110 110 for filho in no.childNodes: … … 120 120 no = self.getMessages() 121 121 if not no: 122 return False122 return 0 # False 123 123 messages = {} 124 124 for filho in no.childNodes: … … 134 134 no = self.getMode(self.mode) 135 135 if not no: 136 return False136 return 0 # False 137 137 return no.getElementsByTagName('messages')[0] 138 138 … … 144 144 """ 145 145 if not mode in ('text', 'gui'): 146 return False146 return 0 # False 147 147 root = self.getRoot() 148 148 for no in root.childNodes:
