From 05f8f16f994676ec9b3a88a7b6fd1eca6a2c3516 Mon Sep 17 00:00:00 2001 From: ericmenezesn@gmail.com Date: Wed, 23 Jul 2014 18:40:01 -0300 Subject: [PATCH] Ip, mac e nome da interface sendo pego com sucesso. Falta descobrir qual maneira adequada para apresentá-las. --- cacic-teste/testcacic.cpp | 11 +++-------- cacic-teste/testcacic.h | 3 +-- src/ccacic.cpp | 14 ++++++-------- src/ccacic.h | 7 ++++--- 4 files changed, 14 insertions(+), 21 deletions(-) diff --git a/cacic-teste/testcacic.cpp b/cacic-teste/testcacic.cpp index d26da3c..58dc3e5 100644 --- a/cacic-teste/testcacic.cpp +++ b/cacic-teste/testcacic.cpp @@ -84,16 +84,11 @@ void CTestCacic::testDeCrypt(){ } -void CTestCacic::testpegarIPInterfaceDeRede(){ +void CTestCacic::testInterfaceDeRede(){ // qDebug() << QString::fromStdString(OCacicComp.getIp()); - QVERIFY(OCacicComp.getIp() != ""); -} - -void CTestCacic::testpegarMACInterfaceDeRede(){ -// qDebug() << QString::fromStdString(OCacicComp.getMac()); - QVERIFY(OCacicComp.getMac() != ""); + QVERIFY(!OCacicComp.getNetworkInterface().empty()); } void CTestCacic::testpegarOS(){ - QVERIFY(OCacicComp.pegarOS() == "linux"); + QVERIFY(OCacicComp.getOs() == "Windows_NT"); } diff --git a/cacic-teste/testcacic.h b/cacic-teste/testcacic.h index 8cd5fed..174ced8 100644 --- a/cacic-teste/testcacic.h +++ b/cacic-teste/testcacic.h @@ -38,8 +38,7 @@ private slots: void testCreateFolder(); void testDeleteFolder(); void testDeleteFile(); - void testpegarIPInterfaceDeRede(); - void testpegarMACInterfaceDeRede(); + void testInterfaceDeRede(); void testpegarOS(); }; diff --git a/src/ccacic.cpp b/src/ccacic.cpp index 8a78716..8d9bf07 100644 --- a/src/ccacic.cpp +++ b/src/ccacic.cpp @@ -102,7 +102,6 @@ bool CCacic::deleteFile(QString path) return true; } - /*enCrypt * @parameter QString str_in: string que será encriptada (url). * QString key: chave utilizada na encriptação (32 caracteres) 32*8 = 256 bits @@ -116,13 +115,12 @@ QString CCacic::enCrypt(QString str_in, QString key, QString iv) { std::string str_out; CryptoPP::CFB_Mode::Encryption encryption((byte*)key.toStdString().c_str(), key.length(), (byte*)iv.toStdString().c_str()); CryptoPP::StringSource encryptor(str_in.toStdString(), true, - new CryptoPP::StreamTransformationFilter(encryption, - new CryptoPP::Base64Encoder( - new CryptoPP::StringSink(str_out), - false // do not append a newline - ) - ) - ); + new CryptoPP::StreamTransformationFilter(encryption, + new CryptoPP::Base64Encoder(new CryptoPP::StringSink(str_out), + false // do not append a newline + ) + ) + ); //qDebug(QString::fromStdString(str_out).toLocal8Bit()); return QString::fromStdString(str_out).toLocal8Bit(); } diff --git a/src/ccacic.h b/src/ccacic.h index b856eda..b643768 100644 --- a/src/ccacic.h +++ b/src/ccacic.h @@ -2,10 +2,7 @@ #define CCACIC_H #include #include -#include #include -#include -#include #include "crypto++/include/aes.h" #include "crypto++/include/base64.h" #include "crypto++/include/modes.h" @@ -15,6 +12,10 @@ #include "crypto++/include/md5.h" #include #include +#include +#include +#include +#include class CCacic : public QObject { -- libgit2 0.21.2