diff --git a/src/WirelessMatcher.cpp b/src/WirelessMatcher.cpp index 7c6da08..2fea387 100644 --- a/src/WirelessMatcher.cpp +++ b/src/WirelessMatcher.cpp @@ -65,6 +65,8 @@ #include "algorithms/Tpw4gKeygen.h" #include "algorithms/PldtKeygen.h" #include "algorithms/BaseXKeygen.h" +#include "algorithms/EijsinkKeygen.h" +#include "algorithms/GontwifiKeygen.h" #include WirelessMatcher::WirelessMatcher() { @@ -269,7 +271,7 @@ QVector * WirelessMatcher::getKeygens(QString ssid, QString mac) { } - if (ssid.count(QRegExp("^InfostradaWiFi-[0-9a-zA-Z]{6}$")) == 1) + if (ssid.count(QRegExp("^InfostradaWiFi-[0-9a-f]{6}$")) == 1) keygens->append(new InfostradaKeygen(ssid, mac)); if (ssid.startsWith("InterCable")) @@ -295,8 +297,11 @@ QVector * WirelessMatcher::getKeygens(QString ssid, QString mac) { if (ssid.count(QRegExp("^PBS-[0-9A-F]{6}$")) == 1) keygens->append(new PBSKeygen(ssid, mac)); - if (mac.startsWith("08:86:3B") || mac.startsWith("94:44:52") - || mac.startsWith("EC:1A:59")) + if (ssid.count(QRegExp("^(B|b)elkin(\\.|_)[0-9a-fA-F]{3,6}$")) == 1 + && (mac.startsWith("08:86:3B") || mac.startsWith("14:91:82") + || mac.startsWith("94:10:3E") || mac.startsWith("94:44:52") + || mac.startsWith("B4:75:0E") || mac.startsWith("C0:56:27") + || mac.startsWith("EC:1A:59"))) keygens->append(new BelkinKeygen(ssid, mac)); if (ssid.count( @@ -341,10 +346,16 @@ QVector * WirelessMatcher::getKeygens(QString ssid, QString mac) { || mac.startsWith("00:22:3F") || mac.startsWith("00:24:B2"))) keygens->append(new SkyV1Keygen(ssid, mac)); - if (ssid.count(QRegExp("^WLAN-[0-9a-fA-F]{6}$")) == 1 - && (mac.startsWith("00:12:BF") || mac.startsWith("00:1A:2A") - || mac.startsWith("00:1D:19"))) - keygens->append(new Speedport500Keygen(ssid, mac)); + if (ssid.count(QRegExp("^WLAN-[0-9A-F]{6}$")) == 1 + && ssid.mid(5, 4) == mac.mid(9, 5).replace(":", "")) { + if (mac.startsWith("00:12:BF") || mac.startsWith("00:1A:2A") + || mac.startsWith("00:1D:19")) { + keygens->append(new Speedport500Keygen(ssid, mac, "-")); + } + if (mac.startsWith("00:1D:19") || mac.startsWith("00:23:08")) { + keygens->append(new Speedport500Keygen(ssid, mac, "")); + } + } if (ssid.count(QRegExp("^TECOM-AH4(021|222)-[0-9A-Z]{6}$")) == 1) { keygens->append(new TecomKeygen(ssid, mac)); @@ -441,17 +452,27 @@ 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) { keygens->append(new BssidKeygen(ssid, mac, FlagUc | FlagLen8, -16)); } + /* Hon Hai Precision Ind. Co.,Ltd. algo */ + if (ssid.count(QRegExp("^TeleRed-[0-9A-F]{4}$")) == 1 + || ssid.count(QRegExp("^Ubee[0-9A-F]{4}$")) == 1) { + keygens->append(new BssidKeygen(ssid, mac, FlagUc | FlagLen10, -4)); + } + if (ssid.count(QRegExp("^PTV[0-9]{4}$")) == 1 || ssid.count(QRegExp("^VIVO-[0-9A-F]{4}$")) == 1 - || (ssid.count(QRegExp("^WIFI-[0-9A-F]{4}$")) == 1 && mac.replace(":", "").right(4) == ssid.right(4) ) ) { + || (ssid.count(QRegExp("^WIFI-[0-9A-F]{4}$")) == 1 && mac.right(5).replace(":", "") == ssid.right(4) ) ) { keygens->append(new BssidKeygen(ssid, mac, FlagUc | FlagLen10, 0)); } @@ -478,6 +499,19 @@ QVector * WirelessMatcher::getKeygens(QString ssid, QString mac) { keygens->append(new BssidKeygen(ssid, mac, FlagLc | FlagLen10, -1)); } + if (ssid.count(QRegExp("^ORANGE-[0-9A-F]{4}$")) == 1) { + keygens->append(new BssidKeygen(ssid, mac, FlagLc | FlagLen12, -6)); + } + + if (ssid.count(QRegExp("^Distributel_[0-9]{5}$")) == 1) { + keygens->append(new BssidKeygen(ssid, mac, FlagLc | FlagLen12, -3)); + keygens->append(new BssidKeygen(ssid, mac, FlagLc | FlagLen12, -2)); + } + + if (ssid.count(QRegExp("^FLOW[0-9]{4}$")) == 1) { + keygens->append(new BssidKeygen(ssid, mac, FlagUc | FlagLen12, -2)); + } + if (ssid.count(QRegExp("^Access[0-9]{3}$")) == 1) { keygens->append(new BssidKeygen(ssid, mac, FlagUc | FlagLen12, 2)); } @@ -528,6 +562,12 @@ QVector * WirelessMatcher::getKeygens(QString ssid, QString mac) { keygens->append(new BssidKeygen(ssid, mac, FlagLc | FlagLen12, -6)); } + if (ssid.count(QRegExp("^HOTBOX-[0-9A-F]{4}$")) == 1 && + (mac.startsWith("7C:B7:33") || mac.startsWith("A0:64:8F") + || mac.startsWith("B4:EE:B4") || mac.startsWith("E0:CE:C3"))) { + keygens->append(new BssidKeygen(ssid, mac, FlagLc | FlagLen12, -6)); + } + if (ssid.count(QRegExp("^movistar_[0-9a-f]{6}$")) == 1) { keygens->append(new BssidKeygen(ssid, mac, FlagLc | FlagLen12, -9)); } @@ -553,6 +593,11 @@ QVector * WirelessMatcher::getKeygens(QString ssid, QString mac) { keygens->append(new BssidKeygen(ssid, mac, FlagLc | FlagLen8 | FlagCutLeft, 1)); } + if (ssid.count(QRegExp("^LIME[0-9]{4}$")) == 1) { + keygens->append(new BssidKeygen(ssid, mac, FlagUc | FlagLen10 | FlagCutLeft, 0)); + keygens->append(new BssidKeygen(ssid, mac, FlagUc | FlagLen12, -2)); + } + if (ssid.count(QRegExp("^Singtel[0-9]{4}-[0-9A-F]{4}$")) == 1 || ssid.count(QRegExp("^SINGTEL-[0-9A-F]{4}$")) == 1 || ssid.count(QRegExp("^BoxByTELMA-[0-9A-F]{4}$")) == 1) { @@ -615,5 +660,12 @@ QVector * WirelessMatcher::getKeygens(QString ssid, QString mac) { keygens->append(new PldtKeygen(ssid, mac, 1)); } + 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/EijsinkKeygen.cpp b/src/algorithms/EijsinkKeygen.cpp new file mode 100644 index 0000000..10f7c24 --- /dev/null +++ b/src/algorithms/EijsinkKeygen.cpp @@ -0,0 +1,35 @@ +/* + * 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 "EijsinkKeygen.h" + +EijsinkKeygen::EijsinkKeygen(QString ssid, QString mac) : + Keygen(ssid, mac) { + kgname = "Eijsink"; +} + +QVector & EijsinkKeygen::getKeys(){ + QString ssid = getSsidName(); + ssid.replace("k5", ""); + ssid.replace("K5", ""); + + results.append("951" + ssid.right(5)); + + return results; +} diff --git a/src/algorithms/EijsinkKeygen.h b/src/algorithms/EijsinkKeygen.h new file mode 100644 index 0000000..a6164c6 --- /dev/null +++ b/src/algorithms/EijsinkKeygen.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 EIJSINKKEYGEN_H +#define EIJSINKKEYGEN_H +#include "Keygen.h" + +class EijsinkKeygen : public Keygen +{ + public: + EijsinkKeygen(QString ssid, QString mac); + private: + QVector & getKeys(); +}; + +#endif // EIJSINKKEYGEN_H 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/src/algorithms/InfostradaKeygen.cpp b/src/algorithms/InfostradaKeygen.cpp index 36639d6..c07ec8e 100644 --- a/src/algorithms/InfostradaKeygen.cpp +++ b/src/algorithms/InfostradaKeygen.cpp @@ -27,6 +27,9 @@ QVector & InfostradaKeygen::getKeys(){ QString mac = getMacAddress(); if ( mac.size() != 12 ) throw ERROR; + results.append("2"+mac.toUpper()); + results.append("2"+mac.toLower()); + return results; } diff --git a/src/algorithms/Speedport500Keygen.cpp b/src/algorithms/Speedport500Keygen.cpp index 9540b22..bd49894 100644 --- a/src/algorithms/Speedport500Keygen.cpp +++ b/src/algorithms/Speedport500Keygen.cpp @@ -1,21 +1,24 @@ #include "Speedport500Keygen.h" -Speedport500Keygen::Speedport500Keygen(QString ssid, QString mac) : +Speedport500Keygen::Speedport500Keygen(QString ssid, QString mac, QString minus) : Keygen(ssid, mac) { kgname = "Speedport500"; + this->minus = minus; } QVector & Speedport500Keygen::getKeys() { QString mac = getMacAddress(); if (mac.size() != 12) throw ERROR; + QString ssid = getSsidName(); + QString first = ssid.at(9); QString block = ssid.at(10) + mac.right(3); - QString beginning = "SP-"; - beginning += ssid.at(9); + for (char x = '0'; x <= '9'; ++x) for (char y = '0'; y <= '9'; ++y) - for (char z = '0'; z <= '9'; ++z) - this->results.append(beginning + z + block + x +y + z ); + for (char z = '0'; z <= '9'; ++z) { + this->results.append("SP" + minus + first + z + block + x + y + z ); + } return results; } diff --git a/src/algorithms/Speedport500Keygen.h b/src/algorithms/Speedport500Keygen.h index 304ed58..f74eb57 100644 --- a/src/algorithms/Speedport500Keygen.h +++ b/src/algorithms/Speedport500Keygen.h @@ -6,9 +6,10 @@ class Speedport500Keygen :public Keygen { public: - Speedport500Keygen(QString ssid, QString mac); + Speedport500Keygen(QString ssid, QString mac, QString minus); private: QVector & getKeys(); + QString minus; }; #endif // SPEEDPORT500KEYGEN_H diff --git a/test/AlgorithmsTest.cpp b/test/AlgorithmsTest.cpp index 32c69a6..05a991a 100644 --- a/test/AlgorithmsTest.cpp +++ b/test/AlgorithmsTest.cpp @@ -43,6 +43,8 @@ #include "algorithms/Tpw4gKeygen.h" #include "algorithms/PldtKeygen.h" #include "algorithms/BaseXKeygen.h" +#include "algorithms/EijsinkKeygen.h" +#include "algorithms/GontwifiKeygen.h" #include "WirelessMatcher.h" #include "wifi/QScanResult.h" #include @@ -183,7 +185,7 @@ private slots: } void testBelkin() { - QScanResult wifi("Belkin.c0de","94:44:52:00:C0:DE"); + QScanResult wifi("Belkin_C0DE","94:44:52:00:C0:DE"); wifi.checkSupport(matcher); QVector * keygens = wifi.getKeygens(); QVERIFY2(keygens->size() != 0 , "An algorithm was not detected"); @@ -206,6 +208,18 @@ private slots: QCOMPARE(results.at(0),QString("d49496b9")); } + void testBelkin3() { + QScanResult wifi("Belkin_24615A","08:86:3b:24:61:5a"); + wifi.checkSupport(matcher); + QVector * keygens = wifi.getKeygens(); + QVERIFY2(keygens->size() != 0 , "An algorithm was not detected"); + Keygen * keygen = keygens->at(0); + QCOMPARE(typeid(*keygen), typeid(BelkinKeygen) ); + QVector results = keygen->getResults(); + QCOMPARE(results.size(),1); + QCOMPARE(results.at(0),QString("2E4C5631")); + } + void testCONN() { QScanResult wifi("CONN-X", ""); wifi.checkSupport(matcher); @@ -421,11 +435,15 @@ private slots: QVector * keygens = wifi.getKeygens(); QVERIFY2(keygens->size() != 0 , "An algorithm was not detected"); QCOMPARE(typeid(*(keygens->at(0))), typeid(ArcadyanKeygen) ); - QVERIFY2(keygens->size() == 2, "2 algorithm should have been detected"); + QVERIFY2(keygens->size() == 3, "3 algorithms should have been detected"); Keygen * keygen = keygens->at(1); QCOMPARE(typeid(*keygen), typeid(Speedport500Keygen) ); QVector results = keygen->getResults(); QCOMPARE(results.size(),1000); + Keygen * keygen2 = keygens->at(2); + QCOMPARE(typeid(*keygen2), typeid(Speedport500Keygen) ); + QVector results2 = keygen->getResults(); + QCOMPARE(results2.size(),1000); bool found = false; for ( int i = 0; i < results.size() ; ++i ){ if ( results.at(i) == "SP-0947DD059" ){ @@ -436,6 +454,26 @@ private slots: QVERIFY2(found, "SP-0947DD059 was not found"); } + void testSpeedport5002() { + QScanResult wifi("WLAN-068370", "00:23:08:06:83:5b"); + wifi.checkSupport(matcher); + QVector * keygens = wifi.getKeygens(); + QVERIFY2(keygens->size() == 2, "2 algorithm should have been detected"); + QCOMPARE(typeid(*(keygens->at(0))), typeid(ArcadyanKeygen) ); + Keygen * keygen = keygens->at(1); + QCOMPARE(typeid(*keygen), typeid(Speedport500Keygen) ); + QVector results = keygen->getResults(); + QCOMPARE(results.size(),1000); + bool found = false; + for ( int i = 0; i < results.size() ; ++i ){ + if ( results.at(i) == "SP70035B050" ){ + found = true; + break; + } + } + QVERIFY2(found, "SP70035B050 was not found"); + } + void testTeletu() { QScanResult wifi("TeleTu_00238EE528C7", "00:23:8E:E5:28:C7"); wifi.checkSupport(matcher); @@ -673,6 +711,29 @@ private slots: QCOMPARE(results.at(0), QString("wlanbb5544")); } + void Eijsink() { + QScanResult wifi("Eijsink12345k5", "11:22:33:44:aa:bb"); + 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(EijsinkKeygen) ); + QVector results = keygen->getResults(); + 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")); + } };