diff --git a/src/WirelessMatcher.cpp b/src/WirelessMatcher.cpp index fbe1d1c..2fea387 100644 --- a/src/WirelessMatcher.cpp +++ b/src/WirelessMatcher.cpp @@ -66,6 +66,7 @@ #include "algorithms/PldtKeygen.h" #include "algorithms/BaseXKeygen.h" #include "algorithms/EijsinkKeygen.h" +#include "algorithms/GontwifiKeygen.h" #include WirelessMatcher::WirelessMatcher() { @@ -451,8 +452,12 @@ QVector * WirelessMatcher::getKeygens(QString ssid, QString mac) { keygens->append(new BssidKeygen(ssid, mac, FlagLc | FlagLen8, -2)); } - if (ssid.count(QRegExp("^NET_2G[0-9A-F]{6}$")) == 1) { + if (ssid.count(QRegExp("^NET_2G[0-9A-F]{6}$")) == 1 + || ssid.count(QRegExp("^NET_2G_[0-9]{3}$")) == 1) { keygens->append(new BssidKeygen(ssid, mac, FlagUc | FlagLen8, -6)); + keygens->append(new BssidKeygen(ssid, mac, FlagUc | FlagLen8, -5)); + keygens->append(new BssidKeygen(ssid, mac, FlagUc | FlagLen12, -6)); + keygens->append(new BssidKeygen(ssid, mac, FlagUc | FlagLen12, -5)); } if (ssid.count(QRegExp("^OPTIC[0-9a-fA-F]{4}$")) == 1) { @@ -658,5 +663,9 @@ QVector * WirelessMatcher::getKeygens(QString ssid, QString mac) { if (ssid.count(QRegExp("^Eijsink[0-9]{5}(K5|k5|)$")) == 1) keygens->append(new EijsinkKeygen(ssid, mac)); + if (ssid.startsWith("GONTWIFI") + || ssid.startsWith("GONT_WIFI")) + keygens->append(new GontwifiKeygen(ssid, mac)); + return keygens; } diff --git a/src/algorithms/GontwifiKeygen.cpp b/src/algorithms/GontwifiKeygen.cpp new file mode 100644 index 0000000..2b673f2 --- /dev/null +++ b/src/algorithms/GontwifiKeygen.cpp @@ -0,0 +1,33 @@ +/* + * Copyright 2016 Alex Stanev + * + * This file is part of Router Keygen. + * + * Router Keygen is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Router Keygen is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Router Keygen. If not, see . + */ + +#include "GontwifiKeygen.h" + +GontwifiKeygen::GontwifiKeygen(QString ssid, QString mac) : + Keygen(ssid, mac) { + kgname = "Gontwifi"; +} + +QVector & GontwifiKeygen::getKeys(){ + QString mac = getMacAddress(); + + results.append("000000" + mac[9] + mac[8] + mac[7] + mac[6]); + + return results; +} diff --git a/src/algorithms/GontwifiKeygen.h b/src/algorithms/GontwifiKeygen.h new file mode 100644 index 0000000..dff4171 --- /dev/null +++ b/src/algorithms/GontwifiKeygen.h @@ -0,0 +1,32 @@ +/* + * Copyright 2016 Alex Stanev + * + * This file is part of Router Keygen. + * + * Router Keygen is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Router Keygen is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Router Keygen. If not, see . + */ + +#ifndef GONTWIFIKEYGEN_H +#define GONTWIFIKEYGEN_H +#include "Keygen.h" + +class GontwifiKeygen : public Keygen +{ + public: + GontwifiKeygen(QString ssid, QString mac); + private: + QVector & getKeys(); +}; + +#endif // GONTWIFIKEYGEN_H diff --git a/test/AlgorithmsTest.cpp b/test/AlgorithmsTest.cpp index 3166119..05a991a 100644 --- a/test/AlgorithmsTest.cpp +++ b/test/AlgorithmsTest.cpp @@ -44,6 +44,7 @@ #include "algorithms/PldtKeygen.h" #include "algorithms/BaseXKeygen.h" #include "algorithms/EijsinkKeygen.h" +#include "algorithms/GontwifiKeygen.h" #include "WirelessMatcher.h" #include "wifi/QScanResult.h" #include @@ -721,6 +722,18 @@ private slots: QCOMPARE( results.size(),1); QCOMPARE(results.at(0), QString("95112345")); } + + void Gontwifi() { + QScanResult wifi("GONTWIFI_ABCD", "18:d0:71:AB:CD:EF"); + wifi.checkSupport(matcher); + QVector * keygens = wifi.getKeygens(); + QVERIFY2(keygens->size() == 1 , "An algorithm was not detected"); + Keygen * keygen = keygens->at(0); + QCOMPARE(typeid(*keygen),typeid(GontwifiKeygen) ); + QVector results = keygen->getResults(); + QCOMPARE( results.size(),1); + QCOMPARE(results.at(0), QString("000000DCBA")); + } };