Commit 6f61fc4fe2debc0a7c399d237af228fe5da16b47

Authored by Adriano Vieira
1 parent f74aa407
Exists in master and in 1 other branch 3.1

Gerente "trunk" atualizado

- Alterações acumuladas realizadas/enviadas pela Dataprev/ES (Anderson Peterle)
  implementações no "ws" para atender ao agente linux em python
  correções em indução de coletas
  correções de relatórios
  adição de funções padrão (library)

git-svn-id: http://svn.softwarepublico.gov.br/svn/cacic/cacic/trunk/gerente@397 fecfc0c7-e812-0410-ae72-849f08638ee7
admin/forca_coleta_estacao.php
... ... @@ -24,7 +24,11 @@ else { // Inserir regras para outras verificações (ex: permissões do usuário)!
24 24 }
25 25  
26 26 require_once('../include/library.php');
27   -// Comentado temporariamente - AntiSpy();
  27 +AntiSpy('1,2,3'); // Permitido somente a estes cs_nivel_administracao...
  28 +// 1 - Administração
  29 +// 2 - Gestão Central
  30 +// 3 - Supervisão
  31 +
28 32 ?>
29 33 <html>
30 34 <head>
... ... @@ -32,8 +36,15 @@ require_once(&#39;../include/library.php&#39;);
32 36 <title><?=$oTranslator->_('Coleta induzida por Computador');?></title>
33 37 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
34 38 <? // O require abaixo será usado pelo inc_opcoes_administrativas/coleta_forcada.php - Não remova! - A.A.P. 23/09/2004
35   -require_once('../include/opcoes_avancadas_combos.js'); ?>
36   -
  39 +require_once('../include/opcoes_avancadas_combos.js'); ?>
  40 +<style type="text/css">
  41 +<!--
  42 +.style1 {
  43 + color: #000099;
  44 + font-weight: bold;
  45 +}
  46 +-->
  47 +</style>
37 48 </head>
38 49  
39 50 <body>
... ... @@ -46,26 +57,26 @@ require_once(&#39;../include/opcoes_avancadas_combos.js&#39;); ?&gt;
46 57 <tr>
47 58 <td class="descricao"><?=$oTranslator->_('Esta pagina permite induzir coletas em determinado computador');?></td>
48 59 </tr>
  60 + <tr>
  61 + <td><br>
  62 + <span class="style1"><u>Observa&ccedil;&otilde;es</u>: </span><br>
  63 + 1)
  64 + Este comando informar&aacute; ao computador alvo que a pr&oacute;xima coleta deve ser enviada ao gerente incondicionalmente, ou seja, mesmo que seja id&ecirc;ntica &agrave; anterior;<br>
  65 + 2) A coleta acontecer&aacute; obedecendo ao intervalo previamente configurado por usu&aacute;rio com o devido privil&eacute;gio de acesso.</td>
  66 + </tr>
49 67  
50 68 <br>
51   - <table width="90%" border="0" align="center" cellpadding="0" cellspacing="1">
52 69 <?
53 70 $forca_coleta_estacao = 'OK'; // Variável a ser verificada pela rotina em opcoes_avancadas.php
54 71 require_once('../include/opcoes_avancadas.php');
55 72 ?>
56   -
57   - <tr>
58   - <td height="1" bgcolor="#333333"></td>
59   - </tr>
60   - <tr>
61   - <td>&nbsp;</td>
62   - </tr>
  73 + <br>
  74 + <br>
63 75 <tr>
64 76 <td><div align="center">
65 77 <input name="submit" type="submit" value="<?=$oTranslator->_('Induzir coletas');?>">
66 78 </div></td>
67 79 </tr>
68   - </table>
69 80 </table>
70 81 </form>
71 82 <p>&nbsp;</p>
... ...
include/contador.php
... ... @@ -3,13 +3,15 @@ session_start();
3 3 $sqlContador = 'SELECT DATE_FORMAT(min(dt_acao), "%d/%m/%Y") as MenorData,
4 4 count(cs_acao) as TotalAcessos
5 5 FROM log
6   - WHERE cs_acao="ACE"';
  6 + WHERE cs_acao="ACE" AND
  7 + nm_script = "menu_esq.php"';
7 8 conecta_bd_cacic();
8 9 $resultContador = mysql_query($sqlContador);
9 10 $rowContador = mysql_fetch_array($resultContador);
10 11 $_SESSION['TotalAcessos']=$rowContador['TotalAcessos'];
11 12 $_SESSION['MenorData']=$rowContador['MenorData'];
12 13  
  14 +
13 15 ?>
14 16 <script>
15 17 function MontaContador(strTotalAcessos)
... ...
include/library.php
... ... @@ -13,8 +13,7 @@
13 13 Você deve ter recebido uma cópia da Licença Pública Geral GNU, sob o título "LICENCA.txt", junto com este programa, se não, escreva para a Fundação do Software
14 14 Livre(FSF) Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
15 15 */
16   -
17   -@session_start();
  16 +session_start();
