summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-11-19 07:23:41 (GMT)
committerMontel Laurent <montel@kde.org>2016-11-19 07:23:41 (GMT)
commit79ac0ea8d98e7fc7ba2119469fa2af962ed021eb (patch)
treedec0313057fb9171c93d505c12837d373412dc61
parent7166458b37d021e826254aaabcd70e66a6aacaaa (diff)
Continue to implement search in local database
-rw-r--r--webengineviewer/src/checkphishingurl/localdatabasemanager.cpp15
-rw-r--r--webengineviewer/src/checkphishingurl/localdatabasemanager.h3
2 files changed, 15 insertions, 3 deletions
diff --git a/webengineviewer/src/checkphishingurl/localdatabasemanager.cpp b/webengineviewer/src/checkphishingurl/localdatabasemanager.cpp
index 8e0503f..535e95d 100644
--- a/webengineviewer/src/checkphishingurl/localdatabasemanager.cpp
+++ b/webengineviewer/src/checkphishingurl/localdatabasemanager.cpp
@@ -276,14 +276,25 @@ void LocalDataBaseManager::setDownloadProgress(bool downloadProgress)
void LocalDataBaseManager::checkUrl(const QUrl &url)
{
if (mDataBaseOk) {
- //TODO check in DataBase
+ QByteArray hash = createHash(url);
+ if (malwareFound(hash)) {
+ Q_EMIT checkUrlFinished(url, WebEngineViewer::LocalDataBaseManager::Malware);
+ } else {
+ Q_EMIT checkUrlFinished(url, WebEngineViewer::LocalDataBaseManager::UrlOk);
+ }
} else {
Q_EMIT checkUrlFinished(url, WebEngineViewer::LocalDataBaseManager::Unknown);
}
//TODO
}
-QByteArray LocalDataBaseManager::createHash()
+QByteArray LocalDataBaseManager::createHash(const QUrl &url)
{
return QCryptographicHash::hash(QByteArray() /*TODO use url*/, QCryptographicHash::Sha256);
}
+
+bool LocalDataBaseManager::malwareFound(const QByteArray &hash)
+{
+ //TODO
+ return false;
+}
diff --git a/webengineviewer/src/checkphishingurl/localdatabasemanager.h b/webengineviewer/src/checkphishingurl/localdatabasemanager.h
index 266f92a..bec3f3c 100644
--- a/webengineviewer/src/checkphishingurl/localdatabasemanager.h
+++ b/webengineviewer/src/checkphishingurl/localdatabasemanager.h
@@ -70,9 +70,10 @@ private:
void slotCheckDataBase();
bool initializeDataBase();
- QByteArray createHash();
+ QByteArray createHash(const QUrl &url);
void checkDataBase();
bool createTable();
+ bool malwareFound(const QByteArray &hash);
QSqlDatabase mDataBase;
QString mNewClientState;