Commit 05f8f16f994676ec9b3a88a7b6fd1eca6a2c3516
1 parent
0cf007a9
Exists in
master
Ip, mac e nome da interface sendo pego com sucesso.
Falta descobrir qual maneira adequada para apresentá-las.
Showing
4 changed files
with
14 additions
and
21 deletions
Show diff stats
cacic-teste/testcacic.cpp
... | ... | @@ -84,16 +84,11 @@ void CTestCacic::testDeCrypt(){ |
84 | 84 | |
85 | 85 | } |
86 | 86 | |
87 | -void CTestCacic::testpegarIPInterfaceDeRede(){ | |
87 | +void CTestCacic::testInterfaceDeRede(){ | |
88 | 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 | 92 | void CTestCacic::testpegarOS(){ |
98 | - QVERIFY(OCacicComp.pegarOS() == "linux"); | |
93 | + QVERIFY(OCacicComp.getOs() == "Windows_NT"); | |
99 | 94 | } | ... | ... |
cacic-teste/testcacic.h
src/ccacic.cpp
... | ... | @@ -102,7 +102,6 @@ bool CCacic::deleteFile(QString path) |
102 | 102 | return true; |
103 | 103 | } |
104 | 104 | |
105 | - | |
106 | 105 | /*enCrypt |
107 | 106 | * @parameter QString str_in: string que será encriptada (url). |
108 | 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 | 115 | std::string str_out; |
117 | 116 | CryptoPP::CFB_Mode<CryptoPP::AES>::Encryption encryption((byte*)key.toStdString().c_str(), key.length(), (byte*)iv.toStdString().c_str()); |
118 | 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 | 124 | //qDebug(QString::fromStdString(str_out).toLocal8Bit()); |
127 | 125 | return QString::fromStdString(str_out).toLocal8Bit(); |
128 | 126 | } | ... | ... |
src/ccacic.h
... | ... | @@ -2,10 +2,7 @@ |
2 | 2 | #define CCACIC_H |
3 | 3 | #include <QCoreApplication> |
4 | 4 | #include <QObject> |
5 | -#include <QDebug> | |
6 | 5 | #include <QFile> |
7 | -#include <iostream> | |
8 | -#include <iomanip> | |
9 | 6 | #include "crypto++/include/aes.h" |
10 | 7 | #include "crypto++/include/base64.h" |
11 | 8 | #include "crypto++/include/modes.h" |
... | ... | @@ -15,6 +12,10 @@ |
15 | 12 | #include "crypto++/include/md5.h" |
16 | 13 | #include <QSettings> |
17 | 14 | #include <QDir> |
15 | +#include <QJsonObject> | |
16 | +#include <QJsonParseError> | |
17 | +#include <QJsonArray> | |
18 | +#include <QDebug> | |
18 | 19 | |
19 | 20 | class CCacic : public QObject |
20 | 21 | { | ... | ... |