18 17 @define('CACIC',1);
19 18  
20 19 @include_once('config.php');
... ... @@ -30,7 +29,50 @@ $oTranslator = new Translator( CACIC_LANGUAGE, CACIC_PATH.CACIC_LANGUAGE_PATH, C
30 29 $oTranslator->setURLPath(TRANSLATOR_PATH_URL);
31 30 $oTranslator->setLangFilesInSubDirs(true);
32 31 $oTranslator->initStdLanguages();
  32 +//Debug($_SERVER['SCRIPT_FILENAME']);
33 33  
  34 +// --------------------------------------------------------------------------
  35 +// Função para retorno dos nomes das colunas de hardware passível de controle
  36 +// --------------------------------------------------------------------------
  37 +function getDescricoesColunasComputadores()
  38 + {
  39 + // Conecto ao banco
  40 + conecta_bd_cacic();
  41 +
  42 + // Consulto lista de colunas de hardware e retorno em um array
  43 + $queryDescricoesColunasComputadores = "SELECT nm_campo,
  44 + te_descricao_campo
  45 + FROM descricoes_colunas_computadores";
  46 + $resultDescricoesColunasComputadores = mysql_query($queryDescricoesColunasComputadores) or die('Ocorreu um erro durante a consulta à tabela descricoes_colunas_computadores.');
  47 +
  48 + // Crio um array que conterá nm_campo => te_descricao_campo.
  49 + $arrDescricoesColunasComputadoresAux = array();
  50 + while($rowHardware = mysql_fetch_array($resultDescricoesColunasComputadores))
  51 + $arrDescricoesColunasComputadoresAux[trim($rowHardware['nm_campo'])] = $rowHardware['te_descricao_campo'];
  52 + return $arrDescricoesColunasComputadoresAux;
  53 + }
  54 +
  55 +// --------------------------------------------------------------
  56 +// Função para retorno dos nomes de hardware passível de controle
  57 +// --------------------------------------------------------------
  58 +function getDescricaoHardware()
  59 + {
  60 + // Conecto ao banco
  61 + conecta_bd_cacic();
  62 +
  63 + // Consulto lista de descrições de hardware e retorno em um array
  64 + $queryDescricaoHardware = "SELECT nm_campo_tab_hardware,
  65 + te_desc_hardware
  66 + FROM descricao_hardware";
  67 + $resultDescricaoHardware = mysql_query($queryDescricaoHardware) or die('Ocorreu um erro durante a consulta à tabela descricao_hardware.');
  68 +
  69 + // Crio um array que conterá nm_campo => te_descricao_campo.
  70 + $arrDescricaoHardwareAux = array();
  71 + while($rowHardware = mysql_fetch_array($resultDescricaoHardware))
  72 + $arrDescricaoHardwareAux[trim($rowHardware['nm_campo_tab_hardware'])] = $rowHardware['te_desc_hardware'];
  73 + return $arrDescricaoHardwareAux;
  74 + }
  75 +
34 76 // --------------------------------------------------------------------------------------
35 77 // Função para bloqueio de acesso indevido
36 78 // --------------------------------------------------------------------------------------
... ... @@ -46,11 +88,11 @@ function AntiSpy($strNiveisPermitidos = &#39;&#39;)
46 88 include $mainFolder.'/include/config.php'; // Incluo o config.php para pegar as chaves de criptografia
47 89  
48 90 if (session_is_registered("id_usuario") && session_is_registered("id_usuario_crypted") &&
49   - $_SESSION["id_usuario_crypted"] == EnCrypt($key,$iv,$_SESSION["id_usuario"],"1","0","0") &&
  91 + $_SESSION["id_usuario_crypted"] == EnCrypt($key,$iv,$_SESSION["id_usuario"],"1","0","0","") &&
50 92 $boolNivelPermitido)
51 93 return true;
52 94 //$_SERVER['HTTP_HOST']
53   - $strLocation = 'http://'.$_SERVER['HTTP_HOST'].'/cacic2/include/acesso_nao_permitido.php';
  95 + $strLocation = 'http://'.$_SERVER['SERVER_ADDR'].'/cacic2/include/acesso_nao_permitido.php';
54 96 header ("Location: $strLocation");
55 97 exit;
56 98 }
... ... @@ -228,8 +270,14 @@ function stripos2($strString, $strSubString, $boolRetornaPosicao = true)
228 270 // To decrypt values
229 271 // p_cs_cipher => Y/N
230 272 // ---------------------------------
231   -function DeCrypt($p_CipherKey, $p_IV, $p_CriptedData, $p_cs_Cipher, $p_cs_UnCompress='0')
  273 +function DeCrypt($p_CipherKey, $p_IV, $p_CriptedData, $p_cs_Cipher, $p_cs_UnCompress='0', $p_PaddingKey = '')
232 274 {
  275 + $p_CipherKey .= $p_PaddingKey;
  276 +
  277 + GravaTESTES('Em DeCrypt: p_CipherKey = "'.$p_CipherKey.'"');
  278 + GravaTESTES('Em DeCrypt: p_IV = "'.$p_IV.'"');
  279 + GravaTESTES('Em DeCrypt: p_CriptedData = "'.$p_CriptedData.'"');
  280 + GravaTESTES('Em DeCrypt: p_cs_Cipher = "'.$p_cs_Cipher.'"');
233 281 // Bloco de Substituições para antes da Decriptação
234 282 // ------------------------------------------------
235 283 // Razão: Dependendo da configuração do servidor, os valores
... ... @@ -266,6 +314,15 @@ function DeCrypt($p_CipherKey, $p_IV, $p_CriptedData, $p_cs_Cipher, $p_cs_UnComp
266 314 if ($p_cs_UnCompress == '1')
267 315 $v_result = gzinflate($v_result);
268 316  
  317 + GravaTESTES('Em DeCrypt: p_PaddingKey = "'.$p_PaddingKey.'"');
  318 + // Aqui retiro do resultado a ocorrência do preenchimento, caso exista. (o agente Python faz esse preenchimento)
  319 + if ($p_PaddingKey <> '')
  320 + {
  321 + $char = substr($p_PaddingKey,0,1);
  322 + $re = "/".$char."*$/";
  323 + $v_result = preg_replace($re, "", $v_result);
  324 + }
  325 + GravaTESTES('Em DeCrypt: v_result = "'.$v_result.'"');
269 326 return trim($v_result);
270 327 }
271 328  
... ... @@ -288,9 +345,10 @@ if(!function_exists(&#39;hash&#39;))
288 345 // To crypt values
289 346 // p_cs_cipher => Y/N
290 347 // ------------------------------
291   -function EnCrypt($p_CipherKey, $p_IV, $p_PlainData, $p_cs_Cipher, $p_cs_Compress, $p_compress_level=0)
  348 +function EnCrypt($p_CipherKey, $p_IV, $p_PlainData, $p_cs_Cipher, $p_cs_Compress, $p_compress_level=0, $p_PaddingKey = '')
292 349 {
293   -
  350 + $p_CipherKey .= $p_PaddingKey;
  351 +
294 352 if ($p_cs_Cipher=='1')
295 353 $v_result = base64_encode(@mcrypt_cbc(MCRYPT_RIJNDAEL_128,$p_CipherKey,$p_PlainData,MCRYPT_ENCRYPT,$p_IV));
296 354 else
... ... @@ -627,12 +685,21 @@ function dectobin($dectobin)
627 685 return $cadtemp.$dectobin;
628 686 }
629 687  
630   -function autentica_agente($p_CipherKey, $p_IV, $p_cs_cipher, $p_cs_compress)
  688 +function autentica_agente($p_CipherKey, $p_IV, $p_cs_cipher, $p_cs_compress, $p_PaddingKey='')
631 689 {
632   -
633   - if ((strtoupper(DeCrypt($p_CipherKey,$p_IV,$_SERVER['HTTP_USER_AGENT'],$p_cs_cipher, $p_cs_compress)) != 'AGENTE_CACIC') ||
634   - (strtoupper(DeCrypt($p_CipherKey,$p_IV,$_SERVER['PHP_AUTH_USER'],$p_cs_cipher, $p_cs_compress)) != 'USER_CACIC') ||
635   - (strtoupper(DeCrypt($p_CipherKey,$p_IV,$_SERVER['PHP_AUTH_PW'],$p_cs_cipher, $p_cs_compress)) != 'PW_CACIC'))
  690 +
  691 + GravaTESTES('###########################################');
  692 + GravaTESTES('Script Chamador: '.$_SERVER['REQUEST_URI']);
  693 + GravaTESTES('1: '.$_SERVER['HTTP_USER_AGENT']);
  694 + GravaTESTES('11: '.strtoupper(DeCrypt($p_CipherKey,$p_IV,$_SERVER['HTTP_USER_AGENT'],$p_cs_cipher, $p_cs_compress,$p_PaddingKey)));
  695 + GravaTESTES('2: '.$_SERVER['PHP_AUTH_USER']);
  696 + GravaTESTES('22: '.strtoupper(DeCrypt($p_CipherKey,$p_IV,$_SERVER['PHP_AUTH_USER'],$p_cs_cipher, $p_cs_compress,$p_PaddingKey)));
  697 + GravaTESTES('3: '.$_SERVER['PHP_AUTH_PW']);
  698 + GravaTESTES('33: '.strtoupper(DeCrypt($p_CipherKey,$p_IV,$_SERVER['PHP_AUTH_PW'],$p_cs_cipher, $p_cs_compress,$p_PaddingKey)));
  699 + GravaTESTES('###########################################');
  700 + if ((strtoupper(DeCrypt($p_CipherKey,$p_IV,$_SERVER['HTTP_USER_AGENT'],$p_cs_cipher, $p_cs_compress,$p_PaddingKey)) != 'AGENTE_CACIC') ||
  701 + (strtoupper(DeCrypt($p_CipherKey,$p_IV,$_SERVER['PHP_AUTH_USER'],$p_cs_cipher, $p_cs_compress,$p_PaddingKey)) != 'USER_CACIC') ||
  702 + (strtoupper(DeCrypt($p_CipherKey,$p_IV,$_SERVER['PHP_AUTH_PW'],$p_cs_cipher, $p_cs_compress,$p_PaddingKey)) != 'PW_CACIC'))
636 703 {
637 704 echo 'Acesso não autorizado.';
638 705 exit;
... ... @@ -689,21 +756,21 @@ function inclui_computador_caso_nao_exista( $te_node_address,
689 756 if (substr_count($v_te_ip,'zf')>0 || trim($v_te_ip)=='')
690 757 $v_te_ip = $_SERVER['REMOTE_ADDR'];
691 758  
692   - //GravaTESTES('Script Chamador: '.$_SERVER['REQUEST_URI']);
693   - //GravaTESTES('v_te_ip: '.$v_te_ip);
  759 + GravaTESTES('Script Chamador: '.$_SERVER['REQUEST_URI']);
  760 + GravaTESTES('v_te_ip: '.$v_te_ip);
694 761  
695 762  
696   - // {
697   - //GravaTESTES('te_node_address: '.$te_node_address);
698   - //GravaTESTES('id_so_new: '.$id_so_new);
699   - //GravaTESTES('te_so_new: '.$te_so_new);
700   - //GravaTESTES('te_so_new_new: '.$te_so_new_new);
701   - //GravaTESTES('id_ip_rede: '.$id_ip_rede);
702   - //GravaTESTES('te_ip: '.$te_ip);
703   - //GravaTESTES('v_te_ip: '.$v_te_ip);
704   - //GravaTESTES('te_nome_computador: '.$te_nome_computador);
705   - //GravaTESTES('te_workgroup: '.$te_workgroup);
706   - // }
  763 +
  764 + GravaTESTES('te_node_address: '.$te_node_address);
  765 + GravaTESTES('id_so_new: '.$id_so_new);
  766 + GravaTESTES('te_so_new: '.$te_so_new);
  767 + GravaTESTES('te_so_new_new: '.$te_so_new_new);
  768 + GravaTESTES('id_ip_rede: '.$id_ip_rede);
  769 + GravaTESTES('te_ip: '.$te_ip);
  770 + GravaTESTES('v_te_ip: '.$v_te_ip);
  771 + GravaTESTES('te_nome_computador: '.$te_nome_computador);
  772 + GravaTESTES('te_workgroup: '.$te_workgroup);
  773 +
707 774  
708 775 $id_so = get_valor_campo('so', 'id_so', 'id_so = '.$id_so_new);
709 776 $te_so = get_valor_campo('so', 'te_so', 'te_so = "'.$te_so_new.'"');
... ... @@ -717,6 +784,7 @@ function inclui_computador_caso_nao_exista( $te_node_address,
717 784 $query = 'UPDATE so
718 785 SET te_so = "'.$te_so_new.'"
719 786 WHERE id_so = '.$id_so;
  787 + GravaTESTES('query 1: '.$query);
720 788 $result = mysql_query($query);
721 789 }
722 790 elseif ($te_so <> '' && ($id_so == '' || $id_so == 0)) // Encontrei somente o Identificador Interno (TE_SO)
... ... @@ -725,6 +793,7 @@ function inclui_computador_caso_nao_exista( $te_node_address,
725 793 $query = 'SELECT id_so
726 794 FROM so
727 795 WHERE te_so = "'.$te_so.'"';
  796 + GravaTESTES('query 2: '.$query);
728 797 $result = mysql_query($query);
729 798 $row = mysql_fetch_array($result);
730 799 $id_so = $row['id_so'];
... ... @@ -751,6 +820,7 @@ function inclui_computador_caso_nao_exista( $te_node_address,
751 820 $queryINS = 'INSERT
752 821 INTO so(id_so,te_desc_so,sg_so,te_so)
753 822 VALUES ('.$id_so.',"S.O. a Cadastrar","Sigla a Cadastrar","'.$te_so_new.'")';
  823 + GravaTESTES('queryINS: '.$queryINS);
754 824 $resultINS = mysql_query($queryINS);
755 825  
756 826 // Carrego os dados referente à rede da estação
... ... @@ -761,6 +831,7 @@ function inclui_computador_caso_nao_exista( $te_node_address,
761 831 FROM acoes_so
762 832 WHERE id_local = '.$v_dados_rede['id_local'].'
763 833 GROUP BY id_acao';
  834 + GravaTESTES('querySEL: '.$querySEL);
764 835 $resultSEL = mysql_query($querySEL);
765 836  
766 837 // Caso existam ações configuradas para o local, incluo o S.O. para que também execute-as...
... ... @@ -803,7 +874,7 @@ function inclui_computador_caso_nao_exista( $te_node_address,
803 874 WHERE te_node_address = "'.$te_node_address.'"
804 875 AND id_so = "'.$id_so.'"';
805 876 }
806   -//GravaTESTES($query);
  877 +GravaTESTES('QUERY : '.$query);
807 878 $result = mysql_query($query);
808 879 $arrRetorno = array('id_so'=>$id_so,'te_so'=>$te_so);
809 880 // OK! O computador foi INCLUIDO/ATUALIZADO.
... ...
relatorios/computador/computador.php
... ... @@ -47,7 +47,12 @@ $result = mysql_query($query);
47 47  
48 48 if (@mysql_num_rows($result))
49 49 {
50   - require_once('inc_detalhes_computador.php'); ?>
  50 + require_once('inc_detalhes_computador.php');
  51 + $strPreenchimentoPadrao = '#CCCCFF';
  52 + $strCorDaLinha = '#E1E1E1';
  53 + $linha = '<tr><td colspan="5" height="1" bgcolor="'.$strCorDaLinha.'"></td></tr>';
  54 +
  55 + ?>
51 56  
52 57 <table width="100%" border="0" cellpadding="0" cellspacing="2">
53 58 <tr><td>
... ...
relatorios/computador/historico.php
... ... @@ -19,65 +19,94 @@ require_once(&#39;../../include/library.php&#39;);
19 19 AntiSpy();
20 20 conecta_bd_cacic();
21 21  
22   -if ($historico_hardware) {
23   - $query = "SELECT DATE_FORMAT(dt_hr_alteracao,'%d/%m/%Y às %H:%ih') as 'Data de Alteração',dt_hr_alteracao, te_placa_rede_desc as 'Placa de Rede',
24   - te_cpu_desc as 'CPU', te_cpu_freq as 'Frequência CPU', te_cpu_fabricante as 'Fab. CPU',
25   - te_cpu_serial as 'CPU serial', te_placa_mae_desc as 'Placa Mãe',
26   - te_placa_mae_fabricante as 'Fab. Placa Mãe', te_placa_video_desc as 'Placa de Vídeo',
27   - qt_placa_video_cores as 'Quant. cores Placa Video', te_placa_video_resolucao as 'Resol. Placa Vídeo',
28   - qt_placa_video_mem as 'Mem. Vídeo', qt_mem_ram as 'RAM', te_mem_ram_desc as 'Desc. RAM',
29   - te_bios_desc as 'Desc. da BIOS', te_bios_fabricante as 'Fab. BIOS', te_placa_som_desc as 'Desc. Placa Som',
30   - te_modem_desc as 'Desc. Modem', te_cdrom_desc as 'Desc. CDROM', te_teclado_desc as 'Desc. Teclado',
31   - te_mouse_desc as 'Desc. Mouse'
32   - FROM historico_hardware
33   - WHERE te_node_address = '". $_POST['te_node_address'] ."' AND
34   - id_so = '". $_POST['id_so'] ."'
35   - ORDER BY dt_hr_alteracao";
  22 +if ($_POST['historico_hardware'])
  23 + {
  24 + $query = "SELECT DATE_FORMAT(dt_hr_alteracao,'%d/%m/%Y às %H:%ih') as 'Data de Alteração',
  25 + dt_hr_alteracao,
  26 + te_placa_rede_desc,
  27 + te_cpu_desc,
  28 + te_cpu_freq,
  29 + te_cpu_fabricante,
  30 + te_cpu_serial,
  31 + te_placa_mae_desc,
  32 + te_placa_mae_fabricante,
  33 + te_placa_video_desc,
  34 + qt_placa_video_cores,
  35 + te_placa_video_resolucao,
  36 + qt_placa_video_mem,
  37 + qt_mem_ram,
  38 + te_mem_ram_desc,
  39 + te_bios_desc,
  40 + te_bios_fabricante,
  41 + te_placa_som_desc,
  42 + te_modem_desc,
  43 + te_cdrom_desc,
  44 + te_teclado_desc,
  45 + te_mouse_desc
  46 + FROM historico_hardware
  47 + WHERE te_node_address = '". $_POST['te_node_address'] ."' AND
  48 + id_so = '". $_POST['id_so'] ."'
  49 + ORDER BY dt_hr_alteracao DESC";
36 50 $result = mysql_query($query) or die ('Erro no select ou sua sessão expirou!');
37 51 $tipo_historico = 'de Hardware';
38   -}
39   -else if ($historico_patrimonio) {
40   - $query = "SELECT te_etiqueta, nm_campo_tab_patrimonio
41   - FROM patrimonio_config_interface
42   - WHERE in_exibir_etiqueta = 'S'";
43   - $result = mysql_query($query) or die('Erro na consulta à tabela "patrimonio_config_interface" ou sua sessão expirou!');
  52 + }
  53 +else if ($_POST['historico_patrimonio'])
  54 + {
  55 + $query = "SELECT te_etiqueta,
  56 + nm_campo_tab_patrimonio
  57 + FROM patrimonio_config_interface
  58 + WHERE in_exibir_etiqueta = 'S'";
  59 + $result = mysql_query($query) or die('Erro na consulta à tabela "patrimonio_config_interface" ou sua sessão expirou!');
44 60  
45   - while ($row = mysql_fetch_array($result)) {
46   - if (strtolower($row['nm_campo_tab_patrimonio']) == 'id_unid_organizacional_nivel1' ) {
47   - $row['nm_campo_tab_patrimonio'] = 'b.nm_unid_organizacional_nivel1';
48   - }
49   - else if (strtolower($row['nm_campo_tab_patrimonio']) == 'id_unid_organizacional_nivel2' ) {
50   - $row['nm_campo_tab_patrimonio'] = 'c.nm_unid_organizacional_nivel2';
51   - }
52   - $campos = $campos . ", " . $row['nm_campo_tab_patrimonio'] . " AS '" . $row["te_etiqueta"] . "'";
53   - }
  61 + while ($row = mysql_fetch_array($result))
  62 + {
  63 + if (strtolower($row['nm_campo_tab_patrimonio']) == 'id_unid_organizacional_nivel1' )
  64 + {
  65 + $row['nm_campo_tab_patrimonio'] = 'b.nm_unid_organizacional_nivel1';
  66 + }
  67 + else if (strtolower($row['nm_campo_tab_patrimonio']) == 'id_unid_organizacional_nivel2' )
  68 + {
  69 + $row['nm_campo_tab_patrimonio'] = 'c.nm_unid_organizacional_nivel2';
  70 + }
  71 + $campos = $campos . ", " . $row['nm_campo_tab_patrimonio'] . " AS '" . $row["te_etiqueta"] . "'";
  72 + }
54 73  
55   - $query = "SELECT DATE_FORMAT(dt_hr_alteracao,'%d/%m/%Y às %H:%ih') as 'Data de Alteração',dt_hr_alteracao " . $campos . "
56   - FROM patrimonio a, unid_organizacional_nivel1 b, unid_organizacional_nivel2 c
57   - WHERE a.te_node_address = '" . $_POST['te_node_address'] . "' AND
58   - a.id_so = '" . $_POST['id_so'] . "' AND
59   - a.id_unid_organizacional_nivel1 = b.id_unid_organizacional_nivel1 AND
60   - a.id_unid_organizacional_nivel1 = c.id_unid_organizacional_nivel1 AND
61   - a.id_unid_organizacional_nivel2 = c.id_unid_organizacional_nivel2
62   - ORDER BY dt_hr_alteracao";
  74 + $query = "SELECT DATE_FORMAT(dt_hr_alteracao,'%d/%m/%Y às %H:%ih') as 'Data de Alteração',
  75 + dt_hr_alteracao " . $campos . "
  76 + FROM patrimonio a,
  77 + unid_organizacional_nivel1 b,
  78 + unid_organizacional_nivel2 c
  79 + WHERE a.te_node_address = '" . $_POST['te_node_address'] . "' AND
  80 + a.id_so = '" . $_POST['id_so'] . "' AND
  81 + a.id_unid_organizacional_nivel1 = b.id_unid_organizacional_nivel1 AND
  82 + a.id_unid_organizacional_nivel1 = c.id_unid_organizacional_nivel1 AND
  83 + a.id_unid_organizacional_nivel2 = c.id_unid_organizacional_nivel2
  84 + ORDER BY dt_hr_alteracao";
63 85  
64 86 $result = mysql_query($query) or die ('Erro na consulta à tabela "patrimonio" ou sua sessão expirou!');
65 87 $tipo_historico = 'de Patrimônio';
66   -}
67   -
68   -else if ($historico_rede) {
69   - $query = "SELECT DATE_FORMAT(dt_hr_alteracao,'%d/%m/%Y às %H:%ih') as 'Data de Alteração',dt_hr_alteracao, te_nome_computador as 'Nome da Máquina', te_ip as 'IP',
70   - te_mascara as 'Mascara de Rede', te_gateway as 'Gateway', te_wins_primario as 'Wins Primário',
71   - te_wins_secundario as 'Wins Secundario', te_dns_primario as 'DNS Primário',
72   - te_dns_secundario as 'DNS Secundario', te_dominio_dns as 'Domínio DNS',
73   - te_serv_dhcp as 'Servidor DHCP'
74   - FROM historico_tcp_ip
75   - WHERE te_node_address = '".$_POST['te_node_address']."' AND
76   - id_so = '". $_POST['id_so'] ."'
77   - ORDER BY dt_hr_alteracao";
  88 + }
  89 +else if ($_POST['historico_rede'])
  90 + {
  91 + $query = "SELECT DATE_FORMAT(dt_hr_alteracao,'%d/%m/%Y às %H:%ih') as 'Data de Alteração',
  92 + dt_hr_alteracao,
  93 + te_nome_computador as 'Nome da Máquina',
  94 + te_ip as 'IP',
  95 + te_mascara as 'Mascara de Rede',
  96 + te_gateway as 'Gateway',
  97 + te_wins_primario as 'Wins Primário',
  98 + te_wins_secundario as 'Wins Secundario',
  99 + te_dns_primario as 'DNS Primário',
  100 + te_dns_secundario as 'DNS Secundario',
  101 + te_dominio_dns as 'Domínio DNS',
  102 + te_serv_dhcp as 'Servidor DHCP'
  103 + FROM historico_tcp_ip
  104 + WHERE te_node_address = '".$_POST['te_node_address']."' AND
  105 + id_so = '". $_POST['id_so'] ."'
  106 + ORDER BY dt_hr_alteracao";
78 107 $result = mysql_query($query) or die ('Erro no select ou sua sessão expirou!');
79 108 $tipo_historico = 'TCP/IP';
80   -}
  109 + }
81 110 ?>
82 111 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
83 112 <html>
... ... @@ -110,41 +139,49 @@ $cor = 0;
110 139 $num_registro = 1;
111 140  
112 141 $fields=mysql_num_fields($result);
113   -if (mysql_num_rows($result) > 0) {
  142 +if (mysql_num_rows($result) > 0)
  143 + {
  144 + // Obtenho os nomes do hardware passível de controle
  145 + $arrDescricoesColunasComputadores = getDescricoesColunasComputadores();
  146 +
114 147 echo '<table cellpadding="1" cellspacing="0" border="1" bordercolor="#999999" bordercolordark="#E1E1E1">
115 148 <tr bgcolor="#E1E1E1" >
116 149 <td nowrap align="left"><font size="2" face="Verdana, Arial">&nbsp;</font></td>';
117 150  
118   - for ($i=0; $i < mysql_num_fields($result); $i++) { //Table Header
  151 + for ($i=0; $i < mysql_num_fields($result); $i++)
  152 + { //Table Header
119 153 if (mysql_field_name($result, $i) <> 'dt_hr_alteracao')
120 154 {
121   - print '<td nowrap align="center"><b><font size="2" face="Verdana, Arial">'. mysql_field_name($result, $i) .'</font><b></td>';
  155 + $strNomeColuna = $arrDescricoesColunasComputadores[mysql_field_name($result, $i)];
  156 + print '<td nowrap align="center"><b><font size="2" face="Verdana, Arial">'. ($strNomeColuna <> ''?$strNomeColuna:mysql_field_name($result, $i)) .'</font><b></td>';
122 157 }
123   - }
  158 + }
124 159 echo '</tr>';
125 160  
126   - while ($row = mysql_fetch_row($result)) { //Table body
  161 + while ($row = mysql_fetch_row($result))
  162 + { //Table body
127 163 echo '<tr ';
128   - if ($cor) { echo 'bgcolor="#E1E1E1"'; }
  164 + if ($cor)
  165 + echo 'bgcolor="#E1E1E1"';
129 166 echo '>';
130 167 echo '<td nowrap align="left"><font size="2" face="Verdana, Arial">' . $num_registro . '</font></td>';
131 168  
132   - for ($i=0; $i < $fields; $i++) {
  169 + for ($i=0; $i < $fields; $i++)
  170 + {
133 171 if (mysql_field_name($result, $i)<>'dt_hr_alteracao')
134   - {
135 172 echo '<td nowrap align="left"><font size="1" face="Verdana, Arial">' . $row[$i] .'&nbsp;</td>';
136   - }
137   - }
  173 + }
138 174 $cor=!$cor;
139 175 $num_registro++;
140 176 echo '</tr>';
141   - }
  177 + }
142 178 echo '</table>';
143   -}
144   -else {
  179 + }
  180 +else
  181 + {
145 182 echo '</table>';
146 183 echo mensagem('Não foi encontrado nenhum registro');
147   -}
  184 + }
148 185 ?>
149 186 <p><font size="1" face="Verdana, Arial, Helvetica, sans-serif"> Hit&oacute;rico
150 187 gerado pelo <strong>CACIC</strong> - Configurador Autom&aacute;tico e Coletor
... ...
relatorios/computador/inc_compartilhamento.php
... ... @@ -17,20 +17,13 @@
17 17 if (!$_SESSION['compartilhamento'])
18 18 $_SESSION['compartilhamento'] = false;
19 19 if ($exibir == 'compartilhamento')
20   - {
21 20 $_SESSION['compartilhamento'] = !($_SESSION['compartilhamento']);
22   - }
23 21 else
24   - {
25 22 $_SESSION['compartilhamento'] = false;
26   - }
27 23  
28 24 ?>
29 25 <table width="94%" border="0" align="center" cellpadding="0" cellspacing="1">
30 26 <tr>
31   - <td> </td>
32   - </tr>
33   - <tr>
34 27 <td height="1" bgcolor="#333333"></td>
35 28 </tr>
36 29 <tr>
... ...
relatorios/computador/inc_ferramentas.php
... ... @@ -17,19 +17,12 @@
17 17 if (!$_SESSION['ferramentas'])
18 18 $_SESSION['ferramentas'] = false;
19 19 if ($exibir == 'ferramentas')
20   - {
21 20 $_SESSION['ferramentas'] = !($_SESSION['ferramentas']);
22   - }
23 21 else
24   - {
25 22 $_SESSION['ferramentas'] = false;
26   - }
27 23 ?>
28 24 <table width="94%" border="0" align="center" cellpadding="0" cellspacing="1">
29 25 <tr>
30   - <td colspan="3"> </td>
31   - </tr>
32   - <tr>
33 26 <td colspan="3" height="1" bgcolor="#333333"></td>
34 27 </tr>
35 28 <tr>
... ...
relatorios/computador/inc_hardware.php
... ... @@ -17,29 +17,26 @@
17 17 if (!$_SESSION['hardware'])
18 18 $_SESSION['hardware'] = false;
19 19 if ($exibir == 'hardware')
20   - {
21 20 $_SESSION['hardware'] = !($_SESSION['hardware']);
22   - }
23 21 else
24   - {
25 22 $_SESSION['hardware'] = false;
26   - }
27 23 ?>
28 24 <table width="94%" border="0" align="center" cellpadding="0" cellspacing="1">
29 25 <tr>
30   - <td colspan="3" height="1" bgcolor="#333333"></td>
  26 + <td colspan="5" height="1" bgcolor="#333333"></td>
31 27 </tr>
32 28 <tr>
33   - <td colspan="3" bgcolor="#E1E1E1" class="cabecalho_tabela">&nbsp;<a href="computador.php?exibir=hardware&te_node_address=<? echo $_GET['te_node_address']?>&id_so=<? echo $_GET['id_so']?>">
  29 + <td colspan="5" bgcolor="#E1E1E1" class="cabecalho_tabela">&nbsp;<a href="computador.php?exibir=hardware&te_node_address=<? echo $_GET['te_node_address']?>&id_so=<? echo $_GET['id_so']?>">
34 30 <img src="../../imgs/<? if($_SESSION['hardware'] == true) echo 'menos';
35 31 else echo 'mais'; ?>.gif" width="12" height="12" border="0"> Hardware Instalado</a></td>
36 32 </tr>
37 33 <tr>
38   - <td colspan="3" height="1" bgcolor="#333333"></td>
  34 + <td colspan="5" height="1" bgcolor="#333333"></td>
39 35 </tr>
40 36 <?
  37 +
41 38 $strCor = '';
42   - $strCor = ($strCor==''?'#CCCCFF':'');
  39 + $strCor = ($strCor==''?$strPreenchimentoPadrao:'');
43 40 if ( $_SESSION['hardware'] == true) {
44 41 // EXIBIR INFORMAÇÕES DE HARDWARE DO COMPUTADOR
45 42 $query = "SELECT cs_situacao
... ... @@ -49,147 +46,145 @@ else
49 46 $result_acoes = mysql_query($query);
50 47 if (mysql_result($result_acoes, 0, "cs_situacao") <> 'N') {
51 48 ?>
52   - <? echo $linha;
53   - $strCor = ($strCor==''?'#CCCCFF':'');
54   - ?>
55   -
56 49 <tr bgcolor="<? echo $strCor;?>">
57   - <td>&nbsp;</td>
58   - <td class="opcao_tabela">Placa M&atilde;e:</td>
59   - <td class="dado"><? echo mysql_result($result, 0, "te_placa_mae_desc"); ?></td>
  50 + <td></td>
  51 + <td class="opcao_tabela" align="left">Placa M&atilde;e</td>
  52 + <td class="opcao_tabela" align="left">Descri&ccedil;&atilde;o:</td>
  53 + <td class="opcao_tabela" align="left"><b><? echo mysql_result($result, 0, "te_placa_mae_desc"); ?></b></td>
60 54 </tr>
61   - <? echo $linha;
62   - $strCor = ($strCor==''?'#CCCCFF':'');
63   - ?>
64   -
  55 + <?
  56 + $strCor = ($strCor==''?$strPreenchimentoPadrao:'');
  57 + ?>
65 58 <tr bgcolor="<? echo $strCor;?>">
66   - <td>&nbsp;</td>
67   - <td class="opcao_tabela">Fabricante da Placa M&atilde;e:</td>
68   - <td class="dado"><? echo mysql_result($result, 0, "te_placa_mae_fabricante"); ?></td>
  59 + <td colspan="2"></td>
  60 + <td class="opcao_tabela" align="left">Fabricante:</td>
  61 + <td class="opcao_tabela" align="left"><b><? echo mysql_result($result, 0, "te_placa_mae_fabricante"); ?></b></td>
69 62 </tr>
70   - <? echo $linha;
71   - $strCor = ($strCor==''?'#CCCCFF':'');
  63 + <?
  64 + echo $linha;
  65 + $strCor = ($strCor==''?$strPreenchimentoPadrao:'');
72 66 ?>
73 67  
74 68 <tr bgcolor="<? echo $strCor;?>">
75 69 <td>&nbsp;</td>
76   - <td class="opcao_tabela">Placa de V&iacute;deo:</td>
77   - <td class="dado"><? echo mysql_result($result, 0, "te_placa_video_desc"); ?></td>
  70 + <td class="opcao_tabela" align="left">BIOS</td>
  71 + <td class="opcao_tabela" align="left">Descrição:</td>
  72 + <td class="opcao_tabela" align="left"><b><? echo mysql_result($result, 0, "te_bios_desc"); ?></b></td>
78 73 </tr>
79   - <? echo $linha;
80   - $strCor = ($strCor==''?'#CCCCFF':'');
81   - ?>
82   -
  74 + <?
  75 + $strCor = ($strCor==''?$strPreenchimentoPadrao:'');
  76 + ?>
83 77 <tr bgcolor="<? echo $strCor;?>">
84   - <td>&nbsp;</td>
85   - <td class="opcao_tabela">Quant. Cores placa de V&iacute;deo:</td>
86   - <td class="dado"><? echo mysql_result($result, 0, "qt_placa_video_cores"); ?></td>
  78 + <td colspan="2"></td>
  79 + <td class="opcao_tabela" align="left">Fabricante:</td>
  80 + <td class="opcao_tabela" align="left"><b><? echo mysql_result($result, 0, "te_bios_fabricante"); ?></b></td>
87 81 </tr>
88   - <? echo $linha;
89   - $strCor = ($strCor==''?'#CCCCFF':'');
  82 +
  83 + <?
  84 + echo $linha;
  85 + $strCor = ($strCor==''?$strPreenchimentoPadrao:'');
  86 + $arrMemRAM = explode('Slot ',mysql_result($result, 0, "te_mem_ram_desc"));
  87 + $intContaSlots = 0;
  88 + for ($intRAM=0;$intRAM < count($arrMemRAM);$intRAM++)
  89 + {
  90 + if ($arrMemRAM[$intRAM]<>'')
  91 + {
  92 + $strSlot = $intContaSlots.':';
  93 + ?>
  94 + <tr bgcolor="<? echo $strCor;?>">
  95 + <td></td>
  96 + <td class="opcao_tabela" align="left"><? echo ($intContaSlots==0?'Mem&oacute;ria RAM':'');?></td>
  97 + <td class="opcao_tabela" align="left">Slot <? echo $intContaSlots;?>:</td>
  98 + <td class="opcao_tabela" align="left"><b><? echo str_replace($intContaSlots.': ','',str_replace(' - ','',$arrMemRAM[$intRAM])); ?></b></td>
  99 + </tr>
  100 + <?
  101 + $strCor = ($strCor==''?$strPreenchimentoPadrao:'');
  102 + $intContaSlots ++;
  103 + }
  104 + }
  105 +
  106 + echo $linha;
90 107 ?>
91   -
92 108 <tr bgcolor="<? echo $strCor;?>">
93 109 <td>&nbsp;</td>
94   - <td class="opcao_tabela">Resolu&ccedil;&atilde;o da Placa de V&iacute;deo:</td>
95   - <td class="dado"><? echo mysql_result($result, 0, "te_placa_video_resolucao"); ?></td>
  110 + <td class="opcao_tabela" align="left">Teclado</td>
  111 + <td class="opcao_tabela" align="left">Descrição:</td>
  112 + <td class="opcao_tabela" align="left"><b><? echo mysql_result($result, 0, "te_teclado_desc"); ?></b></td>
96 113 </tr>
97   - <? echo $linha;
98   - $strCor = ($strCor==''?'#CCCCFF':'');
99   - ?>
100 114  
101   - <tr bgcolor="<? echo $strCor;?>">
102   - <td>&nbsp;</td>
103   - <td class="opcao_tabela">Mem. da Placa de V&iacute;deo:</td>
104   - <td class="dado"><? echo mysql_result($result, 0, "qt_placa_video_mem").' MB'; ?></td>
105   - </tr>
106   - <? echo $linha;
107   - $strCor = ($strCor==''?'#CCCCFF':'');
  115 +
  116 + <?
  117 + echo $linha;
  118 + $strCor = ($strCor==''?$strPreenchimentoPadrao:'');
108 119 ?>
109   -
110 120 <tr bgcolor="<? echo $strCor;?>">
111   - <td>&nbsp;</td>
112   - <td class="opcao_tabela">Mem&oacute;ria RAM:</td>
113   - <td class="dado"><? echo mysql_result($result, 0, 'qt_mem_ram').' MB'; ?></td>
114   - </tr>
115   - <? echo $linha;
116   - $strCor = ($strCor==''?'#CCCCFF':'');
117   - ?>
  121 + <td>&nbsp;</td>
  122 + <td class="OPCAO_TABELA" align="left">Mouse</td>
  123 + <td class="opcao_tabela" align="left">Descrição:</td>
  124 + <td class="opcao_tabela" align="left"><b><? echo mysql_result($result, 0, "te_mouse_desc"); ?></b></td>
  125 + </tr>
118 126  
119   - <tr bgcolor="<? echo $strCor;?>">
120   - <td>&nbsp;</td>
121   - <td class="opcao_tabela">Detalhes da Mem&oacute;ria RAM:</td>
122   - <td class="dado"><? echo mysql_result($result, 0, "te_mem_ram_desc"); ?></td>
123   - </tr>
124   - <? echo $linha;
125   - $strCor = ($strCor==''?'#CCCCFF':'');
  127 + <?
  128 + echo $linha;
  129 + $strCor = ($strCor==''?$strPreenchimentoPadrao:'');
126 130 ?>
127   -
128 131 <tr bgcolor="<? echo $strCor;?>">
129 132 <td>&nbsp;</td>
130   - <td class="opcao_tabela">Descri&ccedil;&atilde;o da BIOS:</td>
131   - <td class="dado"><? echo mysql_result($result, 0, "te_bios_desc"); ?></td>
  133 + <td class="opcao_tabela" align="left">Modem</td>
  134 + <td class="opcao_tabela" align="left">Descrição:</td>
  135 + <td class="opcao_tabela" align="left"><b><? echo mysql_result($result, 0, "te_modem_desc"); ?></b></td>
132 136 </tr>
133   - <? echo $linha;
134   - $strCor = ($strCor==''?'#CCCCFF':'');
135   - ?>
136 137  
  138 + <?
  139 + echo $linha;
  140 + $strCor = ($strCor==''?$strPreenchimentoPadrao:'');
  141 + ?>
137 142 <tr bgcolor="<? echo $strCor;?>">
138 143 <td>&nbsp;</td>
139   - <td class="opcao_tabela">Fabricante da BIOS:</td>
140   - <td class="dado"><? echo mysql_result($result, 0, "te_bios_fabricante"); ?></td>
141   - </tr>
142   - <? echo $linha;
143   - $strCor = ($strCor==''?'#CCCCFF':'');
144   - ?>
145   -
  144 + <td class="opcao_tabela" align="left">Placa de Som</td>
  145 + <td class="opcao_tabela" align="left">Descrição:</td>
  146 + <td class="opcao_tabela" align="left"><b><? echo mysql_result($result, 0, "te_placa_som_desc"); ?></b></td>
  147 + </tr>
  148 + <?
  149 + $strCor = ($strCor==''?$strPreenchimentoPadrao:'');
  150 + echo $linha;
  151 + ?>
146 152 <tr bgcolor="<? echo $strCor;?>">
147   - <td>&nbsp;</td>
148   - <td class="opcao_tabela">Placa de Som:</td>
149   - <td class="dado"><? echo mysql_result($result, 0, "te_placa_som_desc"); ?></td>
  153 + <td></td>
  154 + <td class="opcao_tabela" align="left">Placa de V&iacute;deo</td>
  155 + <td class="opcao_tabela" align="left">Descrição:</td>
  156 + <td class="opcao_tabela" align="left"><b><? echo mysql_result($result, 0, "te_placa_video_desc"); ?></b></td>
150 157 </tr>
151   - <? echo $linha;
152   - $strCor = ($strCor==''?'#CCCCFF':'');
  158 + <?
  159 + $strCor = ($strCor==''?$strPreenchimentoPadrao:'');
153 160 ?>
154   -
155 161 <tr bgcolor="<? echo $strCor;?>">
156   - <td>&nbsp;</td>
157   - <td class="opcao_tabela">Modem:</td>
158   - <td class="dado"><? echo mysql_result($result, 0, "te_modem_desc"); ?></td>
  162 + <td colspan="2"></td>
  163 + <td class="opcao_tabela" align="left">Quantidade de Cores:</td>
  164 + <td class="opcao_tabela" align="left"><b><? echo mysql_result($result, 0, "qt_placa_video_cores"); ?></b></td>
159 165 </tr>
160   - <? echo $linha;
161   - $strCor = ($strCor==''?'#CCCCFF':'');
  166 + <?
  167 + $strCor = ($strCor==''?$strPreenchimentoPadrao:'');
162 168 ?>
163 169  
164 170 <tr bgcolor="<? echo $strCor;?>">
165   - <td>&nbsp;</td>
166   - <td class="opcao_tabela">Teclado:</td>
167   - <td class="dado"><? echo mysql_result($result, 0, "te_teclado_desc"); ?></td>
  171 + <td colspan="2"></td>
  172 + <td class="opcao_tabela" align="left">Resolu&ccedil;&atilde;o:</td>
  173 + <td class="opcao_tabela" align="left"><b><? echo mysql_result($result, 0, "te_placa_video_resolucao"); ?></b></td>
168 174 </tr>
169   - <? echo $linha;
170   - $strCor = ($strCor==''?'#CCCCFF':'');
  175 + <?
  176 + $strCor = ($strCor==''?$strPreenchimentoPadrao:'');
171 177 ?>
172 178  
173 179 <tr bgcolor="<? echo $strCor;?>">
174   - <td>&nbsp;</td>
175   - <td class="opcao_tabela">Mouse:</td>
176   - <td class="dado"><? echo mysql_result($result, 0, "te_mouse_desc"); ?></td>
177   - </tr>
178   - <?
179   - echo $linha;
180   - $strCor = ($strCor==''?'#CCCCFF':'');
181   -
182   - conecta_bd_cacic();
183   - // Consulto lista de colunas de hardware
184   - $queryDescricoesColunas = "SELECT nm_campo,
185   - te_descricao_campo
186   - FROM descricoes_colunas_computadores";
187   - $resultDescricoesColunas = mysql_query($queryDescricoesColunas) or die('Ocorreu um erro durante a consulta à tabela descricoes_colunas_computadores.');
188   -
189   - // Crio um array que conterá nm_campo => te_descricao_campo.
190   - $arrDescricoesColunas = array();
191   - while($rowColunasComputadores = mysql_fetch_array($resultDescricoesColunas))
192   - $arrDescricoesColunas[trim($rowColunasComputadores['nm_campo'])] = $rowColunasComputadores['te_descricao_campo'];
  180 + <td colspan="2"></td>
  181 + <td class="opcao_tabela" align="left">Quantidade de Mem&oacute;ria:</td>
  182 + <td class="opcao_tabela" align="left"><b><? echo mysql_result($result, 0, "qt_placa_video_mem").' MB'; ?></b></td>
  183 + </tr>
  184 + <?
  185 + echo $linha;
  186 + // Obtenho os nomes do hardware passível de controle
  187 + $arrDescricoesColunasComputadores = getDescricoesColunasComputadores();
193 188  
194 189 $strQueryTotalizaGeralExistentes = ' SELECT cs_tipo_componente,
195 190 te_valor
... ... @@ -203,33 +198,53 @@ else
203 198 $intSequencial = 0;
204 199 while ($rowTotalizaGeralExistentes = mysql_fetch_array($resultTotalizaGeralExistentes))
205 200 {
206   - if ($strComponenteAtual <> $rowTotalizaGeralExistentes['te_valor'])
  201 + if ($strComponenteAtual <> $rowTotalizaGeralExistentes['cs_tipo_componente'])
207 202 {
208   - $strComponenteAtual = $rowTotalizaGeralExistentes['te_valor'];
209   - ?>
210   - <tr bgcolor="<? echo $strCor;?>">
211   - <?
  203 + $strComponenteAtual = $rowTotalizaGeralExistentes['cs_tipo_componente'];
  204 + $intSequencial = 1;
212 205 }
  206 + else
  207 + $intSequencial ++;
213 208  
214 209 $arrColunasValores = explode('#FIELD#',$rowTotalizaGeralExistentes['te_valor']);
215 210 for ($i=0; $i<count($arrColunasValores);$i++)
216 211 {
217   - $arrColunas = explode('###',$arrColunasValores[$i]);?>
  212 + $arrColunas = explode('###',$arrColunasValores[$i]);
  213 + $strCor = ($strCor==''?$strPreenchimentoPadrao:'');
  214 + ?>
  215 + <tr bgcolor="<? echo $strCor;?>">
218 216 <td>&nbsp;</td>
219   - <td class="opcao_tabela"><? echo $arrDescricoesColunas[$arrColunas[0]];?>:</td>
220   - <td class="dado"><? echo $arrColunas[1]; ?></td>
  217 + <?
  218 + if ($i > 0)
  219 + {
  220 + ?>
  221 + <td>&nbsp;</td>
  222 + <?
  223 + }
  224 + ?>
  225 + <td class="opcao_tabela"><? echo $arrDescricoesColunasComputadores[$arrColunas[0]].($i==0?' '.$intSequencial:':');?></td>
  226 + <?
  227 + if ($i == 0)
  228 + {
  229 + ?>
  230 + <td class="opcao_tabela"><? echo 'Descrição:';?></td>
  231 + <?
  232 + }
  233 + ?>
  234 + <td class="dado" colspan="3"><? echo $arrColunas[1]; ?></td>
221 235 </tr>
222 236 <?
223 237 }
  238 + echo $linha;
224 239 }
225   - echo $linha;
226   - $strCor = ($strCor==''?'#CCCCFF':'');
  240 +
  241 + $strCor = ($strCor==''?$strPreenchimentoPadrao:'');
227 242 ?>
228 243 <tr>
229 244 <td>&nbsp;</td>
230   - <td colspan="2"> <form action="historico.php" method="post" name="form1" target="_blank">
  245 + <td colspan="4"> <form action="historico.php" method="post" name="form1" target="_blank">
231 246 <div align="center"><br>
232   - <input name=historico_hardware type=submit id=historico_hardware value="Hist&oacute;rico de Altera&ccedil;&otilde;es na Configura&ccedil;&atilde;o de Hardware" >
  247 + <input name="historico_hardware" type=submit id="historico_hardware" value="Hist&oacute;rico de Altera&ccedil;&otilde;es na Configura&ccedil;&atilde;o de Hardware" >
233 248 <br>
234 249 &nbsp;
235 250 <input name="te_node_address" type="hidden" id="te_node_address" value="<? echo mysql_result($result, 0, "te_node_address");?>">
... ...
relatorios/computador/inc_officescan.php
... ... @@ -17,23 +17,17 @@
17 17 if (!$_SESSION['officescan'])
18 18 $_SESSION['officescan'] = false;
19 19 if ($exibir == 'officescan')
20   - {
21 20 $_SESSION['officescan'] = !($_SESSION['officescan']);
22   - }
23 21 else
24   - {
25 22 $_SESSION['officescan'] = false;
26   - }
  23 +
27 24 $strCor = '';
28   -$strCor = ($strCor==''?'#CCCCFF':'');
  25 +$strCor = ($strCor==''?$strPreenchimentoPadrao:'');
29 26  
30 27 ?>
31 28 <table width="94%" border="0" align="center" cellpadding="0" cellspacing="1">
32 29 <tr>
33   - <td colspan="5"> </td>
34   - </tr>
35   - <tr>
36   - <td colspan="5" height="1" bgcolor="#333333"></td>
  30 + <td colspan="5" bgcolor="#333333" height="1"></td>
37 31 </tr>
38 32 <tr>
39 33 <td colspan="5" bgcolor="#E1E1E1" class="cabecalho_tabela">&nbsp; <a href="computador.php?exibir=officescan&te_node_address=<? echo $_GET['te_node_address']?>&id_so=<? echo $_GET['id_so']?>">
... ... @@ -42,11 +36,14 @@ $strCor = ($strCor==&#39;&#39;?&#39;#CCCCFF&#39;:&#39;&#39;);
42 36 OfficeScan</a></td>
43 37 </tr>
44 38 <tr>
45   - <td colspan="5" height="1" bgcolor="#333333"></td>
  39 + <td colspan="5" bgcolor="#333333" height="1"></td>
46 40 </tr>
  41 +
47 42 <?
48   - if ($_SESSION['officescan'] == true) {
49   - // EXIBIR INFORMAÇÕES DO OFFICESCAN DO COMPUTADOR
  43 +
  44 + if ($_SESSION['officescan'] == true)
  45 + {
  46 + // EXIBIR INFORMAÇÕES DO OFFICESCAN DO COMPUTADOR
50 47 $query = "SELECT cs_situacao
51 48 FROM acoes_redes
52 49 WHERE id_acao = 'cs_coleta_officescan' AND
... ... @@ -69,7 +66,7 @@ $strCor = ($strCor==&#39;&#39;?&#39;#CCCCFF&#39;:&#39;&#39;);
69 66 <td class="dado"><div align="left"><? echo mysql_result($result_officescan, 0, "te_servidor"); ?>&nbsp;</div></td>
70 67 </tr>
71 68 <? echo $linha;
72   - $strCor = ($strCor==''?'#CCCCFF':'');
  69 + $strCor = ($strCor==''?$strPreenchimentoPadrao:'');
73 70 ?>
74 71  
75 72 <tr bgcolor="<? echo $strCor;?>">
... ... @@ -80,7 +77,7 @@ $strCor = ($strCor==&#39;&#39;?&#39;#CCCCFF&#39;:&#39;&#39;);
80 77 <td class="dado"><? echo date("d/m/Y à\s H:i\h", strtotime(mysql_result($result_officescan, 0, "dt_hr_instalacao"))); ?></td>
81 78 </tr>
82 79 <? echo $linha;
83   - $strCor = ($strCor==''?'#CCCCFF':'');
  80 + $strCor = ($strCor==''?$strPreenchimentoPadrao:'');
84 81 ?>
85 82  
86 83 <tr bgcolor="<? echo $strCor;?>">
... ... @@ -96,10 +93,6 @@ $strCor = ($strCor==&#39;&#39;?&#39;#CCCCFF&#39;:&#39;&#39;);
96 93 <td class="opcao_tabela">Data da &Uacute;ltima Coleta:</td>
97 94 <td class="dado"><? echo date("d/m/Y à\s H:i\h", strtotime(mysql_result($result_officescan, 0, "dt_hr_coleta"))); ?></td>
98 95 </tr>
99   - <? echo $linha?>
100   - <tr>
101   - <td colspan="5">&nbsp;</td>
102   - </tr>
103 96 <?
104 97 }
105 98 else {
... ... @@ -126,4 +119,5 @@ $strCor = ($strCor==&#39;&#39;?&#39;#CCCCFF&#39;:&#39;&#39;);
126 119 }
127 120 // FIM DA EXIBIÇÃO DE INFORMAÇÕES DO OFFICESCAN DO COMPUTADOR
128 121 ?>
  122 +
129 123 </table>
... ...
relatorios/computador/inc_patrimonio.php
... ... @@ -17,22 +17,16 @@
17 17 if (!$_SESSION['patrimonio'])
18 18 $_SESSION['patrimonio'] = false;
19 19 if ($exibir == 'patrimonio')
20   - {
21 20 $_SESSION['patrimonio'] = !($_SESSION['patrimonio']);
22   - }
23 21 else
24   - {
25 22 $_SESSION['patrimonio'] = false;
26   - }
  23 +
27 24 $strCor = '';
28   -$strCor = ($strCor==''?'#CCCCFF':'');
  25 +$strCor = ($strCor==''?$strPreenchimentoPadrao:'');
29 26  
30 27 ?>
31 28 <table width="94%" border="0" align="center" cellpadding="0" cellspacing="1">
32 29 <tr>
33   - <td colspan="5"> </td>
34   - </tr>
35   - <tr>
36 30 <td colspan="5" height="1" bgcolor="#333333"></td>
37 31 </tr>
38 32 <tr>
... ... @@ -93,7 +87,7 @@ $strCor = ($strCor==&#39;&#39;?&#39;#CCCCFF&#39;:&#39;&#39;);
93 87 <td colspan="3" class="dado"><? echo mysql_result($result_patrimonio, 0, "nm_unid_organizacional_nivel1"); ?></td>
94 88 </tr>
95 89 <? echo $linha;
96   - $strCor = ($strCor==''?'#CCCCFF':'');
  90 + $strCor = ($strCor==''?$strPreenchimentoPadrao:'');
97 91 ?>
98 92 <tr bgcolor="<? echo $strCor;?>">
99 93 <td>&nbsp;</td>
... ... @@ -102,7 +96,7 @@ $strCor = ($strCor==&#39;&#39;?&#39;#CCCCFF&#39;:&#39;&#39;);
102 96 </tr>
103 97  
104 98 <? echo $linha;
105   - $strCor = ($strCor==''?'#CCCCFF':'');
  99 + $strCor = ($strCor==''?$strPreenchimentoPadrao:'');
106 100 ?>
107 101 <tr bgcolor="<? echo $strCor;?>">
108 102 <td>&nbsp;</td>
... ... @@ -110,7 +104,7 @@ $strCor = ($strCor==&#39;&#39;?&#39;#CCCCFF&#39;:&#39;&#39;);
110 104 <td colspan="3" class="dado"><? echo mysql_result($result_patrimonio, 0, 'nm_unid_organizacional_nivel2'); ?></td>
111 105 </tr>
112 106 <? echo $linha;
113   - $strCor = ($strCor==''?'#CCCCFF':'');
  107 + $strCor = ($strCor==''?$strPreenchimentoPadrao:'');
114 108 ?>
115 109 <tr bgcolor="<? echo $strCor;?>">
116 110 <td>&nbsp;</td>
... ... @@ -118,7 +112,7 @@ $strCor = ($strCor==&#39;&#39;?&#39;#CCCCFF&#39;:&#39;&#39;);
118 112 <td colspan="3" class="dado"><? echo mysql_result($result_patrimonio, 0, "te_localizacao_complementar"); ?></td>
119 113 </tr>
120 114 <? echo $linha;
121   - $strCor = ($strCor==''?'#CCCCFF':'');
  115 + $strCor = ($strCor==''?$strPreenchimentoPadrao:'');
122 116 ?>
123 117 <tr bgcolor="<? echo $strCor;?>">
124 118 <td>&nbsp;</td>
... ... @@ -126,7 +120,7 @@ $strCor = ($strCor==&#39;&#39;?&#39;#CCCCFF&#39;:&#39;&#39;);
126 120 <td class="dado" colspan="3"><? echo date('d/m/Y H:i', strtotime(mysql_result($result_patrimonio, 0, 'dt_hr_alteracao'))); ?></td>
127 121 </tr>
128 122 <? echo $linha;
129   - $strCor = ($strCor==''?'#CCCCFF':'');
  123 + $strCor = ($strCor==''?$strPreenchimentoPadrao:'');
130 124 ?>
131 125 <tr>
132 126 <td colspan="5" height="1" bgcolor="#333333"></td>
... ... @@ -142,8 +136,9 @@ $strCor = ($strCor==&#39;&#39;?&#39;#CCCCFF&#39;:&#39;&#39;);
142 136 ?></td>
143 137 <td class="dado" colspan="3"><? if ($var_aux) { echo mysql_result($result_patrimonio, 0, 'te_info_patrimonio1') ; } ?></td>
144 138 </tr>
145   - <?
146   - $strCor = ($strCor==''?'#CCCCFF':'');
  139 + <?
  140 + echo $linha;
  141 + $strCor = ($strCor==''?$strPreenchimentoPadrao:'');
147 142 ?>
148 143 <tr bgcolor="<? echo $strCor;?>">
149 144 <td>&nbsp;</td>
... ... @@ -155,7 +150,8 @@ $strCor = ($strCor==&#39;&#39;?&#39;#CCCCFF&#39;:&#39;&#39;);
155 150 <? if ($var_aux) { echo mysql_result($result_patrimonio, 0, 'te_info_patrimonio2'); } ?> </td>
156 151 </tr>
157 152 <?
158   - $strCor = ($strCor==''?'#CCCCFF':'');
  153 + echo $linha;
  154 + $strCor = ($strCor==''?$strPreenchimentoPadrao:'');
159 155 ?>
160 156 <tr bgcolor="<? echo $strCor;?>">
161 157 <td class="opcao_tabela">&nbsp;</td>
... ... @@ -167,7 +163,8 @@ $strCor = ($strCor==&#39;&#39;?&#39;#CCCCFF&#39;:&#39;&#39;);
167 163 <td class="dado" colspan="3"><? if ($var_aux) { echo mysql_result($result_patrimonio, 0, 'te_info_patrimonio3'); } ?></td>
168 164 </tr>
169 165 <?
170   - $strCor = ($strCor==''?'#CCCCFF':'');
  166 + echo $linha;
  167 + $strCor = ($strCor==''?$strPreenchimentoPadrao:'');
171 168 ?>
172 169  
173 170 <tr bgcolor="<? echo $strCor;?>">
... ... @@ -180,7 +177,8 @@ $strCor = ($strCor==&#39;&#39;?&#39;#CCCCFF&#39;:&#39;&#39;);
180 177 <? if ($var_aux) { echo mysql_result($result_patrimonio, 0, 'te_info_patrimonio4'); } ?> </td>
181 178 </tr>
182 179 <?
183   - $strCor = ($strCor==''?'#CCCCFF':'');
  180 + echo $linha;
  181 + $strCor = ($strCor==''?$strPreenchimentoPadrao:'');
184 182 ?>
185 183 <tr bgcolor="<? echo $strCor;?>">
186 184 <td>&nbsp;</td>
... ... @@ -192,7 +190,8 @@ $strCor = ($strCor==&#39;&#39;?&#39;#CCCCFF&#39;:&#39;&#39;);
192 190 <td>&nbsp;</td>
193 191 </tr>
194 192 <?
195   - $strCor = ($strCor==''?'#CCCCFF':'');
  193 + echo $linha;
  194 + $strCor = ($strCor==''?$strPreenchimentoPadrao:'');
196 195 ?>
197 196  
198 197 <tr bgcolor="<? echo $strCor;?>">
... ... @@ -205,7 +204,8 @@ $strCor = ($strCor==&#39;&#39;?&#39;#CCCCFF&#39;:&#39;&#39;);
205 204 <? if ($var_aux) { echo mysql_result($result_patrimonio, 0, 'te_info_patrimonio6'); } ?> </td>
206 205 </tr>
207 206 <?
208   - $strCor = ($strCor==''?'#CCCCFF':'');
  207 + echo $linha;
  208 + $strCor = ($strCor==''?$strPreenchimentoPadrao:'');
209 209 ?>
210 210 <tr>
211 211 <td>&nbsp;</td>
... ...
relatorios/computador/inc_sistemas_monitorados.php
... ... @@ -47,7 +47,7 @@ else
47 47 <?
48 48 if ($_SESSION['aplicativo_monitorado'] == true)
49 49 {
50   - $linha = ' <tr bgcolor="#e7e7e7">
  50 + $linha = ' <tr bgcolor="'.$strCorDaLinha.'">
51 51 <td height="1" colspan="6"></td>
52 52 </tr>';
53 53  
... ... @@ -90,7 +90,7 @@ if ($_SESSION[&#39;aplicativo_monitorado&#39;] == true)
90 90 while ($row = mysql_fetch_array($result_software))
91 91 {
92 92 $v_achei = 1;
93   - $strCor = ($strCor==''?'#CCCCFF':'');
  93 + $strCor = ($strCor==''?$strPreenchimentoPadrao:'');
94 94 ?>
95 95 <tr bgcolor="<? echo $strCor;?>">
96 96 <td class="descricao">&nbsp;<? echo $row['nm_aplicativo']; ?></td>
... ...
relatorios/computador/inc_software.php
... ... @@ -17,128 +17,117 @@
17 17 if (!$_SESSION['software'])
18 18 $_SESSION['software'] = false;
19 19 if ($exibir == 'software')
20   - {
21 20 $_SESSION['software'] = !($_SESSION['software']);
22   - }
23 21 else
24   - {
25 22 $_SESSION['software'] = false;
26   - }
27 23 $strCor = '';
28   -$strCor = ($strCor==''?'#CCCCFF':'');
  24 +$strCor = ($strCor==''?$strPreenchimentoPadrao:'');
29 25  
30 26 ?>
31 27 <table width="94%" border="0" align="center" cellpadding="0" cellspacing="1">
32   - <tr>
33   - <td colspan="5" height="1" bgcolor="#333333"></td>
34   - </tr>
35   - <tr bgcolor="#E1E1E1">
36   - <td colspan="5" class="cabecalho_tabela">&nbsp;<a href="computador.php?exibir=software&te_node_address=<? echo $_GET['te_node_address']?>&id_so=<? echo $_GET['id_so']?>">
37   - <img src="../../imgs/<? if($_SESSION['software'] == true) echo 'menos';
38   - else echo 'mais'; ?>.gif" width="12" height="12" border="0"> Vers&otilde;es
39   - de Softwares B&aacute;sicos</a></td>
40   - </tr>
41   - <tr>
42   - <td colspan="5" height="1" bgcolor="#333333"></td>
43   - </tr>
44   - <?
45   - if ($_SESSION['software'] == true) {
46   - // EXIBIR INFORMAÇÕES DE SOFTWARE DO COMPUTADOR
47   - $query = "SELECT cs_situacao
48   - FROM acoes_redes
49   - WHERE id_acao = 'cs_coleta_software' AND
50   - id_ip_rede = '".mysql_result($result,0,'id_ip_rede')."'";
51   - $result_acoes = mysql_query($query);
52   -
53   - if (mysql_result($result_acoes, 0, "cs_situacao") <> 'N') {
54   - $query = "SELECT * FROM versoes_softwares
55   - WHERE te_node_address = '".$_GET['te_node_address']."' AND
56   - id_so = '". $_GET['id_so'] ."'";
57   - $result_software = mysql_query($query);
58   - if(mysql_num_rows($result_software) > 0) {
59   - ?>
60   - <tr bgcolor="<? echo $strCor;?>">
61   - <td>&nbsp;</td>
62   - <td class="opcao_tabela">Sistema Operacional:</td>
63   - <td class="dado"><? echo mysql_result($result, 0, "te_desc_so"); ?></td>
64   - <td class="opcao_tabela">Vers&atilde;o do DirectX:</td>
65   - <td class="dado"><? echo mysql_result($result_software, 0, "te_versao_directx"); ?></td>
66   - </tr>
67   - <? echo $linha;
68   - $strCor = ($strCor==''?'#CCCCFF':'');
69   - ?>
70   -
71   - <tr bgcolor="<? echo $strCor;?>">
72   - <td>&nbsp;</td>
73   - <td class="opcao_tabela">Vers&atilde;o do Internet Explorer:</td>
74   - <td class="dado"><? echo mysql_result($result_software, 0, "te_versao_ie"); ?></td>
75   - <td class="opcao_tabela">Vers&atilde;o do ODBC:</td>
76   - <td class="dado"><? echo mysql_result($result_software, 0, "te_versao_odbc"); ?></td>
77   - </tr>
78   - <? echo $linha;
79   - $strCor = ($strCor==''?'#CCCCFF':'');
80   - ?>
  28 +<tr><td colspan="5" height="1" bgcolor="#333333"></td></tr>
  29 +<tr>
  30 +<td bgcolor="#E1E1E1" colspan="5" class="cabecalho_tabela">&nbsp;<a href="computador.php?exibir=software&te_node_address=<? echo $_GET['te_node_address']?>&id_so=<? echo $_GET['id_so']?>">
  31 +<img src="../../imgs/<?
  32 +if($_SESSION['software'] == true)
  33 + echo 'menos';
  34 +else
  35 + echo 'mais'; ?>.gif" width="12" height="12" border="0"> Vers&otilde;es de Softwares B&aacute;sicos</a></td>
  36 +</tr>
  37 +<tr><td colspan="5" height="1" bgcolor="#333333"></td></tr>
  38 +<?
81 39  
82   - <tr bgcolor="<? echo $strCor;?>">
83   - <td>&nbsp;</td>
84   - <td class="opcao_tabela">Vers&atilde;o do Mozilla:</td>
85   - <td class="dado"><div align="left"><? echo mysql_result($result_software, 0, "te_versao_mozilla"); ?></div></td>
86   - <td class="opcao_tabela">Vers&atilde;o do DAO:</td>
87   - <td class="dado"><? echo mysql_result($result_software, 0, "te_versao_dao"); ?></td>
88   - </tr>
89   - <? echo $linha;
90   - $strCor = ($strCor==''?'#CCCCFF':'');
91   - ?>
92 40  
93   - <tr bgcolor="<? echo $strCor;?>">
94   - <td>&nbsp;</td>
95   - <td class="opcao_tabela">Vers&atilde;o do Acrobat Reader:</td>
96   - <td class="dado"><? echo mysql_result($result_software, 0, "te_versao_acrobat_reader"); ?></td>
97   - <td class="opcao_tabela">Vers&atilde;o do ADO:</td>
98   - <td class="dado"><? echo mysql_result($result_software, 0, "te_versao_ado"); ?></td>
99   - </tr>
100   - <? echo $linha;
101   - $strCor = ($strCor==''?'#CCCCFF':'');
102   - ?>
103   -
104   - <tr bgcolor="<? echo $strCor;?>">
105   - <td>&nbsp;</td>
106   - <td class="opcao_tabela">Vers&atilde;o do Java Runtime (JVM):</td>
107   - <td class="dado"><? echo mysql_result($result_software, 0, "te_versao_jre"); ?></td>
108   - <td>Vers&atilde;o do BDE:</td>
109   - <td class="dado"><? echo mysql_result($result_software, 0, "te_versao_bde"); ?></td>
110   - </tr>
111   - <? echo $linha;
112   - $strCor = ($strCor==''?'#CCCCFF':'');
113   - ?>
114   -
115   - <tr>
116   - <td>&nbsp;</td>
117   - <td colspan="4">&nbsp; </td>
118   - </tr>
119   - <?
120   - }
121   - else {
122   - echo '<tr><td>
123   - <p>
124   - <div align="center">
125   - <br>
126   - <font font size="2" face="Verdana, Arial, Helvetica, sans-serif" color="#FF0000">
127   - Não foram coletadas informações de software referente a esta máquina
128   - </font></div>
129   - </p>
130   - </td></tr>';
131   - }
  41 +if ($_SESSION['software'] == true)
  42 + {
  43 + // EXIBIR INFORMAÇÕES DE SOFTWARE DO COMPUTADOR
  44 + $query = "SELECT cs_situacao
  45 + FROM acoes_redes
  46 + WHERE id_acao = 'cs_coleta_software' AND
  47 + id_ip_rede = '".mysql_result($result,0,'id_ip_rede')."'";
  48 + $result_acoes = mysql_query($query);
  49 +
  50 + if (mysql_result($result_acoes, 0, "cs_situacao") <> 'N')
  51 + {
  52 + $query = "SELECT * FROM versoes_softwares
  53 + WHERE te_node_address = '".$_GET['te_node_address']."' AND
  54 + id_so = '". $_GET['id_so'] ."'";
  55 + $result_software = mysql_query($query);
  56 + if(mysql_num_rows($result_software) > 0)
  57 + {
  58 + ?>
  59 + <tr bgcolor="<? echo $strCor;?>">
  60 + <td>&nbsp;</td>
  61 + <td class="opcao_tabela">Sistema Operacional:</td>
  62 + <td class="dado"><? echo mysql_result($result, 0, "te_desc_so"); ?></td>
  63 + <td class="opcao_tabela">Vers&atilde;o do DirectX:</td>
  64 + <td class="dado"><? echo mysql_result($result_software, 0, "te_versao_directx"); ?></td>
  65 + </tr>
  66 + <? echo $linha;
  67 + $strCor = ($strCor==''?$strPreenchimentoPadrao:'');
  68 + ?>
  69 + <tr bgcolor="<? echo $strCor;?>">
  70 + <td>&nbsp;</td>
  71 + <td class="opcao_tabela">Vers&atilde;o do Internet Explorer:</td>
  72 + <td class="dado"><? echo mysql_result($result_software, 0, "te_versao_ie"); ?></td>
  73 + <td class="opcao_tabela">Vers&atilde;o do ODBC:</td>
  74 + <td class="dado"><? echo mysql_result($result_software, 0, "te_versao_odbc"); ?></td>
  75 + </tr>
  76 + <? echo $linha;
  77 + $strCor = ($strCor==''?$strPreenchimentoPadrao:'');
  78 + ?>
  79 + <tr bgcolor="<? echo $strCor;?>">
  80 + <td>&nbsp;</td>
  81 + <td class="opcao_tabela">Vers&atilde;o do Mozilla:</td>
  82 + <td class="dado"><div align="left"><? echo mysql_result($result_software, 0, "te_versao_mozilla"); ?></div></td>
  83 + <td class="opcao_tabela">Vers&atilde;o do DAO:</td>
  84 + <td class="dado"><? echo mysql_result($result_software, 0, "te_versao_dao"); ?></td>
  85 + </tr>
  86 + <? echo $linha;
  87 + $strCor = ($strCor==''?$strPreenchimentoPadrao:'');
  88 + ?>
  89 + <tr bgcolor="<? echo $strCor;?>">
  90 + <td>&nbsp;</td>
  91 + <td class="opcao_tabela">Vers&atilde;o do Acrobat Reader:</td>
  92 + <td class="dado"><? echo mysql_result($result_software, 0, "te_versao_acrobat_reader"); ?></td>
  93 + <td class="opcao_tabela">Vers&atilde;o do ADO:</td>
  94 + <td class="dado"><? echo mysql_result($result_software, 0, "te_versao_ado"); ?></td>
  95 + </tr>
  96 + <? echo $linha;
  97 + $strCor = ($strCor==''?$strPreenchimentoPadrao:'');
  98 + ?>
  99 + <tr bgcolor="<? echo $strCor;?>">
  100 + <td>&nbsp;</td>
  101 + <td class="opcao_tabela">Vers&atilde;o do Java Runtime (JVM):</td>
  102 + <td class="dado"><? echo mysql_result($result_software, 0, "te_versao_jre"); ?></td>
  103 + <td>Vers&atilde;o do BDE:</td>
  104 + <td class="dado"><? echo mysql_result($result_software, 0, "te_versao_bde"); ?></td>
  105 + </tr>
  106 + <?
132 107 }
133   - else {
134   - echo '<tr><td>
135   - <div align="center">
136   - <font font size="2" face="Verdana, Arial, Helvetica, sans-serif" color="#FF0000">
137   - O módulo de Coleta de Informações de Software não foi habilitado pelo Administrador do CACIC.
138   - </font></div>
139   - </td></tr>';
  108 + else
  109 + {
  110 + echo ' <tr><td>
  111 + <p>
  112 + <div align="center">
  113 + <br>
  114 + <font font size="2" face="Verdana, Arial, Helvetica, sans-serif" color="#FF0000">
  115 + Não foram coletadas informações de software referente a esta máquina
  116 + </font></div>
  117 + </p>
  118 + </td></tr>';
140 119 }
141 120 }
142   - // FIM DA EXIBIÇÃO DE INFORMAÇÕES DE SOFTWARE DO COMPUTADOR
143   - ?>
  121 + else
  122 + {
  123 + echo '<tr><td>
  124 + <div align="center">
  125 + <font font size="2" face="Verdana, Arial, Helvetica, sans-serif" color="#FF0000">
  126 + O módulo de Coleta de Informações de Software não foi habilitado pelo Administrador do CACIC.
  127 + </font></div>
  128 + </td></tr>';
  129 + }
  130 + }
  131 + // FIM DA EXIBIÇÃO DE INFORMAÇÕES DE SOFTWARE DO COMPUTADOR
  132 + ?>
144 133 </table>
... ...
relatorios/computador/inc_software_inventariado.php
... ... @@ -62,7 +62,7 @@ else
62 62 $strCor = '';
63 63 while ($row = mysql_fetch_array($result_software))
64 64 {
65   - $strCor = ($strCor==''?'#CCCCFF':'');
  65 + $strCor = ($strCor==''?$strPreenchimentoPadrao:'');
66 66  
67 67 $v_achei = 1;
68 68 $intContaItem ++;
... ...
relatorios/computador/inc_tcp_ip.php
... ... @@ -27,8 +27,10 @@ else
27 27 }
28 28  
29 29 $strCor = '';
30   -$strCor = ($strCor==''?'#CCCCFF':'');
31   -
  30 +$strCor = ($strCor==''?$strPreenchimentoPadrao:'');
  31 +$linha = '<tr bgcolor="'.$strCorDaLinha.'">
  32 + <td height="1" colspan="5"></td>
  33 + </tr>';
32 34 ?>
33 35 <table width="94%" border="0" align="center" cellpadding="0" cellspacing="1">
34 36 <tr>
... ... @@ -38,7 +40,7 @@ $strCor = ($strCor==&#39;&#39;?&#39;#CCCCFF&#39;:&#39;&#39;);
38 40 <td colspan="5" bgcolor="#E1E1E1" class="cabecalho_tabela">&nbsp;<a href="computador.php?exibir=tcp_ip&te_node_address=<? echo $_GET['te_node_address']?>&id_so=<? echo $_GET['id_so']?>">
39 41 <img src="../../imgs/<? if($_SESSION['tcp_ip'] == true) echo 'menos';
40 42 else echo 'mais'; ?>.gif" width="12" height="12" border="0"> Protocolo
41   - TCP/IP</a></td>
  43 + TCP/IP (Configura&ccedil;&atilde;o Principal) </a></td>
42 44 </tr>
43 45 <tr>
44 46 <td colspan="5" height="1" bgcolor="#333333"></td>
... ... @@ -55,7 +57,7 @@ $strCor = ($strCor==&#39;&#39;?&#39;#CCCCFF&#39;:&#39;&#39;);
55 57 <td class="dado"><? echo mysql_result($result, 0, "te_wins_primario"); ?></td>
56 58 </tr>
57 59 <? echo $linha;
58   - $strCor = ($strCor==''?'#CCCCFF':'');
  60 + $strCor = ($strCor==''?$strPreenchimentoPadrao:'');
59 61 ?>
60 62  
61 63 <tr bgcolor="<? echo $strCor;?>">
... ... @@ -66,7 +68,7 @@ $strCor = ($strCor==&#39;&#39;?&#39;#CCCCFF&#39;:&#39;&#39;);
66 68 <td class="dado"><? echo mysql_result($result, 0, "te_wins_secundario"); ?></td>
67 69 </tr>
68 70 <? echo $linha;
69   - $strCor = ($strCor==''?'#CCCCFF':'');
  71 + $strCor = ($strCor==''?$strPreenchimentoPadrao:'');
70 72 ?>
71 73  
72 74 <tr bgcolor="<? echo $strCor;?>">
... ... @@ -77,7 +79,7 @@ $strCor = ($strCor==&#39;&#39;?&#39;#CCCCFF&#39;:&#39;&#39;);
77 79 <td class="dado"><? echo mysql_result($result, 0, "te_dns_primario"); ?></td>
78 80 </tr>
79 81 <? echo $linha;
80   - $strCor = ($strCor==''?'#CCCCFF':'');
  82 + $strCor = ($strCor==''?$strPreenchimentoPadrao:'');
81 83 ?>
82 84  
83 85 <tr bgcolor="<? echo $strCor;?>">
... ... @@ -88,7 +90,7 @@ $strCor = ($strCor==&#39;&#39;?&#39;#CCCCFF&#39;:&#39;&#39;);
88 90 <td class="dado"><? echo mysql_result($result, 0, "te_dns_secundario"); ?></td>
89 91 </tr>
90 92 <? echo $linha;
91   - $strCor = ($strCor==''?'#CCCCFF':'');
  93 + $strCor = ($strCor==''?$strPreenchimentoPadrao:'');
92 94 ?>
93 95  
94 96 <tr bgcolor="<? echo $strCor;?>">
... ... @@ -99,7 +101,7 @@ $strCor = ($strCor==&#39;&#39;?&#39;#CCCCFF&#39;:&#39;&#39;);
99 101 <td class="dado"><? echo mysql_result($result, 0, "te_serv_dhcp");?></td>
100 102 </tr>
101 103 <? echo $linha;
102   - $strCor = ($strCor==''?'#CCCCFF':'');
  104 + $strCor = ($strCor==''?$strPreenchimentoPadrao:'');
103 105 ?>
104 106  
105 107 <tr bgcolor="<? echo $strCor;?>">
... ...
relatorios/computador/inc_unidades_disco.php
... ... @@ -17,20 +17,13 @@
17 17 if (!$_SESSION['unidades_disco'])
18 18 $_SESSION['unidades_disco'] = false;
19 19 if ($exibir == 'unidades_disco')
20   - {
21 20 $_SESSION['unidades_disco'] = !($_SESSION['unidades_disco']);
22   - }
23 21 else
24   - {
25 22 $_SESSION['unidades_disco'] = false;
26   - }
27 23  
28 24 ?>
29 25 <table width="94%" border="0" align="center" cellpadding="0" cellspacing="1">
30 26 <tr>
31   - <td> </td>
32   - </tr>
33   - <tr>
34 27 <td height="1" bgcolor="#333333"></td>
35 28 </tr>
36 29 <tr>
... ... @@ -60,7 +53,7 @@ else
60 53 if(mysql_num_rows($result_disco) > 0) {
61 54 echo '<tr><td><br>
62 55 <table border="1" align="center" cellpadding="1" cellspacing="0" bordercolor="#999999" bordercolordark="#E1E1E1">
63   - <tr bgcolor="#FFFFCC">
  56 + <tr bgcolor="'.$strPreenchimentoPadrao.'">
64 57 <td nowrap rowspan="2" class="opcao_tabela"><div align="center">Letra</div></td>';
65 58 echo '<td nowrap rowspan="2" class="opcao_tabela"><div align="center">Sist. Arq.</div></td>
66 59 <td nowrap rowspan="2" class="opcao_tabela"><div align="center">Nº Serial</div></td>
... ... @@ -68,7 +61,7 @@ else
68 61 <td nowrap colspan="2" class="opcao_tabela"><div align="center">Espaço (MB)</div></td>
69 62 <td nowrap colspan="2" rowspan="2" class="opcao_tabela"><div align="center">Utilização (%)</div></td>
70 63 </tr>
71   - <tr bgcolor="#FFFFCC">
  64 + <tr bgcolor="'.$strPreenchimentoPadrao.'">
72 65 <td nowrap class="opcao_tabela"><div align="center">Utilizado</div></td>
73 66 <td nowrap class="opcao_tabela"><div align="center">Livre</div></td>
74 67 </tr>';
... ...
relatorios/computador/inc_variaveis_ambiente.php
... ... @@ -17,13 +17,9 @@
17 17 if (!$_SESSION['variavel_ambiente'])
18 18 $_SESSION['variavel_ambiente'] = false;
19 19 if ($exibir == 'variavel_ambiente')
20   - {
21 20 $_SESSION['variavel_ambiente'] = !($_SESSION['variavel_ambiente']);
22   - }
23 21 else
24   - {
25 22 $_SESSION['variavel_ambiente'] = false;
26   - }
27 23  
28 24 ?>
29 25 <table width="94%" border="0" align="center" cellpadding="0" cellspacing="1">
... ... @@ -65,7 +61,7 @@ else
65 61  
66 62 while ($row = @mysql_fetch_array($result_software))
67 63 {
68   - $strCor = ($strCor==''?'#CCCCFF':'');
  64 + $strCor = ($strCor==''?$strPreenchimentoPadrao:'');
69 65 $v_achei = 1;
70 66 $intContaItem ++;
71 67 ?>
... ...
relatorios/hardware/index.php
... ... @@ -16,6 +16,7 @@
16 16 // Essa variável é usada pelo arquivo de include selecao_redes_inc.php e inicio_relatorios_inc.php.
17 17 $id_acao = 'cs_coleta_hardware';
18 18 require_once('../../include/inicio_relatorios_inc.php');
  19 + require_once('../../include/library.php');
19 20 ?>
20 21  
21 22 <table width="90%" border="0" align="center">
... ... @@ -132,14 +133,19 @@
132 133 <td>&nbsp;</td>
133 134 <td> <div align="left">
134 135 <select multiple name="list5[]" size="10" class="normal" onFocus="SetaClassDigitacao(this);" onBlur="SetaClassNormal(this);" >
135   - <? $query = "SELECT nm_campo_tab_hardware, te_desc_hardware
  136 + <?
  137 + // Obtenho os nomes do hardware passível de controle
  138 + $arrDescricaoHardware = getDescricaoHardware();
  139 + /*
  140 + $query = "SELECT nm_campo_tab_hardware, te_desc_hardware
136 141 FROM descricao_hardware
137 142 ORDER BY te_desc_hardware";
138 143 $result_hardwares_selecionados = mysql_query($query) or die('Ocorreu um erro durante a consulta à tabela descricao_hardware ou sua sessão expirou!');
  144 + */
139 145 /* Agora monto os itens do combo de hardwares selecionadas. */
140   - while($campos_hardwares_selecionados=mysql_fetch_array($result_hardwares_selecionados)) {
141   - echo '<option value=", ' . $campos_hardwares_selecionados['nm_campo_tab_hardware'] . ' as &quot;' . $campos_hardwares_selecionados['te_desc_hardware'] . '&quot;">' . $campos_hardwares_selecionados['te_desc_hardware'] . '</option>';
142   - } ?>
  146 + foreach($arrDescricaoHardware as $i => $v)
  147 + echo '<option value="' . trim($i) . '">' . $v . '</option>';
  148 + ?>
143 149 </select>
144 150 </div></td>
145 151 <td>&nbsp;</td>
... ...
relatorios/hardware/rel_hardware.php
... ... @@ -107,7 +107,7 @@ else
107 107 redes.id_local IN ('. $locais_selecionados .') AND
108 108 redes.id_local = locais.id_local ';
109 109 $select = ' ,sg_local as Local ';
110   - $from = ' ,redes ,locais ';
  110 + $from = ' ,redes,locais ';
111 111 }
112 112  
113 113 // Aqui pego todos os SO selecionados
... ... @@ -117,14 +117,17 @@ for( $i = 1; $i &lt; count($_SESSION[&quot;list4&quot;] ); $i++ )
117 117 $so_selecionados = $so_selecionados . ",'" . $_SESSION["list4"][$i] . "'";
118 118 }
119 119  
  120 +$campos_hardware = '';
120 121 // Aqui pego todas as configurações de hardware que deseja exibir
121 122 for( $i = 0; $i < count($_SESSION["list6"] ); $i++ )
122 123 {
  124 + $campos_hardware .= ($campos_hardware <> ''?',':'');
123 125 $campos_hardware = $campos_hardware . $_SESSION["list6"][$i];
124 126 }
125 127 // Aqui substitui todas as strings \ por vazio que a variável $campos_hardware retorna
126 128 $campos_hardware = str_replace('\\', '', $campos_hardware);
127 129  
  130 +echo $campos_hardware . '<br>';
128 131 if ($_GET['orderby']) { $orderby = $_GET['orderby']; }
129 132 else { $orderby = '3'; } //por Nome Comp.
130 133 $query = ' SELECT distinct a.te_node_address,
... ... @@ -132,7 +135,6 @@ else { $orderby = &#39;3&#39;; } //por Nome Comp.
132 135 a.te_nome_computador as "Nome Comp.",
133 136 sg_so as "S.O.",
134 137 a.te_ip as "IP"' .
135   - $campos_hardware .
136 138 $select .'
137 139 FROM so LEFT JOIN computadores a ON (a.id_so = so.id_so) '.
138 140 $from . '
... ... @@ -140,7 +142,8 @@ else { $orderby = &#39;3&#39;; } //por Nome Comp.
140 142 a.id_so IN ('. $so_selecionados .') '.
141 143 $query_redes .'
142 144 ORDER BY ' . $orderby;
143   -
  145 +// $campos_hardware .
  146 +echo $query . '<br>';
144 147 $result = mysql_query($query) or die('Erro no select ou sua sessão expirou!');
145 148  
146 149 $cor = 0;
... ...
relatorios/navegacao.php
... ... @@ -164,11 +164,16 @@ if ($_REQUEST[&#39;p&#39;]==&#39;&#39; &amp;&amp; $_REQUEST[&#39;consultar&#39;] == &#39;&#39;)
164 164 $RedeAnt = $row["id_ip_rede"];
165 165 }
166 166  
167   - if ($WorkGroupAnt <> $row["te_workgroup"] || $RedeAntAux <> $RedeAnt)
  167 + $arrGrupo = explode('@',$row["te_workgroup"]);
  168 + if (count($arrGrupo) > 1)
  169 + $strGrupo = $arrGrupo[1];
  170 + else
  171 + $strGrupo = $row["te_workgroup"];
  172 +
  173 + if ($WorkGroupAnt <> $strGrupo || $RedeAntAux <> $RedeAnt)
168 174 {
169   - $v_grupo = $row["te_workgroup"];
170   - $_SESSION['Tripa'] .= '...' . $row["te_workgroup"].'#';
171   - $WorkGroupAnt = $row["te_workgroup"];
  175 + $_SESSION['Tripa'] .= '...' . $strGrupo.'#';
  176 + $WorkGroupAnt = $strGrupo;
172 177 $RedeAntAux = $RedeAnt;
173 178 }
174 179  
... ...
ws/get_config.php
... ... @@ -31,12 +31,29 @@ $v_compress_level = 0; // Mantido em 0(zero) para desabilitar a Compressão/Deco
31 31 $retorno_xml_header = '<?xml version="1.0" encoding="iso-8859-1" ?><STATUS>OK</STATUS><CONFIGS>';
32 32 $retorno_xml_values = '';
33 33  
  34 +LimpaTESTES();
  35 +
34 36 // Essas variáveis conterão os indicadores de criptografia e compactação
35 37 $v_cs_cipher = (trim($_POST['cs_cipher']) <> ''?trim($_POST['cs_cipher']) : '4');
36 38 $v_cs_compress = (trim($_POST['cs_compress']) <> ''?trim($_POST['cs_compress']) : '4');
37 39  
  40 +$strPaddingKey = '';
  41 +
  42 +// O agente PyCACIC envia o valor "padding_key" para preenchimento da palavra chave para decriptação/encriptação
  43 +if ($_POST['padding_key'])
  44 + {
  45 + // Valores específicos para trabalho com o PyCACIC - 04 de abril de 2008 - Rogério Lino - Dataprev/ES
  46 + $strPaddingKey = $_POST['padding_key']; // A versão inicial do agente em Python exige esse complemento na chave...
  47 + $boolPyCACIC = (trim(DeCrypt($key,$iv,$_POST['agente'],$v_cs_cipher,$v_cs_compress,$strPaddingKey)) == 'pycacic'?1:0);
  48 +
  49 + if ($_POST['agente'] <> '')
  50 + foreach($HTTP_POST_VARS as $i => $v)
  51 + GravaTESTES('i: "'.$i.'" v: "'.$v.'"');
  52 + }
  53 +
  54 +
38 55 // Obtenho o IP da estação por meio da decriptografia...
39   -$v_id_ip_estacao = trim(DeCrypt($key,$iv,$_POST['id_ip_estacao'],$v_cs_cipher,$v_cs_compress));
  56 +$v_id_ip_estacao = trim(DeCrypt($key,$iv,$_POST['id_ip_estacao'],$v_cs_cipher,$v_cs_compress,$strPaddingKey));
40 57  
41 58 // ...caso o IP esteja inválido, obtenho-o a partir de variável do servidor
42 59 if (substr_count($v_id_ip_estacao,'zf')>0 || trim($v_id_ip_estacao)=='')
... ... @@ -45,12 +62,12 @@ if (substr_count($v_id_ip_estacao,&#39;zf&#39;)&gt;0 || trim($v_id_ip_estacao)==&#39;&#39;)
45 62 $v_dados_rede = getDadosRede();
46 63  
47 64 // Essa condição testa se foi o "chkcacic" chamado para instalação ou o "Gerente de Coletas" para validar IP da estação...
48   -if (trim(DeCrypt($key,$iv,$_POST['in_chkcacic'],$v_cs_cipher,$v_cs_compress))=='chkcacic' ||
49   - trim(DeCrypt($key,$iv,$_POST['in_teste'] ,$v_cs_cipher,$v_cs_compress))=='OK')
  65 +if (trim(DeCrypt($key,$iv,$_POST['in_chkcacic'],$v_cs_cipher,$v_cs_compress,$strPaddingKey))=='chkcacic' ||
  66 + trim(DeCrypt($key,$iv,$_POST['in_teste'] ,$v_cs_cipher,$v_cs_compress,$strPaddingKey))=='OK')
50 67 {
51   - $retorno_xml_values .= '<TE_REDE_OK>' . EnCrypt($key,$iv,($v_dados_rede['id_ip_rede'] <> ''?'S':'N') ,$v_cs_cipher,$v_cs_compress,$v_compress_level). '</TE_REDE_OK>';
  68 + $retorno_xml_values .= '<TE_REDE_OK>' . EnCrypt($key,$iv,($v_dados_rede['id_ip_rede'] <> ''?'S':'N') ,$v_cs_cipher,$v_cs_compress,$v_compress_level,$strPaddingKey). '</TE_REDE_OK>';
52 69  
53   - if (trim(DeCrypt($key,$iv,$_POST['in_chkcacic'],$v_cs_cipher,$v_cs_compress))=='chkcacic')
  70 + if (trim(DeCrypt($key,$iv,$_POST['in_chkcacic'],$v_cs_cipher,$v_cs_compress,$strPaddingKey))=='chkcacic')
54 71 {
55 72 // Retorno as versões dos três principais agentes ao CHKCACIC para que sejam verificadas...
56 73 $MainFolder = GetMainFolder();
... ... @@ -58,17 +75,17 @@ if (trim(DeCrypt($key,$iv,$_POST[&#39;in_chkcacic&#39;],$v_cs_cipher,$v_cs_compress))==&#39;
58 75 if (file_exists($MainFolder . '/repositorio/versoes_agentes.ini'))
59 76 {
60 77 $v_array_versoes_agentes = parse_ini_file($MainFolder . '/repositorio/versoes_agentes.ini');
61   - $retorno_xml_values .= '<CACIC2>' . EnCrypt($key,$iv,$v_array_versoes_agentes['cacic2.exe'],$v_cs_cipher,$v_cs_compress,$v_compress_level) . '<' . '/CACIC2>';
62   - $retorno_xml_values .= '<GER_COLS>' . EnCrypt($key,$iv,$v_array_versoes_agentes['ger_cols.exe'],$v_cs_cipher,$v_cs_compress,$v_compress_level) . '<' . '/GER_COLS>';
63   - $retorno_xml_values .= '<CHKSIS>' . EnCrypt($key,$iv,$v_array_versoes_agentes['chksis.exe'],$v_cs_cipher,$v_cs_compress,$v_compress_level) . '<' . '/CHKSIS>';
  78 + $retorno_xml_values .= '<CACIC2>' . EnCrypt($key,$iv,$v_array_versoes_agentes['cacic2.exe'],$v_cs_cipher,$v_cs_compress,$v_compress_level,$strPaddingKey) . '<' . '/CACIC2>';
  79 + $retorno_xml_values .= '<GER_COLS>' . EnCrypt($key,$iv,$v_array_versoes_agentes['ger_cols.exe'],$v_cs_cipher,$v_cs_compress,$v_compress_level,$strPaddingKey) . '<' . '/GER_COLS>';
  80 + $retorno_xml_values .= '<CHKSIS>' . EnCrypt($key,$iv,$v_array_versoes_agentes['chksis.exe'],$v_cs_cipher,$v_cs_compress,$v_compress_level,$strPaddingKey) . '<' . '/CHKSIS>';
64 81 }
65 82 }
66 83  
67 84 $v_te_fila_ftp = '0';
68   - $v_id_ftp = ($_POST['id_ftp']?trim(DeCrypt($key,$iv,$_POST['id_ftp'],$v_cs_cipher,$v_cs_compress)):'');
  85 + $v_id_ftp = ($_POST['id_ftp']?trim(DeCrypt($key,$iv,$_POST['id_ftp'],$v_cs_cipher,$v_cs_compress,$strPaddingKey)):'');
69 86  
70 87 // Operações para agrupamento de FTP por subredes
71   - if (trim(DeCrypt($key,$iv,$_POST['te_fila_ftp'],$v_cs_cipher,$v_cs_compress))=='1' &&
  88 + if (trim(DeCrypt($key,$iv,$_POST['te_fila_ftp'],$v_cs_cipher,$v_cs_compress,$strPaddingKey))=='1' &&
72 89 !$v_id_ftp)
73 90 {
74 91 // TimeOut definido para 5 minutos, ou seja, tempo máximo para as estações efetuarem FTP dos módulos necessários
... ... @@ -111,7 +128,7 @@ if (trim(DeCrypt($key,$iv,$_POST[&#39;in_chkcacic&#39;],$v_cs_cipher,$v_cs_compress))==&#39;
111 128 $retorno_xml_values .= '<TE_FILA_FTP>' . $v_te_fila_ftp . '</TE_FILA_FTP>';
112 129 $retorno_xml_values .= '<ID_FTP>' . mysql_insert_id() . '</ID_FTP>';
113 130 }
114   - elseif (trim(DeCrypt($key,$iv,$_POST['te_fila_ftp'],$v_cs_cipher,$v_cs_compress))=='2') // Operação concluída com sucesso!
  131 + elseif (trim(DeCrypt($key,$iv,$_POST['te_fila_ftp'],$v_cs_cipher,$v_cs_compress,$strPaddingKey))=='2') // Operação concluída com sucesso!
115 132 {
116 133 $query_del = 'DELETE
117 134 FROM redes_grupos_ftp
... ... @@ -119,13 +136,16 @@ if (trim(DeCrypt($key,$iv,$_POST[&#39;in_chkcacic&#39;],$v_cs_cipher,$v_cs_compress))==&#39;
119 136 id_ip_rede = "'.$v_dados_rede['id_ip_rede'].'" AND
120 137 id_ip_estacao = "'.$v_id_ip_estacao.'"';
121 138 $result_del = mysql_query($query_del);
122   - // Refaço o retorno_xml para redução do pacote a retornar...
123 139 }
124 140 }
125 141 else
126 142 {
  143 + GravaTESTES('Chamando autentica_agente: key="'.$key.'"');
  144 + GravaTESTES('Chamando autentica_agente: iv="'.$iv.'"');
  145 + GravaTESTES('Chamando autentica_agente: v_cs_cipher="'.$v_cs_cipher.'"');
  146 +
127 147 // Autenticação dos agentes:
128   - autentica_agente($key,$iv,$v_cs_cipher,$v_cs_compress);
  148 + autentica_agente($key,$iv,$v_cs_cipher,$v_cs_compress,$strPaddingKey);
129 149  
130 150 $id_ip_rede = $v_dados_rede['id_ip_rede'];
131 151 $v_te_serv_updates = $v_dados_rede['te_serv_updates'];
... ... @@ -135,14 +155,14 @@ else
135 155 $v_te_senha_login_serv_updates = $v_dados_rede['te_senha_login_serv_updates'];
136 156 $v_nu_porta_serv_updates = $v_dados_rede['nu_porta_serv_updates'];
137 157  
138   - $te_node_address = DeCrypt($key,$iv,$_POST['te_node_address'] ,$v_cs_cipher,$v_cs_compress);
139   - $id_so_new = DeCrypt($key,$iv,$_POST['id_so'] ,$v_cs_cipher,$v_cs_compress);
140   - $te_so = DeCrypt($key,$iv,$_POST['te_so'] ,$v_cs_cipher,$v_cs_compress);
141   - $te_nome_computador = DeCrypt($key,$iv,$_POST['te_nome_computador'] ,$v_cs_cipher,$v_cs_compress);
142   - $te_workgroup = DeCrypt($key,$iv,$_POST['te_workgroup'] ,$v_cs_cipher,$v_cs_compress);
143   - $te_versao_cacic = DeCrypt($key,$iv,$_POST['te_versao_cacic'] ,$v_cs_cipher,$v_cs_compress);
144   - $te_versao_gercols = DeCrypt($key,$iv,$_POST['te_versao_gercols'] ,$v_cs_cipher,$v_cs_compress);
145   - $te_tripa_perfis = DeCrypt($key,$iv,$_POST['te_tripa_perfis'] ,$v_cs_cipher,$v_cs_compress);
  158 + $te_node_address = DeCrypt($key,$iv,$_POST['te_node_address'] ,$v_cs_cipher,$v_cs_compress,$strPaddingKey);
  159 + $id_so_new = DeCrypt($key,$iv,$_POST['id_so'] ,$v_cs_cipher,$v_cs_compress,$strPaddingKey);
  160 + $te_so = DeCrypt($key,$iv,$_POST['te_so'] ,$v_cs_cipher,$v_cs_compress,$strPaddingKey);
  161 + $te_nome_computador = DeCrypt($key,$iv,$_POST['te_nome_computador'] ,$v_cs_cipher,$v_cs_compress,$strPaddingKey);
  162 + $te_workgroup = DeCrypt($key,$iv,$_POST['te_workgroup'] ,$v_cs_cipher,$v_cs_compress,$strPaddingKey);
  163 + $te_versao_cacic = DeCrypt($key,$iv,$_POST['te_versao_cacic'] ,$v_cs_cipher,$v_cs_compress,$strPaddingKey);
  164 + $te_versao_gercols = DeCrypt($key,$iv,$_POST['te_versao_gercols'] ,$v_cs_cipher,$v_cs_compress,$strPaddingKey);
  165 + $te_tripa_perfis = DeCrypt($key,$iv,$_POST['te_tripa_perfis'] ,$v_cs_cipher,$v_cs_compress,$strPaddingKey);
146 166  
147 167 /* Todas as vezes em que é feita a recuperação das configurações por um agente, é incluído
148 168 o computador deste agente no BD, caso ainda não esteja inserido. */
... ... @@ -246,7 +266,7 @@ else
246 266 $id_acao = $campos['id_acao'];
247 267 if (eh_excecao($id_acao, $te_node_address) == 0)
248 268 {
249   - $retorno_xml_values .= '<' . $id_acao . '>'.EnCrypt($key,$iv,'S',$v_cs_cipher,$v_cs_compress,$v_compress_level).'</' . $id_acao . '>';
  269 + $retorno_xml_values .= '<' . $id_acao . '>'.EnCrypt($key,$iv,'S',$v_cs_cipher,$v_cs_compress,$v_compress_level,$strPaddingKey).'</' . $id_acao . '>';
250 270  
251 271 if ($campos['dt_hr_coleta_forcada'] || $te_tripa_coleta['dt_hr_coleta_forcada_estacao'])
252 272 {
... ... @@ -257,7 +277,7 @@ else
257 277 {
258 278 $v_dt_hr_coleta_forcada = $te_tripa_coleta['dt_hr_coleta_forcada_estacao'];
259 279 }
260   - $retorno_xml_values .= '<' . 'DT_HR_COLETA_FORCADA_' . $campos["te_nome_curto_modulo"] . '>' . EnCrypt($key,$iv,$v_dt_hr_coleta_forcada,$v_cs_cipher,$v_cs_compress,$v_compress_level) . '</' . 'DT_HR_COLETA_FORCADA_' . $campos["te_nome_curto_modulo"] . '>';
  280 + $retorno_xml_values .= '<' . 'DT_HR_COLETA_FORCADA_' . $campos["te_nome_curto_modulo"] . '>' . EnCrypt($key,$iv,$v_dt_hr_coleta_forcada,$v_cs_cipher,$v_cs_compress,$v_compress_level,$strPaddingKey) . '</' . 'DT_HR_COLETA_FORCADA_' . $campos["te_nome_curto_modulo"] . '>';
261 281 }
262 282 if (trim($id_acao) == "cs_coleta_monitorado" && mysql_num_rows($result_monitorado))
263 283 {
... ... @@ -375,10 +395,10 @@ else
375 395  
376 396 $result_modulos = mysql_query($query_modulos);
377 397 while ($row_modulos = mysql_fetch_array($result_modulos))
378   - $retorno_xml_values .= '<' . 'DT_VERSAO_' . str_replace('.EXE','',strtoupper($row_modulos['nm_modulo'])) . '_DISPONIVEL>' . EnCrypt($key,$iv,$row_modulos['te_versao_modulo'],$v_cs_cipher,$v_cs_compress,$v_compress_level) . '<' . '/DT_VERSAO_' . str_replace('.EXE','',strtoupper($row_modulos['nm_modulo'])) . '_DISPONIVEL>';
  398 + $retorno_xml_values .= '<' . 'DT_VERSAO_' . str_replace('.EXE','',strtoupper($row_modulos['nm_modulo'])) . '_DISPONIVEL>' . EnCrypt($key,$iv,$row_modulos['te_versao_modulo'],$v_cs_cipher,$v_cs_compress,$v_compress_level,$strPaddingKey) . '<' . '/DT_VERSAO_' . str_replace('.EXE','',strtoupper($row_modulos['nm_modulo'])) . '_DISPONIVEL>';
379 399  
380 400 if ($v_retorno_MONITORADOS <> '')
381   - $retorno_xml_values .= '<SISTEMAS_MONITORADOS_PERFIS>'.EnCrypt($key,$iv,$v_retorno_MONITORADOS,$v_cs_cipher,$v_cs_compress,$v_compress_level).'</SISTEMAS_MONITORADOS_PERFIS>';
  401 + $retorno_xml_values .= '<SISTEMAS_MONITORADOS_PERFIS>'.EnCrypt($key,$iv,$v_retorno_MONITORADOS,$v_cs_cipher,$v_cs_compress,$v_compress_level,$strPaddingKey).'</SISTEMAS_MONITORADOS_PERFIS>';
382 402  
383 403 // Configurações relacionadas ao comportamento do agente.
384 404 $query = 'SELECT in_exibe_bandeja,
... ... @@ -399,7 +419,7 @@ else
399 419 for ($i=0; $i < mysql_num_fields($result_configs); $i++)
400 420 {
401 421 $nome_campo = mysql_field_name($result_configs, $i);
402   - $retorno_xml_values .= '<' . $nome_campo . '>' . EnCrypt($key,$iv,$campos_configs[$nome_campo],$v_cs_cipher,$v_cs_compress,$v_compress_level) . '</' . $nome_campo . '>';
  422 + $retorno_xml_values .= '<' . $nome_campo . '>' . EnCrypt($key,$iv,$campos_configs[$nome_campo],$v_cs_cipher,$v_cs_compress,$v_compress_level,$strPaddingKey) . '</' . $nome_campo . '>';
403 423 }
404 424  
405 425 // Caso não haja identificador de servidor de updates informado, assumirá o nome do servidor gerente
... ... @@ -411,12 +431,12 @@ else
411 431  
412 432 }
413 433  
414   -$retorno_xml_values .= '<TE_SERV_CACIC>' . EnCrypt($key,$iv,$v_dados_rede['te_serv_cacic'] ,$v_cs_cipher,$v_cs_compress,$v_compress_level). '</TE_SERV_CACIC>';
415   -$retorno_xml_values .= '<TE_SERV_UPDATES>' . EnCrypt($key,$iv,$v_dados_rede['te_serv_updates'] ,$v_cs_cipher,$v_cs_compress,$v_compress_level). '</TE_SERV_UPDATES>';
416   -$retorno_xml_values .= '<NU_PORTA_SERV_UPDATES>' . EnCrypt($key,$iv,$v_dados_rede['nu_porta_serv_updates'] ,$v_cs_cipher,$v_cs_compress,$v_compress_level). '</NU_PORTA_SERV_UPDATES>';
417   -$retorno_xml_values .= '<TE_PATH_SERV_UPDATES>' . EnCrypt($key,$iv,$v_dados_rede['te_path_serv_updates'] ,$v_cs_cipher,$v_cs_compress,$v_compress_level). '</TE_PATH_SERV_UPDATES>';
418   -$retorno_xml_values .= '<NM_USUARIO_LOGIN_SERV_UPDATES>' . EnCrypt($key,$iv,$v_dados_rede['nm_usuario_login_serv_updates'] ,$v_cs_cipher,$v_cs_compress,$v_compress_level). '</NM_USUARIO_LOGIN_SERV_UPDATES>';
419   -$retorno_xml_values .= '<TE_SENHA_LOGIN_SERV_UPDATES>' . EnCrypt($key,$iv,$v_dados_rede['te_senha_login_serv_updates'] ,$v_cs_cipher,$v_cs_compress,$v_compress_level). '</TE_SENHA_LOGIN_SERV_UPDATES>';
  434 +$retorno_xml_values .= '<TE_SERV_CACIC>' . EnCrypt($key,$iv,$v_dados_rede['te_serv_cacic'] ,$v_cs_cipher,$v_cs_compress,$v_compress_level,$strPaddingKey). '</TE_SERV_CACIC>';
  435 +$retorno_xml_values .= '<TE_SERV_UPDATES>' . EnCrypt($key,$iv,$v_dados_rede['te_serv_updates'] ,$v_cs_cipher,$v_cs_compress,$v_compress_level,$strPaddingKey). '</TE_SERV_UPDATES>';
  436 +$retorno_xml_values .= '<NU_PORTA_SERV_UPDATES>' . EnCrypt($key,$iv,$v_dados_rede['nu_porta_serv_updates'] ,$v_cs_cipher,$v_cs_compress,$v_compress_level,$strPaddingKey). '</NU_PORTA_SERV_UPDATES>';
  437 +$retorno_xml_values .= '<TE_PATH_SERV_UPDATES>' . EnCrypt($key,$iv,$v_dados_rede['te_path_serv_updates'] ,$v_cs_cipher,$v_cs_compress,$v_compress_level,$strPaddingKey). '</TE_PATH_SERV_UPDATES>';
  438 +$retorno_xml_values .= '<NM_USUARIO_LOGIN_SERV_UPDATES>' . EnCrypt($key,$iv,$v_dados_rede['nm_usuario_login_serv_updates'] ,$v_cs_cipher,$v_cs_compress,$v_compress_level,$strPaddingKey). '</NM_USUARIO_LOGIN_SERV_UPDATES>';
  439 +$retorno_xml_values .= '<TE_SENHA_LOGIN_SERV_UPDATES>' . EnCrypt($key,$iv,$v_dados_rede['te_senha_login_serv_updates'] ,$v_cs_cipher,$v_cs_compress,$v_compress_level,$strPaddingKey). '</TE_SENHA_LOGIN_SERV_UPDATES>';
420 440  
421 441 // --------------- Retorno de Classificador de CRIPTOGRAFIA --------------- //
422 442 if ($v_cs_cipher <> '1') $v_cs_cipher --;
... ...
ws/get_patrimonio.php
... ... @@ -30,17 +30,26 @@ $v_compress_level = 0; // Mantido em 0(zero) para desabilitar a Compressão/Deco
30 30 $v_cs_cipher = (trim($_POST['cs_cipher']) <> ''?trim($_POST['cs_cipher']) : '4');
31 31 $v_cs_compress = (trim($_POST['cs_compress']) <> ''?trim($_POST['cs_compress']) : '4');
32 32  
33   -autentica_agente($key,$iv,$v_cs_cipher,$v_cs_compress);
  33 +$strPaddingKey = '';
  34 +
  35 +// O agente PyCACIC envia o valor "padding_key" para preenchimento da palavra chave para decriptação/encriptação
  36 +if ($_POST['padding_key'])
  37 + {
  38 + // Valores específicos para trabalho com o PyCACIC - 04 de abril de 2008 - Rogério Lino - Dataprev/ES
  39 + $strPaddingKey = $_POST['padding_key']; // A versão inicial do agente em Python exige esse complemento na chave...
  40 + }
  41 +
  42 +autentica_agente($key,$iv,$v_cs_cipher,$v_cs_compress, $strPaddingKey);
34 43  
35 44 $v_dados_rede = getDadosRede();
36 45  
37   -$te_node_address = DeCrypt($key,$iv,$_POST['te_node_address'] ,$v_cs_cipher,$v_cs_compress);
38   -$id_so_new = DeCrypt($key,$iv,$_POST['id_so'] ,$v_cs_cipher,$v_cs_compress);
39   -$te_so = DeCrypt($key,$iv,$_POST['te_so'] ,$v_cs_cipher,$v_cs_compress);
40   -$id_ip_rede = DeCrypt($key,$iv,$_POST['id_ip_rede'] ,$v_cs_cipher,$v_cs_compress);
41   -$te_ip = DeCrypt($key,$iv,$_POST['te_ip'] ,$v_cs_cipher,$v_cs_compress);
42   -$te_nome_computador = DeCrypt($key,$iv,$_POST['te_nome_computador'] ,$v_cs_cipher,$v_cs_compress);
43   -$te_workgroup = DeCrypt($key,$iv,$_POST['te_workgroup'] ,$v_cs_cipher,$v_cs_compress);
  46 +$te_node_address = DeCrypt($key,$iv,$_POST['te_node_address'] ,$v_cs_cipher,$v_cs_compress, $strPaddingKey);
  47 +$id_so_new = DeCrypt($key,$iv,$_POST['id_so'] ,$v_cs_cipher,$v_cs_compress, $strPaddingKey);
  48 +$te_so = DeCrypt($key,$iv,$_POST['te_so'] ,$v_cs_cipher,$v_cs_compress, $strPaddingKey);
  49 +$id_ip_rede = DeCrypt($key,$iv,$_POST['id_ip_rede'] ,$v_cs_cipher,$v_cs_compress, $strPaddingKey);
  50 +$te_ip = DeCrypt($key,$iv,$_POST['te_ip'] ,$v_cs_cipher,$v_cs_compress, $strPaddingKey);
  51 +$te_nome_computador = DeCrypt($key,$iv,$_POST['te_nome_computador'] ,$v_cs_cipher,$v_cs_compress, $strPaddingKey);
  52 +$te_workgroup = DeCrypt($key,$iv,$_POST['te_workgroup'] ,$v_cs_cipher,$v_cs_compress, $strPaddingKey);
44 53  
45 54 /* Todas as vezes em que é feita a recuperação das configurações por um agente, é incluído
46 55 o computador deste agente no BD, caso ainda não esteja inserido. */
... ... @@ -70,7 +79,7 @@ $query = &#39;SELECT dt_hr_alteracao_patrim_interface,
70 79 conecta_bd_cacic();
71 80 $result = mysql_query($query);
72 81 $campos = mysql_fetch_array($result);
73   -$retorno_xml='<?xml version="1.0" encoding="iso-8859-1" ?><CONFIGS><STATUS>OK</STATUS><dt_hr_alteracao_patrim_interface>' . EnCrypt($key,$iv,$campos['dt_hr_alteracao_patrim_interface'],$v_cs_cipher,$v_cs_compress,$v_compress_level) .'</dt_hr_alteracao_patrim_interface><dt_hr_alteracao_patrim_uon1>' . EnCrypt($key,$iv,$campos['dt_hr_alteracao_patrim_uon1'],$v_cs_cipher,$v_cs_compress,$v_compress_level) .'</dt_hr_alteracao_patrim_uon1><dt_hr_alteracao_patrim_uon2>' . EnCrypt($key,$iv,$campos['dt_hr_alteracao_patrim_uon2'],$v_cs_cipher,$v_cs_compress,$v_compress_level) .'</dt_hr_alteracao_patrim_uon2><cs_abre_janela_patr>' . EnCrypt($key,$iv,$campos['cs_abre_janela_patr'],$v_cs_cipher,$v_cs_compress,$v_compress_level) .'</cs_abre_janela_patr>';
  82 +$retorno_xml='<?xml version="1.0" encoding="iso-8859-1" ?><CONFIGS><STATUS>OK</STATUS><dt_hr_alteracao_patrim_interface>' . EnCrypt($key,$iv,$campos['dt_hr_alteracao_patrim_interface'],$v_cs_cipher,$v_cs_compress,$v_compress_level, $strPaddingKey) .'</dt_hr_alteracao_patrim_interface><dt_hr_alteracao_patrim_uon1>' . EnCrypt($key,$iv,$campos['dt_hr_alteracao_patrim_uon1'],$v_cs_cipher,$v_cs_compress,$v_compress_level, $strPaddingKey) .'</dt_hr_alteracao_patrim_uon1><dt_hr_alteracao_patrim_uon2>' . EnCrypt($key,$iv,$campos['dt_hr_alteracao_patrim_uon2'],$v_cs_cipher,$v_cs_compress,$v_compress_level, $strPaddingKey) .'</dt_hr_alteracao_patrim_uon2><cs_abre_janela_patr>' . EnCrypt($key,$iv,$campos['cs_abre_janela_patr'],$v_cs_cipher,$v_cs_compress,$v_compress_level, $strPaddingKey) .'</cs_abre_janela_patr>';
74 83  
75 84  
76 85 /*
... ... @@ -104,9 +113,9 @@ while ($campos = mysql_fetch_array($result))
104 113 {
105 114 $id = $i;
106 115 }
107   - $retorno_xml .= '<te_etiqueta' . $id . '>'. EnCrypt($key,$iv,$campos["te_etiqueta"],$v_cs_cipher,$v_cs_compress,$v_compress_level) . '</te_etiqueta' . $id . '>' .
108   - '<in_exibir_etiqueta' . $id . '>'. EnCrypt($key,$iv,$campos["in_exibir_etiqueta"],$v_cs_cipher,$v_cs_compress,$v_compress_level) . '</in_exibir_etiqueta' . $id . '>' .
109   - '<te_help_etiqueta' . $id . '>'. EnCrypt($key,$iv,$campos["te_help_etiqueta"],$v_cs_cipher,$v_cs_compress,$v_compress_level) . '</te_help_etiqueta' . $id . '>';
  116 + $retorno_xml .= '<te_etiqueta' . $id . '>'. EnCrypt($key,$iv,$campos["te_etiqueta"],$v_cs_cipher,$v_cs_compress,$v_compress_level, $strPaddingKey) . '</te_etiqueta' . $id . '>' .
  117 + '<in_exibir_etiqueta' . $id . '>'. EnCrypt($key,$iv,$campos["in_exibir_etiqueta"],$v_cs_cipher,$v_cs_compress,$v_compress_level, $strPaddingKey) . '</in_exibir_etiqueta' . $id . '>' .
  118 + '<te_help_etiqueta' . $id . '>'. EnCrypt($key,$iv,$campos["te_help_etiqueta"],$v_cs_cipher,$v_cs_compress,$v_compress_level, $strPaddingKey) . '</te_help_etiqueta' . $id . '>';
110 119 $i++ ;
111 120 }
112 121  
... ... @@ -142,7 +151,7 @@ while ($campos = mysql_fetch_array($result))
142 151 $pos1 = stripos2($strTripaIdUON1,$strAux,false);
143 152 if (!$pos1)
144 153 {
145   - $retorno_xml .= '<IT1><ID1>' . EnCrypt($key,$iv,$campos['uo1_id'],$v_cs_cipher,$v_cs_compress,$v_compress_level) . '</ID1><NM1>' . EnCrypt($key,$iv,$campos['uo1_nm'],$v_cs_cipher,$v_cs_compress,$v_compress_level) . '</NM1></IT1>';
  154 + $retorno_xml .= '<IT1><ID1>' . EnCrypt($key,$iv,$campos['uo1_id'],$v_cs_cipher,$v_cs_compress,$v_compress_level, $strPaddingKey) . '</ID1><NM1>' . EnCrypt($key,$iv,$campos['uo1_nm'],$v_cs_cipher,$v_cs_compress,$v_compress_level, $strPaddingKey) . '</NM1></IT1>';
146 155 $strTripaIdUON1 .= '#'.$campos['uo1_id'].'-'.$campos['uo1_nm'].'#';
147 156 }
148 157 }
... ... @@ -166,14 +175,14 @@ while ($campos = mysql_fetch_array($result))
166 175  
167 176 if (!$pos1)
168 177 {
169   - $retorno_xml .= '<IT1a><ID1>' . EnCrypt($key,$iv,$campos['uo1_id'],$v_cs_cipher,$v_cs_compress,$v_compress_level) . '</ID1><SG_LOC>' . EnCrypt($key,$iv,$campos['loc_sg'],$v_cs_cipher,$v_cs_compress,$v_compress_level) . '</SG_LOC><ID1a>' . EnCrypt($key,$iv,$campos['uo1a_id'],$v_cs_cipher,$v_cs_compress,$v_compress_level) . '</ID1a><NM1a>' . EnCrypt($key,$iv,$campos['uo1a_nm'],$v_cs_cipher,$v_cs_compress,$v_compress_level) . '</NM1a><ID_LOCAL>' . EnCrypt($key,$iv,$campos['uo2_id_local'],$v_cs_cipher,$v_cs_compress,$v_compress_level) . '</ID_LOCAL></IT1a>';
  178 + $retorno_xml .= '<IT1a><ID1>' . EnCrypt($key,$iv,$campos['uo1_id'],$v_cs_cipher,$v_cs_compress,$v_compress_level, $strPaddingKey) . '</ID1><SG_LOC>' . EnCrypt($key,$iv,$campos['loc_sg'],$v_cs_cipher,$v_cs_compress,$v_compress_level, $strPaddingKey) . '</SG_LOC><ID1a>' . EnCrypt($key,$iv,$campos['uo1a_id'],$v_cs_cipher,$v_cs_compress,$v_compress_level, $strPaddingKey) . '</ID1a><NM1a>' . EnCrypt($key,$iv,$campos['uo1a_nm'],$v_cs_cipher,$v_cs_compress,$v_compress_level, $strPaddingKey) . '</NM1a><ID_LOCAL>' . EnCrypt($key,$iv,$campos['uo2_id_local'],$v_cs_cipher,$v_cs_compress,$v_compress_level, $strPaddingKey) . '</ID_LOCAL></IT1a>';
170 179 $strTripaIdUON1a .= '#'.$campos['uo1a_id'].'-'.$campos['uo2_id_local'].'#';
171 180 }
172 181 }
173 182  
174 183 mysql_data_seek($result,0);
175 184 while ($campos = mysql_fetch_array($result))
176   - $retorno_xml .= '<IT2><ID1a>' . EnCrypt($key,$iv,$campos['uo1a_id'],$v_cs_cipher,$v_cs_compress,$v_compress_level) . '</ID1a><ID2>' . EnCrypt($key,$iv,$campos['uo2_id'],$v_cs_cipher,$v_cs_compress,$v_compress_level) . '</ID2><NM2>' . EnCrypt($key,$iv,$campos['uo2_nm'],$v_cs_cipher,$v_cs_compress,$v_compress_level) . '</NM2><ID_LOCAL>' . EnCrypt($key,$iv,$campos['uo2_id_local'],$v_cs_cipher,$v_cs_compress,$v_compress_level) . '</ID_LOCAL></IT2>';
  185 + $retorno_xml .= '<IT2><ID1a>' . EnCrypt($key,$iv,$campos['uo1a_id'],$v_cs_cipher,$v_cs_compress,$v_compress_level, $strPaddingKey) . '</ID1a><ID2>' . EnCrypt($key,$iv,$campos['uo2_id'],$v_cs_cipher,$v_cs_compress,$v_compress_level, $strPaddingKey) . '</ID2><NM2>' . EnCrypt($key,$iv,$campos['uo2_nm'],$v_cs_cipher,$v_cs_compress,$v_compress_level, $strPaddingKey) . '</NM2><ID_LOCAL>' . EnCrypt($key,$iv,$campos['uo2_id_local'],$v_cs_cipher,$v_cs_compress,$v_compress_level, $strPaddingKey) . '</ID_LOCAL></IT2>';
177 186  
178 187  
179 188 // Envio os valores já existentes no banco, referentes ao ID_SO+TE_NODE_ADDRESS da estação chamadora...
... ... @@ -199,16 +208,16 @@ $result = mysql_query($query);
199 208 if (count($result)>0)
200 209 {
201 210 $valores = mysql_fetch_array($result);
202   - $retorno_xml .= '<ID_UON1a>' .EnCrypt($key,$iv,$valores['id_unid_organizacional_nivel1a'],$v_cs_cipher,$v_cs_compress,$v_compress_level).'</ID_UON1a>';
203   - $retorno_xml .= '<ID_UON2>' .EnCrypt($key,$iv,$valores['id_unid_organizacional_nivel2'] ,$v_cs_cipher,$v_cs_compress,$v_compress_level).'</ID_UON2>';
204   - $retorno_xml .= '<ID_LOCAL>' .EnCrypt($key,$iv,$valores['id_local'] ,$v_cs_cipher,$v_cs_compress,$v_compress_level).'</ID_LOCAL>';
205   - $retorno_xml .= '<TE_LOC_COMPL>'.EnCrypt($key,$iv,$valores['te_localizacao_complementar'] ,$v_cs_cipher,$v_cs_compress,$v_compress_level).'</TE_LOC_COMPL>';
206   - $retorno_xml .= '<TE_INFO1>' .EnCrypt($key,$iv,$valores['te_info_patrimonio1'] ,$v_cs_cipher,$v_cs_compress,$v_compress_level).'</TE_INFO1>';
207   - $retorno_xml .= '<TE_INFO2>' .EnCrypt($key,$iv,$valores['te_info_patrimonio2'] ,$v_cs_cipher,$v_cs_compress,$v_compress_level).'</TE_INFO2>';
208   - $retorno_xml .= '<TE_INFO3>' .EnCrypt($key,$iv,$valores['te_info_patrimonio3'] ,$v_cs_cipher,$v_cs_compress,$v_compress_level).'</TE_INFO3>';
209   - $retorno_xml .= '<TE_INFO4>' .EnCrypt($key,$iv,$valores['te_info_patrimonio4'] ,$v_cs_cipher,$v_cs_compress,$v_compress_level).'</TE_INFO4>';
210   - $retorno_xml .= '<TE_INFO5>' .EnCrypt($key,$iv,$valores['te_info_patrimonio5'] ,$v_cs_cipher,$v_cs_compress,$v_compress_level).'</TE_INFO5>';
211   - $retorno_xml .= '<TE_INFO6>' .EnCrypt($key,$iv,$valores['te_info_patrimonio6'] ,$v_cs_cipher,$v_cs_compress,$v_compress_level).'</TE_INFO6>';
  211 + $retorno_xml .= '<ID_UON1a>' .EnCrypt($key,$iv,$valores['id_unid_organizacional_nivel1a'],$v_cs_cipher,$v_cs_compress,$v_compress_level, $strPaddingKey).'</ID_UON1a>';
  212 + $retorno_xml .= '<ID_UON2>' .EnCrypt($key,$iv,$valores['id_unid_organizacional_nivel2'] ,$v_cs_cipher,$v_cs_compress,$v_compress_level, $strPaddingKey).'</ID_UON2>';
  213 + $retorno_xml .= '<ID_LOCAL>' .EnCrypt($key,$iv,$valores['id_local'] ,$v_cs_cipher,$v_cs_compress,$v_compress_level, $strPaddingKey).'</ID_LOCAL>';
  214 + $retorno_xml .= '<TE_LOC_COMPL>'.EnCrypt($key,$iv,$valores['te_localizacao_complementar'] ,$v_cs_cipher,$v_cs_compress,$v_compress_level, $strPaddingKey).'</TE_LOC_COMPL>';
  215 + $retorno_xml .= '<TE_INFO1>' .EnCrypt($key,$iv,$valores['te_info_patrimonio1'] ,$v_cs_cipher,$v_cs_compress,$v_compress_level, $strPaddingKey).'</TE_INFO1>';
  216 + $retorno_xml .= '<TE_INFO2>' .EnCrypt($key,$iv,$valores['te_info_patrimonio2'] ,$v_cs_cipher,$v_cs_compress,$v_compress_level, $strPaddingKey).'</TE_INFO2>';
  217 + $retorno_xml .= '<TE_INFO3>' .EnCrypt($key,$iv,$valores['te_info_patrimonio3'] ,$v_cs_cipher,$v_cs_compress,$v_compress_level, $strPaddingKey).'</TE_INFO3>';
  218 + $retorno_xml .= '<TE_INFO4>' .EnCrypt($key,$iv,$valores['te_info_patrimonio4'] ,$v_cs_cipher,$v_cs_compress,$v_compress_level, $strPaddingKey).'</TE_INFO4>';
  219 + $retorno_xml .= '<TE_INFO5>' .EnCrypt($key,$iv,$valores['te_info_patrimonio5'] ,$v_cs_cipher,$v_cs_compress,$v_compress_level, $strPaddingKey).'</TE_INFO5>';
  220 + $retorno_xml .= '<TE_INFO6>' .EnCrypt($key,$iv,$valores['te_info_patrimonio6'] ,$v_cs_cipher,$v_cs_compress,$v_compress_level, $strPaddingKey).'</TE_INFO6>';
212 221 }
213 222  
214 223 // --------------- Retorno de Classificador de CRIPTOGRAFIA --------------- //
... ...
ws/mapa_acesso.php
... ... @@ -40,7 +40,7 @@ if ($te_versao_mapa &lt;&gt; &#39;&#39;)
40 40 $v_array_versoes_agentes = parse_ini_file('../repositorio/install/versoes_agentes.ini');
41 41 if ($v_array_versoes_agentes['mapacacic.exe'] <> $te_versao_mapa)
42 42 {
43   - $retorno_xml_values = '<TE_VERSAO_MAPA>'.EnCrypt($key,$iv,$v_array_versoes_agentes['mapacacic.exe'],$v_cs_cipher,$v_cs_compress,$v_compress_level).'</TE_VERSAO_MAPA>';
  43 + $retorno_xml_values = '<TE_VERSAO_MAPA>'.EnCrypt($key,$iv,$v_array_versoes_agentes['mapacacic.exe'],$v_cs_cipher,$v_cs_compress,$v_compress_level,'').'</TE_VERSAO_MAPA>';
44 44 $boolVersaoCorreta = false;
45 45 }
46 46 }
... ... @@ -48,10 +48,10 @@ if ($te_versao_mapa &lt;&gt; &#39;&#39;)
48 48 if ($boolVersaoCorreta)
49 49 {
50 50 // Autenticação do agente MapaCacic.exe:
51   - autentica_agente($key,$iv,$v_cs_cipher,$v_cs_compress);
  51 + autentica_agente($key,$iv,$v_cs_cipher,$v_cs_compress,'');
52 52  
53 53 // Essa condição testa se a chamada trouxe o valor de cs_mapa-cacic, enviado por MapaCacic.exe
54   - if (trim(DeCrypt($key,$iv,$_POST['cs_MapaCacic'],$v_cs_cipher,$v_cs_compress))=='S')
  54 + if (trim(DeCrypt($key,$iv,$_POST['cs_MapaCacic'],$v_cs_cipher,$v_cs_compress,''))=='S')
55 55 {
56 56 $v_dados_rede = getDadosRede();
57 57 conecta_bd_cacic();
... ... @@ -63,15 +63,15 @@ if ($boolVersaoCorreta)
63 63 locais c
64 64 WHERE a.id_grupo_usuarios = b.id_grupo_usuarios AND
65 65 b.id_grupo_usuarios = 7 AND
66   - a.nm_usuario_acesso = '". trim(DeCrypt($key,$iv,$_POST['nm_acesso'],$v_cs_cipher,$v_cs_compress)) ."' AND
  66 + a.nm_usuario_acesso = '". trim(DeCrypt($key,$iv,$_POST['nm_acesso'],$v_cs_cipher,$v_cs_compress,'')) ."' AND
67 67 a.id_local = c.id_local AND
68 68 a.te_senha = ";
69 69 //SHA1('". trim(DeCrypt($key,$iv,$_POST['te_senha'],$v_cs_cipher,$v_cs_compress)) ."')";
70 70  
71 71 // Solução temporária, até total convergência para versões 4.0.2 ou maior de MySQL
72 72 // Anderson Peterle - Dataprev/ES - 04/09/2006
73   - $v_AUTH_SHA1 = " SHA1('". trim(DeCrypt($key,$iv,$_POST['te_senha'],$v_cs_cipher,$v_cs_compress)) ."')";
74   - $v_AUTH_PASSWORD = " PASSWORD('". trim(DeCrypt($key,$iv,$_POST['te_senha'],$v_cs_cipher,$v_cs_compress)) ."')";
  73 + $v_AUTH_SHA1 = " SHA1('". trim(DeCrypt($key,$iv,$_POST['te_senha'],$v_cs_cipher,$v_cs_compress,'')) ."')";
  74 + $v_AUTH_PASSWORD = " PASSWORD('". trim(DeCrypt($key,$iv,$_POST['te_senha'],$v_cs_cipher,$v_cs_compress,'')) ."')";
75 75  
76 76 // Para MySQL 4.0.2 ou maior
77 77 // Anderson Peterle - Dataprev/ES - 04/09/2006
... ... @@ -89,8 +89,8 @@ if ($boolVersaoCorreta)
89 89 if (mysql_num_rows($result_qry_usuario)>0)
90 90 {
91 91 $row = mysql_fetch_array($result_qry_usuario);
92   - $retorno_xml_values .= '<ID_USUARIO>'.EnCrypt($key,$iv,$row['id_usuario'],$v_cs_cipher,$v_cs_compress,$v_compress_level).'</ID_USUARIO>';
93   - $retorno_xml_values .= '<NM_USUARIO_COMPLETO>'.EnCrypt($key,$iv,$row['nm_usuario_completo'],$v_cs_cipher,$v_cs_compress,$v_compress_level).'</NM_USUARIO_COMPLETO>';
  92 + $retorno_xml_values .= '<ID_USUARIO>'.EnCrypt($key,$iv,$row['id_usuario'],$v_cs_cipher,$v_cs_compress,$v_compress_level,'').'</ID_USUARIO>';
  93 + $retorno_xml_values .= '<NM_USUARIO_COMPLETO>'.EnCrypt($key,$iv,$row['nm_usuario_completo'],$v_cs_cipher,$v_cs_compress,$v_compress_level,'').'</NM_USUARIO_COMPLETO>';
94 94 $_SESSION['id_usuario'] = $row['id_usuario'];
95 95 GravaLog('ACE',$_SERVER['SCRIPT_NAME'],'acesso');
96 96 }
... ...
ws/mapa_get_patrimonio.php
... ... @@ -25,7 +25,7 @@ $v_compress_level = 0; // Mantido em 0(zero) para desabilitar a Compressão/Deco
25 25 $v_cs_cipher = (trim($_POST['cs_cipher']) <> ''?trim($_POST['cs_cipher']) : '4');
26 26 $v_cs_compress = (trim($_POST['cs_compress']) <> ''?trim($_POST['cs_compress']) : '4');
27 27  
28   -autentica_agente($key,$iv,$v_cs_cipher,$v_cs_compress);
  28 +autentica_agente($key,$iv,$v_cs_cipher,$v_cs_compress,'');
29 29  
30 30 $v_dados_rede = getDadosRede();
31 31  
... ... @@ -86,9 +86,9 @@ while ($campos = mysql_fetch_array($result))
86 86 {
87 87 $id = $i;
88 88 }
89   - $retorno_xml .= '<te_etiqueta' . $id . '>'. EnCrypt($key,$iv,$campos["te_etiqueta"],$v_cs_cipher,$v_cs_compress,$v_compress_level) . '</te_etiqueta' . $id . '>' .
90   - '<in_exibir_etiqueta' . $id . '>'. EnCrypt($key,$iv,$campos["in_exibir_etiqueta"],$v_cs_cipher,$v_cs_compress,$v_compress_level) . '</in_exibir_etiqueta' . $id . '>' .
91   - '<te_help_etiqueta' . $id . '>'. EnCrypt($key,$iv,$campos["te_help_etiqueta"],$v_cs_cipher,$v_cs_compress,$v_compress_level) . '</te_help_etiqueta' . $id . '>';
  89 + $retorno_xml .= '<te_etiqueta' . $id . '>'. EnCrypt($key,$iv,$campos["te_etiqueta"],$v_cs_cipher,$v_cs_compress,$v_compress_level,'') . '</te_etiqueta' . $id . '>' .
  90 + '<in_exibir_etiqueta' . $id . '>'. EnCrypt($key,$iv,$campos["in_exibir_etiqueta"],$v_cs_cipher,$v_cs_compress,$v_compress_level,'') . '</in_exibir_etiqueta' . $id . '>' .
  91 + '<te_help_etiqueta' . $id . '>'. EnCrypt($key,$iv,$campos["te_help_etiqueta"],$v_cs_cipher,$v_cs_compress,$v_compress_level,'') . '</te_help_etiqueta' . $id . '>';
92 92 $i++ ;
93 93 }
94 94  
... ... @@ -139,7 +139,7 @@ while ($campos = mysql_fetch_array($result))
139 139 $pos1 = stripos2($strTripaIdUON1,$strAux,false);
140 140 if (!$pos1)
141 141 {
142   - $retorno_xml .= '<IT1><ID1>' . EnCrypt($key,$iv,$campos['uo1_id'],$v_cs_cipher,$v_cs_compress,$v_compress_level) . '</ID1><NM1>' . EnCrypt($key,$iv,$campos['uo1_nm'],$v_cs_cipher,$v_cs_compress,$v_compress_level) . '</NM1></IT1>';
  142 + $retorno_xml .= '<IT1><ID1>' . EnCrypt($key,$iv,$campos['uo1_id'],$v_cs_cipher,$v_cs_compress,$v_compress_level,'') . '</ID1><NM1>' . EnCrypt($key,$iv,$campos['uo1_nm'],$v_cs_cipher,$v_cs_compress,$v_compress_level,'') . '</NM1></IT1>';
143 143 $strTripaIdUON1 .= '#'.$campos['uo1_id'].'-'.$campos['uo1_nm'].'#';
144 144 }
145 145 }
... ... @@ -156,14 +156,14 @@ while ($campos = mysql_fetch_array($result))
156 156  
157 157 if (!$pos1)
158 158 {
159   - $retorno_xml .= '<IT1a><ID1>' . EnCrypt($key,$iv,$campos['uo1_id'],$v_cs_cipher,$v_cs_compress,$v_compress_level) . '</ID1><SG_LOC>' . EnCrypt($key,$iv,$campos['loc_sg'],$v_cs_cipher,$v_cs_compress,$v_compress_level) . '</SG_LOC><ID1a>' . EnCrypt($key,$iv,$campos['uo1a_id'],$v_cs_cipher,$v_cs_compress,$v_compress_level) . '</ID1a><NM1a>' . EnCrypt($key,$iv,$campos['uo1a_nm'],$v_cs_cipher,$v_cs_compress,$v_compress_level) . '</NM1a><ID_LOCAL>' . EnCrypt($key,$iv,$campos['uo2_id_local'],$v_cs_cipher,$v_cs_compress,$v_compress_level) . '</ID_LOCAL></IT1a>';
  159 + $retorno_xml .= '<IT1a><ID1>' . EnCrypt($key,$iv,$campos['uo1_id'],$v_cs_cipher,$v_cs_compress,$v_compress_level,'') . '</ID1><SG_LOC>' . EnCrypt($key,$iv,$campos['loc_sg'],$v_cs_cipher,$v_cs_compress,$v_compress_level,'') . '</SG_LOC><ID1a>' . EnCrypt($key,$iv,$campos['uo1a_id'],$v_cs_cipher,$v_cs_compress,$v_compress_level,'') . '</ID1a><NM1a>' . EnCrypt($key,$iv,$campos['uo1a_nm'],$v_cs_cipher,$v_cs_compress,$v_compress_level,'') . '</NM1a><ID_LOCAL>' . EnCrypt($key,$iv,$campos['uo2_id_local'],$v_cs_cipher,$v_cs_compress,$v_compress_level,'') . '</ID_LOCAL></IT1a>';
160 160 $strTripaIdUON1a .= '#'.$campos['uo1a_id'].'-'.$campos['uo2_id_local'].'#';
161 161 }
162 162 }
163 163  
164 164 mysql_data_seek($result,0);
165 165 while ($campos = mysql_fetch_array($result))
166   - $retorno_xml .= '<IT2><ID1a>' . EnCrypt($key,$iv,$campos['uo1a_id'],$v_cs_cipher,$v_cs_compress,$v_compress_level) . '</ID1a><ID2>' . EnCrypt($key,$iv,$campos['uo2_id'],$v_cs_cipher,$v_cs_compress,$v_compress_level) . '</ID2><NM2>' . EnCrypt($key,$iv,$campos['uo2_nm'],$v_cs_cipher,$v_cs_compress,$v_compress_level) . '</NM2><ID_LOCAL>' . EnCrypt($key,$iv,$campos['uo2_id_local'],$v_cs_cipher,$v_cs_compress,$v_compress_level) . '</ID_LOCAL></IT2>';
  166 + $retorno_xml .= '<IT2><ID1a>' . EnCrypt($key,$iv,$campos['uo1a_id'],$v_cs_cipher,$v_cs_compress,$v_compress_level,'') . '</ID1a><ID2>' . EnCrypt($key,$iv,$campos['uo2_id'],$v_cs_cipher,$v_cs_compress,$v_compress_level,'') . '</ID2><NM2>' . EnCrypt($key,$iv,$campos['uo2_nm'],$v_cs_cipher,$v_cs_compress,$v_compress_level,'') . '</NM2><ID_LOCAL>' . EnCrypt($key,$iv,$campos['uo2_id_local'],$v_cs_cipher,$v_cs_compress,$v_compress_level,'') . '</ID_LOCAL></IT2>';
167 167  
168 168 // Envio os valores já existentes no banco, referentes ao ID_SO+TE_NODE_ADDRESS da estação chamadora...
169 169 $query = ' SELECT pat.id_unid_organizacional_nivel1a,
... ... @@ -187,16 +187,16 @@ $result = mysql_query($query);
187 187 if (count($result)>0)
188 188 {
189 189 $valores = mysql_fetch_array($result);
190   - $retorno_xml .= '<ID_UON1a>' .EnCrypt($key,$iv,$valores['id_unid_organizacional_nivel1a'],$v_cs_cipher,$v_cs_compress,$v_compress_level).'</ID_UON1a>';
191   - $retorno_xml .= '<ID_UON2>' .EnCrypt($key,$iv,$valores['id_unid_organizacional_nivel2'] ,$v_cs_cipher,$v_cs_compress,$v_compress_level).'</ID_UON2>';
192   - $retorno_xml .= '<ID_LOCAL>' .EnCrypt($key,$iv,$valores['id_local'] ,$v_cs_cipher,$v_cs_compress,$v_compress_level).'</ID_LOCAL>';
193   - $retorno_xml .= '<TE_LOC_COMPL>'.EnCrypt($key,$iv,$valores['te_localizacao_complementar'] ,$v_cs_cipher,$v_cs_compress,$v_compress_level).'</TE_LOC_COMPL>';
194   - $retorno_xml .= '<TE_INFO1>' .EnCrypt($key,$iv,$valores['te_info_patrimonio1'] ,$v_cs_cipher,$v_cs_compress,$v_compress_level).'</TE_INFO1>';
195   - $retorno_xml .= '<TE_INFO2>' .EnCrypt($key,$iv,$valores['te_info_patrimonio2'] ,$v_cs_cipher,$v_cs_compress,$v_compress_level).'</TE_INFO2>';
196   - $retorno_xml .= '<TE_INFO3>' .EnCrypt($key,$iv,$valores['te_info_patrimonio3'] ,$v_cs_cipher,$v_cs_compress,$v_compress_level).'</TE_INFO3>';
197   - $retorno_xml .= '<TE_INFO4>' .EnCrypt($key,$iv,$valores['te_info_patrimonio4'] ,$v_cs_cipher,$v_cs_compress,$v_compress_level).'</TE_INFO4>';
198   - $retorno_xml .= '<TE_INFO5>' .EnCrypt($key,$iv,$valores['te_info_patrimonio5'] ,$v_cs_cipher,$v_cs_compress,$v_compress_level).'</TE_INFO5>';
199   - $retorno_xml .= '<TE_INFO6>' .EnCrypt($key,$iv,$valores['te_info_patrimonio6'] ,$v_cs_cipher,$v_cs_compress,$v_compress_level).'</TE_INFO6>';
  190 + $retorno_xml .= '<ID_UON1a>' .EnCrypt($key,$iv,$valores['id_unid_organizacional_nivel1a'],$v_cs_cipher,$v_cs_compress,$v_compress_level,'').'</ID_UON1a>';
  191 + $retorno_xml .= '<ID_UON2>' .EnCrypt($key,$iv,$valores['id_unid_organizacional_nivel2'] ,$v_cs_cipher,$v_cs_compress,$v_compress_level,'').'</ID_UON2>';
  192 + $retorno_xml .= '<ID_LOCAL>' .EnCrypt($key,$iv,$valores['id_local'] ,$v_cs_cipher,$v_cs_compress,$v_compress_level,'').'</ID_LOCAL>';
  193 + $retorno_xml .= '<TE_LOC_COMPL>'.EnCrypt($key,$iv,$valores['te_localizacao_complementar'] ,$v_cs_cipher,$v_cs_compress,$v_compress_level,'').'</TE_LOC_COMPL>';
  194 + $retorno_xml .= '<TE_INFO1>' .EnCrypt($key,$iv,$valores['te_info_patrimonio1'] ,$v_cs_cipher,$v_cs_compress,$v_compress_level,'').'</TE_INFO1>';
  195 + $retorno_xml .= '<TE_INFO2>' .EnCrypt($key,$iv,$valores['te_info_patrimonio2'] ,$v_cs_cipher,$v_cs_compress,$v_compress_level,'').'</TE_INFO2>';
  196 + $retorno_xml .= '<TE_INFO3>' .EnCrypt($key,$iv,$valores['te_info_patrimonio3'] ,$v_cs_cipher,$v_cs_compress,$v_compress_level,'').'</TE_INFO3>';
  197 + $retorno_xml .= '<TE_INFO4>' .EnCrypt($key,$iv,$valores['te_info_patrimonio4'] ,$v_cs_cipher,$v_cs_compress,$v_compress_level,'').'</TE_INFO4>';
  198 + $retorno_xml .= '<TE_INFO5>' .EnCrypt($key,$iv,$valores['te_info_patrimonio5'] ,$v_cs_cipher,$v_cs_compress,$v_compress_level,'').'</TE_INFO5>';
  199 + $retorno_xml .= '<TE_INFO6>' .EnCrypt($key,$iv,$valores['te_info_patrimonio6'] ,$v_cs_cipher,$v_cs_compress,$v_compress_level,'').'</TE_INFO6>';
200 200 }
201 201  
202 202 $retorno_xml .= '</CONFIGS>';
... ...
ws/set_compart.php
... ... @@ -27,15 +27,24 @@ require_once(&#39;../include/library.php&#39;);
27 27 $v_cs_cipher = (trim($_POST['cs_cipher']) <> ''?trim($_POST['cs_cipher']) : '4');
28 28 $v_cs_compress = (trim($_POST['cs_compress']) <> ''?trim($_POST['cs_compress']) : '4');
29 29  
30   -autentica_agente($key,$iv,$v_cs_cipher,$v_cs_compress);
  30 +$strPaddingKey = '';
31 31  
32   -$te_node_address = DeCrypt($key,$iv,$_POST['te_node_address'] ,$v_cs_cipher, $v_cs_compress);
33   -$id_so_new = DeCrypt($key,$iv,$_POST['id_so'] ,$v_cs_cipher, $v_cs_compress);
34   -$te_so = DeCrypt($key,$iv,$_POST['te_so'] ,$v_cs_cipher, $v_cs_compress);
35   -$te_ip = DeCrypt($key,$iv,$_POST['te_ip'] ,$v_cs_cipher, $v_cs_compress);
36   -$id_ip_rede = DeCrypt($key,$iv,$_POST['id_ip_rede'] ,$v_cs_cipher, $v_cs_compress);
37   -$te_nome_computador = DeCrypt($key,$iv,$_POST['te_nome_computador'] ,$v_cs_cipher, $v_cs_compress);
38   -$te_workgroup = DeCrypt($key,$iv,$_POST['te_workgroup'] ,$v_cs_cipher, $v_cs_compress);
  32 +// O agente PyCACIC envia o valor "padding_key" para preenchimento da palavra chave para decriptação/encriptação
  33 +if ($_POST['padding_key'])
  34 + {
  35 + // Valores específicos para trabalho com o PyCACIC - 04 de abril de 2008 - Rogério Lino - Dataprev/ES
  36 + $strPaddingKey = $_POST['padding_key']; // A versão inicial do agente em Python exige esse complemento na chave...
  37 + }
  38 +
  39 +autentica_agente($key,$iv,$v_cs_cipher,$v_cs_compress, $strPaddingKey);
  40 +
  41 +$te_node_address = DeCrypt($key,$iv,$_POST['te_node_address'] ,$v_cs_cipher, $v_cs_compress, $strPaddingKey);
  42 +$id_so_new = DeCrypt($key,$iv,$_POST['id_so'] ,$v_cs_cipher, $v_cs_compress, $strPaddingKey);
  43 +$te_so = DeCrypt($key,$iv,$_POST['te_so'] ,$v_cs_cipher, $v_cs_compress, $strPaddingKey);
  44 +$te_ip = DeCrypt($key,$iv,$_POST['te_ip'] ,$v_cs_cipher, $v_cs_compress, $strPaddingKey);
  45 +$id_ip_rede = DeCrypt($key,$iv,$_POST['id_ip_rede'] ,$v_cs_cipher, $v_cs_compress, $strPaddingKey);
  46 +$te_nome_computador = DeCrypt($key,$iv,$_POST['te_nome_computador'] ,$v_cs_cipher, $v_cs_compress, $strPaddingKey);
  47 +$te_workgroup = DeCrypt($key,$iv,$_POST['te_workgroup'] ,$v_cs_cipher, $v_cs_compress, $strPaddingKey);
39 48  
40 49 if ($te_node_address <> '')
41 50 {
... ... @@ -49,7 +58,7 @@ if ($te_node_address &lt;&gt; &#39;&#39;)
49 58 // Tiro os escapes que o post automaticamente coloca.
50 59 //$xmlSource=stripslashes(DeCrypt($key,$iv,$_POST['compartilhamentos'],$v_cs_cipher, $v_cs_compress));
51 60 //$strTripaDados = stripslashes(DeCrypt($key,$iv,$_POST['compartilhamentos'],$v_cs_cipher, $v_cs_compress));
52   - $strTripaDados = DeCrypt($key,$iv,$_POST['CompartilhamentosLocais'],$v_cs_cipher, $v_cs_compress);
  61 + $strTripaDados = DeCrypt($key,$iv,$_POST['CompartilhamentosLocais'],$v_cs_cipher, $v_cs_compress, $strPaddingKey);
53 62  
54 63 //First we define a number of variables to store the data from each element
55 64 /*
... ...
ws/set_hardware.php
... ... @@ -24,28 +24,67 @@ require_once(&#39;../include/library.php&#39;);
24 24 $v_cs_cipher = (trim($_POST['cs_cipher']) <> ''?trim($_POST['cs_cipher']) : '4');
25 25 $v_cs_compress = (trim($_POST['cs_compress']) <> ''?trim($_POST['cs_compress']) : '4');
26 26  
27   -autentica_agente($key,$iv,$v_cs_cipher,$v_cs_compress);
  27 +$strPaddingKey = '';
  28 +
  29 +// O agente PyCACIC envia o valor "padding_key" para preenchimento da palavra chave para decriptação/encriptação
  30 +// Valores específicos para trabalho com o PyCACIC - 04 de abril de 2008 - Rogério Lino - Dataprev/ES
  31 +if ($_POST['padding_key'])
  32 + $strPaddingKey = $_POST['padding_key']; // A versão inicial do agente em Python exige esse complemento na chave...
  33 +
  34 +autentica_agente($key,$iv,$v_cs_cipher,$v_cs_compress, $strPaddingKey);
28 35  
29 36 // Obtenho o IP da estação por meio da decriptografia...
30   -$v_id_ip_estacao = trim(DeCrypt($key,$iv,$_POST['id_ip_estacao'],$v_cs_cipher,$v_cs_compress));
  37 +$v_id_ip_estacao = trim(DeCrypt($key,$iv,$_POST['id_ip_estacao'],$v_cs_cipher,$v_cs_compress, $strPaddingKey));
31 38  
32 39 // ...caso o IP esteja inválido, obtenho-o a partir de variável do servidor
33 40 if (substr_count($v_id_ip_estacao,'zf')>0 || trim($v_id_ip_estacao)=='')
34 41 $v_id_ip_estacao = $_SERVER['REMOTE_ADDR'];
35 42  
36   -$te_node_address = DeCrypt($key,$iv,$_POST['te_node_address'] ,$v_cs_cipher, $v_cs_compress);
37   -$id_so_new = DeCrypt($key,$iv,$_POST['id_so'] ,$v_cs_cipher, $v_cs_compress);
38   -$te_so = DeCrypt($key,$iv,$_POST['te_so'] ,$v_cs_cipher, $v_cs_compress);
39   -$id_ip_rede = DeCrypt($key,$iv,$_POST['id_ip_rede'] ,$v_cs_cipher, $v_cs_compress);
40   -$te_nome_computador = DeCrypt($key,$iv,$_POST['te_nome_computador'] ,$v_cs_cipher, $v_cs_compress);
41   -$te_workgroup = DeCrypt($key,$iv,$_POST['te_workgroup'] ,$v_cs_cipher, $v_cs_compress);
42   -
43   -$strTripa_CPU = DeCrypt($key,$iv,$_POST['te_Tripa_CPU'] ,$v_cs_cipher, $v_cs_compress);
44   -$strTripa_CDROM = DeCrypt($key,$iv,$_POST['te_Tripa_CDROM'] ,$v_cs_cipher, $v_cs_compress);
45   -$strTripa_TCPIP = DeCrypt($key,$iv,$_POST['te_Tripa_TCPIP'] ,$v_cs_cipher, $v_cs_compress);
  43 +$te_node_address = DeCrypt($key,$iv,$_POST['te_node_address'] ,$v_cs_cipher, $v_cs_compress, $strPaddingKey);
  44 +$id_so_new = DeCrypt($key,$iv,$_POST['id_so'] ,$v_cs_cipher, $v_cs_compress, $strPaddingKey);
  45 +$te_so = DeCrypt($key,$iv,$_POST['te_so'] ,$v_cs_cipher, $v_cs_compress, $strPaddingKey);
  46 +$id_ip_rede = DeCrypt($key,$iv,$_POST['id_ip_rede'] ,$v_cs_cipher, $v_cs_compress, $strPaddingKey);
  47 +$te_nome_computador = DeCrypt($key,$iv,$_POST['te_nome_computador'] ,$v_cs_cipher, $v_cs_compress, $strPaddingKey);
  48 +$te_workgroup = DeCrypt($key,$iv,$_POST['te_workgroup'] ,$v_cs_cipher, $v_cs_compress, $strPaddingKey);
  49 +
  50 +
  51 +// *****************************************************************************************************
  52 +// Procedimentos para o Tratamento de Múltiplos Componentes de Hardware - Anderson Peterle em Março/2008
  53 +// *****************************************************************************************************
  54 +
  55 +// ==============================================================================================================================================================
  56 +// Informe no array abaixo os tipos de componentes para a verificação de multiplicidade
  57 +// ***** ATENÇÃO ***** Para acrescentar tipo de componente à lista (array) é necessário implementar o envio das informações no agente Col_Hard, em forma de Tripa
  58 +// ==============================================================================================================================================================
  59 +$arrTiposComponentes = array( 'CDROM',
  60 + 'CPU',
  61 + 'TCPIP');
  62 +
  63 +// Informe abaixo os ítens de componentes contidos na tripa oriunda do agente coletor
  64 +// ----------------------------------------------------------------------------------
  65 +// te_Tripa_CDROM
  66 +// --------------
  67 +// CDROMName
  68 +//
  69 +// te_Tripa_CPU
  70 +// ------------
  71 +// CPUName, Vendor, Serial Number, Frequency
  72 +//
  73 +// te_Tripa_TCPIP
  74 +// --------------
  75 +// Name, PhysicalAddress, IPAddress, IPMask, Gateway_IPAddress, DHCP_IPAddress, PrimaryWINS_IPAddress, SecondaryWINS_IPAddress
  76 +
  77 +
  78 +// Criação das "Tripas" na memória com os dados dos componentes a serem tratados
  79 +for ($intTiposComponentes = 0;$intTiposComponentes < count($arrTiposComponentes);$intTiposComponentes++)
  80 + {
  81 + $strNomeTripaMemoria = 'strTripa_'.$arrTiposComponentes[$intTiposComponentes];
  82 + $strNomeTripaRecebida = 'te_Tripa_'.$arrTiposComponentes[$intTiposComponentes];
  83 + $$strNomeTripaMemoria = DeCrypt($key,$iv,$_POST[$strNomeTripaRecebida] ,$v_cs_cipher, $v_cs_compress, $strPaddingKey);
  84 + }
46 85  
47 86 // Todas as vezes em que é feita a recuperação das configurações por um agente, é incluído
48   -// o computador deste agente no BD, caso ainda não esteja inserido.
  87 +// o computador deste agente no BD, caso ainda não esteja inserido.
49 88 if ($te_node_address <> '')
50 89 {
51 90 $arrSO = inclui_computador_caso_nao_exista( $te_node_address,
... ... @@ -65,302 +104,131 @@ if ($te_node_address &lt;&gt; &#39;&#39;)
65 104 $resultTotalizaGeralExistentes = mysql_query($strQueryTotalizaGeralExistentes) or die('Problema Consultando Tabela Componentes_Estações 1!');
66 105 $rowTotalizaGeralExistentes = mysql_fetch_array($resultTotalizaGeralExistentes);
67 106  
68   - // ================================================================================
69   - // A função VerificaComponentes retornará um array contendo os seguintes elementos:
70   - // ================================================================================
71   - // ACR => Acrescentados
72   - // REM => Removidos
73   - // ALT => Alterados
74   - // ALT_OLD => Registros Antigos, afetados pelas ALTERAÇÕES
75   - // ================================================================================
  107 + $boolHardwareAlterado = false;
  108 + for ($intTiposComponentes = 0;$intTiposComponentes < count($arrTiposComponentes);$intTiposComponentes++)
  109 + {
  110 + $strNomeArray = 'arr'.$arrTiposComponentes[$intTiposComponentes];
  111 + $strNomeTripa = 'strTripa_'.$arrTiposComponentes[$intTiposComponentes];
  112 + $$strNomeArray = VerificaComponentes($arrTiposComponentes[$intTiposComponentes],$$strNomeTripa,$rowTotalizaGeralExistentes['TotalGeralExistentes']);
  113 + $arrTemp = $$strNomeArray;
  114 +
  115 + if (($arrTemp['ACR'])<>'' || ($arrTemp['REM'])<>'')
  116 + $boolHardwareAlterado = true;
  117 + }
76 118  
77   - // Itens de componentes CDROM
78   - // --------------------------
79   - // 00 - CDROMName
80   - $arrCDROM = VerificaComponentes('CDROM',$strTripa_CDROM,$rowTotalizaGeralExistentes['TotalGeralExistentes']);
81   -
82   - // Itens de componentes CPU
83   - // ------------------------
84   - // 00 - CPUName
85   - // 01 - Vendor
86   - // 02 - Serial Number
87   - // 03 - Frequency
88   - $arrCPU = VerificaComponentes('CPU',$strTripa_CPU,$rowTotalizaGeralExistentes['TotalGeralExistentes']);
89   -
90   - // Itens de componentes TCPIP
91   - // --------------------------
92   - // 00 - Name
93   - // 01 - PhysicalAddress
94   - // 02 - IPAddress
95   - // 03 - IPMask
96   - // 04 - Gateway_IPAddress
97   - // 05 - DHCP_IPAddress
98   - // 06 - PrimaryWINS_IPAddress
99   - // 07 - SecondaryWINS_IPAddress
100   - $arrTCPIP = VerificaComponentes('TCPIP',$strTripa_TCPIP,$rowTotalizaGeralExistentes['TotalGeralExistentes']);
101   -
102   - if ($arrCDROM['ACR'] <> '' ||
103   - $arrCDROM['REM'] <> '' ||
104   - $arrCDROM['ALT'] <> '' ||
105   - $arrCPU['ACR'] <> '' ||
106   - $arrCPU['REM'] <> '' ||
107   - $arrCPU['ALT'] <> '' ||
108   - $arrTCPIP['ACR'] <> '' ||
109   - $arrTCPIP['REM'] <> '' ||
110   - $arrTCPIP['ALT'] <> '')
  119 + if ($boolHardwareAlterado)
111 120 {
112 121 $v_dados_rede = getDadosRede();
  122 +
  123 + $strValues = '';
  124 + for ($intTiposComponentes = 0;$intTiposComponentes < count($arrTiposComponentes);$intTiposComponentes++)
  125 + {
  126 + $strNomeArray = 'arr'.$arrTiposComponentes[$intTiposComponentes];
  127 + $arrTemp = $$strNomeArray;
  128 + $strValueACR = ($arrTemp['ACR']<>''?'("'.$te_node_address.'",'.$arrSO['id_so'].',"'.$arrTiposComponentes[$intTiposComponentes].'","'.$arrTemp['ACR'].'",now(),"ACR")':'');
  129 + $strValueREM = ($arrTemp['REM']<>''?'("'.$te_node_address.'",'.$arrSO['id_so'].',"'.$arrTiposComponentes[$intTiposComponentes].'","'.$arrTemp['REM'].'",now(),"REM")':'');
113 130  
114   - // Agora, verifico se os administradores deverão ser notificados da alteração na configuração de hardware.
115   - if (trim($destinatarios = get_valor_campo('configuracoes_locais', 'te_notificar_mudanca_hardware','id_local='.$v_dados_rede['id_local'])) <> '')
  131 + $strValues .= ($strValues <> '' && ($strValueACR . $strValueREM)<>''?',':'');
  132 + $strVirgula = ($strValueACR <> '' && $strValueREM <> ''?',':'');
  133 + $strValues .= $strValueACR . $strVirgula . $strValueREM;
  134 + }
  135 +
  136 + if ($strValues)
116 137 {
117   - // Consulto lista de colunas de hardware
118   - $queryDescricoesColunas = "SELECT nm_campo,
119   - te_descricao_campo
120   - FROM descricoes_colunas_computadores";
121   - $resultDescricoesColunas = mysql_query($queryDescricoesColunas) or die('Ocorreu um erro durante a consulta à tabela descricoes_colunas_computadores.');
122   -
123   - // Crio um array que conterá nm_campo => te_descricao_campo.
124   - $arrDescricoesColunas = array();
125   - while($rowColunasComputadores = mysql_fetch_array($resultDescricoesColunas))
126   - $arrDescricoesColunas[trim($rowColunasComputadores['nm_campo'])] = $rowColunasComputadores['te_descricao_campo'];
127   -
  138 + // Armazeno as ocorrências no Histórico
  139 + $strQueryInsereHistorico = ' INSERT
  140 + INTO componentes_estacoes_historico( te_node_address,
  141 + id_so,
  142 + cs_tipo_componente,
  143 + te_valor,
  144 + dt_alteracao,
  145 + cs_tipo_alteracao)
  146 + VALUES '.$strValues;
  147 + $resultInsereHistorico = mysql_query($strQueryInsereHistorico) or die('Problema Inserindo Dados na Tabela Componentes_Estações_Histórico!');
  148 + }
  149 +
  150 + // Verifico se há emails para notificação de alteração na configuração de hardware.
  151 + if (trim($strEmailsDestinatarios = get_valor_campo('configuracoes_locais', 'te_notificar_mudanca_hardware','id_local='.$v_dados_rede['id_local'])) <> '')
  152 + {
  153 + // Obtenho os nomes do hardware passível de controle
  154 + $arrDescricoesColunasComputadores = getDescricoesColunasComputadores();
128 155  
129 156 // Consulto todos os hardwares que foram selecionados para notificacao. Isso é setado pelo administrador na página de 'Configurações Gerais'.
130   - $queryColunasSelecionadas = "SELECT nm_campo_tab_hardware,
  157 + $queryHardwareSelecionado = "SELECT nm_campo_tab_hardware,
131 158 te_desc_hardware
132 159 FROM descricao_hardware
133 160 WHERE te_locais_notificacao_ativada like '%,".$v_dados_rede['id_local'].",%'";
134   - $resultColunasSelecionadas = mysql_query($queryColunasSelecionadas) or die('Ocorreu um erro durante a consulta à tabela descricao_hardware.');
135   -
136   - // Crio um array que conterá nm_campo_tab_hardware => te_desc_hardware.
137   - $arrColunasSelecionadas = array();
138   - while($rowColunasSelecionadas = mysql_fetch_array($resultColunasSelecionadas))
139   - $arrColunasSelecionadas[trim($rowColunasSelecionadas['nm_campo_tab_hardware'])] = $rowColunasSelecionadas['te_desc_hardware'];
  161 + $resultHardwareSelecionado = mysql_query($queryHardwareSelecionado) or die('Ocorreu um erro durante a consulta à tabela descricao_hardware.');
140 162  
141   - $cont_aux = 0;
142   - $campos_alterados = '';
  163 + // Crio um array que conterá nm_campo_tab_hardware => te_desc_hardware dos hardwares selecionados para notificação
  164 + $arrHardwareSelecionado = array();
  165 + while($rowHardwareSelecionado = mysql_fetch_array($resultHardwareSelecionado))
  166 + $arrHardwareSelecionado[trim($rowHardwareSelecionado['nm_campo_tab_hardware'])] = $rowHardwareSelecionado['te_desc_hardware'];
143 167  
144   -
145   - // =====================================================================================
146   - // ================ Início do Tratamento de ACRESCENTADOS ==============================
147   - // =====================================================================================
148   - $campos_alterados .= TrataAlteracoes('CDROM, CPU, TCPIP', $arrColunasSelecionadas,$arrDescricoesColunas);
149   -GravaTESTES('Campos_Alterados: '.$campos_alterados);
150   - /*
151   - // =====
152   - // CDROM
153   - // =====
154   - $boolConteudo = false;
155   - $arrAcrescentadosCDROM = explode('#CDROM#',$arrCDROM['ACR']);
156   - for ($i=0; $i < count($arrAcrescentadosCDROM); $i++)
157   - {
158   - $arrItensAcrescentadosCDROM = explode('###',$arrAcrescentadosCDROM[$i]);
159   - $campos_alterados .= ($campos_alterados?'<br><br>':'');
160   - for ($j=0; $j < count($arrItensAcrescentadosCDROM); $j+=2)
161   - if ($arrItensAcrescentadosCDROM[$j])
162   - {
163   - $campos_alterados .= $descricoes_campos[trim($arrItensAcrescentadosCDROM[$j])] .': '.$arrItensAcrescentadosCDROM[$j+1].'\n';
164   - $boolConteudo = true;
165   - }
166   - }
167   -
168   - if ($boolConteudo)
169   - $campos_alterados = ($campos_alterados?'Itens Acrescentados:<br><br>':'').$campos_alterados.'<br>';
170   -
171   - // ===
172   - // CPU
173   - // ===
174   - $boolConteudo = false;
175   - $arrAcrescentadosCPU = explode('#CPU#',$arrCPU['ACR']);
176   - for ($i=0; $i < count($arrAcrescentadosCPU); $i++)
177   - {
178   - $arrItensAcrescentadosCPU = explode('###',$arrAcrescentadosCPU[$i]);
179   - $campos_alterados .= ($campos_alterados?'<br><br>':'');
180   - for ($j=0; $j < count($arrItensAcrescentadosCPU); $j+=2)
181   - if ($arrItensAcrescentadosCPU[$j])
182   - {
183   - $campos_alterados .= $descricoes_campos[trim($arrItensAcrescentadosCPU[$j])] .': '.$arrItensAcrescentadosCPU[$j+1].'\n';
184   - $boolConteudo = true;
185   - }
186   - }
187   -
188   - if ($boolConteudo)
189   - $campos_alterados = ($campos_alterados?'Itens Acrescentados:<br><br>':'').$campos_alterados.'<br>';
190   -
191   - // =====
192   - // TCPIP
193   - // =====
194   - $boolConteudo = false;
195   - $arrAcrescentadosTCPIP = explode('#CPU#',$arrTCPIP['ACR']);
196   - for ($i=0; $i < count($arrAcrescentadosTCPIP); $i++)
197   - {
198   - $arrItensAcrescentadosTCPIP = explode('###',$arrAcrescentadosTCPIP[$i]);
199   - $campos_alterados .= ($campos_alterados?'<br><br>':'');
200   - for ($j=0; $j < count($arrItensAcrescentadosTCPIP); $j+=2)
201   - if ($arrItensAcrescentadosTCPIP[$j])
202   - {
203   - $campos_alterados .= $descricoes_campos[trim($arrItensAcrescentadosTCPIP[$j])] .': '.$arrItensAcrescentadosTCPIP[$j+1].'\n';
204   - $boolConteudo = true;
205   - }
206   - }
207   -
208   - if ($boolConteudo)
209   - $campos_alterados = ($campos_alterados?'Itens Acrescentados:<br><br>':'').$campos_alterados.'<br>';
210   -
211   - // ==================================================================================
212   - // ================ Fim do Tratamento de ACRESCENTADOS ==============================
213   - // ==================================================================================
214   -
215   -
216   - // REMOVIDOS
217   - // =========
218   - $boolConteudo = false;
219   - $arrRemovidosCDROM = explode('#CDROM#',$arrCDROM['REM']);
220   - for ($i=0; $i < count($arrRemovidosCDROM); $i++)
221   - {
222   - $arrItensRemovidosCDROM = explode('###',$arrRemovidosCDROM[$i]);
223   - $campos_alterados .= ($campos_alterados?'<br><br>':'');
224   - for ($j=0; $j < count($arrItensRemovidosCDROM); $j+=2)
225   - if ($arrItensRemovidosCDROM[$j])
226   - {
227   - $campos_alterados .= $descricoes_campos[trim($arrItensRemovidosCDROM[$j])] .': '.$arrItensRemovidosCDROM[$j+1].'<br>';
228   - $boolConteudo = true;
229   - }
230   - }
  168 + // Obtenho uma string contendo as alterações/inclusões/exclusões efetuadas
  169 + $strCamposAlterados .= TrataAlteracoes($arrTiposComponentes, $arrHardwareSelecionado,$arrDescricoesColunasComputadores);
231 170  
232   - if ($boolConteudo)
233   - $campos_alterados = ($campos_alterados?'Itens Removidos:<br><br>':'').$campos_alterados.'<br>';
234   -
235   - // ALTERADOS
236   - // =========
237   - $boolConteudo = false;
238   - $arrAlteradosCDROM = explode('#CDROM#',$arrCDROM['ALT']);
239   - for ($i=0; $i < count($arrAlteradosCDROM); $i++)
240   - {
241   - $arrItensAlteradosCDROM = explode('###',$arrAlteradosCDROM[$i]);
242   - $campos_alterados .= ($campos_alterados?'<br><br>':'');
243   - for ($j=0; $j < count($arrItensAlteradosCDROM); $j+=2)
244   - if ($arrItensAlteradosCDROM[$j])
245   - {
246   - $campos_alterados .= $descricoes_campos[trim($arrItensAlteradosCDROM[$j])] .': '.$arrItensAlteradosCDROM[$j+1].'<br>';
247   - $boolConteudo = true;
248   - }
249   - }
250   -
251   - if ($boolConteudo)
252   - $campos_alterados = ($campos_alterados?'Itens Alterados:<br><br>':'').$campos_alterados;
253   -
254   - // ================== Fim do Tratamento de ACRESCENTADOS ===============================
255   -
256   - /*
257   - // ================ Início do Tratamento de ACRESCENTADOS ==============================
258   -
259   - // CDROM
260   - // =============
261   - $boolConteudo = false;
262   - $arrAcrescentadosCDROM = explode('#CDROM#',$arrCDROM['ACR']);
263   - for ($i=0; $i < count($arrAcrescentadosCDROM); $i++)
264   - {
265   - $arrItensAcrescentadosCDROM = explode('###',$arrAcrescentadosCDROM[$i]);
266   - $campos_alterados .= ($campos_alterados?'<br><br>':'');
267   - for ($j=0; $j < count($arrItensAcrescentadosCDROM); $j+=2)
268   - if ($arrItensAcrescentadosCDROM[$j])
269   - {
270   - $campos_alterados .= $descricoes_campos[trim($arrItensAcrescentadosCDROM[$j])] .': '.$arrItensAcrescentadosCDROM[$j+1].'\n';
271   - $boolConteudo = true;
272   - }
273   - }
274   -
275   - if ($boolConteudo)
276   - $campos_alterados = ($campos_alterados?'Itens Acrescentados:<br><br>':'').$campos_alterados.'<br>';
277   -
278   - // REMOVIDOS
279   - // =========
280   - $boolConteudo = false;
281   - $arrRemovidosCDROM = explode('#CDROM#',$arrCDROM['REM']);
282   - for ($i=0; $i < count($arrRemovidosCDROM); $i++)
283   - {
284   - $arrItensRemovidosCDROM = explode('###',$arrRemovidosCDROM[$i]);
285   - $campos_alterados .= ($campos_alterados?'<br><br>':'');
286   - for ($j=0; $j < count($arrItensRemovidosCDROM); $j+=2)
287   - if ($arrItensRemovidosCDROM[$j])
288   - {
289   - $campos_alterados .= $descricoes_campos[trim($arrItensRemovidosCDROM[$j])] .': '.$arrItensRemovidosCDROM[$j+1].'<br>';
290   - $boolConteudo = true;
291   - }
292   - }
293   -
294   - if ($boolConteudo)
295   - $campos_alterados = ($campos_alterados?'Itens Removidos:<br><br>':'').$campos_alterados.'<br>';
296   -
297   - // ALTERADOS
298   - // =========
299   - $boolConteudo = false;
300   - $arrAlteradosCDROM = explode('#CDROM#',$arrCDROM['ALT']);
301   - for ($i=0; $i < count($arrAlteradosCDROM); $i++)
302   - {
303   - $arrItensAlteradosCDROM = explode('###',$arrAlteradosCDROM[$i]);
304   - $campos_alterados .= ($campos_alterados?'<br><br>':'');
305   - for ($j=0; $j < count($arrItensAlteradosCDROM); $j+=2)
306   - if ($arrItensAlteradosCDROM[$j])
307   - {
308   - $campos_alterados .= $descricoes_campos[trim($arrItensAlteradosCDROM[$j])] .': '.$arrItensAlteradosCDROM[$j+1].'<br>';
309   - $boolConteudo = true;
310   - }
311   - }
312   -
313   - if ($boolConteudo)
314   - $campos_alterados = ($campos_alterados?'Itens Alterados:<br><br>':'').$campos_alterados;
315   -
316   - // ================== Fim do Tratamento de ACRESCENTADOS ===============================
317   - */
318   -
319   - // ================== Início da Montagem do Email ======================================
320   - if ($campos_alterados <> '')
  171 + // Caso a string acima não esteja vazia, monto o email para notificação
  172 + if ($strCamposAlterados <> '')
321 173 {
322   - $corpo_mail = '';
323   - $corpo_mail .= " Prezado administrador,\n\n";
324   - $corpo_mail .= " foi identificada uma alteração na configuração de hardware do seguinte computador:\n\n";
325   - $corpo_mail .= " Nome...........: ". $te_nome_computador ."\n";
326   - $corpo_mail .= " Endereço IP: ". $v_id_ip_estacao . "\n";
327   - $corpo_mail .= " Rede............: ". $v_dados_rede['id_ip_rede'] ."\n\n\n";
328   - $corpo_mail .= " A alteracao refere-se a:\n\n";
329   - $corpo_mail .= str_replace('<br>',(chr(13).chr(10)),$campos_alterados) ;
330   - $corpo_mail .= "\n\nPara visualizar mais informações sobre esse computador, acesse o endereço\nhttp://";
331   - $corpo_mail .= $_SERVER['SERVER_ADDR'] . '/cacic2/relatorios/computador/computador.php?te_node_address=' . $te_node_address . '&id_so=' . $arrSO['id_so'];
332   - $corpo_mail .= "\n\n\n________________________________________________\n";
333   - $corpo_mail .= "CACIC - " . date('d/m/Y H:i') . "h \n";
334   - $corpo_mail .= "Desenvolvido pela Dataprev - Unidade Regional Espírito Santo";
  174 + $strCorpoMail = '';
  175 + $strCorpoMail .= " Prezado administrador,\n\n";
  176 + $strCorpoMail .= " foi identificada uma alteração na configuração de hardware do seguinte computador:\n\n";
  177 + $strCorpoMail .= " Nome...........: ". $te_nome_computador ."\n";
  178 + $strCorpoMail .= " Endereço IP: ". $v_id_ip_estacao . "\n";
  179 + $strCorpoMail .= " Rede............: ". $v_dados_rede['id_ip_rede'] ."\n";
  180 + $strCorpoMail .= str_replace('<br>',(chr(13).chr(10)),$strCamposAlterados) ;
  181 + $strCorpoMail .= "\n\nPara visualizar mais informações sobre esse computador, acesse o endereço\nhttp://";
  182 + $strCorpoMail .= $_SERVER['SERVER_ADDR'] . '/cacic2/relatorios/computador/computador.php?te_node_address=' . $te_node_address . '&id_so=' . $arrSO['id_so'];
  183 + $strCorpoMail .= "\n\n\n________________________________________________\n";
  184 + $strCorpoMail .= "CACIC - " . date('d/m/Y H:i') . "h \n";
  185 + $strCorpoMail .= "Desenvolvido pela Dataprev - Unidade Regional Espírito Santo";
335 186  
336 187 // Manda mail para os administradores.
337   - mail("$destinatarios", "[Sistema CACIC] Alteracao de Hardware Detectada", "$corpo_mail", "From: cacic@{$_SERVER['SERVER_NAME']}");
338   - GravaTESTES('EMAIL ENVIADO!');
339   - }
340   - else
341   - GravaTESTES('EMAIL NÃO ENVIADO!');
342   -
  188 + mail("$strEmailsDestinatarios", "[Sistema CACIC] Alteracao de Hardware Detectada", "$strCorpoMail", "From: cacic@{$_SERVER['SERVER_NAME']}");
  189 + }
343 190 }
344 191 }
  192 +
  193 + // Lembre-se de que o computador já existe. Ele é criado durante a obtenção das configurações, no arquivo get_config.php.
  194 + $query = " UPDATE computadores
  195 + SET te_mem_ram_desc = '" . DeCrypt($key,$iv,$_POST['te_mem_ram_desc'] ,$v_cs_cipher,$v_cs_compress) . "',
  196 + qt_mem_ram = '" . DeCrypt($key,$iv,$_POST['qt_mem_ram'] ,$v_cs_cipher,$v_cs_compress) . "',
  197 + te_bios_desc = '" . DeCrypt($key,$iv,$_POST['te_bios_desc'] ,$v_cs_cipher,$v_cs_compress) . "',
  198 + te_bios_data = '" . DeCrypt($key,$iv,$_POST['te_bios_data'] ,$v_cs_cipher,$v_cs_compress) . "',
  199 + te_bios_fabricante = '" . DeCrypt($key,$iv,$_POST['te_bios_fabricante'] ,$v_cs_cipher,$v_cs_compress) . "',
  200 + te_placa_mae_desc = '" . DeCrypt($key,$iv,$_POST['te_placa_mae_desc'] ,$v_cs_cipher,$v_cs_compress) . "',
  201 + te_placa_mae_fabricante = '" . DeCrypt($key,$iv,$_POST['te_placa_mae_fabricante'] ,$v_cs_cipher,$v_cs_compress) . "',
  202 + qt_placa_video_mem = '" . DeCrypt($key,$iv,$_POST['qt_placa_video_mem'] ,$v_cs_cipher,$v_cs_compress) . "',
  203 + qt_placa_video_cores = '" . DeCrypt($key,$iv,$_POST['qt_placa_video_cores'] ,$v_cs_cipher,$v_cs_compress) . "',
  204 + te_placa_video_desc = '" . DeCrypt($key,$iv,$_POST['te_placa_video_desc'] ,$v_cs_cipher,$v_cs_compress) . "',
  205 + te_placa_video_resolucao = '" . DeCrypt($key,$iv,$_POST['te_placa_video_resolucao'] ,$v_cs_cipher,$v_cs_compress) . "',
  206 + te_placa_som_desc = '" . DeCrypt($key,$iv,$_POST['te_placa_som_desc'] ,$v_cs_cipher,$v_cs_compress) . "',
  207 + te_teclado_desc = '" . DeCrypt($key,$iv,$_POST['te_teclado_desc'] ,$v_cs_cipher,$v_cs_compress) . "',
  208 + te_mouse_desc = '" . DeCrypt($key,$iv,$_POST['te_mouse_desc'] ,$v_cs_cipher,$v_cs_compress) . "',
  209 + te_modem_desc = '" . DeCrypt($key,$iv,$_POST['te_modem_desc'] ,$v_cs_cipher,$v_cs_compress) . "'
  210 + WHERE te_node_address = '" . $te_node_address . "' and id_so = '" . $arrSO['id_so'] . "'";
  211 + $result = mysql_query($query);
  212 +
345 213 echo '<?xml version="1.0" encoding="iso-8859-1" ?><STATUS>OK</STATUS>';
346 214 }
347 215 else
348 216 echo '<?xml version="1.0" encoding="iso-8859-1" ?><STATUS>Chave (TE_NODE_ADDRESS + ID_SO) Inválida</STATUS>';
349 217  
350 218 // Função para montagem do texto de componentes acrescentados
351   -function TrataAlteracoes($strTripaComponentes, $arrColunasSelecionadas,$arrDescricoesColunas)
  219 +function TrataAlteracoes($arrTiposComponentes, $arrHardwareSelecionado,$arrDescricoesColunasComputadores)
352 220 {
353 221 $strAlteracoes = '';
354   - $arrOperacoes = explode(',','REM,ACR');
355   - $arrComponentes = explode(',',$strTripaComponentes);
  222 + $arrOperacoes = array('REM','ACR');
  223 + $strAlteracoes = '';
  224 + $strOperacaoAtual = '';
356 225 for ($g=0; $g < count($arrOperacoes); $g++)
357 226 {
358   - if ($strAlteracoes)
359   - $strAlteracoes = ($strAlteracoes?' Itens '.($arrOperacoes[$g-1]=='ACR'?'Acrescentados':($arrOperacoes[$g-1]=='REM'?'Removidos':'Alterados')).':<br> ================<br>':'').$strAlteracoes.'<br>';
360   -
361   - for ($h=0; $h < count($arrComponentes);$h++)
  227 + $boolNovaOperacao = true;
  228 + $strOperacaoAtual = $arrOperacoes[$g];
  229 + for ($h=0; $h < count($arrTiposComponentes);$h++)
362 230 {
363   - $strNomeArrayComponente = 'arr'.trim($arrComponentes[$h]);
  231 + $strNomeArrayComponente = 'arr'.trim($arrTiposComponentes[$h]);
364 232  
365 233 // Importo a variável array do componente via variável-variável
366 234 global $$strNomeArrayComponente;
... ... @@ -368,7 +236,7 @@ function TrataAlteracoes($strTripaComponentes, $arrColunasSelecionadas,$arrDescr
368 236 $arrItensAlteracoesExterno = $$strNomeArrayComponente;
369 237  
370 238 // Explodo os tipos de componentes
371   - $arrAlteracoes = explode('#'.trim($arrComponentes[$h]).'#',$arrItensAlteracoesExterno[$arrOperacoes[$g]]);
  239 + $arrAlteracoes = explode('#'.trim($arrTiposComponentes[$h]).'#',$arrItensAlteracoesExterno[$arrOperacoes[$g]]);
372 240  
373 241 for ($i=0; $i < count($arrAlteracoes); $i++)
374 242 {
... ... @@ -384,7 +252,7 @@ function TrataAlteracoes($strTripaComponentes, $arrColunasSelecionadas,$arrDescr
384 252 {
385 253 // Explodo os campos
386 254 $arrCampos = explode('###',$arrItensAlteracoes[$j]);
387   - if ($arrColunasSelecionadas[trim($arrCampos[0])]<>'')
  255 + if ($arrHardwareSelecionado[trim($arrCampos[0])]<>'')
388 256 {
389 257 $boolAlerta = true;
390 258 $j = count($arrItensAlteracoes);
... ... @@ -399,27 +267,47 @@ function TrataAlteracoes($strTripaComponentes, $arrColunasSelecionadas,$arrDescr
399 267 {
400 268 // Explodo os campos
401 269 $arrCampos = explode('###',$arrItensAlteracoes[$j]);
402   - $strDescricaoColuna = $arrDescricoesColunas[trim($arrCampos[0])];
  270 + $strDescricaoColuna = $arrDescricoesColunasComputadores[trim($arrCampos[0])];
403 271 $strDescricaoColuna = ($strDescricaoColuna?$strDescricaoColuna:trim($arrCampos[0]));
  272 + if ($boolNovaOperacao)
  273 + {
  274 + $strPluralItem = 'ns';
  275 + $strPlural = 's';
  276 + if (count($arrAlteracoes)==1)
  277 + {
  278 + $strPluralItem = 'm';
  279 + $strPlural = '';
  280 + }
  281 + $boolNovaOperacao = false;
  282 + $strAlteracoes .= '<br><br>'.str_repeat('=',50).' Ite'.$strPluralItem.' '.($strOperacaoAtual=='ACR'?'Acrescentado'.$strPlural:($strOperacaoAtual=='REM'?'Removido'.$strPlural:'Alterado'.$strPlural)).' '.str_repeat('=',50).'<br>';
  283 + }
404 284  
405 285 if ($j == 0)
406   - $strAlteracoes .= ($strAlteracoes<>''?'<br><br>':'').$arrDescricoesColunas[trim($arrCampos[0])] . ' => ' . $arrCampos[1].'<br>';
  286 + {
  287 + $strTextoItem = $arrDescricoesColunasComputadores[trim($arrCampos[0])] . ' => ';
  288 + $strAlteracoes .= $strTextoItem;
  289 + }
407 290 else
408   - $strAlteracoes .= ' '. $strDescricaoColuna . ': ' . $arrCampos[1].'<br>';
  291 + $strAlteracoes .= str_repeat(' ',strlen($strTextoItem)). $strDescricaoColuna . ': ';
  292 + $strAlteracoes .= $arrCampos[1].'<br>';
409 293 }
410 294 }
411 295 }
412 296 }
413 297 }
414   -
415   - if ($strAlteracoes)
416   - $strAlteracoes = ($strAlteracoes?' Itens '.($arrOperacoes[$g-1]=='ACR'?'Acrescentados':($arrOperacoes[$g-1]=='REM'?'Removidos':'Alterados')).':<br> ================<br>':'').$strAlteracoes.'<br>';
417   -
  298 +
418 299 return $strAlteracoes;
419 300 }
420 301  
421 302 function VerificaComponentes($strCsTipoComponente, $strTripaComponentesRecebidos, $intTotalGeralExistentes = 0)
422 303 {
  304 + // =============================================================
  305 + // Esta função retorna um array contendo os seguintes elementos:
  306 + // =============================================================
  307 + // ACR => Acrescentados
  308 + // REM => Removidos
  309 + // =============================================================
  310 +
423 311 global $te_node_address;
424 312 global $arrSO;
425 313  
... ... @@ -427,8 +315,6 @@ function VerificaComponentes($strCsTipoComponente, $strTripaComponentesRecebidos
427 315  
428 316 $strTripaACR = '';
429 317 $strTripaREM = '';
430   - $strTripaALT = '';
431   - $strTripaALT_OLD = '';
432 318 $intTotalExistentes = 0;
433 319 $intTotalRecebidos = 0;
434 320  
... ... @@ -454,9 +340,9 @@ function VerificaComponentes($strCsTipoComponente, $strTripaComponentesRecebidos
454 340 $resultComponentesExistentes = mysql_query($strQueryComponentesExistentes) or die('Problema Consultando Tabela Componentes_Estações 2!');
455 341 $intTotalExistentes = @mysql_num_rows($resultComponentesExistentes);
456 342  
457   - // ===============================================================================================
458   - // Se já existem componentes associados à estação, vou tratar ACRESCENTADOS, REMOVIDOS e ALTERADOS
459   - // ===============================================================================================
  343 + // ====================================================================================
  344 + // Se já existem componentes associados à estação, vou tratar ACRESCENTADOS e REMOVIDOS
  345 + // ====================================================================================
460 346 if ($intTotalExistentes > 0)
461 347 {
462 348 while ($rowComponentesExistentes = mysql_fetch_array($resultComponentesExistentes))
... ... @@ -505,6 +391,7 @@ function VerificaComponentes($strCsTipoComponente, $strTripaComponentesRecebidos
505 391 // ===============================
506 392 if (count($arrComponentesAcrescentados)>0)
507 393 {
  394 +
508 395 $strTripaInsereComponentes = '';
509 396 $strTripaACR = '';
510 397 for ($intItemComponentesAcrescentados = 0;$intItemComponentesAcrescentados < count($arrComponentesAcrescentados);$intItemComponentesAcrescentados ++)
... ... @@ -566,36 +453,8 @@ function VerificaComponentes($strCsTipoComponente, $strTripaComponentesRecebidos
566 453 }
567 454 }
568 455  
569   - /*
570   - // ===============================================================================================================================================
571   - // Verifico se houve apenas ALTERAÇÃO de componentes
572   - // ===============================================================================================================================================
573   - if ( count($arrComponentesAcrescentados) > 0 &&
574   - (count($arrComponentesAcrescentados) == count($arrComponentesRemovidos)) &&
575   - $strTripaComponentesRecebidosAux <> '#'.$strCsTipoComponente.'#' &&
576   - $strTripaComponentesExistentesAux <> '#'.$strCsTipoComponente.'#')
577   - {
578   - // Neste caso, entendo que houve apenas uma alteração e esvazio as tripas de ACRÉSCIMO e REMOÇÃO, informando apenas ALTERAÇÃO.
579   - $strTripaACR = '';
580   - $strTripaREM = '';
581   - $strTripaALT = $strTripaComponentesRecebidosAux;
582   - $strTripaALT_OLD = $strTripaComponentesExistentesAux;
583   - }
584   - // ===============================================================================================================================================
585   - */
586   -
587   - // =======================================================
588   - // Será retornado um array com os elementos:
589   - // =======================================================
590   - // ACR => Acrescentados
591   - // REM => Removidos
592   - // ALT => Alterados
593   - // ALT_OLD => Registros Antigos, afetados pelas ALTERAÇÕES
594   - // =======================================================
595 456 $arrRetorno = array('ACR' => $strTripaACR,
596   - 'REM' => $strTripaREM,
597   - 'ALT' => $strTripaALT,
598   - 'ALT_OLD' => $strTripaALT_OLD);
  457 + 'REM' => $strTripaREM);
599 458 return $arrRetorno;
600 459 }
601 460 ?>
602 461 \ No newline at end of file
... ...
ws/set_monitorado.php
... ... @@ -25,16 +25,25 @@ require_once(&#39;../include/library.php&#39;);
25 25 $v_cs_cipher = (trim($_POST['cs_cipher']) <> ''?trim($_POST['cs_cipher']) : '4');
26 26 $v_cs_compress = (trim($_POST['cs_compress']) <> ''?trim($_POST['cs_compress']) : '4');
27 27  
28   -autentica_agente($key,$iv,$v_cs_cipher,$v_cs_compress);
  28 +$strPaddingKey = '';
29 29  
30   -$te_node_address = DeCrypt($key,$iv,$_POST['te_node_address'] ,$v_cs_cipher,$v_cs_compress);
31   -$id_so_new = DeCrypt($key,$iv,$_POST['id_so'] ,$v_cs_cipher,$v_cs_compress);
32   -$te_so = DeCrypt($key,$iv,$_POST['te_so'] ,$v_cs_cipher,$v_cs_compress);
33   -$te_ip = DeCrypt($key,$iv,$_POST['te_ip'] ,$v_cs_cipher,$v_cs_compress);
34   -$id_ip_rede = DeCrypt($key,$iv,$_POST['id_ip_rede'] ,$v_cs_cipher,$v_cs_compress);
35   -$te_nome_computador = DeCrypt($key,$iv,$_POST['te_nome_computador'] ,$v_cs_cipher,$v_cs_compress);
36   -$te_workgroup = DeCrypt($key,$iv,$_POST['te_workgroup'] ,$v_cs_cipher,$v_cs_compress);
37   -$v_tripa_monitorados = DeCrypt($key,$iv,$_POST['te_tripa_monitorados'] ,$v_cs_cipher,$v_cs_compress);
  30 +// O agente PyCACIC envia o valor "padding_key" para preenchimento da palavra chave para decriptação/encriptação
  31 +if ($_POST['padding_key'])
  32 + {
  33 + // Valores específicos para trabalho com o PyCACIC - 04 de abril de 2008 - Rogério Lino - Dataprev/ES
  34 + $strPaddingKey = $_POST['padding_key']; // A versão inicial do agente em Python exige esse complemento na chave...
  35 + }
  36 +
  37 +autentica_agente($key,$iv,$v_cs_cipher,$v_cs_compress, $strPaddingKey);
  38 +
  39 +$te_node_address = DeCrypt($key,$iv,$_POST['te_node_address'] ,$v_cs_cipher,$v_cs_compress,$strPaddingKey);
  40 +$id_so_new = DeCrypt($key,$iv,$_POST['id_so'] ,$v_cs_cipher,$v_cs_compress,$strPaddingKey);
  41 +$te_so = DeCrypt($key,$iv,$_POST['te_so'] ,$v_cs_cipher,$v_cs_compress,$strPaddingKey);
  42 +$te_ip = DeCrypt($key,$iv,$_POST['te_ip'] ,$v_cs_cipher,$v_cs_compress,$strPaddingKey);
  43 +$id_ip_rede = DeCrypt($key,$iv,$_POST['id_ip_rede'] ,$v_cs_cipher,$v_cs_compress,$strPaddingKey);
  44 +$te_nome_computador = DeCrypt($key,$iv,$_POST['te_nome_computador'] ,$v_cs_cipher,$v_cs_compress,$strPaddingKey);
  45 +$te_workgroup = DeCrypt($key,$iv,$_POST['te_workgroup'] ,$v_cs_cipher,$v_cs_compress,$strPaddingKey);
  46 +$v_tripa_monitorados = DeCrypt($key,$iv,$_POST['te_tripa_monitorados'],$v_cs_cipher,$v_cs_compress,$strPaddingKey);
38 47  
39 48  
40 49 /* Todas as vezes em que é feita a recuperação das configurações por um agente, é incluído
... ...
ws/set_officescan.php
... ... @@ -25,15 +25,24 @@ require_once(&#39;../include/library.php&#39;);
25 25 $v_cs_cipher = (trim($_POST['cs_cipher']) <> ''?trim($_POST['cs_cipher']) : '4');
26 26 $v_cs_compress = (trim($_POST['cs_compress']) <> ''?trim($_POST['cs_compress']) : '4');
27 27  
28   -autentica_agente($key,$iv,$v_cs_cipher,$v_cs_compress);
  28 +$strPaddingKey = '';
29 29  
30   -$te_node_address = DeCrypt($key,$iv,$_POST['te_node_address'] ,$v_cs_cipher,$v_cs_compress);
31   -$id_so_new = DeCrypt($key,$iv,$_POST['id_so'] ,$v_cs_cipher,$v_cs_compress);
32   -$te_so = DeCrypt($key,$iv,$_POST['te_so'] ,$v_cs_cipher,$v_cs_compress);
33   -$te_ip = DeCrypt($key,$iv,$_POST['te_ip'] ,$v_cs_cipher,$v_cs_compress);
34   -$id_ip_rede = DeCrypt($key,$iv,$_POST['id_ip_rede'] ,$v_cs_cipher,$v_cs_compress);
35   -$te_nome_computador = DeCrypt($key,$iv,$_POST['te_nome_computador'] ,$v_cs_cipher,$v_cs_compress);
36   -$te_workgroup = DeCrypt($key,$iv,$_POST['te_workgroup'] ,$v_cs_cipher,$v_cs_compress);
  30 +// O agente PyCACIC envia o valor "padding_key" para preenchimento da palavra chave para decriptação/encriptação
  31 +if ($_POST['padding_key'])
  32 + {
  33 + // Valores específicos para trabalho com o PyCACIC - 04 de abril de 2008 - Rogério Lino - Dataprev/ES
  34 + $strPaddingKey = $_POST['padding_key']; // A versão inicial do agente em Python exige esse complemento na chave...
  35 + }
  36 +
  37 +autentica_agente($key,$iv,$v_cs_cipher,$v_cs_compress, $strPaddingKey);
  38 +
  39 +$te_node_address = DeCrypt($key,$iv,$_POST['te_node_address'] ,$v_cs_cipher,$v_cs_compress, $strPaddingKey);
  40 +$id_so_new = DeCrypt($key,$iv,$_POST['id_so'] ,$v_cs_cipher,$v_cs_compress, $strPaddingKey);
  41 +$te_so = DeCrypt($key,$iv,$_POST['te_so'] ,$v_cs_cipher,$v_cs_compress, $strPaddingKey);
  42 +$te_ip = DeCrypt($key,$iv,$_POST['te_ip'] ,$v_cs_cipher,$v_cs_compress, $strPaddingKey);
  43 +$id_ip_rede = DeCrypt($key,$iv,$_POST['id_ip_rede'] ,$v_cs_cipher,$v_cs_compress, $strPaddingKey);
  44 +$te_nome_computador = DeCrypt($key,$iv,$_POST['te_nome_computador'] ,$v_cs_cipher,$v_cs_compress, $strPaddingKey);
  45 +$te_workgroup = DeCrypt($key,$iv,$_POST['te_workgroup'] ,$v_cs_cipher,$v_cs_compress, $strPaddingKey);
37 46  
38 47 /* Todas as vezes em que é feita a recuperação das configurações por um agente, é incluído
39 48 o computador deste agente no BD, caso ainda não esteja inserido. */
... ... @@ -62,12 +71,12 @@ if ($te_node_address &lt;&gt; &#39;&#39;)
62 71 }
63 72  
64 73 $query = "UPDATE officescan
65   - SET nu_versao_engine = '" . DeCrypt($key,$iv,$_POST['nu_versao_engine'] ,$v_cs_cipher,$v_cs_compress) . "',
66   - nu_versao_pattern = '" . DeCrypt($key,$iv,$_POST['nu_versao_pattern'] ,$v_cs_cipher,$v_cs_compress) . "',
  74 + SET nu_versao_engine = '" . DeCrypt($key,$iv,$_POST['nu_versao_engine'] ,$v_cs_cipher,$v_cs_compress, $strPaddingKey) . "',
  75 + nu_versao_pattern = '" . DeCrypt($key,$iv,$_POST['nu_versao_pattern'] ,$v_cs_cipher,$v_cs_compress, $strPaddingKey) . "',
67 76 dt_hr_coleta = NOW(),
68   - dt_hr_instalacao = '" . DeCrypt($key,$iv,$_POST['dt_hr_instalacao'] ,$v_cs_cipher,$v_cs_compress) . "',
69   - te_servidor = '" . DeCrypt($key,$iv,$_POST['te_servidor'] ,$v_cs_cipher,$v_cs_compress) . "',
70   - in_ativo = '" . DeCrypt($key,$iv,$_POST['in_ativo'] ,$v_cs_cipher,$v_cs_compress) . "'
  77 + dt_hr_instalacao = '" . DeCrypt($key,$iv,$_POST['dt_hr_instalacao'] ,$v_cs_cipher,$v_cs_compress, $strPaddingKey) . "',
  78 + te_servidor = '" . DeCrypt($key,$iv,$_POST['te_servidor'] ,$v_cs_cipher,$v_cs_compress, $strPaddingKey) . "',
  79 + in_ativo = '" . DeCrypt($key,$iv,$_POST['in_ativo'] ,$v_cs_cipher,$v_cs_compress, $strPaddingKey) . "'
71 80 WHERE te_node_address = '" . $te_node_address . "' and
72 81 id_so = '" . $arrSO['id_so'] . "'";
73 82 $result = mysql_query($query);
... ...
ws/set_patrimonio.php
... ... @@ -25,20 +25,29 @@ require_once(&#39;../include/library.php&#39;);
25 25 $v_cs_cipher = (trim($_POST['cs_cipher']) <> ''?trim($_POST['cs_cipher']) : '4');
26 26 $v_cs_compress = (trim($_POST['cs_compress']) <> ''?trim($_POST['cs_compress']) : '4');
27 27  
28   -autentica_agente($key,$iv,$v_cs_cipher,$v_cs_compress);
  28 +$strPaddingKey = '';
  29 +
  30 +// O agente PyCACIC envia o valor "padding_key" para preenchimento da palavra chave para decriptação/encriptação
  31 +if ($_POST['padding_key'])
  32 + {
  33 + // Valores específicos para trabalho com o PyCACIC - 04 de abril de 2008 - Rogério Lino - Dataprev/ES
  34 + $strPaddingKey = $_POST['padding_key']; // A versão inicial do agente em Python exige esse complemento na chave...
  35 + }
  36 +
  37 +autentica_agente($key,$iv,$v_cs_cipher,$v_cs_compress,$strPaddingKey);
29 38  
30 39  
31 40 $v_dados_rede = getDadosRede();
32 41  
33 42 // Se o envio de informações foi feito com dados criptografados... (Versões 2.0.2.5+)
34   -$te_node_address = DeCrypt($key,$iv,$_POST['te_node_address'] ,$v_cs_cipher,$v_cs_compress);
35   -$id_so_new = DeCrypt($key,$iv,$_POST['id_so'] ,$v_cs_cipher,$v_cs_compress);
36   -$te_so = DeCrypt($key,$iv,$_POST['te_so'] ,$v_cs_cipher,$v_cs_compress);
37   -$te_nome_computador = DeCrypt($key,$iv,$_POST['te_nome_computador'] ,$v_cs_cipher,$v_cs_compress);
38   -$te_ip = DeCrypt($key,$iv,$_POST['te_ip'] ,$v_cs_cipher,$v_cs_compress);
39   -$te_nome_host = DeCrypt($key,$iv,$_POST['te_nome_host'] ,$v_cs_cipher,$v_cs_compress);
40   -$id_ip_rede = DeCrypt($key,$iv,$_POST['id_ip_rede'] ,$v_cs_cipher,$v_cs_compress);
41   -$te_workgroup = DeCrypt($key,$iv,$_POST['te_workgroup'] ,$v_cs_cipher,$v_cs_compress);
  43 +$te_node_address = DeCrypt($key,$iv,$_POST['te_node_address'] ,$v_cs_cipher,$v_cs_compress,$strPaddingKey);
  44 +$id_so_new = DeCrypt($key,$iv,$_POST['id_so'] ,$v_cs_cipher,$v_cs_compress,$strPaddingKey);
  45 +$te_so = DeCrypt($key,$iv,$_POST['te_so'] ,$v_cs_cipher,$v_cs_compress,$strPaddingKey);
  46 +$te_nome_computador = DeCrypt($key,$iv,$_POST['te_nome_computador'] ,$v_cs_cipher,$v_cs_compress,$strPaddingKey);
  47 +$te_ip = DeCrypt($key,$iv,$_POST['te_ip'] ,$v_cs_cipher,$v_cs_compress,$strPaddingKey);
  48 +$te_nome_host = DeCrypt($key,$iv,$_POST['te_nome_host'] ,$v_cs_cipher,$v_cs_compress,$strPaddingKey);
  49 +$id_ip_rede = DeCrypt($key,$iv,$_POST['id_ip_rede'] ,$v_cs_cipher,$v_cs_compress,$strPaddingKey);
  50 +$te_workgroup = DeCrypt($key,$iv,$_POST['te_workgroup'] ,$v_cs_cipher,$v_cs_compress,$strPaddingKey);
42 51  
43 52 /* Todas as vezes em que é feita a recuperação das configurações por um agente, é incluído
44 53 o computador deste agente no BD, caso ainda não esteja inserido. */
... ... @@ -139,12 +148,12 @@ if ($te_node_address &lt;&gt; &#39;&#39;)
139 148 $tam_campo_tabela = mysql_field_len($result, $i);
140 149 $posicao_array_nomes_campos = array_search($nome_campo_tabela, $array_nomes_campos);
141 150 $nome_campo_tela = $array_nomes_campos[$posicao_array_nomes_campos + 1];
142   - if (($campos["$nome_campo_tabela"] != substr(DeCrypt($key,$iv,$_POST[$nome_campo_tabela],$v_cs_cipher,$v_cs_compress), 0, $tam_campo_tabela)) && ($nome_campo_tabela != 'dt_hr_alteracao' && $nome_campo_tabela != 'id_so' && $nome_campo_tabela != 'te_node_address'))
  151 + if (($campos["$nome_campo_tabela"] != substr(DeCrypt($key,$iv,$_POST[$nome_campo_tabela],$v_cs_cipher,$v_cs_compress,$strPaddingKey), 0, $tam_campo_tabela)) && ($nome_campo_tabela != 'dt_hr_alteracao' && $nome_campo_tabela != 'id_so' && $nome_campo_tabela != 'te_node_address'))
143 152 {
144 153 if ($nome_campo_tabela != 'id_unid_organizacional_nivel1a' && $nome_campo_tabela != 'id_unid_organizacional_nivel2')
145 154 {
146 155 $valor_anterior = $campos["$nome_campo_tabela"];
147   - $valor_atual = DeCrypt($key,$iv,$_POST["$nome_campo_tabela"],$v_cs_cipher,$v_cs_compress);
  156 + $valor_atual = DeCrypt($key,$iv,$_POST["$nome_campo_tabela"],$v_cs_cipher,$v_cs_compress,$strPaddingKey);
148 157 }
149 158 else
150 159 {
... ... @@ -152,14 +161,14 @@ if ($te_node_address &lt;&gt; &#39;&#39;)
152 161 {
153 162 $posicao_array_nomes_UON1 = array_search($campos["$nome_campo_tabela"], $array_nomes_UON1);
154 163 $valor_anterior = $array_nomes_UON1[$posicao_array_nomes_UON1 + 1];
155   - $posicao_array_nomes_UON1 = array_search(DeCrypt($key,$iv,$_POST["$nome_campo_tabela"],$v_cs_cipher,$v_cs_compress), $array_nomes_UON1);
  164 + $posicao_array_nomes_UON1 = array_search(DeCrypt($key,$iv,$_POST["$nome_campo_tabela"],$v_cs_cipher,$v_cs_compress,$strPaddingKey), $array_nomes_UON1);
156 165 $valor_atual = $array_nomes_UON1[$posicao_array_nomes_UON1 + 1];
157 166 }
158 167 else
159 168 {
160 169 $posicao_array_nomes_UON2 = array_search($campos["$nome_campo_tabela"], $array_nomes_UON2);
161 170 $valor_anterior = $array_nomes_UON2[$posicao_array_nomes_UON2 + 1];
162   - $posicao_array_nomes_UON2 = array_search(DeCrypt($key,$iv,$_POST["$nome_campo_tabela"],$v_cs_cipher,$v_cs_compress), $array_nomes_UON2);
  171 + $posicao_array_nomes_UON2 = array_search(DeCrypt($key,$iv,$_POST["$nome_campo_tabela"],$v_cs_cipher,$v_cs_compress,$strPaddingKey), $array_nomes_UON2);
163 172 $valor_atual = $array_nomes_UON2[$posicao_array_nomes_UON2 + 1];
164 173 }
165 174 }
... ... @@ -214,15 +223,15 @@ if ($te_node_address &lt;&gt; &#39;&#39;)
214 223 VALUES ('" . $te_node_address . "',
215 224 '" . $arrSO['id_so'] . "',
216 225 NOW(),
217   - '" . DeCrypt($key,$iv,$_POST['id_unid_organizacional_nivel1a'] ,$v_cs_cipher,$v_cs_compress) . "',
218   - '" . DeCrypt($key,$iv,$_POST['id_unid_organizacional_nivel2'] ,$v_cs_cipher,$v_cs_compress) . "',
219   - '" . DeCrypt($key,$iv,$_POST['te_localizacao_complementar'] ,$v_cs_cipher,$v_cs_compress) . "',
220   - '" . DeCrypt($key,$iv,$_POST['te_info_patrimonio1'] ,$v_cs_cipher,$v_cs_compress) . "',
221   - '" . DeCrypt($key,$iv,$_POST['te_info_patrimonio2'] ,$v_cs_cipher,$v_cs_compress) . "',
222   - '" . DeCrypt($key,$iv,$_POST['te_info_patrimonio3'] ,$v_cs_cipher,$v_cs_compress) . "',
223   - '" . DeCrypt($key,$iv,$_POST['te_info_patrimonio4'] ,$v_cs_cipher,$v_cs_compress) . "',
224   - '" . DeCrypt($key,$iv,$_POST['te_info_patrimonio5'] ,$v_cs_cipher,$v_cs_compress) . "',
225   - '" . DeCrypt($key,$iv,$_POST['te_info_patrimonio6'] ,$v_cs_cipher,$v_cs_compress) . "')";
  226 + '" . DeCrypt($key,$iv,$_POST['id_unid_organizacional_nivel1a'] ,$v_cs_cipher,$v_cs_compress,$strPaddingKey) . "',
  227 + '" . DeCrypt($key,$iv,$_POST['id_unid_organizacional_nivel2'] ,$v_cs_cipher,$v_cs_compress,$strPaddingKey) . "',
  228 + '" . DeCrypt($key,$iv,$_POST['te_localizacao_complementar'] ,$v_cs_cipher,$v_cs_compress,$strPaddingKey) . "',
  229 + '" . DeCrypt($key,$iv,$_POST['te_info_patrimonio1'] ,$v_cs_cipher,$v_cs_compress,$strPaddingKey) . "',
  230 + '" . DeCrypt($key,$iv,$_POST['te_info_patrimonio2'] ,$v_cs_cipher,$v_cs_compress,$strPaddingKey) . "',
  231 + '" . DeCrypt($key,$iv,$_POST['te_info_patrimonio3'] ,$v_cs_cipher,$v_cs_compress,$strPaddingKey) . "',
  232 + '" . DeCrypt($key,$iv,$_POST['te_info_patrimonio4'] ,$v_cs_cipher,$v_cs_compress,$strPaddingKey) . "',
  233 + '" . DeCrypt($key,$iv,$_POST['te_info_patrimonio5'] ,$v_cs_cipher,$v_cs_compress,$strPaddingKey) . "',
  234 + '" . DeCrypt($key,$iv,$_POST['te_info_patrimonio6'] ,$v_cs_cipher,$v_cs_compress,$strPaddingKey) . "')";
226 235 $result = mysql_query($query);
227 236 echo '<?xml version="1.0" encoding="iso-8859-1" ?><STATUS>OK</STATUS>';
228 237 }
... ...
ws/set_software.php
... ... @@ -25,17 +25,26 @@ require_once(&#39;../include/library.php&#39;);
25 25 $v_cs_cipher = (trim($_POST['cs_cipher']) <> ''?trim($_POST['cs_cipher']) : '4');
26 26 $v_cs_compress = (trim($_POST['cs_compress']) <> ''?trim($_POST['cs_compress']) : '4');
27 27  
28   -autentica_agente($key,$iv,$v_cs_cipher,$v_cs_compress);
  28 +$strPaddingKey = '';
  29 +
  30 +// O agente PyCACIC envia o valor "padding_key" para preenchimento da palavra chave para decriptação/encriptação
  31 +if ($_POST['padding_key'])
  32 + {
  33 + // Valores específicos para trabalho com o PyCACIC - 04 de abril de 2008 - Rogério Lino - Dataprev/ES
  34 + $strPaddingKey = $_POST['padding_key']; // A versão inicial do agente em Python exige esse complemento na chave...
  35 + }
  36 +
  37 +autentica_agente($key,$iv,$v_cs_cipher,$v_cs_compress,$strPaddingKey);
29 38  
30 39 // Se o envio de informações foi feito com dados criptografados... (Versões 2.0.2.5+)
31   -$te_node_address = DeCrypt($key,$iv,$_POST['te_node_address'] ,$v_cs_cipher,$v_cs_compress);
32   -$id_so_new = DeCrypt($key,$iv,$_POST['id_so'] ,$v_cs_cipher,$v_cs_compress);
33   -$te_so = DeCrypt($key,$iv,$_POST['te_so'] ,$v_cs_cipher,$v_cs_compress);
34   -$te_nome_computador = DeCrypt($key,$iv,$_POST['te_nome_computador'] ,$v_cs_cipher,$v_cs_compress);
35   -$te_ip = DeCrypt($key,$iv,$_POST['te_ip'] ,$v_cs_cipher,$v_cs_compress);
36   -$te_nome_host = DeCrypt($key,$iv,$_POST['te_nome_host'] ,$v_cs_cipher,$v_cs_compress);
37   -$id_ip_rede = DeCrypt($key,$iv,$_POST['id_ip_rede'] ,$v_cs_cipher,$v_cs_compress);
38   -$te_workgroup = DeCrypt($key,$iv,$_POST['te_workgroup'] ,$v_cs_cipher,$v_cs_compress);
  40 +$te_node_address = DeCrypt($key,$iv,$_POST['te_node_address'] ,$v_cs_cipher,$v_cs_compress,$strPaddingKey);
  41 +$id_so_new = DeCrypt($key,$iv,$_POST['id_so'] ,$v_cs_cipher,$v_cs_compress,$strPaddingKey);
  42 +$te_so = DeCrypt($key,$iv,$_POST['te_so'] ,$v_cs_cipher,$v_cs_compress,$strPaddingKey);
  43 +$te_nome_computador = DeCrypt($key,$iv,$_POST['te_nome_computador'] ,$v_cs_cipher,$v_cs_compress,$strPaddingKey);
  44 +$te_ip = DeCrypt($key,$iv,$_POST['te_ip'] ,$v_cs_cipher,$v_cs_compress,$strPaddingKey);
  45 +$te_nome_host = DeCrypt($key,$iv,$_POST['te_nome_host'] ,$v_cs_cipher,$v_cs_compress,$strPaddingKey);
  46 +$id_ip_rede = DeCrypt($key,$iv,$_POST['id_ip_rede'] ,$v_cs_cipher,$v_cs_compress,$strPaddingKey);
  47 +$te_workgroup = DeCrypt($key,$iv,$_POST['te_workgroup'] ,$v_cs_cipher,$v_cs_compress,$strPaddingKey);
39 48  
40 49 /* Todas as vezes em que é feita a recuperação das configurações por um agente, é incluído
41 50 o computador deste agente no BD, caso ainda não esteja inserido. */
... ... @@ -68,15 +77,15 @@ if ($te_node_address &lt;&gt; &#39;&#39;)
68 77 }
69 78  
70 79 $query = "UPDATE versoes_softwares
71   - SET te_versao_bde = '" . DeCrypt($key,$iv,$_POST['te_versao_bde'] ,$v_cs_cipher,$v_cs_compress) . "',
72   - te_versao_dao = '" . DeCrypt($key,$iv,$_POST['te_versao_dao'] ,$v_cs_cipher,$v_cs_compress) . "',
73   - te_versao_ado = '" . DeCrypt($key,$iv,$_POST['te_versao_ado'] ,$v_cs_cipher,$v_cs_compress) . "',
74   - te_versao_odbc = '" . DeCrypt($key,$iv,$_POST['te_versao_odbc'] ,$v_cs_cipher,$v_cs_compress) . "',
75   - te_versao_directx = '" . DeCrypt($key,$iv,$_POST['te_versao_directx'] ,$v_cs_cipher,$v_cs_compress) . "',
76   - te_versao_acrobat_reader = '" . DeCrypt($key,$iv,$_POST['te_versao_acrobat_reader'] ,$v_cs_cipher,$v_cs_compress) . "',
77   - te_versao_ie = '" . DeCrypt($key,$iv,$_POST['te_versao_ie'] ,$v_cs_cipher,$v_cs_compress) . "',
78   - te_versao_mozilla = '" . DeCrypt($key,$iv,$_POST['te_versao_mozilla'] ,$v_cs_cipher,$v_cs_compress) . "',
79   - te_versao_jre = '" . DeCrypt($key,$iv,$_POST['te_versao_jre'] ,$v_cs_cipher,$v_cs_compress) . "'
  80 + SET te_versao_bde = '" . DeCrypt($key,$iv,$_POST['te_versao_bde'] ,$v_cs_cipher,$v_cs_compress,$strPaddingKey) . "',
  81 + te_versao_dao = '" . DeCrypt($key,$iv,$_POST['te_versao_dao'] ,$v_cs_cipher,$v_cs_compress,$strPaddingKey) . "',
  82 + te_versao_ado = '" . DeCrypt($key,$iv,$_POST['te_versao_ado'] ,$v_cs_cipher,$v_cs_compress,$strPaddingKey) . "',
  83 + te_versao_odbc = '" . DeCrypt($key,$iv,$_POST['te_versao_odbc'] ,$v_cs_cipher,$v_cs_compress,$strPaddingKey) . "',
  84 + te_versao_directx = '" . DeCrypt($key,$iv,$_POST['te_versao_directx'] ,$v_cs_cipher,$v_cs_compress,$strPaddingKey) . "',
  85 + te_versao_acrobat_reader = '" . DeCrypt($key,$iv,$_POST['te_versao_acrobat_reader'] ,$v_cs_cipher,$v_cs_compress,$strPaddingKey) . "',
  86 + te_versao_ie = '" . DeCrypt($key,$iv,$_POST['te_versao_ie'] ,$v_cs_cipher,$v_cs_compress,$strPaddingKey) . "',
  87 + te_versao_mozilla = '" . DeCrypt($key,$iv,$_POST['te_versao_mozilla'] ,$v_cs_cipher,$v_cs_compress,$strPaddingKey) . "',
  88 + te_versao_jre = '" . DeCrypt($key,$iv,$_POST['te_versao_jre'] ,$v_cs_cipher,$v_cs_compress,$strPaddingKey) . "'
80 89 WHERE te_node_address = '" . $te_node_address . "' and
81 90 id_so = '" . $arrSO['id_so'] . "'";
82 91 $result = mysql_query($query);
... ... @@ -84,7 +93,7 @@ if ($te_node_address &lt;&gt; &#39;&#39;)
84 93 // =========================================================
85 94 // SOFTWARES INVENTARIADOS (Registrados no Windows Registry)
86 95 // =========================================================
87   - $te_inventario_softwares = str_replace("&quot;","'",DeCrypt($key,$iv,$_POST['te_inventario_softwares'],$v_cs_cipher,$v_cs_compress));
  96 + $te_inventario_softwares = str_replace("&quot;","'",DeCrypt($key,$iv,$_POST['te_inventario_softwares'],$v_cs_cipher,$v_cs_compress,$strPaddingKey));
88 97 $te_inventario_softwares = str_replace("&apos;","^",$te_inventario_softwares);
89 98 // Aspas simples e acento cincunflexo inseridos pelo agente coletor
90 99  
... ... @@ -165,7 +174,7 @@ if ($te_node_address &lt;&gt; &#39;&#39;)
165 174 // =====================
166 175 // VARIÁVEIS DE AMBIENTE
167 176 // =====================
168   - $te_variaveis_ambiente = DeCrypt($key,$iv,$_POST['te_variaveis_ambiente'],$v_cs_cipher,$v_cs_compress);
  177 + $te_variaveis_ambiente = DeCrypt($key,$iv,$_POST['te_variaveis_ambiente'],$v_cs_cipher,$v_cs_compress,$strPaddingKey);
169 178  
170 179 while (substr(trim($te_variaveis_ambiente),0,1)=='=')
171 180 $te_variaveis_ambiente = substr(trim($te_variaveis_ambiente),1);
... ...
ws/set_software_nao_opcional.php
... ... @@ -20,6 +20,7 @@
20 20 //$v_compress_level = 9;
21 21 $v_compress_level = 0; // Mantido em 0(zero) para desabilitar a Compressão/Decompressão
22 22 // Há necessidade de testes para Análise de Viabilidade Técnica
  23 +
23 24  
24 25 require_once('../include/library.php');
25 26  
... ... @@ -27,17 +28,26 @@ require_once(&#39;../include/library.php&#39;);
27 28 $v_cs_cipher = (trim($_POST['cs_cipher']) <> ''?trim($_POST['cs_cipher']) : '4');
28 29 $v_cs_compress = (trim($_POST['cs_compress']) <> ''?trim($_POST['cs_compress']) : '4');
29 30  
30   -autentica_agente($key,$iv,$v_cs_cipher,$v_cs_compress);
  31 +$strPaddingKey = '';
  32 +
  33 +// O agente PyCACIC envia o valor "padding_key" para preenchimento da palavra chave para decriptação/encriptação
  34 +if ($_POST['padding_key'])
  35 + {
  36 + // Valores específicos para trabalho com o PyCACIC - 04 de abril de 2008 - Rogério Lino - Dataprev/ES
  37 + $strPaddingKey = $_POST['padding_key']; // A versão inicial do agente em Python exige esse complemento na chave...
  38 + }
  39 +
  40 +autentica_agente($key,$iv,$v_cs_cipher,$v_cs_compress,$strPaddingKey);
31 41  
32 42 // Se o envio de informações foi feito com dados criptografados... (Versões 2.0.2.5+)
33   -$te_node_address = DeCrypt($key,$iv,$_POST['te_node_address'] ,$v_cs_cipher,$v_cs_compress);
34   -$id_so_new = DeCrypt($key,$iv,$_POST['id_so'] ,$v_cs_cipher,$v_cs_compress);
35   -$te_so = DeCrypt($key,$iv,$_POST['te_so'] ,$v_cs_cipher,$v_cs_compress);
36   -$te_ip = DeCrypt($key,$iv,$_POST['te_ip'] ,$v_cs_cipher,$v_cs_compress);
37   -$te_nome_computador = DeCrypt($key,$iv,$_POST['te_nome_computador'] ,$v_cs_cipher,$v_cs_compress);
38   -$te_nome_host = DeCrypt($key,$iv,$_POST['te_nome_host'] ,$v_cs_cipher,$v_cs_compress);
39   -$id_ip_rede = DeCrypt($key,$iv,$_POST['id_ip_rede'] ,$v_cs_cipher,$v_cs_compress);
40   -$te_workgroup = DeCrypt($key,$iv,$_POST['te_workgroup'] ,$v_cs_cipher,$v_cs_compress);
  43 +$te_node_address = DeCrypt($key,$iv,$_POST['te_node_address'] ,$v_cs_cipher,$v_cs_compress,$strPaddingKey);
  44 +$id_so_new = DeCrypt($key,$iv,$_POST['id_so'] ,$v_cs_cipher,$v_cs_compress,$strPaddingKey);
  45 +$te_so = DeCrypt($key,$iv,$_POST['te_so'] ,$v_cs_cipher,$v_cs_compress,$strPaddingKey);
  46 +$te_ip = DeCrypt($key,$iv,$_POST['te_ip'] ,$v_cs_cipher,$v_cs_compress,$strPaddingKey);
  47 +$te_nome_computador = DeCrypt($key,$iv,$_POST['te_nome_computador'] ,$v_cs_cipher,$v_cs_compress,$strPaddingKey);
  48 +$te_nome_host = DeCrypt($key,$iv,$_POST['te_nome_host'] ,$v_cs_cipher,$v_cs_compress,$strPaddingKey);
  49 +$id_ip_rede = DeCrypt($key,$iv,$_POST['id_ip_rede'] ,$v_cs_cipher,$v_cs_compress,$strPaddingKey);
  50 +$te_workgroup = DeCrypt($key,$iv,$_POST['te_workgroup'] ,$v_cs_cipher,$v_cs_compress,$strPaddingKey);
41 51  
42 52 /* Todas as vezes em que é feita a recuperação das configurações por um agente, é incluído
43 53 o computador deste agente no BD, caso ainda não esteja inserido. */
... ... @@ -53,7 +63,7 @@ if ($te_node_address &lt;&gt; &#39;&#39;)
53 63 conecta_bd_cacic();
54 64  
55 65 $query = " UPDATE computadores
56   - SET te_versao_cacic = '" . DeCrypt($key,$iv,$_POST['te_versao_cacic'],$v_cs_cipher,$v_cs_compress) . "'
  66 + SET te_versao_cacic = '" . DeCrypt($key,$iv,$_POST['te_versao_cacic'],$v_cs_cipher,$v_cs_compress,$strPaddingKey) . "'
57 67 WHERE te_node_address = '" . $te_node_address . "' and
58 68 id_so = '" . $arrSO['id_so'] . "'";
59 69 $result = mysql_query($query);
... ...
ws/set_tcp_ip.php
... ... @@ -24,15 +24,27 @@ require_once(&#39;../include/library.php&#39;);
24 24 $v_cs_cipher = (trim($_POST['cs_cipher']) <> ''?trim($_POST['cs_cipher']) : '4');
25 25 $v_cs_compress = (trim($_POST['cs_compress']) <> ''?trim($_POST['cs_compress']) : '4');
26 26  
27   -autentica_agente($key,$iv,$v_cs_cipher,$v_cs_compress);
  27 +$strPaddingKey = '';
28 28  
29   -$te_node_address = DeCrypt($key,$iv,$_POST['te_node_address'] ,$v_cs_cipher, $v_cs_compress);
30   -$id_so_new = DeCrypt($key,$iv,$_POST['id_so'] ,$v_cs_cipher, $v_cs_compress);
31   -$te_so = DeCrypt($key,$iv,$_POST['te_so'] ,$v_cs_cipher, $v_cs_compress);
32   -$id_ip_rede = DeCrypt($key,$iv,$_POST['id_ip_rede'] ,$v_cs_cipher, $v_cs_compress);
33   -$te_ip = DeCrypt($key,$iv,$_POST['te_ip'] ,$v_cs_cipher, $v_cs_compress);
34   -$te_nome_computador = DeCrypt($key,$iv,$_POST['te_nome_computador'] ,$v_cs_cipher, $v_cs_compress);
35   -$te_workgroup = DeCrypt($key,$iv,$_POST['te_workgroup'] ,$v_cs_cipher, $v_cs_compress);
  29 +// O agente PyCACIC envia o valor "padding_key" para preenchimento da palavra chave para decriptação/encriptação
  30 +if ($_POST['padding_key'])
  31 + {
  32 + // Valores específicos para trabalho com o PyCACIC - 04 de abril de 2008 - Rogério Lino - Dataprev/ES
  33 + $strPaddingKey = $_POST['padding_key']; // A versão inicial do agente em Python exige esse complemento na chave...
  34 + }
  35 +
  36 +autentica_agente($key,$iv,$v_cs_cipher,$v_cs_compress,$strPaddingKey);
  37 +
  38 +
  39 +$te_node_address = DeCrypt($key,$iv,$_POST['te_node_address'] ,$v_cs_cipher, $v_cs_compress,$strPaddingKey);
  40 +$id_so_new = DeCrypt($key,$iv,$_POST['id_so'] ,$v_cs_cipher, $v_cs_compress,$strPaddingKey);
  41 +$te_so = DeCrypt($key,$iv,$_POST['te_so'] ,$v_cs_cipher, $v_cs_compress,$strPaddingKey);
  42 +$id_ip_rede = DeCrypt($key,$iv,$_POST['id_ip_rede'] ,$v_cs_cipher, $v_cs_compress,$strPaddingKey);
  43 +$te_ip = DeCrypt($key,$iv,$_POST['te_ip'] ,$v_cs_cipher, $v_cs_compress,$strPaddingKey);
  44 +$te_nome_computador = DeCrypt($key,$iv,$_POST['te_nome_computador'] ,$v_cs_cipher, $v_cs_compress,$strPaddingKey);
  45 +//$te_workgroup = DeCrypt($key,$iv,$_POST['te_workgroup'] ,$v_cs_cipher, $v_cs_compress);
  46 +
  47 +$te_workgroup = DeCrypt($key,$iv,$_POST['te_dominio_windows'],$v_cs_cipher, $v_cs_compress,$strPaddingKey);
36 48  
37 49 conecta_bd_cacic();
38 50  
... ... @@ -50,7 +62,7 @@ if ($te_node_address &lt;&gt; &#39;&#39;)
50 62 $v_te_workgroup = $te_workgroup;
51 63 if ($v_te_workgroup == '')
52 64 {
53   - $v_array_te_dominio_windows = explode('\\',DeCrypt($key,$iv,$_POST['te_dominio_windows'],$v_cs_cipher, $v_cs_compress));
  65 + $v_array_te_dominio_windows = explode('\\',DeCrypt($key,$iv,$_POST['te_dominio_windows'],$v_cs_cipher, $v_cs_compress,$strPaddingKey));
54 66 $v_te_workgroup = $v_array_te_dominio_windows[0];
55 67 }
56 68  
... ... @@ -78,19 +90,20 @@ if ($te_node_address &lt;&gt; &#39;&#39;)
78 90 $te_nome_computador . "',
79 91 NOW(), '" .
80 92 $te_ip . "', '" .
81   - DeCrypt($key,$iv,$_POST['te_mascara'] ,$v_cs_cipher, $v_cs_compress) . "', '" .
  93 + DeCrypt($key,$iv,$_POST['te_mascara'] ,$v_cs_cipher, $v_cs_compress,$strPaddingKey) . "', '" .
82 94 $id_ip_rede . "', '" .
83   - DeCrypt($key,$iv,$_POST['te_gateway'] ,$v_cs_cipher, $v_cs_compress) . "', '" .
84   - DeCrypt($key,$iv,$_POST['te_serv_dhcp'] ,$v_cs_cipher, $v_cs_compress) . "', '" .
85   - DeCrypt($key,$iv,$_POST['te_nome_host'] ,$v_cs_cipher, $v_cs_compress) . "', '" .
86   - DeCrypt($key,$iv,$_POST['te_dominio_dns'] ,$v_cs_cipher, $v_cs_compress) . "', '" .
87   - DeCrypt($key,$iv,$_POST['te_dominio_windows'] ,$v_cs_cipher, $v_cs_compress) . "', '" .
88   - DeCrypt($key,$iv,$_POST['te_dns_primario'] ,$v_cs_cipher, $v_cs_compress) . "', '" .
89   - DeCrypt($key,$iv,$_POST['te_dns_secundario'] ,$v_cs_cipher, $v_cs_compress) . "', '" .
90   - DeCrypt($key,$iv,$_POST['te_wins_primario'] ,$v_cs_cipher, $v_cs_compress) . "', '" .
91   - DeCrypt($key,$iv,$_POST['te_wins_secundario'] ,$v_cs_cipher, $v_cs_compress) . "', '" .
  95 + DeCrypt($key,$iv,$_POST['te_gateway'] ,$v_cs_cipher, $v_cs_compress,$strPaddingKey) . "', '" .
  96 + DeCrypt($key,$iv,$_POST['te_serv_dhcp'] ,$v_cs_cipher, $v_cs_compress,$strPaddingKey) . "', '" .
  97 + DeCrypt($key,$iv,$_POST['te_nome_host'] ,$v_cs_cipher, $v_cs_compress,$strPaddingKey) . "', '" .
  98 + DeCrypt($key,$iv,$_POST['te_dominio_dns'] ,$v_cs_cipher, $v_cs_compress,$strPaddingKey) . "', '" .
  99 + $v_te_workgroup . "', '" .
  100 + DeCrypt($key,$iv,$_POST['te_dns_primario'] ,$v_cs_cipher, $v_cs_compress,$strPaddingKey) . "', '" .
  101 + DeCrypt($key,$iv,$_POST['te_dns_secundario'] ,$v_cs_cipher, $v_cs_compress,$strPaddingKey) . "', '" .
  102 + DeCrypt($key,$iv,$_POST['te_wins_primario'] ,$v_cs_cipher, $v_cs_compress,$strPaddingKey) . "', '" .
  103 + DeCrypt($key,$iv,$_POST['te_wins_secundario'] ,$v_cs_cipher, $v_cs_compress,$strPaddingKey) . "', '" .
92 104 $v_te_workgroup . "', '" .
93   - DeCrypt($key,$iv,$_POST['te_origem_mac'],$v_cs_cipher, $v_cs_compress) . "')";
  105 + DeCrypt($key,$iv,$_POST['te_origem_mac'],$v_cs_cipher, $v_cs_compress,$strPaddingKey) . "')";
  106 +// DeCrypt($key,$iv,$_POST['te_dominio_windows'] ,$v_cs_cipher, $v_cs_compress) . "', '" .
94 107 //GravaTESTES($query);
95 108  
96 109 $result = mysql_query($query);
... ... @@ -98,26 +111,28 @@ if ($te_node_address &lt;&gt; &#39;&#39;)
98 111 //echo $query;
99 112 //exit;
100 113  
101   - // Lembre-se de que o computador já existe. Ele é criado durante a obtenção das configurações, no arquivo get_config.php.
  114 + // O computador já existe.
  115 + // Ele é criado durante a obtenção das configurações, no script get_config.php.
102 116 $query = " UPDATE computadores
103 117 SET te_ip = '" . $te_ip . "',
104 118 te_nome_computador = '" . $te_nome_computador . "',
105   - te_mascara = '" . DeCrypt($key,$iv,$_POST['te_mascara'] ,$v_cs_cipher, $v_cs_compress) . "',
  119 + te_mascara = '" . DeCrypt($key,$iv,$_POST['te_mascara'] ,$v_cs_cipher, $v_cs_compress,$strPaddingKey) . "',
106 120 id_ip_rede = '" . $id_ip_rede . "',
107   - te_gateway = '" . DeCrypt($key,$iv,$_POST['te_gateway'] ,$v_cs_cipher, $v_cs_compress) . "',
108   - te_serv_dhcp = '" . DeCrypt($key,$iv,$_POST['te_serv_dhcp'] ,$v_cs_cipher, $v_cs_compress) . "',
109   - te_nome_host = '" . DeCrypt($key,$iv,$_POST['te_nome_host'] ,$v_cs_cipher, $v_cs_compress) . "',
110   - te_dominio_windows = '" . DeCrypt($key,$iv,$_POST['te_dominio_windows'] ,$v_cs_cipher, $v_cs_compress) . "',
111   - te_dominio_dns = '" . DeCrypt($key,$iv,$_POST['te_dominio_dns'] ,$v_cs_cipher, $v_cs_compress) . "',
112   - te_dns_primario = '" . DeCrypt($key,$iv,$_POST['te_dns_primario'] ,$v_cs_cipher, $v_cs_compress) . "',
113   - te_dns_secundario = '" . DeCrypt($key,$iv,$_POST['te_dns_secundario'] ,$v_cs_cipher, $v_cs_compress) . "',
114   - te_wins_primario = '" . DeCrypt($key,$iv,$_POST['te_wins_primario'] ,$v_cs_cipher, $v_cs_compress) . "',
115   - te_wins_secundario = '" . DeCrypt($key,$iv,$_POST['te_wins_secundario'] ,$v_cs_cipher, $v_cs_compress) . "',
  121 + te_gateway = '" . DeCrypt($key,$iv,$_POST['te_gateway'] ,$v_cs_cipher, $v_cs_compress,$strPaddingKey) . "',
  122 + te_serv_dhcp = '" . DeCrypt($key,$iv,$_POST['te_serv_dhcp'] ,$v_cs_cipher, $v_cs_compress,$strPaddingKey) . "',
  123 + te_nome_host = '" . DeCrypt($key,$iv,$_POST['te_nome_host'] ,$v_cs_cipher, $v_cs_compress,$strPaddingKey) . "',
  124 + te_dominio_windows = '" . $v_te_workgroup . "',
  125 + te_dominio_dns = '" . DeCrypt($key,$iv,$_POST['te_dominio_dns'] ,$v_cs_cipher, $v_cs_compress,$strPaddingKey) . "',
  126 + te_dns_primario = '" . DeCrypt($key,$iv,$_POST['te_dns_primario'] ,$v_cs_cipher, $v_cs_compress,$strPaddingKey) . "',
  127 + te_dns_secundario = '" . DeCrypt($key,$iv,$_POST['te_dns_secundario'] ,$v_cs_cipher, $v_cs_compress,$strPaddingKey) . "',
  128 + te_wins_primario = '" . DeCrypt($key,$iv,$_POST['te_wins_primario'] ,$v_cs_cipher, $v_cs_compress,$strPaddingKey) . "',
  129 + te_wins_secundario = '" . DeCrypt($key,$iv,$_POST['te_wins_secundario'] ,$v_cs_cipher, $v_cs_compress,$strPaddingKey) . "',
116 130 te_workgroup = '" . $v_te_workgroup . "',
117   - te_origem_mac = '" . DeCrypt($key,$iv,$_POST['te_origem_mac'] ,$v_cs_cipher, $v_cs_compress) . "'
  131 + te_origem_mac = '" . DeCrypt($key,$iv,$_POST['te_origem_mac'] ,$v_cs_cipher, $v_cs_compress,$strPaddingKey) . "'
118 132 WHERE te_node_address = '" . $te_node_address . "' and
119 133 id_so = '" . $arrSO['id_so'] . "'";
120 134 //GravaTESTES($query);
  135 +// te_dominio_windows = '" . DeCrypt($key,$iv,$_POST['te_dominio_windows'] ,$v_cs_cipher, $v_cs_compress) . "',
121 136 $result = mysql_query($query);
122 137  
123 138 echo '<?xml version="1.0" encoding="iso-8859-1" ?><STATUS>OK</STATUS>';
... ...
ws/set_unid_discos.php
... ... @@ -27,17 +27,27 @@ require_once(&#39;../include/library.php&#39;);
27 27 $v_cs_cipher = (trim($_POST['cs_cipher']) <> ''?trim($_POST['cs_cipher']) : '4');
28 28 $v_cs_compress = (trim($_POST['cs_compress']) <> ''?trim($_POST['cs_compress']) : '4');
29 29  
30   -autentica_agente($key,$iv,$v_cs_cipher,$v_cs_compress);
  30 +$strPaddingKey = '';
  31 +
  32 +// O agente PyCACIC envia o valor "padding_key" para preenchimento da palavra chave para decriptação/encriptação
  33 +if ($_POST['padding_key'])
  34 + {
  35 + // Valores específicos para trabalho com o PyCACIC - 04 de abril de 2008 - Rogério Lino - Dataprev/ES
  36 + $strPaddingKey = $_POST['padding_key']; // A versão inicial do agente em Python exige esse complemento na chave...
  37 + }
  38 +
  39 +autentica_agente($key,$iv,$v_cs_cipher,$v_cs_compress,$strPaddingKey);
  40 +
31 41  
32 42 // Se o envio de informações foi feito com dados criptografados... (Versões 2.0.2.5+)
33   -$te_node_address = DeCrypt($key,$iv,$_POST['te_node_address'] ,$v_cs_cipher,$v_cs_compress);
34   -$id_so_new = DeCrypt($key,$iv,$_POST['id_so'] ,$v_cs_cipher,$v_cs_compress);
35   -$te_so = DeCrypt($key,$iv,$_POST['te_so'] ,$v_cs_cipher,$v_cs_compress);
36   -$te_nome_computador = DeCrypt($key,$iv,$_POST['te_nome_computador'] ,$v_cs_cipher,$v_cs_compress);
37   -$te_ip = DeCrypt($key,$iv,$_POST['te_ip'] ,$v_cs_cipher,$v_cs_compress);
38   -$te_nome_host = DeCrypt($key,$iv,$_POST['te_nome_host'] ,$v_cs_cipher,$v_cs_compress);
39   -$id_ip_rede = DeCrypt($key,$iv,$_POST['id_ip_rede'] ,$v_cs_cipher,$v_cs_compress);
40   -$te_workgroup = DeCrypt($key,$iv,$_POST['te_workgroup'] ,$v_cs_cipher,$v_cs_compress);
  43 +$te_node_address = DeCrypt($key,$iv,$_POST['te_node_address'] ,$v_cs_cipher,$v_cs_compress,$strPaddingKey);
  44 +$id_so_new = DeCrypt($key,$iv,$_POST['id_so'] ,$v_cs_cipher,$v_cs_compress,$strPaddingKey);
  45 +$te_so = DeCrypt($key,$iv,$_POST['te_so'] ,$v_cs_cipher,$v_cs_compress,$strPaddingKey);
  46 +$te_nome_computador = DeCrypt($key,$iv,$_POST['te_nome_computador'] ,$v_cs_cipher,$v_cs_compress,$strPaddingKey);
  47 +$te_ip = DeCrypt($key,$iv,$_POST['te_ip'] ,$v_cs_cipher,$v_cs_compress,$strPaddingKey);
  48 +$te_nome_host = DeCrypt($key,$iv,$_POST['te_nome_host'] ,$v_cs_cipher,$v_cs_compress,$strPaddingKey);
  49 +$id_ip_rede = DeCrypt($key,$iv,$_POST['id_ip_rede'] ,$v_cs_cipher,$v_cs_compress,$strPaddingKey);
  50 +$te_workgroup = DeCrypt($key,$iv,$_POST['te_workgroup'] ,$v_cs_cipher,$v_cs_compress,$strPaddingKey);
41 51  
42 52 /* Todas as vezes em que é feita a recuperação das configurações por um agente, é incluído
43 53 o computador deste agente no BD, caso ainda não esteja inserido. */
... ... @@ -53,7 +63,7 @@ if ($te_node_address &lt;&gt; &#39;&#39;)
53 63 // Tiro os escapes que o post automaticamente coloca.
54 64 //$xmlSource=stripslashes(DeCrypt($key,$iv,$_POST['unidades'],$v_cs_cipher,$v_cs_compress));
55 65 //$strTripaDados=stripslashes(DeCrypt($key,$iv,$_POST['unidades'],$v_cs_cipher,$v_cs_compress));
56   - $strTripaDados = DeCrypt($key,$iv,$_POST['UnidadesDiscos'],$v_cs_cipher,$v_cs_compress);
  66 + $strTripaDados = DeCrypt($key,$iv,$_POST['UnidadesDiscos'],$v_cs_cipher,$v_cs_compress,$strPaddingKey);
57 67  
58 68  
59 69 //First we define a number of variables to store the data from each element
... ...