Commit 05f8f16f994676ec9b3a88a7b6fd1eca6a2c3516

Authored by Eric Menezes Noronha
1 parent 0cf007a9
Exists in master

Ip, mac e nome da interface sendo pego com sucesso.

Falta descobrir qual maneira adequada para apresentá-las.
cacic-teste/testcacic.cpp
@@ -84,16 +84,11 @@ void CTestCacic::testDeCrypt(){ @@ -84,16 +84,11 @@ void CTestCacic::testDeCrypt(){
84 84
85 } 85 }
86 86
87 -void CTestCacic::testpegarIPInterfaceDeRede(){ 87 +void CTestCacic::testInterfaceDeRede(){
88 // qDebug() << QString::fromStdString(OCacicComp.getIp()); 88 // qDebug() << QString::fromStdString(OCacicComp.getIp());
89 - QVERIFY(OCacicComp.getIp() != "");  
90 -}  
91 -  
92 -void CTestCacic::testpegarMACInterfaceDeRede(){  
93 -// qDebug() << QString::fromStdString(OCacicComp.getMac());  
94 - QVERIFY(OCacicComp.getMac() != ""); 89 + QVERIFY(!OCacicComp.getNetworkInterface().empty());
95 } 90 }
96 91
97 void CTestCacic::testpegarOS(){ 92 void CTestCacic::testpegarOS(){
98 - QVERIFY(OCacicComp.pegarOS() == "linux"); 93 + QVERIFY(OCacicComp.getOs() == "Windows_NT");
99 } 94 }
cacic-teste/testcacic.h
@@ -38,8 +38,7 @@ private slots: @@ -38,8 +38,7 @@ private slots:
38 void testCreateFolder(); 38 void testCreateFolder();
39 void testDeleteFolder(); 39 void testDeleteFolder();
40 void testDeleteFile(); 40 void testDeleteFile();
41 - void testpegarIPInterfaceDeRede();  
42 - void testpegarMACInterfaceDeRede(); 41 + void testInterfaceDeRede();
43 void testpegarOS(); 42 void testpegarOS();
44 }; 43 };
45 44
src/ccacic.cpp
@@ -102,7 +102,6 @@ bool CCacic::deleteFile(QString path) @@ -102,7 +102,6 @@ bool CCacic::deleteFile(QString path)
102 return true; 102 return true;
103 } 103 }
104 104
105 -  
106 /*enCrypt 105 /*enCrypt
107 * @parameter QString str_in: string que será encriptada (url). 106 * @parameter QString str_in: string que será encriptada (url).
108 * QString key: chave utilizada na encriptação (32 caracteres) 32*8 = 256 bits 107 * 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) { @@ -116,13 +115,12 @@ QString CCacic::enCrypt(QString str_in, QString key, QString iv) {
116 std::string str_out; 115 std::string str_out;
117 CryptoPP::CFB_Mode<CryptoPP::AES>::Encryption encryption((byte*)key.toStdString().c_str(), key.length(), (byte*)iv.toStdString().c_str()); 116 CryptoPP::CFB_Mode<CryptoPP::AES>::Encryption encryption((byte*)key.toStdString().c_str(), key.length(), (byte*)iv.toStdString().c_str());
118 CryptoPP::StringSource encryptor(str_in.toStdString(), true, 117 CryptoPP::StringSource encryptor(str_in.toStdString(), true,
119 - new CryptoPP::StreamTransformationFilter(encryption,  
120 - new CryptoPP::Base64Encoder(  
121 - new CryptoPP::StringSink(str_out),  
122 - false // do not append a newline  
123 - )  
124 - )  
125 - ); 118 + new CryptoPP::StreamTransformationFilter(encryption,
  119 + new CryptoPP::Base64Encoder(new CryptoPP::StringSink(str_out),
  120 + false // do not append a newline
  121 + )
  122 + )
  123 + );
126 //qDebug(QString::fromStdString(str_out).toLocal8Bit()); 124 //qDebug(QString::fromStdString(str_out).toLocal8Bit());
127 return QString::fromStdString(str_out).toLocal8Bit(); 125 return QString::fromStdString(str_out).toLocal8Bit();
128 } 126 }
@@ -2,10 +2,7 @@ @@ -2,10 +2,7 @@
2 #define CCACIC_H 2 #define CCACIC_H
3 #include <QCoreApplication> 3 #include <QCoreApplication>
4 #include <QObject> 4 #include <QObject>
5 -#include <QDebug>  
6 #include <QFile> 5 #include <QFile>
7 -#include <iostream>  
8 -#include <iomanip>  
9 #include "crypto++/include/aes.h" 6 #include "crypto++/include/aes.h"
10 #include "crypto++/include/base64.h" 7 #include "crypto++/include/base64.h"
11 #include "crypto++/include/modes.h" 8 #include "crypto++/include/modes.h"
@@ -15,6 +12,10 @@ @@ -15,6 +12,10 @@
15 #include "crypto++/include/md5.h" 12 #include "crypto++/include/md5.h"
16 #include <QSettings> 13 #include <QSettings>
17 #include <QDir> 14 #include <QDir>
  15 +#include <QJsonObject>
  16 +#include <QJsonParseError>
  17 +#include <QJsonArray>
  18 +#include <QDebug>
18 19
19 class CCacic : public QObject 20 class CCacic : public QObject
20 { 21 {