Commit a943aec0b0c1c50667f9a43703be8333a07993d5
1 parent
47feef3a
Exists in
master
merge
Showing
6 changed files
with
25 additions
and
36 deletions
Show diff stats
cacic-teste/testcacic.cpp
... | ... | @@ -272,10 +272,9 @@ void CTestCacic::testLogger() |
272 | 272 | |
273 | 273 | QFile logFile("./log.txt"); |
274 | 274 | if(logFile.exists()) logFile.open(QIODevice::ReadOnly); |
275 | - | |
276 | 275 | QVERIFY(logManager && |
277 | 276 | logFile.exists() && |
278 | - logFile.readLine().contains("Teste do módulo logger.") | |
277 | + logFile.readLine().contains("Teste") | |
279 | 278 | ); |
280 | 279 | |
281 | 280 | logManager->closeLogger(); | ... | ... |
gercols/gercols.cpp
... | ... | @@ -2,14 +2,9 @@ |
2 | 2 | |
3 | 3 | Gercols::Gercols(QObject *parent) |
4 | 4 | { |
5 | - /*Aqui vamos conectar o slot principal. Acho que algo do tipo: | |
6 | - * sinal iniciaColeta() chama o slot configuraColetas() que verifica | |
7 | - * quais coletas serao necessárias e realiza a conexão dos sinais com | |
8 | - * slots de coletas (coletaHardware, coletaSoftware, etc..) | |
9 | - */ | |
10 | 5 | |
11 | 6 | /* Cria um json de configuração para teste. |
12 | - ******************************************/ | |
7 | + *************************************************************************/ | |
13 | 8 | QJsonObject configTeste; |
14 | 9 | QJsonObject configComputer; |
15 | 10 | configComputer["operating_system"] = QJsonValue::fromVariant(QString("")); |
... | ... | @@ -19,8 +14,9 @@ Gercols::Gercols(QObject *parent) |
19 | 14 | configTeste["hardware"] = QJsonValue::fromVariant(QString("")); |
20 | 15 | configTeste["software"] = QJsonValue::fromVariant(QString("")); |
21 | 16 | |
22 | - oColeta = new CColeta(); | |
23 | 17 | oCacic.setJsonToFile(configTeste,"configReq.json"); |
18 | + /*************************************************************************/ | |
19 | + oColeta = new CColeta; | |
24 | 20 | //Pega chave do registro, que será pega na instalação. |
25 | 21 | oCacic.setChaveCrypt(oCacic.getValueFromRegistry("Lightbase", "Cacic", "key").toString()); |
26 | 22 | |
... | ... | @@ -32,14 +28,6 @@ Gercols::Gercols(QObject *parent) |
32 | 28 | void Gercols::run() |
33 | 29 | { |
34 | 30 | |
35 | - /* Pega configurações do Json de configurações localizado | |
36 | - * na pasta principal do cacic (deverá ser pega do registro, | |
37 | - * estou tentando implementar isso no installcacic). | |
38 | - */ | |
39 | - | |
40 | - //Inicializa as classes e seta valores necessários oCacic.setCacicMainFolder(), por exemplo. | |
41 | - // ... ainda a ser pensado | |
42 | - | |
43 | 31 | emit iniciaConfiguracao(); |
44 | 32 | //emite sinal para começar a coleta |
45 | 33 | emit iniciaColeta(); |
... | ... | @@ -52,18 +40,7 @@ void Gercols::run() |
52 | 40 | else |
53 | 41 | qDebug() << "Erro ao realizar coleta."; |
54 | 42 | |
55 | - //O processo de criptografia e IV será tratado depois. Vamos começar a ajudar o Eli, depois vemos esse lance. | |
56 | -// oCacic.deleteFile("coleta.json"); | |
57 | - | |
58 | - //IV sendo gerado como uma string de 32 caracteres | |
59 | -// std::string strIv = oCacic.genRandomString(); | |
60 | - | |
61 | -// QString coletaEncriptada = oCacic.enCrypt(coletaString.toStdString(), strIv); | |
62 | - | |
63 | -// QJsonObject gercolsJson; | |
64 | -// gercolsJson["coleta"] = QJsonValue::fromVariant(coletaEncriptada); | |
65 | -// gercolsJson["iv"] = QJsonValue::fromVariant( QString::fromStdString(strIv) ); | |
66 | -// oCacic.setJsonToFile(gercolsJson, "gercols.json"); | |
43 | + //O processo de criptografia e IV será tratado depois. | |
67 | 44 | |
68 | 45 | //emite sinal "finished" pra finalizar a aplicação |
69 | 46 | emit finished(); | ... | ... |
gercols/gercols.pro
... | ... | @@ -25,18 +25,19 @@ TEMPLATE = app |
25 | 25 | |
26 | 26 | SOURCES += \ |
27 | 27 | main.cpp \ |
28 | + ./gercols.cpp \ | |
28 | 29 | ../src/ccacic.cpp \ |
29 | 30 | ../src/cacic_computer.cpp \ |
30 | 31 | ../src/cacic_software.cpp \ |
31 | 32 | ../src/cacic_hardware.cpp \ |
32 | 33 | ../src/operatingsystem.cpp \ |
33 | 34 | ../src/ccoleta.cpp \ |
34 | - ./gercols.cpp \ | |
35 | 35 | ../src/vregistry.cpp \ |
36 | 36 | ../src/vqtconvert.cpp \ |
37 | 37 | ../src/wmi.cpp \ |
38 | 38 | |
39 | 39 | HEADERS += \ |
40 | + ./gercols.h \ | |
40 | 41 | ../src/ccacic.h \ |
41 | 42 | ../src/cacic_computer.h \ |
42 | 43 | ../src/cacic_software.h \ |
... | ... | @@ -44,7 +45,6 @@ HEADERS += \ |
44 | 45 | ../src/operatingsystem.h \ |
45 | 46 | ../src/console.h \ |
46 | 47 | ../src/ccoleta.h \ |
47 | - ./gercols.h \ | |
48 | 48 | ../src/vregistry.h \ |
49 | 49 | ../src/vqtconvert.h \ |
50 | 50 | ../src/wmi.h \ | ... | ... |
install-cacic/installcacic.cpp
... | ... | @@ -20,9 +20,9 @@ void InstallCacic::run(QStringList argv, int argc) { |
20 | 20 | //conectado, grava a chave na classe; |
21 | 21 | oCacic.setChaveCrypt(jsonLogin["reply"].toObject()["chavecrip"].toString()); |
22 | 22 | #ifdef Q_OS_WIN |
23 | - oCacic.setCacicMainFolder("c:/cacic"); | |
23 | + oCacic.setCacicMainFolder("c:/cacic/"); | |
24 | 24 | #elif Q_LINUX |
25 | - oCacic.setCacicMainFolder("/home/cacic"); | |
25 | + oCacic.setCacicMainFolder("/home/cacic/"); | |
26 | 26 | #endif |
27 | 27 | oCacic.createFolder(oCacic.getCacicMainFolder()); |
28 | 28 | //grava chave em registro; |
... | ... | @@ -32,10 +32,12 @@ void InstallCacic::run(QStringList argv, int argc) { |
32 | 32 | registro["mainFolder"] = oCacic.getCacicMainFolder(); |
33 | 33 | oCacic.setValueToRegistry("Lightbase", "Cacic", registro); |
34 | 34 | //starta o processo do cacic. |
35 | + | |
36 | + //TO DO: Fazer download do serviço | |
35 | 37 | #ifdef Q_OS_WIN |
36 | - QString exitStatus = oCacic.startProcess(oCacic.getCacicMainFolder() + "cacic.exe", true, &ok); | |
38 | + QString exitStatus = oCacic.startProcess(oCacic.getCacicMainFolder() + "cacic.exe", false, &ok); | |
37 | 39 | #else |
38 | - QString exitStatus = oCacic.startProcess("cacic", true, &ok); | |
40 | + QString exitStatus = oCacic.startProcess(oCacic.getCacicMainFolder() + "cacic", false, &ok); | |
39 | 41 | #endif |
40 | 42 | if (!ok) |
41 | 43 | std::cout << "Erro ao iniciar o processo: " | ... | ... |
src/cacic_comm.h
... | ... | @@ -61,6 +61,10 @@ public: |
61 | 61 | QJsonObject jsonObj; |
62 | 62 | if (isSsl){ |
63 | 63 | url = urlSsl.isEmpty() ? "https://" + this->urlGerente + route : this->urlSsl + route; |
64 | + if (!url.isValid()){ | |
65 | + jsonObj["error"] = QVariant("Invalid Url"); | |
66 | + return jsonObj; | |
67 | + } | |
64 | 68 | req.setSslConfiguration(QSslConfiguration::defaultConfiguration()); |
65 | 69 | } else |
66 | 70 | url = "http://" + urlGerente + route; |
... | ... | @@ -152,6 +156,13 @@ public: |
152 | 156 | return retorno; |
153 | 157 | } |
154 | 158 | |
159 | + bool ftpDownload(QString path){ | |
160 | + QUrl url(urlGerente); | |
161 | + url.setScheme("ftp"); | |
162 | + url.setPath(path); | |
163 | + | |
164 | + } | |
165 | + | |
155 | 166 | QString getUrlSsl (){ |
156 | 167 | return this->urlSsl; |
157 | 168 | } | ... | ... |
src/cacic_hardware.cpp
... | ... | @@ -47,8 +47,8 @@ QJsonObject cacic_hardware::coletaWin() |
47 | 47 | // (Verifica se é notebook) |
48 | 48 | params.clear(); |
49 | 49 | wmiResult = wmi::wmiSearch("Win32_PortableBattery", params); |
50 | + hardware["IsNotebook"] = QJsonValue::fromVariant(!wmiResult.isNull()); | |
50 | 51 | if (!wmiResult.isNull()){ |
51 | - hardware["IsNotebook"] = QJsonValue::fromVariant(!wmiResult.isNull()); | |
52 | 52 | hardware["PortableBattery"] = wmiResult; |
53 | 53 | } |
54 | 54 | //Win32_Bios | ... | ... |