├── .cproject ├── .gitignore ├── .project ├── .travis.yml ├── AUTHORS ├── CMakeLists.txt ├── COPYING ├── INSTALL ├── NEWS ├── README.md ├── build_linux.sh ├── build_mac.sh ├── build_win.bat ├── build_win.sh ├── cli ├── routerkeygen-cli.cpp └── routerkeygen-cli.pro ├── cmake ├── DpkgBuild.cmake ├── RpmBuild.cmake ├── icon.rc └── version.h.cmake ├── debian └── copyright ├── doc └── routerkeygen.1 ├── lang ├── CMakeLists.txt ├── create_ts.sh ├── routerkeygen_es.ts ├── routerkeygen_nl.ts └── routerkeygen_pt_PT.ts ├── nsis ├── CMakeLists.txt ├── FileAssociation.nsh └── installer.nsi ├── resources ├── alice.txt ├── cyta_bases.txt ├── loading.gif ├── ote_huawei.txt ├── resources.qrc ├── tele2.txt └── tray_icon.png ├── routerkeygen_version.json ├── share ├── MacOSXBundleInfo.plist.in ├── background.png ├── loading.gif ├── routerkeygen.desktop ├── routerkeygen.entitlements ├── routerkeygen.icns ├── routerkeygen.ico └── routerkeygen.png ├── src ├── CMakeLists.txt ├── KeygenThread.cpp ├── KeygenThread.h ├── RouterKeygen.cpp ├── RouterKeygen.h ├── WirelessMatcher.cpp ├── WirelessMatcher.h ├── algorithms │ ├── AliceGermanyKeygen.cpp │ ├── AliceGermanyKeygen.h │ ├── AliceItalyKeygen.cpp │ ├── AliceItalyKeygen.h │ ├── AndaredKeygen.cpp │ ├── AndaredKeygen.h │ ├── ArcadyanKeygen.cpp │ ├── ArcadyanKeygen.h │ ├── ArnetPirelliKeygen.cpp │ ├── ArnetPirelliKeygen.h │ ├── AxtelKeygen.cpp │ ├── AxtelKeygen.h │ ├── BaseXKeygen.cpp │ ├── BaseXKeygen.h │ ├── BelkinKeygen.cpp │ ├── BelkinKeygen.h │ ├── BssidKeygen.cpp │ ├── BssidKeygen.h │ ├── CabovisaoSagemKeygen.cpp │ ├── CabovisaoSagemKeygen.h │ ├── ComtrendKeygen.cpp │ ├── ComtrendKeygen.h │ ├── ConnKeygen.cpp │ ├── ConnKeygen.h │ ├── DiscusKeygen.cpp │ ├── DiscusKeygen.h │ ├── DlinkKeygen.cpp │ ├── DlinkKeygen.h │ ├── EijsinkKeygen.cpp │ ├── EijsinkKeygen.h │ ├── EircomKeygen.cpp │ ├── EircomKeygen.h │ ├── GontwifiKeygen.cpp │ ├── GontwifiKeygen.h │ ├── HG824xKeygen.cpp │ ├── HG824xKeygen.h │ ├── HuaweiKeygen.cpp │ ├── HuaweiKeygen.h │ ├── InfostradaKeygen.cpp │ ├── InfostradaKeygen.h │ ├── InterCableKeygen.cpp │ ├── InterCableKeygen.h │ ├── Keygen.cpp │ ├── Keygen.h │ ├── OnoKeygen.cpp │ ├── OnoKeygen.h │ ├── OteBAUDKeygen.cpp │ ├── OteBAUDKeygen.h │ ├── OteHuaweiKeygen.cpp │ ├── OteHuaweiKeygen.h │ ├── PBSKeygen.cpp │ ├── PBSKeygen.h │ ├── PirelliKeygen.cpp │ ├── PirelliKeygen.h │ ├── PldtKeygen.cpp │ ├── PldtKeygen.h │ ├── SitecomKeygen.cpp │ ├── SitecomKeygen.h │ ├── SitecomWLR2100Keygen.cpp │ ├── SitecomWLR2100Keygen.h │ ├── SitecomWLR400xKeygen.cpp │ ├── SitecomWLR400xKeygen.h │ ├── SkyV1Keygen.cpp │ ├── SkyV1Keygen.h │ ├── Speedport500Keygen.cpp │ ├── Speedport500Keygen.h │ ├── TecomKeygen.cpp │ ├── TecomKeygen.h │ ├── TeleTuKeygen.h │ ├── TeletuKeygen.cpp │ ├── TelseyKeygen.cpp │ ├── TelseyKeygen.h │ ├── ThomsonKeygen.cpp │ ├── ThomsonKeygen.h │ ├── Tpw4gKeygen.cpp │ ├── Tpw4gKeygen.h │ ├── Upc07Keygen.cpp │ ├── Upc07Keygen.h │ ├── Upc07UbeeKeygen.cpp │ ├── Upc07UbeeKeygen.h │ ├── VerizonKeygen.cpp │ ├── VerizonKeygen.h │ ├── WifimediaRKeygen.cpp │ ├── WifimediaRKeygen.h │ ├── Wlan2Keygen.cpp │ ├── Wlan2Keygen.h │ ├── Wlan6Keygen.cpp │ ├── Wlan6Keygen.h │ ├── ZyxelKeygen.cpp │ ├── ZyxelKeygen.h │ └── unknown.h ├── config │ ├── AliceConfigParser.cpp │ ├── AliceConfigParser.h │ ├── AliceMagicInfo.cpp │ ├── AliceMagicInfo.h │ ├── OTEHuaweiConfigParser.cpp │ ├── OTEHuaweiConfigParser.h │ ├── TeleTuConfigParser.cpp │ ├── TeleTuConfigParser.h │ ├── TeleTuMagicInfo.cpp │ └── TeleTuMagicInfo.h ├── dialog │ ├── AboutDialog.cpp │ ├── AboutDialog.h │ ├── UpdateDialog.cpp │ ├── UpdateDialog.h │ ├── WelcomeDialog.cpp │ └── WelcomeDialog.h ├── forms │ ├── UpdateDialog.ui │ ├── aboutdialog.ui │ ├── routerkeygen.ui │ └── welcome_dialog.ui ├── mac │ ├── macloginitemsmanager.h │ └── macloginitemsmanager.mm ├── main.cpp ├── qcmdlineparser │ ├── qcmdlineargument.cpp │ ├── qcmdlineargument.h │ ├── qcmdlineparser.cpp │ └── qcmdlineparser.h └── wifi │ ├── QScanResult.cpp │ ├── QScanResult.h │ ├── QWifiManager.cpp │ ├── QWifiManager.h │ ├── QWifiManagerPrivate.cpp │ ├── QWifiManagerPrivate.h │ ├── QWifiManagerPrivateMac.cpp │ ├── QWifiManagerPrivateMac.h │ ├── QWifiManagerPrivateUnix.cpp │ ├── QWifiManagerPrivateUnix.h │ ├── QWifiManagerPrivateWin.cpp │ └── QWifiManagerPrivateWin.h └── test ├── .gitignore ├── AlgorithmsTest.cpp ├── test.pro └── test.pro.user /.gitignore: -------------------------------------------------------------------------------- 1 | *DS_Store 2 | CMakeLists.txt.user 3 | linux 4 | win 5 | mac 6 | lang/*.qrc 7 | lang/*.qm 8 | build-test-* 9 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | RouterKeygenQt 4 | 5 | 6 | 7 | 8 | 9 | com.trolltech.qtcppproject.QtMakefileGenerator 10 | 11 | 12 | 13 | 14 | org.eclipse.cdt.make.core.makeBuilder 15 | clean,full,incremental, 16 | 17 | 18 | org.eclipse.cdt.core.errorOutputParser 19 | org.eclipse.cdt.core.GASErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.VCErrorParser;org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.MakeErrorParser; 20 | 21 | 22 | org.eclipse.cdt.make.core.append_environment 23 | true 24 | 25 | 26 | org.eclipse.cdt.make.core.build.arguments 27 | 28 | 29 | 30 | org.eclipse.cdt.make.core.build.command 31 | make 32 | 33 | 34 | org.eclipse.cdt.make.core.build.location 35 | 36 | 37 | 38 | org.eclipse.cdt.make.core.build.target.auto 39 | debug 40 | 41 | 42 | org.eclipse.cdt.make.core.build.target.clean 43 | clean 44 | 45 | 46 | org.eclipse.cdt.make.core.build.target.inc 47 | debug 48 | 49 | 50 | org.eclipse.cdt.make.core.enableAutoBuild 51 | false 52 | 53 | 54 | org.eclipse.cdt.make.core.enableCleanBuild 55 | true 56 | 57 | 58 | org.eclipse.cdt.make.core.enableFullBuild 59 | true 60 | 61 | 62 | org.eclipse.cdt.make.core.enabledIncrementalBuild 63 | true 64 | 65 | 66 | org.eclipse.cdt.make.core.environment 67 | PATH=/usr/share/qt4/bin:${env_var:PATH}:${env_var:PATH}| 68 | 69 | 70 | org.eclipse.cdt.make.core.stopOnError 71 | false 72 | 73 | 74 | org.eclipse.cdt.make.core.useDefaultBuildCmd 75 | false 76 | 77 | 78 | 79 | 80 | org.eclipse.cdt.make.core.ScannerConfigBuilder 81 | 82 | 83 | 84 | 85 | 86 | org.eclipse.cdt.core.cnature 87 | org.eclipse.cdt.core.ccnature 88 | org.eclipse.cdt.make.core.makeNature 89 | org.eclipse.cdt.make.core.ScannerConfigNature 90 | com.trolltech.qtcppproject.QtNature 91 | 92 | 93 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: required 2 | dist: trusty 3 | language: cpp 4 | 5 | before_install: 6 | - sudo apt-get -qq update 7 | - sudo apt-get -qq -o Dpkg::Options::="--force-confnew" install cmake cmake-data build-essential qt5-default libssl-dev qtscript5-dev libnm-gtk-dev qttools5-dev qttools5-dev-tools network-manager-dev lintian 8 | 9 | script: 10 | - sh build_linux.sh 11 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Rui Araújo 2 | -------------------------------------------------------------------------------- /INSTALL: -------------------------------------------------------------------------------- 1 | 2 | INSTALL 3 | 4 | routerkeygenPC 5 | https://github.com/routerkeygen/routerkeygenPC 6 | 7 | 8 | 9 | _LINUX_ 10 | 11 | I tested this guide with: 12 | - Mint 15 64bit KDE 13 | - Debian 7 64 bit Gnome 14 | 15 | 16 | $ sudo aptitude install -y cmake build-essential libqt4-core libqt4-dev libqt4-gui qt4-dev-tools libssl-dev network-manager-dev 17 | $ cd ./routerkeygenPC 18 | $ cc -v && qmake-qt4 -v && cmake -DCMAKE_BUILD_TYPE=Release -DQT_QMAKE_EXECUTABLE=$(which qmake-qt4) && make 19 | $ ./bin/routerkeygen 20 | 21 | -------------------------------------------------------------------------------- /NEWS: -------------------------------------------------------------------------------- 1 | Version 1.0.0 2 | =========== 3 | - Initial port from android version 3.7.0 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # RouterKeygen 2 | 3 | Router Keygen generate default WPA/WEP keys for the following router: 4 | 5 | * Thomson based routers ( this includes Thomson, SpeedTouch, Orange, Infinitum, BBox, DMax, BigPond, O2Wireless, Otenet, Cyta , TN_private, Blink ) 6 | * DLink ( only some models ) 7 | * Pirelli Discus 8 | * Eircom 9 | * Verizon FiOS ( only some routers supported) 10 | * Alice AGPF 11 | * FASTWEB Pirelli and Telsey 12 | * Huawei (some InfinitumXXXX) 13 | * Wlan_XXXX or Jazztel_XXXX 14 | * Wlan_XX ( only some are supported) 15 | * Ono ( P1XXXXXX0000X ) 16 | * WlanXXXXXX, YacomXXXXXX and WifiXXXXXX 17 | * Sky V1 routers 18 | * Clubinternet.box v1 and v2 ( TECOM-AH4XXXX ) 19 | * InfostradaWifi 20 | * CONN-X 21 | * Megared 22 | * EasyBox, Arcor and Vodafone 23 | * PBS (Austria) 24 | * MAXCOM 25 | * PTV 26 | * TeleTu/Tele2 27 | * Axtel, Axtel-xtremo 28 | * Intercable 29 | * OTE 30 | * Cabovisao Sagem 31 | * Alice in Germany 32 | * Speedport 33 | 34 | # Releases 35 | 36 | Get them from here: 37 | https://github.com/routerkeygen/routerkeygenPC/releases 38 | 39 | # Building 40 | 41 | ## Windows (Cross Compilation from Ubuntu) 42 | 43 | Get [MXE](http://mxe.cc/) 44 | `make qt openssl` 45 | `run build_win.sh` 46 | 47 | ## Mac OS X 48 | 49 | Define CMAKE_PREFIX_PATH to point to your Qt instalation. 50 | 51 | 52 | Example: /Users/awesome/Qt/5.3.0/clang_64 53 | `run build_mac.sh` 54 | 55 | ## Linux 56 | 57 | #### Ubuntu 58 | sudo apt-get update 59 | sudo apt-get install cmake build-essential qt5-default libssl-dev qtscript5-dev libnm-gtk-dev qttools5-dev qttools5-dev-tools rpm lintian 60 | chmod a+x build_linux.sh 61 | bash build_linux.sh 62 | 63 | DEB and RPM package are on `linux/` 64 | 65 | # Commandline version 66 | 67 | You can build commandline version without GUI dependecy libs: 68 | 69 | cd cli 70 | qmake 71 | make 72 | 73 | Your binary should be `routerkeygen-cli` 74 | 75 | # Algorithm selftest 76 | 77 | cd test 78 | qmake 79 | make 80 | ./RouterKeygenTest 81 | -------------------------------------------------------------------------------- /build_linux.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cmake --version 3 | 4 | SRC_FOLDER=`pwd` #assumed to be the current folder, change to compile in another location 5 | ROOT_FOLDER=`pwd` 6 | BUILD_FOLDER=$ROOT_FOLDER/linux 7 | mkdir -p $BUILD_FOLDER 8 | cd $BUILD_FOLDER 9 | 10 | cmake -DCMAKE_BUILD_TYPE=Release $SRC_FOLDER 11 | if [ "$?" = "0" ]; then 12 | make 13 | else 14 | echo "Could not create Makefiles" 1>&2 15 | exit 1 16 | fi 17 | if [ "$?" = "0" ]; then 18 | cpack -G DEB 19 | cpack -G RPM #in Ubuntu rpmbuild must be installed 20 | lintian routerkeygen-Linux-x86_64.deb || true 21 | else 22 | echo "Error while building" 1>&2 23 | exit 1 24 | fi 25 | -------------------------------------------------------------------------------- /build_win.bat: -------------------------------------------------------------------------------- 1 | echo "Start Windows build" 2 | 3 | mkdir win 4 | cd win 5 | 6 | cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release -DQT_QMAKE_EXECUTABLE=C:\Qt\4.8.5\bin\qmake.exe .. 7 | 8 | mingw32-make VERBOSE=1 9 | 10 | cd .. -------------------------------------------------------------------------------- /build_win.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | MXE_ROOT=$HOME/mxe 4 | SRC_FOLDER=`pwd` #assumed to be the current folder, change to compile in another location 5 | ROOT_FOLDER=`pwd` 6 | BUILD_FOLDER=$ROOT_FOLDER/win 7 | mkdir -p $BUILD_FOLDER 8 | cd $BUILD_FOLDER 9 | 10 | cmake -DCMAKE_TOOLCHAIN_FILE=$MXE_ROOT/usr/i686-w64-mingw32.static/share/cmake/mxe-conf.cmake -DOPENSSL_ROOT_DIR=$MXE_ROOT/usr/i686-pc-mingw32 -DCMAKE_CROSS_COMPILING=TRUE -DCMAKE_BUILD_TYPE=Release $SRC_FOLDER 11 | if [ "$?" = "0" ]; then 12 | make 13 | else 14 | echo "Could not create Makefiles" 1>&2 15 | exit 1 16 | fi 17 | if [ "$?" = "0" ]; then 18 | make installer 19 | else 20 | echo "Error while building" 1>&2 21 | exit 1 22 | fi 23 | -------------------------------------------------------------------------------- /cli/routerkeygen-cli.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #include "WirelessMatcher.h" 7 | #include "wifi/QScanResult.h" 8 | #include "algorithms/Keygen.h" 9 | 10 | #include "qcmdlineparser/qcmdlineparser.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | QCoreApplication app(argc, argv); 14 | QCmdLineParser parser; 15 | parser.addOption("-s", QCmdLineArgument::StoreValue, QObject::tr("SSID"), "--ssid", "network_name"); 16 | parser.addOption("-m", QCmdLineArgument::StoreValue, QObject::tr("MAC address"), "--mac", "mac_address"); 17 | parser.addOption("-k", QCmdLineArgument::StoreTrue, QObject::tr("Print keygen in form kgname:candidate"), "--kg"); 18 | parser.addOption("-q", QCmdLineArgument::StoreTrue, QObject::tr("Print only calculated keys"), "--quiet"); 19 | QString error = ""; 20 | QVariantMap options = parser.parse(QCoreApplication::arguments(), &error); 21 | if ( !error.isEmpty() || !(options.contains("s") || options.contains("m")) ) { 22 | std::cout << error.toUtf8().data() << std::endl << parser.help().toUtf8().data(); 23 | return -1; 24 | } 25 | if ( options.contains("s") || options.contains("m") ) { 26 | WirelessMatcher m; 27 | QString mac = options.value("m", "").toString().toUpper(); 28 | if ( mac.length()>0 && mac.count(QRegExp("^([0-9A-F]{2}[:-]){5}([0-9A-F]{2})$")) == 0 ) { 29 | mac = ""; 30 | if ( !options.value("q", false).toBool() ) 31 | std::cout << QObject::tr("Invalid MAC. It will not be used.").toUtf8().data() << std::endl; 32 | } 33 | QString ssid = options.value("s", "").toString(); 34 | QScanResult wifi(ssid, mac); 35 | wifi.checkSupport(m); 36 | QVector * keygens = wifi.getKeygens(); 37 | if (keygens == NULL ) { 38 | if ( !options.value("q", false).toBool() ) 39 | std::cout << QObject::tr("Out of memory.").toUtf8().data() << std::endl; 40 | return -100; 41 | } 42 | if ( keygens->size() == 0) { 43 | if ( !options.value("q", false).toBool() ) 44 | std::cout << QObject::tr("Unsupported network. Check the MAC address and the SSID.").toUtf8().data() << std::endl; 45 | return -2; 46 | } 47 | if ( !options.value("q", false).toBool() ) 48 | std::cout << QObject::tr("Calculating keys. This can take a while.").toUtf8().data() << std::endl; 49 | QVector results; 50 | bool kg = options.value("k", false).toBool(); 51 | for ( int i = 0; i < keygens->size(); ++i ){ 52 | try { 53 | QVector r = keygens->at(i)->getResults(); 54 | if (kg) { 55 | foreach (QString s, r) { 56 | results.append(keygens->at(i)->kgname + ":" + s); 57 | } 58 | } else { 59 | results +=r; 60 | } 61 | } catch (int e) { 62 | if ( !options.value("q", false).toBool() ) 63 | std::cout << QObject::tr("Errors while calculating.").toUtf8().data() << std::endl; 64 | continue; 65 | } 66 | } 67 | if (results.isEmpty()) { 68 | if ( !options.value("q", false).toBool() ) 69 | std::cout << QObject::tr("No keys were calculated.").toUtf8().data() << std::endl; 70 | return -1; 71 | } 72 | if ( !options.value("q", false).toBool() ) 73 | std::cout << QObject::tr("Calculated Passwords for %1").arg(wifi.getSsidName()).toUtf8().data() << std::endl; 74 | for (int i = 0; i < results.size(); ++i) 75 | std::cout << results.at(i).toLatin1().data() << std::endl; 76 | } 77 | return 0; 78 | } 79 | -------------------------------------------------------------------------------- /cli/routerkeygen-cli.pro: -------------------------------------------------------------------------------- 1 | QT = core 2 | TARGET = routerkeygen-cli 3 | TEMPLATE = app 4 | SOURCES += \ 5 | ../src/algorithms/*.cpp \ 6 | ../src/WirelessMatcher.cpp \ 7 | ../src/config/*.cpp \ 8 | ../src/wifi/QScanResult.cpp \ 9 | ../src/qcmdlineparser/qcmdlineargument.cpp \ 10 | ../src/qcmdlineparser/qcmdlineparser.cpp \ 11 | routerkeygen-cli.cpp 12 | 13 | HEADERS += ../src/algorithms/*.h \ 14 | ../src/config/*.h \ 15 | ../src/wifi/QScanResult.h \ 16 | ../src/WirelessMatcher.h \ 17 | ../src/qcmdlineparser/qcmdlineargument.h \ 18 | ../src/qcmdlineparser/qcmdlineparser.h 19 | 20 | INCLUDEPATH += ../src/ 21 | LIBS += -lcrypto 22 | 23 | RESOURCES += ../resources/resources.qrc -------------------------------------------------------------------------------- /cmake/DpkgBuild.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # DPKG Finder 3 | # Authors: Rohit Yadav 4 | # 5 | 6 | IF(UNIX) 7 | FIND_PROGRAM(DPKG 8 | NAMES dpkg-deb 9 | PATHS "/usr/bin") #Add paths here 10 | 11 | IF ( DPKG ) 12 | GET_FILENAME_COMPONENT(DPKG_PATH ${DPKG} ABSOLUTE) 13 | MESSAGE(STATUS "Found dpkg-deb : ${DPKG_PATH}") 14 | SET(DPKG_FOUND "YES") 15 | ELSE ( DPKG ) 16 | MESSAGE(STATUS "dpkg-deb NOT found. deb generation will not be available") 17 | SET(DPKG_FOUND "NO") 18 | ENDIF ( DPKG ) 19 | ENDIF(UNIX) -------------------------------------------------------------------------------- /cmake/RpmBuild.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # RPM Finder 3 | # Authors: Rohit Yadav 4 | # 5 | 6 | IF(UNIX) 7 | FIND_PROGRAM(RPMBUILD 8 | NAMES rpmbuild 9 | PATHS "/usr/bin") 10 | 11 | IF ( RPMBUILD ) 12 | GET_FILENAME_COMPONENT(RPMBUILD_PATH ${RPMBUILD} ABSOLUTE) 13 | MESSAGE(STATUS "Found rpmbuild : ${RPMBUILD_PATH}") 14 | SET(RPMBUILD_FOUND "YES") 15 | ELSE ( RPMBUILD ) 16 | MESSAGE(STATUS "rpmbuild NOT found. RPM generation will not be available") 17 | SET(RPMBUILD_FOUND "NO") 18 | ENDIF ( RPMBUILD ) 19 | ENDIF(UNIX) 20 | -------------------------------------------------------------------------------- /cmake/icon.rc: -------------------------------------------------------------------------------- 1 | IDI_ICON1 ICON DISCARDABLE "share/routerkeygen.ico" 2 | -------------------------------------------------------------------------------- /cmake/version.h.cmake: -------------------------------------------------------------------------------- 1 | #ifndef VERSION_H 2 | #define VERSION_H 3 | 4 | /* Project name */ 5 | #cmakedefine PROJECT_NAME "@PROJECT_NAME_SHORT@" 6 | 7 | /* Host computer name */ 8 | #cmakedefine HOSTNAME "@HOSTNAME@" 9 | 10 | /* OS Name */ 11 | #cmakedefine SYSNAME "@SYSNAME@" 12 | 13 | /* Version */ 14 | #cmakedefine PROJECT_VERSION "@PROJECT_VERSION@" 15 | 16 | /* Copyright string */ 17 | #cmakedefine PROJECT_COPYRIGHT "@PROJECT_COPYRIGHT@" 18 | 19 | /* Contact email */ 20 | #cmakedefine PROJECT_CONTACT "@PROJECT_CONTACT@" 21 | 22 | /* Website */ 23 | #cmakedefine ORG_WEBSITE "@ORG_WEBSITE@" 24 | 25 | 26 | #endif //VERSION_H 27 | -------------------------------------------------------------------------------- /debian/copyright: -------------------------------------------------------------------------------- 1 | Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ 2 | License: GPL-3 (/usr/share/common-licenses/GPL-3) 3 | -------------------------------------------------------------------------------- /doc/routerkeygen.1: -------------------------------------------------------------------------------- 1 | .\" Copyright (C) 2010-13 RouterKeygen 2 | .\" Author: Rui Araújo 3 | .\" 4 | .\" This is free software; you may redistribute it and/or modify 5 | .\" it under the terms of the GNU General Public License as 6 | .\" published by the Free Software Foundation; either version 2, 7 | .\" or (at your option) any later version. 8 | .\" 9 | .\" This is distributed in the hope that it will be useful, but 10 | .\" WITHOUT ANY WARRANTY; without even the implied warranty of 11 | .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | .\" GNU General Public License for more details. 13 | .\" 14 | .\" You should have received a copy of the GNU General Public License 15 | .\" along with this; if not write to the Free Software Foundation, Inc. 16 | .\" 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | .TH RouterKeygen 1 "Aug 29, 2013" 18 | .SH NAME 19 | routerkeygen \- RouterKeygen 20 | .SH SYNOPSIS 21 | .B routerkeygen 22 | .RI [ OPTIONS ] 23 | .SH DESCRIPTION 24 | Router Keygen generate default WPA/WEP keys for the following router: 25 | 26 | # Thomson based routers ( this includes Thomson, SpeedTouch, Orange, Infinitum, BBox, DMax, BigPond, O2Wireless, Otenet, Cyta , TN_private, Blink ) 27 | # DLink ( only some models ) 28 | # Pirelli Discus 29 | # Eircom 30 | # Verizon FiOS ( only some routers supported) 31 | # Alice AGPF 32 | # FASTWEB Pirelli and Telsey 33 | # Huawei (some InfinitumXXXX) 34 | # Wlan_XXXX or Jazztel_XXXX 35 | # Wlan_XX ( only some are supported) 36 | # Ono ( P1XXXXXX0000X ) 37 | # WlanXXXXXX, YacomXXXXXX and WifiXXXXXX 38 | # Sky V1 routers 39 | # Clubinternet.box v1 and v2 ( TECOM-AH4XXXX ) 40 | # InfostradaWifi 41 | # CONN-X 42 | # Megared 43 | # EasyBox, Arcor and Vodafone 44 | # PBS (Austria) 45 | # MAXCOM 46 | # PTV 47 | # TeleTu/Tele2 48 | # Axtel, Axtel-xtremo 49 | # Intercable 50 | # OTE 51 | # Cabovisao Sagem 52 | # Alice in Germany 53 | # Speedport 54 | 55 | .SH OPTIONS 56 | If any option is specified, except for 57 | .BI \-\-no-gui 58 | , the program will terminate after processing the command. 59 | .TP 60 | .B \-\-ssid|\-s \fInetwork_name\fR 61 | Specifies a network to test if it is possible to generate a default key. It may be necessary to specify the MAC address for a correct identification. 62 | .TP 63 | .B \-\-mac|\-m \fImac_address\fR 64 | Specifies the MAC address of a router to test if it is possible to generate a default key.It may be necessary to specify the network name ( see above ) for a correct identification. 65 | .TP 66 | .B \-\-help|\-h 67 | Outputs help. 68 | .TP 69 | .B \-\-version|\-v 70 | Outputs version information and exits. 71 | .TP 72 | .B \-\-no-gui 73 | Executes without displaying the main windows, displaying only the system tray indicator. This is an option by the lauch script when the program start automatically after boot-up. 74 | .SH BUGS 75 | If you find a bug, please report it to exobel@gmail.com 76 | .PP 77 | .SH AUTHOR 78 | This manual page was written by Rui Araújo , for the Debian 79 | GNU/Linux system (but may be used by others). 80 | -------------------------------------------------------------------------------- /lang/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # RouterKeygen build system 3 | # Authors: Rui Araújo 4 | # 5 | 6 | ## RCC file 7 | set(TS_QRC ${CMAKE_BINARY_DIR}/lang/resources-lang.qrc) 8 | 9 | if(Qt5LinguistTools_FOUND OR CMAKE_CROSS_COMPILING) 10 | set(QT_LUPDATE_EXECUTABLE lupdate) 11 | set(QT_LRELEASE_EXECUTABLE lrelease) 12 | endif(Qt5LinguistTools_FOUND OR CMAKE_CROSS_COMPILING) 13 | 14 | if(NOT QT_LUPDATE_EXECUTABLE ) 15 | message(WARNING "Could not find lupdate. You won't be able to update translations.") 16 | endif(NOT QT_LUPDATE_EXECUTABLE) 17 | 18 | if(NOT QT_LRELEASE_EXECUTABLE) 19 | message(WARNING "Could not find lrelease. Your build won't contain translations.") 20 | ## Create an empty RCC file 21 | file(WRITE ${TS_QRC} "") 22 | endif(NOT QT_LRELEASE_EXECUTABLE) 23 | 24 | ## Wraps the supplied .ts files in lrelease commands 25 | macro(QT_ADD_TRANSLATIONS outfiles) 26 | file(WRITE ${TS_QRC} "\n") 27 | FOREACH (it ${ARGN}) 28 | get_filename_component(it ${it} ABSOLUTE) 29 | get_filename_component(outfile ${it} NAME_WE) 30 | 31 | file(APPEND ${TS_QRC} "${outfile}.qm\n") 32 | 33 | set(outfile ${CMAKE_BINARY_DIR}/lang/${outfile}.qm) 34 | 35 | add_custom_command( 36 | OUTPUT ${outfile} 37 | COMMAND ${QT_LRELEASE_EXECUTABLE} 38 | ARGS -compress -silent -nounfinished ${it} -qm ${outfile} 39 | MAIN_DEPENDENCY ${it} 40 | ) 41 | 42 | set(${outfiles} ${${outfiles}} ${outfile}) 43 | endforeach(it) 44 | file(APPEND ${TS_QRC} "") 45 | endmacro(QT_ADD_TRANSLATIONS) 46 | 47 | ## set available translations file ids here 48 | option(LANGUAGES "Using translations") 49 | set(ALL_LANGUAGES 50 | en 51 | pt 52 | nl 53 | es # add here more lang tokens like jp, ro etc. as per ts files 54 | ) 55 | 56 | ## Check if user has provided specific LANGS option 57 | if(NOT DEFINED LANGS) 58 | set(LANGUAGES ${ALL_LANGUAGES} CACHE STRING "Using translations" FORCE) 59 | else(NOT DEFINED LANGS) 60 | if(NOT LANGS) 61 | set(LANGUAGES "" CACHE STRING "Using translations" FORCE) 62 | elseif(LANGS STREQUAL *) 63 | set(LANGUAGES ${ALL_LANGUAGES} CACHE STRING "Using translations" FORCE) 64 | else(NOT LANGS) 65 | STRING(REGEX MATCHALL [a-zA-Z_]+ 66 | langs1 ${LANGS}) 67 | set(LANGUAGES ${langs1} CACHE STRING "Using translations" FORCE) 68 | endif(NOT LANGS) 69 | endif(NOT DEFINED LANGS) 70 | 71 | ## Display what translations files will be processed 72 | message(STATUS "Translations: ${LANGUAGES}") 73 | 74 | ## Collect all translations files that are to be processed 75 | foreach(LANGUAGE ${LANGUAGES}) 76 | file(GLOB temp_TS ${CMAKE_SOURCE_DIR}/lang/routerkeygen_*${LANGUAGE}*.ts) 77 | list(APPEND routerkeygen_TS ${temp_TS}) 78 | endforeach() 79 | 80 | if(QT_LRELEASE_EXECUTABLE) 81 | ## Wraps the collected translations 82 | QT_ADD_TRANSLATIONS(routerkeygen_QMS ${routerkeygen_TS}) 83 | 84 | ## Create a target that runs lrelease for all the .ts files 85 | ## "ALL" means that it will be run by default. 86 | add_custom_target(translations ALL DEPENDS ${routerkeygen_QMS}) 87 | endif(QT_LRELEASE_EXECUTABLE) 88 | 89 | if(QT_LUPDATE_EXECUTABLE) 90 | ## Search for all translatable strings in the sources directory 91 | file(GLOB_RECURSE translate_SRCS ${CMAKE_SOURCE_DIR}/src/*.cpp 92 | ${CMAKE_SOURCE_DIR}/src/*.hpp) 93 | file(GLOB_RECURSE translate_HDRS ${CMAKE_SOURCE_DIR}/src/*.h) 94 | file(GLOB_RECURSE translate_UIS ${CMAKE_SOURCE_DIR}/src/*.ui) 95 | 96 | set(translate_SRCS ${translate_SRCS} ${translate_HDRS} ${translate_UIS}) 97 | 98 | ## Create a target that runs lupdate for all the sources and UI files 99 | add_custom_target(lupdate 100 | COMMAND ${QT_LUPDATE_EXECUTABLE} -noobsolete ${translate_SRCS} -ts ${routerkeygen_TS} 101 | ) 102 | endif(QT_LUPDATE_EXECUTABLE) 103 | 104 | -------------------------------------------------------------------------------- /lang/create_ts.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | lupdate ../src/* -ts $1 4 | -------------------------------------------------------------------------------- /nsis/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # NSIS builder 3 | # 4 | 5 | # Output file name 6 | set(NSIS_OUTPUT_FILE "${PROJECT_NAME}_installer.exe") 7 | 8 | # NSIS is only available for Win32 builds (native or cross compilation) 9 | if(MSYS) 10 | set(NSIS_OUTPUT_DIR "${CMAKE_BINARY_DIR}/bin/") 11 | # Check contribs existence 12 | if(EXISTS "${CMAKE_FIND_ROOT_PATH}/") 13 | message(STATUS "${CMAKE_FIND_ROOT_PATH} found!") 14 | # Copy necessary libraries required at runtime 15 | file(COPY "${CMAKE_FIND_ROOT_PATH}/bin/" 16 | DESTINATION ${NSIS_OUTPUT_DIR} 17 | FILES_MATCHING PATTERN "*.dll") 18 | message(STATUS "Configuring NSIS") 19 | # Copy and configure the nsis script file 20 | configure_file(installer.nsi "${NSIS_OUTPUT_DIR}/installer.nsi" @ONLY) 21 | configure_file(FileAssociation.nsh "${NSIS_OUTPUT_DIR}/FileAssociation.nsh" COPYONLY) 22 | add_custom_target(installer 23 | ${CMAKE_COMMAND} -E remove "${NSIS_OUTPUT_DIR}${NSIS_OUTPUT_FILE}" 24 | COMMAND makensis "${NSIS_OUTPUT_DIR}/installer.nsi" 25 | WORKING_DIRECTORY "${NSIS_OUTPUT_DIR}" 26 | ) 27 | add_dependencies(installer routerkeygen) 28 | else(EXISTS "${CMAKE_FIND_ROOT_PATH}/") 29 | message(WARNING "${CMAKE_FIND_ROOT_PATH} not available, you won't be able to create an installer. Read INSTALL.win32 for details.") 30 | endif(EXISTS "${CMAKE_FIND_ROOT_PATH}/") 31 | endif(MSYS) 32 | -------------------------------------------------------------------------------- /resources/cyta_bases.txt: -------------------------------------------------------------------------------- 1 | 0017C2F4 YW F458E0 4 2 | 0017C2F6 YW F600C4 4 3 | 00193EE5 YW E4B1AD 4 4 | 00193EE8 YW E673D9 4 5 | 001CA2DA 74701Y DA5DC1 2 6 | 001CA2DD 74702Y DD3B63 2 7 | 001CA2DD 74702Y DD6C67 2 8 | 001CA2AA YW A82A55 4 9 | 001CA2AA YW A82B2D 4 10 | 001CA2AB YW A82DD5 4 11 | 001CA2AB YW A88775 4 12 | 001CA2AC YW A88775 4 13 | 001CA2B2 YW ACEC5D 4 14 | 001CA2B2 YW ACEDC5 4 15 | 001CA2B2 YW ACEE01 4 16 | 001CA2B3 YW ACEE01 4 17 | 001CA2B4 YW ACEE01 4 18 | 001CA2B4 YW ACEF2D 4 19 | 001CA2B5 YW AD86BD 4 20 | 001CA2D9 YW D0C62D 4 21 | 001CA2DA YW D0EC31 4 22 | 001CA2DE YW D3D73F 4 23 | 00238ECD YW BF5DDD 4 24 | 00238ECE YW BF5F0D 4 25 | 0025538A YW 7A105E 4 26 | 0025538D YW 7BBDEE 4 27 | 0025538E YW 7BC922 4 28 | 0025538F YW 7D82C6 4 29 | 00255390 YW 7D82C6 4 30 | 38229D1B 25801Y 1AF8A2 9 31 | 38229D1C 25801Y 1AF8A2 9 32 | 38229D1C 25901Y 1C4C86 9 33 | 38229D1C 25801Y 1B18E8 9 34 | 38229D98 25801Y 96CE3C 9 35 | 38229D99 25801Y 96CE3C 9 36 | 38229D99 25801Õ 982A48 9 37 | 38229D99 25901Y 995E52 9 38 | 38229DA3 25801Y A07F5C 9 39 | 38229DA4 25801Y A07F5C 9 40 | 38229DA5 25801Y A1553E 9 41 | 38229DA6 25801Y A1553E 9 42 | 38229DA7 25801Y A1553E 9 43 | 38229DA7 25801Y A1A4EE 9 44 | 38229DA8 25801Y A1A4EE 9 45 | 38229DA9 25801Y A1A4EE 9 46 | 38229DA9 25801Y A1A5EC 9 47 | 38229DAA 25801Y A1A5EC 9 48 | 38229DAA 25801Y A1A70C 9 49 | 38229DAB 25801Y A1A70C 9 50 | 38229DAD 25801Y A2CA30 9 51 | 38229DAE 25801Y A2CA30 9 52 | 38229DAF 25801Y A2CA30 9 53 | 38229DBF 25802Y BF8EDC 9 54 | 38229DC0 25802Y BF8EDC 9 55 | 38229DC1 25802Y BF978B 9 56 | 38229DC2 25802Y BF978B 9 57 | 38229DC3 25802Y BF978B 9 58 | 38229DC3 25902Y C391F7 9 59 | 38229DC4 25802Y BF978F 9 60 | 38229DC4 25802Y C12B5D 9 61 | 38229DC5 25802Y C12B5D 9 62 | 38229DC6 25802Y C12B5D 9 63 | 6487D7B4 21602X B4C17A 9 64 | 6487D7B5 21602X B4CE15 9 65 | DC0B1A04 25802Y -2422F 9 66 | DC0B1A05 25802Y -2422F 9 67 | DC0B1A10 25802Y 0DFD2C 9 68 | DC0B1A16 25802Y 0E016D 9 69 | DC0B1A17 25902Y 16A806 9 70 | DC0B1A21 25802Y 16F9C3 9 71 | -------------------------------------------------------------------------------- /resources/loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RealEnder/routerkeygenPC/c1f166555f6620d21b9767682dc79346806e2f5e/resources/loading.gif -------------------------------------------------------------------------------- /resources/resources.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | loading.gif 4 | tele2.txt 5 | alice.txt 6 | ote_huawei.txt 7 | tray_icon.png 8 | cyta_bases.txt 9 | 10 | 11 | -------------------------------------------------------------------------------- /resources/tele2.txt: -------------------------------------------------------------------------------- 1 | 001CA2 DAE656 DB4869 74601 DAD231 3 2 | 001CA2 DC2E9C DCC367 74601 DBAFD9 3 3 | 001CA2 DCDFB2 DD26D1 74601 DBB169 3 4 | 001CA2 DD4671 DD7FED 74702 DD3B63 2 5 | 001CA2 DDBC41 DE26D3 74702 DD6C67 2 6 | 001CA2 DEEAD8 DF0A0D 74601 DD56C5 3 7 | 001CA2 E018E0 E04D96 74601 DE57EB 3 8 | 001CA2 E056BB E07CC2 74601 DE597B 3 9 | 001CA2 FC8582 FCDD48 74601 FA582D 3 10 | 001CA2 FEE5AE FEE5DE 15301 FEE58C 2 11 | 001CA2 FEE75A FEE788 15401 FEE6A4 2 12 | 00238E CE0CB9 CE0CF7 15301 CE0C21 2 13 | 00238E CEBAE5 CEF040 74601 CC08AF 3 14 | 00238E CEF2FB CEF6C5 15301 CEF209 2 15 | 00238E CF2B95 CF2BDD 15301 CF0299 2 16 | 00238E E463E8 E48714 15301 E43A84 2 17 | 00238E E50DC2 E53576 15301 E4C0D4 2 18 | 00238E E5372A E55EAE 15301 E4C232 2 19 | 00238E E884FA E8AC6C 15301 E7E736 2 20 | 00238E E8B78E E8DE8E 15301 E7F250 2 21 | 002553 8A3E36 8A66CE 15301 8951EA 2 22 | 002553 8BBA60 8BD1CC 15301 8AA578 2 23 | 002553 8D50AE 8D7410 15301 8C2448 2 24 | 38229D 03614C 044510 36101 FE3C4C 6 25 | 38229D 05B1EE 05B1F4 36101 FFA91E 6 26 | 38229D 1606D6 1655B8 15302 1606D6 2 27 | 38229D 170342 170410 15302 16B456 2 28 | 38229D 18FFA9 18FFA9 15901 188E99 2 29 | 38229D 1918A5 1918A5 15901 1896ED 2 30 | 38229D 192DE2 1955AE 15302 18DE22 2 31 | 38229D 1A44D2 1A6C90 15302 19CD32 2 32 | 38229D 9ACFA6 9ACFA6 15901 9A24F0 2 33 | 38229D 9CC272 9CEA42 15302 9BD356 2 34 | 38229D 9EB878 9EE04A 15302 9DA180 2 35 | 38229D A0C184 A0E952 15303 A0C182 2 36 | 38229D A15F90 A1609C 15303 A137B4 2 37 | 38229D A75114 A7A0C0 15303 A72828 2 38 | 38229D B059C8 B07134 15303 AFE12C 2 39 | 38229D B07149 B088B1 15303 AFE13D 2 40 | 38229D B088DB B0A747 15303 AFE161 2 41 | 38229D B20CE8 B281F0 15303 B146F4 2 42 | 38229D B37E04 B37EDC 15303 B242E2 2 43 | 38229D B6A824 B73872 36101 B6A81E 6 44 | 38229D B7EB52 B84DBC 36101 B75AF2 6 45 | 38229D B87E3E B96D36 36101 B78B62 6 46 | 38229D BA2778 BC05CE 36101 B8455C 6 47 | 38229D BCB066 BD9ABA 36101 B8EFEE 6 48 | 38229D BEDA36 BEDC82 36101 BA2F58 6 49 | 38229D C31D0E C394BA 36101 BE6FDE 6 50 | 38229D C39512 C39512 36101 BE702A 6 51 | DC0B1A 0B56E7 0C72EE 36101 024955 9 52 | DC0B1A 0D746A 0D7608 36101 034ABF 9 53 | DC0B1A 0DC0BD 0DC0BD 36101 039547 9 54 | -------------------------------------------------------------------------------- /resources/tray_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RealEnder/routerkeygenPC/c1f166555f6620d21b9767682dc79346806e2f5e/resources/tray_icon.png -------------------------------------------------------------------------------- /routerkeygen_version.json: -------------------------------------------------------------------------------- 1 | {"version":"1.1.0"} 2 | -------------------------------------------------------------------------------- /share/MacOSXBundleInfo.plist.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${MACOSX_BUNDLE_EXECUTABLE_NAME} 9 | CFBundleGetInfoString 10 | ${MACOSX_BUNDLE_INFO_STRING} 11 | CFBundleIconFile 12 | ${MACOSX_BUNDLE_ICON_FILE} 13 | CFBundleIdentifier 14 | ${MACOSX_BUNDLE_GUI_IDENTIFIER} 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleLongVersionString 18 | ${MACOSX_BUNDLE_LONG_VERSION_STRING} 19 | CFBundleName 20 | ${MACOSX_BUNDLE_BUNDLE_NAME} 21 | CFBundlePackageType 22 | APPL 23 | CFBundleShortVersionString 24 | ${MACOSX_BUNDLE_SHORT_VERSION_STRING} 25 | CFBundleSignature 26 | com.routerkeygen 27 | CFBundleVersion 28 | ${MACOSX_BUNDLE_BUNDLE_VERSION} 29 | CSResourcesFileMapped 30 | 31 | NSHumanReadableCopyright 32 | ${MACOSX_BUNDLE_COPYRIGHT} 33 | NSPrincipalClass 34 | NSApplication 35 | LSMinimumSystemVersion 36 | 10.6 37 | 38 | 39 | -------------------------------------------------------------------------------- /share/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RealEnder/routerkeygenPC/c1f166555f6620d21b9767682dc79346806e2f5e/share/background.png -------------------------------------------------------------------------------- /share/loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RealEnder/routerkeygenPC/c1f166555f6620d21b9767682dc79346806e2f5e/share/loading.gif -------------------------------------------------------------------------------- /share/routerkeygen.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Name=RouterKegyen 3 | GenericName=Key Generator 4 | Comment=Generate the default key of several routers. 5 | Exec=routerkeygen 6 | Terminal=false 7 | Type=Application 8 | Icon=/usr/share/pixmaps/routerkeygen.png 9 | Categories=Network; 10 | StartupNotify=false 11 | -------------------------------------------------------------------------------- /share/routerkeygen.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.network.client 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /share/routerkeygen.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RealEnder/routerkeygenPC/c1f166555f6620d21b9767682dc79346806e2f5e/share/routerkeygen.icns -------------------------------------------------------------------------------- /share/routerkeygen.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RealEnder/routerkeygenPC/c1f166555f6620d21b9767682dc79346806e2f5e/share/routerkeygen.ico -------------------------------------------------------------------------------- /share/routerkeygen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RealEnder/routerkeygenPC/c1f166555f6620d21b9767682dc79346806e2f5e/share/routerkeygen.png -------------------------------------------------------------------------------- /src/KeygenThread.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Rui Araújo, Luís Fonseca 3 | * 4 | * This file is part of Router Keygen. 5 | * 6 | * Router Keygen is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Router Keygen is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Router Keygen. If not, see . 18 | */ 19 | #include "KeygenThread.h" 20 | #include "algorithms/Keygen.h" 21 | 22 | KeygenThread::KeygenThread( QVector * routers): routers(routers) , error(false){} 23 | 24 | KeygenThread::~KeygenThread() { 25 | } 26 | 27 | void KeygenThread::run(){ 28 | for ( int i = 0; i < routers->size(); ++i ){ 29 | try{ 30 | QVector r = routers->at(i)->getResults(); 31 | foreach (QString s, r) { 32 | results.append(s); 33 | } 34 | } catch (int e){ 35 | error = true; 36 | } 37 | } 38 | } 39 | 40 | QVector KeygenThread::getResults() const { 41 | return results; 42 | } 43 | 44 | bool KeygenThread::hadError() const{ 45 | return error; 46 | } 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /src/KeygenThread.h: -------------------------------------------------------------------------------- 1 | /* 2 | * KeygenThread.h 3 | * 4 | * Created on: 1 de Ago de 2012 5 | * Author: ruka 6 | */ 7 | 8 | #ifndef KEYGENTHREAD_H_ 9 | #define KEYGENTHREAD_H_ 10 | #include 11 | #include 12 | #include 13 | 14 | class Keygen; 15 | class KeygenThread: public QThread { 16 | public: 17 | KeygenThread(QVector *); 18 | virtual ~KeygenThread(); 19 | QVector getResults() const; 20 | bool hadError() const; 21 | protected: 22 | void run(); 23 | private: 24 | QVector * routers; 25 | QVector results; 26 | bool error; 27 | }; 28 | 29 | #endif /* KEYGENTHREAD_H_ */ 30 | -------------------------------------------------------------------------------- /src/RouterKeygen.h: -------------------------------------------------------------------------------- 1 | #ifndef ROUTERKEYGEN_H 2 | #define ROUTERKEYGEN_H 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | namespace Ui { 16 | class RouterKeygen; 17 | } 18 | 19 | class QScanResult; 20 | class QWifiManager; 21 | class AboutDialog; 22 | class WelcomeDialog; 23 | class UpdateDialog; 24 | class Keygen; 25 | class KeygenThread; 26 | class WirelessMatcher; 27 | class RouterKeygen : public QMainWindow 28 | { 29 | Q_OBJECT 30 | 31 | public: 32 | explicit RouterKeygen(QWidget *parent = 0); 33 | virtual ~RouterKeygen(); 34 | void showWithDialog(); 35 | 36 | protected: 37 | bool eventFilter(QObject *obj, QEvent *event); 38 | 39 | private slots: 40 | void rightButtonClicked(QObject *obj,const QPoint &p); 41 | void copyKey(); 42 | void forceRefreshToggle(int); 43 | void backgroundRunToggle(bool); 44 | void startUpRunToggle(bool); 45 | void refreshNetworks(); 46 | void manualCalculation(); 47 | void copyAll(); 48 | void scanFinished(int); 49 | void supportedNetworkRowSelected(int, int); 50 | void unlikelyNetworkRowSelected(int, int); 51 | void unsupportedNetworkRowSelected(int, int); 52 | void getResults(); 53 | void donatePaypal(); 54 | void feedback(); 55 | void donateGooglePlay(); 56 | void showAboutDialog(); 57 | void checkUpdates(); 58 | void onNetworkReply(QNetworkReply*); 59 | 60 | private: 61 | void addNetworkToTray(const QString & ssid, int level, bool locked ); 62 | void setLoadingAnimation(const QString& text); 63 | void cleanLoadingAnimation(); 64 | void calc(QScanResult * wifi ); 65 | void enableUI(bool enable); 66 | QUrl redirectUrl(const QUrl& possibleRedirectUrl, 67 | const QUrl& oldRedirectUrl) const; 68 | Ui::RouterKeygen *ui; 69 | QVector listKeys; 70 | QVector > wifiNetworks; 71 | QScanResult * manualWifi; 72 | WirelessMatcher * matcher; 73 | KeygenThread * calculator; 74 | QWifiManager * wifiManager; 75 | QMovie * loadingAnim; 76 | QLabel * loading; 77 | QLabel * loadingText; 78 | AboutDialog * aboutDialog; 79 | WelcomeDialog * welcomeDialog; 80 | QSystemTrayIcon *trayIcon; 81 | QMenu *trayMenu; 82 | QCompleter *completer; 83 | QAction * startUpAction; 84 | QAction * runInBackgroundAction; 85 | bool runInBackground; 86 | bool runOnStartUp; 87 | bool automaticUpdateCheck; 88 | //SETTINGS VALUES 89 | QSettings * settings; 90 | QStringList wordList; 91 | 92 | //Update checking 93 | const static QUrl UPDATE_URL; 94 | QPointer mNetworkManager; 95 | QUrl _urlRedirectedTo; 96 | 97 | const static QString RUN_ON_START_UP; 98 | const static QString RUN_IN_BACKGROUND; 99 | const static QString FORCE_REFRESH; 100 | const static QString WELCOME_DIALOG; 101 | const static unsigned int SECONDS_IN_WEEK; 102 | }; 103 | 104 | #endif // ROUTERKEYGEN_H 105 | -------------------------------------------------------------------------------- /src/WirelessMatcher.h: -------------------------------------------------------------------------------- 1 | /* 2 | * WirelessMatcher.h 3 | * 4 | * Created on: 1 de Ago de 2012 5 | * Author: ruka 6 | */ 7 | 8 | #ifndef WIRELESSMATCHER_H_ 9 | #define WIRELESSMATCHER_H_ 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | 16 | class Keygen; 17 | struct AliceMagicInfo; 18 | struct TeleTuMagicInfo; 19 | class WirelessMatcher { 20 | public: 21 | WirelessMatcher(); 22 | virtual ~WirelessMatcher(); 23 | QVector * getKeygens(QString ssid, QString mac); 24 | private: 25 | QMap *> * supportedAlice; 26 | QMap *> * supportedTeletu; 27 | QStringList * supportedOTE; 28 | 29 | }; 30 | 31 | #endif /* WIRELESSMATCHER_H_ */ 32 | -------------------------------------------------------------------------------- /src/algorithms/AliceGermanyKeygen.cpp: -------------------------------------------------------------------------------- 1 | #include "AliceGermanyKeygen.h" 2 | #include 3 | 4 | AliceGermanyKeygen::AliceGermanyKeygen(QString ssid, QString mac) : 5 | Keygen(ssid, mac) { 6 | kgname = "AliceGermany"; 7 | this->hash = new QCryptographicHash(QCryptographicHash::Md5); 8 | } 9 | 10 | AliceGermanyKeygen::~AliceGermanyKeygen(){ 11 | delete hash; 12 | } 13 | int AliceGermanyKeygen::getSupportState() const{ 14 | if ( getSsidName().count(QRegExp("^ALICE-WLAN[0-9a-fA-F]{2}$")) == 1 ) 15 | return SUPPORTED; 16 | return UNLIKELY; 17 | } 18 | 19 | QVector & AliceGermanyKeygen::getKeys() { 20 | QString mac = getMacAddress(); 21 | if (mac.size() != 12) 22 | throw ERROR; 23 | QString macEth = mac.right(6); 24 | int macEthInt = macEth.toInt(NULL, 16)-1; 25 | if ( macEthInt < 0 ) 26 | macEthInt = 0xFFFFFF; 27 | macEth.setNum(macEthInt, 16); 28 | while ( macEth.size() < 6 ) 29 | macEth = "0"+ macEth; 30 | macEth = mac.left(6) + macEth; 31 | this->hash->reset(); 32 | this->hash->addData(macEth.toLower().toLatin1()); 33 | QString result = QString::fromLatin1(this->hash->result().toHex().data()); 34 | result.truncate(12); 35 | this->results.append(QString(result.toLatin1().toBase64())); 36 | return results; 37 | } 38 | -------------------------------------------------------------------------------- /src/algorithms/AliceGermanyKeygen.h: -------------------------------------------------------------------------------- 1 | #ifndef ALICEGERMANYKEYGEN_H 2 | #define ALICEGERMANYKEYGEN_H 3 | #include 4 | #include "Keygen.h" 5 | 6 | class AliceGermanyKeygen : public Keygen 7 | { 8 | public: 9 | AliceGermanyKeygen(QString ssid, QString mac); 10 | ~AliceGermanyKeygen(); 11 | int getSupportState() const; 12 | private: 13 | QVector & getKeys(); 14 | QCryptographicHash * hash; 15 | }; 16 | 17 | #endif // ALICEGERMANYKEYGEN_H 18 | -------------------------------------------------------------------------------- /src/algorithms/AliceItalyKeygen.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Rui Araújo, Luís Fonseca 3 | * 4 | * This file is part of Router Keygen. 5 | * 6 | * Router Keygen is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Router Keygen is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Router Keygen. If not, see . 18 | */ 19 | #ifndef ALICEKEYGEN_H 20 | #define ALICEKEYGEN_H 21 | #include "Keygen.h" 22 | struct AliceMagicInfo; 23 | class AliceItalyKeygen : public Keygen 24 | { 25 | public: 26 | const static unsigned char ALICE_SEED[32]; 27 | AliceItalyKeygen(QString ssid, QString mac, QVector * supported); 28 | private: 29 | QVector & getKeys(); 30 | QVector * supportedAlice; 31 | const static QString preInitCharset; 32 | }; 33 | 34 | #endif // ALICEKEYGEN_H 35 | -------------------------------------------------------------------------------- /src/algorithms/AndaredKeygen.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * AndaredKeygen.cpp 3 | * 4 | * Created on: 5 de Ago de 2012 5 | * Author: ruka 6 | */ 7 | 8 | #include "AndaredKeygen.h" 9 | 10 | AndaredKeygen::AndaredKeygen(QString ssid, QString mac) : 11 | Keygen(ssid, mac) { 12 | kgname = "Andared"; 13 | } 14 | 15 | QVector & AndaredKeygen::getKeys() { 16 | results.append(QString("6b629f4c299371737494c61b5a101693a2d4e9e1f3e1320f3ebf9ae379cecf32")); 17 | return results; 18 | } 19 | -------------------------------------------------------------------------------- /src/algorithms/AndaredKeygen.h: -------------------------------------------------------------------------------- 1 | /* 2 | * AndaredKeygen.h 3 | * 4 | * Created on: 5 de Ago de 2012 5 | * Author: ruka 6 | */ 7 | 8 | #ifndef ANDAREDKEYGEN_H_ 9 | #define ANDAREDKEYGEN_H_ 10 | 11 | #include "Keygen.h" 12 | 13 | class AndaredKeygen: public Keygen { 14 | public: 15 | AndaredKeygen(QString ssid, QString mac); 16 | 17 | private: 18 | QVector & getKeys() ; 19 | }; 20 | 21 | #endif /* ANDAREDKEYGEN_H_ */ 22 | -------------------------------------------------------------------------------- /src/algorithms/ArcadyanKeygen.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * EasyBox.cpp 3 | * 4 | * Created on: 5 de Ago de 2012 5 | * Author: ruka 6 | */ 7 | 8 | #include "ArcadyanKeygen.h" 9 | #include 10 | 11 | ArcadyanKeygen::ArcadyanKeygen(QString ssid, QString mac) : 12 | Keygen(ssid, mac) { 13 | kgname = "Arcadyan"; 14 | } 15 | 16 | int ArcadyanKeygen::getSupportState() const{ 17 | if ( getSsidName().count(QRegExp("^(Arcor|EasyBox|Vodafone|WLAN)(-| )[0-9a-fA-F]{6}$")) == 1 18 | || getSsidName().count(QRegExp("Vodafone[0-9a-zA-Z]{4}")) == 1 ) 19 | return SUPPORTED; 20 | return UNLIKELY; 21 | } 22 | QVector & ArcadyanKeygen::getKeys() { 23 | QString mac = getMacAddress(); 24 | if (mac.length() != 12) { 25 | throw ERROR; 26 | } 27 | bool status; 28 | QString C1 = ""; 29 | C1.setNum(mac.right(4).toInt(&status, 16),10); 30 | 31 | while (C1.length() < 5) 32 | C1 = "0" + C1; 33 | 34 | unsigned char S7 = C1.mid(1,1).toInt(&status, 16); 35 | unsigned char S8 = C1.mid(2,1).toInt(&status, 16); 36 | unsigned char S9 = C1.mid(3,1).toInt(&status, 16); 37 | unsigned char S10 = C1.mid(4,1).toInt(&status, 16); 38 | unsigned char M9 = mac.mid(8,1).toInt(&status, 16); 39 | unsigned char M10 = mac.mid(9,1).toInt(&status, 16); 40 | unsigned char M11 = mac.mid(10,1).toInt(&status, 16); 41 | unsigned char M12 = mac.mid(11,1).toInt(&status, 16); 42 | if ( !status ) 43 | throw ERROR; 44 | 45 | unsigned int K1 = (S7 + S8 + M11 + M12) & 0x0f; 46 | unsigned int K2 = (M9 + M10 +S9 + S10) & 0x0f; 47 | 48 | QString X1;X1.setNum(K1 ^ S10, 16); 49 | QString X2;X2.setNum(K1 ^ S9, 16); 50 | QString X3;X3.setNum(K1 ^ S8, 16); 51 | QString Y1;Y1.setNum(K2 ^ M10, 16); 52 | QString Y2;Y2.setNum(K2 ^ M11, 16); 53 | QString Y3;Y3.setNum(K2 ^ M12, 16); 54 | QString Z1;Z1.setNum(M11 ^ S10, 16); 55 | QString Z2;Z2.setNum(M12 ^ S9, 16); 56 | QString Z3;Z3.setNum(K1 ^ K2, 16); 57 | 58 | QString wpaKey = X1 + Y1 + Z1 + X2 + Y2 + Z2 + X3 + Y3 + Z3; 59 | results.append(wpaKey.toUpper()); 60 | 61 | if (wpaKey.indexOf('0')!=-1) { 62 | results.append(wpaKey.replace("0", "1").toUpper()); 63 | } 64 | return results; 65 | } 66 | 67 | -------------------------------------------------------------------------------- /src/algorithms/ArcadyanKeygen.h: -------------------------------------------------------------------------------- 1 | /* 2 | * EasyBox.h 3 | * 4 | * Created on: 5 de Ago de 2012 5 | * Author: ruka 6 | */ 7 | 8 | #ifndef EASYBOX_H_ 9 | #define EASYBOX_H_ 10 | 11 | #include "Keygen.h" 12 | 13 | class ArcadyanKeygen: public Keygen { 14 | public: 15 | ArcadyanKeygen(QString ssid, QString mac); 16 | int getSupportState() const; 17 | private: 18 | QVector & getKeys() ; 19 | }; 20 | 21 | #endif /* EASYBOX_H_ */ 22 | -------------------------------------------------------------------------------- /src/algorithms/ArnetPirelliKeygen.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Rui Araújo, Luís Fonseca 3 | * 4 | * This file is part of Router Keygen. 5 | * 6 | * Router Keygen is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Router Keygen is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Router Keygen. If not, see . 18 | */ 19 | #include "ArnetPirelliKeygen.h" 20 | #include "AliceItalyKeygen.h" 21 | #include 22 | ArnetPirelliKeygen::ArnetPirelliKeygen(QString ssid, QString mac) : 23 | Keygen(ssid, mac) { 24 | kgname = "ArnetPirelli"; 25 | } 26 | 27 | const QString ArnetPirelliKeygen::LOOKUP = "0123456789abcdefghijklmnopqrstuvwxyz"; 28 | const QString ArnetPirelliKeygen::SEED = "1236790"; 29 | 30 | 31 | 32 | int ArnetPirelliKeygen::getSupportState() const{ 33 | if (getSsidName().startsWith("WiFi-Arnet-") || 34 | getSsidName().startsWith("ADSLPT-AB")) 35 | return SUPPORTED; 36 | return UNLIKELY; 37 | } 38 | 39 | QString ArnetPirelliKeygen::incrementMac(QString mac, int increment) { 40 | return QString("%1").arg(mac.toLong(0, 16) + increment, 12, 16, QChar('0')); 41 | } 42 | 43 | QString ArnetPirelliKeygen::generateKey(QString mac, int length) { 44 | SHA256_CTX sha; 45 | unsigned char hash[32]; 46 | 47 | char macBytes[6]; 48 | for (int i = 0; i < 12; i += 2) { 49 | macBytes[i / 2] = (mac.mid(i, 1).toInt(0, 16) << 4) 50 | + mac.mid(i + 1, 1).toInt(0, 16); 51 | } 52 | 53 | /* Compute the hash */ 54 | SHA256_Init(&sha); 55 | SHA256_Update(&sha, (const void *) AliceItalyKeygen::ALICE_SEED, sizeof(AliceItalyKeygen::ALICE_SEED)); 56 | SHA256_Update(&sha, (const void *) SEED.toLatin1().data(), SEED.size()); 57 | SHA256_Update(&sha, (const void *) macBytes, sizeof(macBytes)); 58 | SHA256_Final(hash, &sha); 59 | QString key = ""; 60 | for (int i = 0; i < length; ++i) { 61 | key += LOOKUP.at(hash[i] % LOOKUP.length()); 62 | } 63 | return key; 64 | 65 | 66 | } 67 | 68 | QVector & ArnetPirelliKeygen::getKeys() { 69 | 70 | if ( getMacAddress().length() < 12 ) { 71 | throw ERROR; 72 | } 73 | 74 | QVector keys; 75 | QVector::iterator iter; 76 | 77 | /* Fill key with 0 (most possible key) on the top */ 78 | keys << generateKey(incrementMac(getMacAddress(), 0), 10); 79 | for (int i = -2; i < 5; i++) { 80 | if (i == 0) 81 | continue; 82 | keys << generateKey(incrementMac(getMacAddress(), i), 10); 83 | } 84 | 85 | if (getSsidName().startsWith("WiFi-Arnet-")) { 86 | for(iter = keys.begin(); iter != keys.end(); iter++) { 87 | results.append(*iter); 88 | } 89 | } else if (getSsidName().startsWith("ADSLPT-AB")) { 90 | for(iter = keys.begin(); iter != keys.end(); iter++) { 91 | results.append(QString(*iter).left(8)); 92 | } 93 | } else { 94 | /* No hit on SSID, try all anyway */ 95 | for(iter = keys.begin(); iter != keys.end(); iter++) { 96 | results.append(*iter); 97 | results.append(QString(*iter).left(8)); 98 | } 99 | } 100 | 101 | return results; 102 | 103 | } 104 | -------------------------------------------------------------------------------- /src/algorithms/ArnetPirelliKeygen.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Rui Araújo, Luís Fonseca 3 | * 4 | * This file is part of Router Keygen. 5 | * 6 | * Router Keygen is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Router Keygen is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Router Keygen. If not, see . 18 | */ 19 | #ifndef ARNETPIRELLIKEYGEN_H 20 | #define ARNETPIRELLIKEYGEN_H 21 | #include "Keygen.h" 22 | 23 | class ArnetPirelliKeygen : public Keygen 24 | { 25 | public: 26 | ArnetPirelliKeygen(QString ssid, QString mac); 27 | int getSupportState() const; 28 | protected: 29 | QString incrementMac(QString mac, int increment); 30 | QString generateKey(QString mac, int length); 31 | private: 32 | QVector & getKeys(); 33 | const static QString LOOKUP; 34 | const static QString SEED; 35 | }; 36 | 37 | #endif // ARNETPIRELLIKEYGEN_H 38 | -------------------------------------------------------------------------------- /src/algorithms/AxtelKeygen.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * AxtelKeygen.cpp 3 | * 4 | * Created on: 5 de Ago de 2012 5 | * Author: ruka 6 | */ 7 | 8 | #include "AxtelKeygen.h" 9 | 10 | AxtelKeygen::AxtelKeygen(QString ssid, QString mac) : 11 | Keygen(ssid, mac) { 12 | kgname = "Axtel"; 13 | } 14 | 15 | QVector & AxtelKeygen::getKeys() { 16 | QString mac = getMacAddress(); 17 | QString macShort = mac.replace(":", ""); 18 | bool gotResult = false; 19 | 20 | if ( macShort.length() != 12 ) 21 | throw ERROR; 22 | 23 | QString ssidSubpart = getSsidName().right(4); 24 | if ( ssidSubpart.toLower() == macShort.right(4).toLower()) { 25 | results.append(mac.mid(2).toUpper()); 26 | gotResult = true; 27 | } 28 | 29 | //WPA = (Second octet + 1) + (Fourth octect) + (Fifth octect) + (Sixth octect - 1) 30 | if (macShort.right(2).toInt(0, 16)-1 == ssidSubpart.right(2).toInt(0, 16)) { 31 | QString M1 = QString("%1").arg(mac.mid(2, 2).toInt(0, 16) + 1, 2, 16, QChar('0')); 32 | QString M2 = mac.mid(6, 2); 33 | 34 | QString wpaKey = M1 + M2 + ssidSubpart; 35 | 36 | results.append(wpaKey.toUpper()); 37 | gotResult = true; 38 | } 39 | 40 | if (gotResult) { 41 | return results; 42 | } else { 43 | throw ERROR; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/algorithms/AxtelKeygen.h: -------------------------------------------------------------------------------- 1 | /* 2 | * AxtelKeygen.h 3 | * 4 | * Created on: 5 de Ago de 2012 5 | * Author: ruka 6 | */ 7 | 8 | #ifndef AXTELKEYGEN_H_ 9 | #define AXTELKEYGEN_H_ 10 | 11 | #include "Keygen.h" 12 | 13 | class AxtelKeygen: public Keygen { 14 | public: 15 | AxtelKeygen(QString ssid, QString mac); 16 | 17 | private: 18 | QVector & getKeys() ; 19 | }; 20 | 21 | #endif /* AXTELKEYGEN_H_ */ 22 | -------------------------------------------------------------------------------- /src/algorithms/BaseXKeygen.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Alex Stanev 3 | * 4 | * This file is part of Router Keygen. 5 | * 6 | * Router Keygen is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Router Keygen is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Router Keygen. If not, see . 18 | */ 19 | 20 | #include "BaseXKeygen.h" 21 | 22 | BaseXKeygen::BaseXKeygen(QString ssid, QString mac, int flags, int offset, int base, int nibbles) : 23 | Keygen(ssid, mac) { 24 | kgname = "BaseX"; 25 | this->flags = flags; 26 | this->offset = offset; 27 | this->base = base; 28 | this->nibbles = nibbles; 29 | } 30 | 31 | QVector & BaseXKeygen::getKeys() { 32 | QString mac = getMacAddress(); 33 | if ( mac.length() != 12 ) 34 | throw ERROR; 35 | 36 | /* Cut nibbles */ 37 | QString shortMac = mac.right(nibbles); 38 | 39 | /* Apply offset value and base */ 40 | int ishortMac = shortMac.toInt(0, 16); 41 | QString res = QString("%1").arg(ishortMac + offset, 0, base, QLatin1Char('0')); 42 | 43 | /* Check flags */ 44 | if (flags & xFlagLen8) { 45 | if (flags & xFlagUc) 46 | results.append(res.rightJustified(8, QLatin1Char('0'), true).toUpper()); 47 | if (flags & xFlagLc) 48 | results.append(res.rightJustified(8, QLatin1Char('0'), true).toLower()); 49 | } 50 | if (flags & xFlagLen10) { 51 | if (flags & xFlagUc) 52 | results.append(res.rightJustified(10, QLatin1Char('0'), true).toUpper()); 53 | if (flags & xFlagLc) 54 | results.append(res.rightJustified(10, QLatin1Char('0'), true).toLower()); 55 | } 56 | if (flags & xFlagLen12) { 57 | if (flags & xFlagUc) 58 | results.append(res.rightJustified(12, QLatin1Char('0'), true).toUpper()); 59 | if (flags & xFlagLc) 60 | results.append(res.rightJustified(12, QLatin1Char('0'), true).toLower()); 61 | } 62 | 63 | if (results.isEmpty()) 64 | throw ERROR; 65 | 66 | return results; 67 | } 68 | -------------------------------------------------------------------------------- /src/algorithms/BaseXKeygen.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Alex Stanev 3 | * 4 | * This file is part of Router Keygen. 5 | * 6 | * Router Keygen is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Router Keygen is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Router Keygen. If not, see . 18 | */ 19 | 20 | #ifndef BASEXKEYGEN_H_ 21 | #define BASEXKEYGEN_H_ 22 | 23 | #include "Keygen.h" 24 | 25 | enum BaseXKeygenKeygenFlags { 26 | xFlagLen12 = 1u << 0, 27 | xFlagLen10 = 1u << 1, 28 | xFlagLen8 = 1u << 2, 29 | xFlagUc = 1u << 3, 30 | xFlagLc = 1u << 4 31 | }; 32 | 33 | class BaseXKeygen: public Keygen { 34 | public: 35 | BaseXKeygen(QString ssid, QString mac, int flags, int offset, int base, int nibbles); 36 | 37 | private: 38 | QVector & getKeys(); 39 | unsigned int flags; 40 | int offset; 41 | int base; 42 | int nibbles; 43 | }; 44 | 45 | #endif /* BASEXKEYGEN_H_ */ 46 | -------------------------------------------------------------------------------- /src/algorithms/BelkinKeygen.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * AxtelKeygen.cpp 3 | * 4 | * Created on: 5 de Ago de 2012 5 | * Author: ruka 6 | */ 7 | 8 | #include "BelkinKeygen.h" 9 | #include 10 | 11 | BelkinKeygen::BelkinKeygen(QString ssid, QString mac) : 12 | Keygen(ssid, mac) { 13 | kgname = "Belkin"; 14 | } 15 | 16 | int BelkinKeygen::getSupportState() const{ 17 | if ( getSsidName().count(QRegExp("^(B|b)elkin(\\.|_)[0-9a-fA-F]{3,6}$")) == 1 ) 18 | return SUPPORTED; 19 | return UNLIKELY; 20 | } 21 | 22 | QString BelkinKeygen::addOneToMac(QString mac) { 23 | bool ok; 24 | long macInt = mac.toLong(&ok, 16); 25 | if (!ok) 26 | throw ERROR; 27 | return QString::number(macInt+1, 16); 28 | } 29 | 30 | void BelkinKeygen::generateKey(QString mac, QString charset, int order[8]) { 31 | QString key(""); 32 | if ( mac.length() != 8 ) 33 | throw ERROR; 34 | for ( int i = 0; i < mac.length(); ++i ){ 35 | QString k = mac.mid(order[i]-1, 1); 36 | bool ok; 37 | key += charset.at(k.toInt(&ok, 16)); 38 | if (!ok) 39 | throw ERROR; 40 | } 41 | results.append(key); 42 | } 43 | 44 | QVector & BelkinKeygen::getKeys() { 45 | QString mac = getMacAddress(); 46 | if ( mac.length() != 12 ) 47 | throw ERROR; 48 | QString ssid = getSsidName(); 49 | if (ssid.startsWith("Belkin")) { 50 | generateKey(mac.right(8), CHARSETS[0], (int*)ORDERS[0]); 51 | } else if (ssid.startsWith("belkin")) { 52 | mac = addOneToMac(mac); 53 | generateKey(mac.right(8), CHARSETS[1], (int*)ORDERS[0]); 54 | if (!mac.startsWith("944452")) { 55 | generateKey(mac.right(8), CHARSETS[1], (int*)ORDERS[2]); 56 | generateKey(mac.right(8), CHARSETS[1], (int*)ORDERS[3]); 57 | mac = addOneToMac(mac); 58 | generateKey(mac.right(8), CHARSETS[1], (int*)ORDERS[0]); 59 | } 60 | } else { 61 | //Bruteforcing 62 | for (int i = 0; i < 3; ++i) { 63 | for ( int j = 0; j < NUMBERS_OF_ORDERS; ++j ) { 64 | generateKey(mac.right(8), CHARSETS[0], (int*)ORDERS[j]); 65 | generateKey(mac.right(8), CHARSETS[1], (int*)ORDERS[j]); 66 | } 67 | mac = addOneToMac(mac); 68 | } 69 | } 70 | return results; 71 | } 72 | 73 | 74 | const int BelkinKeygen::ORDERS[NUMBERS_OF_ORDERS][8] = {{6,2,3,8,5,1,7,4},{1,2,3,8,5,1,7,4},{1,2,3,8,5,6,7,4},{6,2,3,8,5,6,7,4}}; 75 | const QString BelkinKeygen::CHARSETS[2] = {QString("024613578ACE9BDF"), QString("944626378ace9bdf")}; 76 | -------------------------------------------------------------------------------- /src/algorithms/BelkinKeygen.h: -------------------------------------------------------------------------------- 1 | /* 2 | * AxtelKeygen.h 3 | * 4 | * Created on: 5 de Ago de 2012 5 | * Author: ruka 6 | */ 7 | 8 | #ifndef BELKINKEYGEN_H_ 9 | #define BELKINKEYGEN_H_ 10 | 11 | #include "Keygen.h" 12 | 13 | #define NUMBERS_OF_ORDERS 4 14 | 15 | class BelkinKeygen: public Keygen { 16 | public: 17 | BelkinKeygen(QString ssid, QString mac); 18 | int getSupportState() const; 19 | 20 | private: 21 | const static int ORDERS[NUMBERS_OF_ORDERS][8]; 22 | const static QString CHARSETS[2]; 23 | QVector & getKeys() ; 24 | void generateKey(QString mac, QString charset, int order[8]); 25 | QString addOneToMac(QString mac); 26 | 27 | }; 28 | 29 | #endif /* BELKINKEYGEN_H_ */ 30 | -------------------------------------------------------------------------------- /src/algorithms/BssidKeygen.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Alex Stanev 3 | * 4 | * This file is part of Router Keygen. 5 | * 6 | * Router Keygen is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Router Keygen is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Router Keygen. If not, see . 18 | */ 19 | 20 | #include "BssidKeygen.h" 21 | 22 | BssidKeygen::BssidKeygen(QString ssid, QString mac, int flags, int offset) : 23 | Keygen(ssid, mac) { 24 | kgname = "Bssid"; 25 | this->flags = flags; 26 | this->offset = offset; 27 | } 28 | 29 | QVector & BssidKeygen::getKeys() { 30 | QString mac = getMacAddress(); 31 | if ( mac.length() != 12 ) 32 | throw ERROR; 33 | 34 | QString tMac; 35 | int last; 36 | 37 | /* Check flags and apply offest */ 38 | if (flags & FlagLen8) { 39 | if (flags & FlagCutLeft) { 40 | tMac = mac.left(8); 41 | } else { 42 | tMac = mac.right(8); 43 | } 44 | last = tMac.right(6).toInt(0, 16); 45 | tMac = tMac.left(2) + QString("%1").arg(last + offset, 6, 16, QLatin1Char('0')).right(6); 46 | if (flags & FlagUc) { 47 | results.append(tMac.toUpper()); 48 | } 49 | if (flags & FlagLc) { 50 | results.append(tMac.toLower()); 51 | } 52 | } 53 | 54 | if (flags & FlagLen10) { 55 | if (flags & FlagCutLeft) { 56 | tMac = mac.left(10); 57 | } else { 58 | tMac = mac.right(10); 59 | } 60 | last = tMac.right(6).toInt(0, 16); 61 | tMac = tMac.left(4) + QString("%1").arg(last + offset, 6, 16, QLatin1Char('0')).right(6); 62 | if (flags & FlagUc) { 63 | results.append(tMac.toUpper()); 64 | } 65 | if (flags & FlagLc) { 66 | results.append(tMac.toLower()); 67 | } 68 | } 69 | 70 | if (flags & FlagLen12) { 71 | last = mac.right(6).toInt(0, 16); 72 | tMac = mac.left(6) + QString("%1").arg(last + offset, 6, 16, QLatin1Char('0')).right(6); 73 | if (flags & FlagUc) { 74 | results.append(tMac.toUpper()); 75 | } 76 | if (flags & FlagLc) { 77 | results.append(tMac.toLower()); 78 | } 79 | } 80 | 81 | if (results.isEmpty()) 82 | throw ERROR; 83 | 84 | return results; 85 | } 86 | -------------------------------------------------------------------------------- /src/algorithms/BssidKeygen.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Alex Stanev 3 | * 4 | * This file is part of Router Keygen. 5 | * 6 | * Router Keygen is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Router Keygen is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Router Keygen. If not, see . 18 | */ 19 | 20 | #ifndef BSSIDKEYGEN_H_ 21 | #define BSSIDKEYGEN_H_ 22 | 23 | #include "Keygen.h" 24 | 25 | enum BssidKeygenFlags { 26 | FlagLen12 = 1u << 0, 27 | FlagLen10 = 1u << 1, 28 | FlagLen8 = 1u << 2, 29 | FlagUc = 1u << 3, 30 | FlagLc = 1u << 4, 31 | FlagCutLeft = 1u << 5 32 | }; 33 | 34 | class BssidKeygen: public Keygen { 35 | public: 36 | BssidKeygen(QString ssid, QString mac, int flags, int offset); 37 | 38 | private: 39 | QVector & getKeys(); 40 | unsigned int flags; 41 | int offset; 42 | }; 43 | 44 | #endif /* BSSIDKEYGEN_H_ */ 45 | -------------------------------------------------------------------------------- /src/algorithms/CabovisaoSagemKeygen.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Rui Araújo, Luís Fonseca 3 | * 4 | * This file is part of Router Keygen. 5 | * 6 | * Router Keygen is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Router Keygen is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Router Keygen. If not, see . 18 | */ 19 | #include "CabovisaoSagemKeygen.h" 20 | 21 | CabovisaoSagemKeygen::CabovisaoSagemKeygen(QString ssid, QString mac) : 22 | Keygen(ssid, mac) { 23 | kgname = "CabovisaoSagem"; 24 | ssidIdentifier = ssid.right(4).toLower(); 25 | } 26 | 27 | CabovisaoSagemKeygen::~CabovisaoSagemKeygen() { 28 | } 29 | const QString CabovisaoSagemKeygen::keyBase = QString("2ce412e"); 30 | 31 | QVector & CabovisaoSagemKeygen::getKeys() { 32 | results.append(keyBase+'a'+ssidIdentifier); 33 | results.append(keyBase+'b'+ssidIdentifier); 34 | results.append(keyBase+'c'+ssidIdentifier); 35 | results.append(keyBase+'d'+ssidIdentifier); 36 | return results; 37 | } 38 | -------------------------------------------------------------------------------- /src/algorithms/CabovisaoSagemKeygen.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Rui Araújo, Luís Fonseca 3 | * 4 | * This file is part of Router Keygen. 5 | * 6 | * Router Keygen is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Router Keygen is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Router Keygen. If not, see . 18 | */ 19 | #ifndef CABOVISAOSAGEMKEYGEN_H 20 | #define CABOVISAOSAGEMKEYGEN_H 21 | #include "Keygen.h" 22 | #include 23 | 24 | class CabovisaoSagemKeygen: public Keygen { 25 | public: 26 | CabovisaoSagemKeygen(QString ssid, QString mac); 27 | ~CabovisaoSagemKeygen(); 28 | private: 29 | QVector & getKeys(); 30 | const static QString keyBase; 31 | QString ssidIdentifier; 32 | }; 33 | 34 | #endif // CabovisaoSagemKeygen_H 35 | -------------------------------------------------------------------------------- /src/algorithms/ComtrendKeygen.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Rui Araújo, Luís Fonseca 3 | * 4 | * This file is part of Router Keygen. 5 | * 6 | * Router Keygen is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Router Keygen is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Router Keygen. If not, see . 18 | */ 19 | #include "ComtrendKeygen.h" 20 | 21 | ComtrendKeygen::ComtrendKeygen(QString ssid, QString mac) : 22 | Keygen(ssid, mac) { 23 | kgname = "Comtrend"; 24 | this->hash = new QCryptographicHash(QCryptographicHash::Md5); 25 | } 26 | ComtrendKeygen::~ComtrendKeygen(){ 27 | delete hash; 28 | } 29 | 30 | const QString ComtrendKeygen::magic = "bcgbghgg"; 31 | const QString ComtrendKeygen::lowermagic = "64680C"; 32 | const QString ComtrendKeygen::highermagic = "3872C0"; 33 | const QString ComtrendKeygen::mac001a2b = "001A2B"; 34 | 35 | QVector & ComtrendKeygen::getKeys() { 36 | QString mac = getMacAddress(); 37 | QString ssid4 = getSsidName().right(4); 38 | QString XX; 39 | if (mac.size() != 12) 40 | throw ERROR; 41 | 42 | if (mac.left(6) == mac001a2b) { 43 | for (int i=0; i<512; i++) { 44 | this->hash->reset(); 45 | this->hash->addData(magic.toLatin1()); 46 | 47 | if (i<256) { 48 | this->hash->addData(lowermagic.toLatin1()); 49 | XX = QString("%1").arg(i, 2, 16, QChar('0')).toUpper(); 50 | this->hash->addData(XX.toLatin1()); 51 | } else { 52 | this->hash->addData(highermagic.toLatin1()); 53 | XX = QString("%1").arg(i-256, 2, 16, QChar('0')).toUpper(); 54 | this->hash->addData(XX.toLatin1()); 55 | } 56 | 57 | this->hash->addData(ssid4.toLatin1()); 58 | this->hash->addData(mac.toLatin1()); 59 | 60 | QString result = QString::fromLatin1(this->hash->result().toHex().data()); 61 | result.truncate(20); 62 | this->results.append(result); 63 | } 64 | return results; 65 | } else { 66 | this->hash->reset(); 67 | this->hash->addData(magic.toLatin1()); 68 | QString macMod = mac.left(8) + ssid4.toLatin1(); 69 | this->hash->addData(macMod.toUpper().toLatin1()); 70 | this->hash->addData(mac.toLatin1()); 71 | QString result = QString::fromLatin1(this->hash->result().toHex().data()); 72 | result.truncate(20); 73 | this->results.append(result); 74 | return results; 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /src/algorithms/ComtrendKeygen.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Rui Araújo, Luís Fonseca 3 | * 4 | * This file is part of Router Keygen. 5 | * 6 | * Router Keygen is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Router Keygen is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Router Keygen. If not, see . 18 | */ 19 | #ifndef COMTRENDKEYGEN_H 20 | #define COMTRENDKEYGEN_H 21 | #include "Keygen.h" 22 | #include 23 | 24 | class ComtrendKeygen: public Keygen { 25 | private: 26 | const static QString magic; 27 | const static QString lowermagic; 28 | const static QString highermagic; 29 | const static QString mac001a2b; 30 | 31 | QVector & getKeys() ; 32 | QCryptographicHash * hash; 33 | public: 34 | ComtrendKeygen(QString ssid, QString mac); 35 | ~ComtrendKeygen(); 36 | }; 37 | 38 | #endif // COMTRENDKEYGEN_H 39 | -------------------------------------------------------------------------------- /src/algorithms/ConnKeygen.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * ConnKeygen.cpp 3 | * 4 | * Created on: 5 de Ago de 2012 5 | * Author: ruka 6 | */ 7 | 8 | #include "ConnKeygen.h" 9 | 10 | ConnKeygen::ConnKeygen(QString ssid, QString mac) : 11 | Keygen(ssid, mac) { 12 | kgname = "Conn"; 13 | } 14 | 15 | QVector & ConnKeygen::getKeys() { 16 | results.append(QString("1234567890123")); 17 | return results; 18 | } 19 | -------------------------------------------------------------------------------- /src/algorithms/ConnKeygen.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ConnKeygen.h 3 | * 4 | * Created on: 5 de Ago de 2012 5 | * Author: ruka 6 | */ 7 | 8 | #ifndef CONNKEYGEN_H_ 9 | #define CONNKEYGEN_H_ 10 | 11 | #include "Keygen.h" 12 | 13 | class ConnKeygen: public Keygen { 14 | public: 15 | ConnKeygen(QString ssid, QString mac); 16 | 17 | private: 18 | QVector & getKeys() ; 19 | }; 20 | 21 | #endif /* CONNKEYGEN_H_ */ 22 | -------------------------------------------------------------------------------- /src/algorithms/DiscusKeygen.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Rui Araújo, Luís Fonseca 3 | * 4 | * This file is part of Router Keygen. 5 | * 6 | * Router Keygen is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Router Keygen is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Router Keygen. If not, see . 18 | */ 19 | #include "DiscusKeygen.h" 20 | 21 | DiscusKeygen::DiscusKeygen(QString ssid, QString mac) : 22 | Keygen(ssid, mac) { 23 | kgname = "Discus"; 24 | } 25 | 26 | QVector & DiscusKeygen::getKeys() { 27 | bool status = false; 28 | unsigned int routerSSIDint = getSsidName().right(6).toInt(&status, 16); 29 | if (!status) 30 | throw ERROR; 31 | QString result; 32 | result.setNum((routerSSIDint - 0xD0EC31) >> 2); 33 | result = "YW0" + result; 34 | results.append(result); 35 | return results; 36 | } 37 | -------------------------------------------------------------------------------- /src/algorithms/DiscusKeygen.h: -------------------------------------------------------------------------------- 1 | #ifndef DISCUSKEYGEN_H 2 | #define DISCUSKEYGEN_H 3 | #include "Keygen.h" 4 | 5 | class DiscusKeygen : public Keygen 6 | { 7 | public: 8 | DiscusKeygen(QString ssid, QString mac); 9 | 10 | private: 11 | QVector & getKeys() ; 12 | }; 13 | 14 | #endif // DISCUSKEYGEN_H 15 | -------------------------------------------------------------------------------- /src/algorithms/DlinkKeygen.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Rui Araújo, Luís Fonseca 3 | * 4 | * This file is part of Router Keygen. 5 | * 6 | * Router Keygen is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Router Keygen is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Router Keygen. If not, see . 18 | */ 19 | #include "DlinkKeygen.h" 20 | 21 | DlinkKeygen::DlinkKeygen(QString ssid, QString mac) : 22 | Keygen(ssid, mac) { 23 | kgname = "Dlink"; 24 | } 25 | 26 | char DlinkKeygen::hash[] = { 'X', 'r', 'q', 'a', 'H', 'N', 'p', 'd', 'S', 'Y', 27 | 'w', '8', '6', '2', '1', '5' }; 28 | 29 | QVector & DlinkKeygen::getKeys() { 30 | QString mac = getMacAddress(); 31 | if ( mac.size() < 12 ) 32 | throw ERROR; 33 | char key[20]; 34 | key[0]=mac.at(11).toLatin1(); 35 | key[1]=mac.at(0).toLatin1(); 36 | 37 | key[2]=mac.at(10).toLatin1(); 38 | key[3]=mac.at(1).toLatin1(); 39 | 40 | key[4]=mac.at(9).toLatin1(); 41 | key[5]=mac.at(2).toLatin1(); 42 | 43 | key[6]=mac.at(8).toLatin1(); 44 | key[7]=mac.at(3).toLatin1(); 45 | 46 | key[8]=mac.at(7).toLatin1(); 47 | key[9]=mac.at(4).toLatin1(); 48 | 49 | key[10]=mac.at(6).toLatin1(); 50 | key[11]=mac.at(5).toLatin1(); 51 | 52 | key[12]=mac.at(1).toLatin1(); 53 | key[13]=mac.at(6).toLatin1(); 54 | 55 | key[14]=mac.at(8).toLatin1(); 56 | key[15]=mac.at(9).toLatin1(); 57 | 58 | key[16]=mac.at(11).toLatin1(); 59 | key[17]=mac.at(2).toLatin1(); 60 | 61 | key[18]=mac.at(4).toLatin1(); 62 | key[19]=mac.at(10).toLatin1(); 63 | char newkey[21]; 64 | char t; 65 | int index = 0; 66 | for (int i=0; i < 20 ; i++) 67 | { 68 | t=key[i]; 69 | if ((t >= '0') && (t <= '9')) 70 | index = t-'0'; 71 | else 72 | { 73 | t= QChar::toUpper((ushort)t); 74 | if ((t >= 'A') && (t <= 'F')) 75 | index = t-'A'+10; 76 | else 77 | { 78 | throw ERROR; 79 | } 80 | } 81 | newkey[i]=hash[index]; 82 | } 83 | newkey[20] = '\0'; 84 | results.append(QString(newkey)); 85 | return results; 86 | } 87 | -------------------------------------------------------------------------------- /src/algorithms/DlinkKeygen.h: -------------------------------------------------------------------------------- 1 | #ifndef DLINKKEYGEN_H 2 | #define DLINKKEYGEN_H 3 | #include "Keygen.h" 4 | 5 | class DlinkKeygen: public Keygen { 6 | public: 7 | DlinkKeygen(QString ssid, QString mac); 8 | private: 9 | QVector & getKeys() ; 10 | static char hash[]; 11 | }; 12 | 13 | #endif // DLINKKEYGEN_H 14 | -------------------------------------------------------------------------------- /src/algorithms/EijsinkKeygen.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Alex Stanev 3 | * 4 | * This file is part of Router Keygen. 5 | * 6 | * Router Keygen is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Router Keygen is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Router Keygen. If not, see . 18 | */ 19 | 20 | #include "EijsinkKeygen.h" 21 | 22 | EijsinkKeygen::EijsinkKeygen(QString ssid, QString mac) : 23 | Keygen(ssid, mac) { 24 | kgname = "Eijsink"; 25 | } 26 | 27 | QVector & EijsinkKeygen::getKeys(){ 28 | QString ssid = getSsidName(); 29 | ssid.replace("k5", ""); 30 | ssid.replace("K5", ""); 31 | 32 | results.append("951" + ssid.right(5)); 33 | 34 | return results; 35 | } 36 | -------------------------------------------------------------------------------- /src/algorithms/EijsinkKeygen.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Alex Stanev 3 | * 4 | * This file is part of Router Keygen. 5 | * 6 | * Router Keygen is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Router Keygen is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Router Keygen. If not, see . 18 | */ 19 | 20 | #ifndef EIJSINKKEYGEN_H 21 | #define EIJSINKKEYGEN_H 22 | #include "Keygen.h" 23 | 24 | class EijsinkKeygen : public Keygen 25 | { 26 | public: 27 | EijsinkKeygen(QString ssid, QString mac); 28 | private: 29 | QVector & getKeys(); 30 | }; 31 | 32 | #endif // EIJSINKKEYGEN_H 33 | -------------------------------------------------------------------------------- /src/algorithms/EircomKeygen.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Rui Araújo, Luís Fonseca 3 | * 4 | * This file is part of Router Keygen. 5 | * 6 | * Router Keygen is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Router Keygen is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Router Keygen. If not, see . 18 | */ 19 | #include "EircomKeygen.h" 20 | #include 21 | #include 22 | EircomKeygen::EircomKeygen(QString ssid, QString mac) : 23 | Keygen(ssid, mac) { 24 | kgname = "Eircom"; 25 | } 26 | 27 | QVector & EircomKeygen::getKeys() { 28 | bool status = false; 29 | QString result = dectoString( 30 | getMacAddress().right(6).toInt(&status, 16) + 0x01000000) 31 | + "Although your world wonders me, "; 32 | if (!status) 33 | throw ERROR; 34 | result = 35 | QString::fromLatin1( 36 | QCryptographicHash::hash(result.toLatin1(), 37 | QCryptographicHash::Sha1).toHex().data()); 38 | result.truncate(26); 39 | results.append(result); 40 | return results; 41 | } 42 | QString EircomKeygen::dectoString(int mac) { 43 | QByteArray ret; 44 | while (mac > 0) { 45 | switch (mac % 10) { 46 | case 0: 47 | ret.prepend("Zero"); 48 | break; 49 | case 1: 50 | ret.prepend("One"); 51 | break; 52 | case 2: 53 | ret.prepend("Two"); 54 | break; 55 | case 3: 56 | ret.prepend("Three"); 57 | break; 58 | case 4: 59 | ret.prepend("Four"); 60 | break; 61 | case 5: 62 | ret.prepend("Five"); 63 | break; 64 | case 6: 65 | ret.prepend("Six"); 66 | break; 67 | case 7: 68 | ret.prepend("Seven"); 69 | break; 70 | case 8: 71 | ret.prepend("Eight"); 72 | break; 73 | case 9: 74 | ret.prepend("Nine"); 75 | break; 76 | } 77 | mac /= 10; 78 | } 79 | return ret; 80 | } 81 | -------------------------------------------------------------------------------- /src/algorithms/EircomKeygen.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Rui Araújo, Luís Fonseca 3 | * 4 | * This file is part of Router Keygen. 5 | * 6 | * Router Keygen is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Router Keygen is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Router Keygen. If not, see . 18 | */ 19 | #ifndef EIRCOMKEYGEN_H 20 | #define EIRCOMKEYGEN_H 21 | #include "Keygen.h" 22 | 23 | class EircomKeygen : public Keygen 24 | { 25 | private: 26 | QString dectoString( int mac ); 27 | QVector & getKeys(); 28 | public: 29 | EircomKeygen(QString ssid, QString mac); 30 | }; 31 | 32 | #endif // EIRCOMKEYGEN_H 33 | -------------------------------------------------------------------------------- /src/algorithms/GontwifiKeygen.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Alex Stanev 3 | * 4 | * This file is part of Router Keygen. 5 | * 6 | * Router Keygen is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Router Keygen is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Router Keygen. If not, see . 18 | */ 19 | 20 | #include "GontwifiKeygen.h" 21 | 22 | GontwifiKeygen::GontwifiKeygen(QString ssid, QString mac) : 23 | Keygen(ssid, mac) { 24 | kgname = "Gontwifi"; 25 | } 26 | 27 | QVector & GontwifiKeygen::getKeys(){ 28 | QString mac = getMacAddress(); 29 | 30 | results.append("000000" + mac[9] + mac[8] + mac[7] + mac[6]); 31 | 32 | return results; 33 | } 34 | -------------------------------------------------------------------------------- /src/algorithms/GontwifiKeygen.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Alex Stanev 3 | * 4 | * This file is part of Router Keygen. 5 | * 6 | * Router Keygen is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Router Keygen is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Router Keygen. If not, see . 18 | */ 19 | 20 | #ifndef GONTWIFIKEYGEN_H 21 | #define GONTWIFIKEYGEN_H 22 | #include "Keygen.h" 23 | 24 | class GontwifiKeygen : public Keygen 25 | { 26 | public: 27 | GontwifiKeygen(QString ssid, QString mac); 28 | private: 29 | QVector & getKeys(); 30 | }; 31 | 32 | #endif // GONTWIFIKEYGEN_H 33 | -------------------------------------------------------------------------------- /src/algorithms/HG824xKeygen.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * HG824xKeygen.cpp 3 | * 4 | * Created on: 5 de Ago de 2012 5 | * Author: ruka 6 | */ 7 | 8 | #include "HG824xKeygen.h" 9 | #include 10 | 11 | HG824xKeygen::HG824xKeygen(QString ssid, QString mac) : 12 | Keygen(ssid, mac) { 13 | kgname = "HG824x"; 14 | } 15 | 16 | 17 | 18 | QVector & HG824xKeygen::getKeys() { 19 | QString mac = getMacAddress(); 20 | if ( mac.size() != 12 ) 21 | throw ERROR; 22 | QString wpaPassword; 23 | wpaPassword.append(mac.mid(6,2)); 24 | int lastPair = mac.mid(10,2).toInt(0, 16); 25 | if ( lastPair <= 8 ) { 26 | int fifthPair = (mac.mid(8, 2).toInt(0, 16) - 1) & 0xFF; 27 | wpaPassword.append(QString::number(fifthPair, 16)); 28 | } else { 29 | wpaPassword.append(mac.mid(8,2)); 30 | } 31 | int lastChar = mac.mid(11).toInt(0, 16); 32 | if ( lastChar <= 8 ) { 33 | int nextPart = (mac.mid(10,1).toInt(0, 16)-1) & 0xF; 34 | wpaPassword.append(QString::number(nextPart, 16)); 35 | } else { 36 | wpaPassword.append(mac.mid(10,1)); 37 | } 38 | switch (lastChar) { 39 | case 8: 40 | wpaPassword.append("F"); 41 | break; 42 | case 9: 43 | wpaPassword.append("0"); 44 | break; 45 | case 0xA: 46 | wpaPassword.append("1"); 47 | break; 48 | case 0xB: 49 | wpaPassword.append("2"); 50 | break; 51 | case 0xC: 52 | wpaPassword.append("3"); 53 | break; 54 | case 0xD: 55 | wpaPassword.append("4"); 56 | break; 57 | case 0xE: 58 | wpaPassword.append("5"); 59 | break; 60 | case 0xF: 61 | wpaPassword.append("6"); 62 | break; 63 | case 0: 64 | wpaPassword.append("7"); 65 | break; 66 | case 1: 67 | wpaPassword.append("8"); 68 | break; 69 | case 2: 70 | wpaPassword.append("9"); 71 | break; 72 | case 3: 73 | wpaPassword.append("A"); 74 | break; 75 | case 4: 76 | wpaPassword.append("B"); 77 | break; 78 | case 5: 79 | wpaPassword.append("C"); 80 | break; 81 | case 6: 82 | wpaPassword.append("D"); 83 | break; 84 | case 7: 85 | wpaPassword.append("E"); 86 | break; 87 | default: 88 | throw ERROR; 89 | } 90 | // TODO: There are more than one values for some of lastPasswordHash 91 | QHash lastPasswordHash; 92 | lastPasswordHash["00"] = "0D"; 93 | lastPasswordHash["08"] = "05"; 94 | lastPasswordHash["10"] = "0E"; 95 | lastPasswordHash["20"] = "1F"; 96 | lastPasswordHash["28"] = "03"; 97 | lastPasswordHash["48"] = "24"; // 57 98 | lastPasswordHash["68"] = "39"; 99 | lastPasswordHash["70"] = "20"; 100 | lastPasswordHash["78"] = "04"; 101 | lastPasswordHash["80"] = "06"; 102 | lastPasswordHash["9C"] = "2A"; 103 | lastPasswordHash["AC"] = "1A"; 104 | lastPasswordHash["CC"] = "12"; 105 | lastPasswordHash["D4"] = "23"; // 35 106 | lastPasswordHash["E0"] = "0C"; // 31 107 | lastPasswordHash["F8"] = "21"; // 4E 108 | if (lastPasswordHash.contains(mac.mid(0,2))) { 109 | results.append(wpaPassword.toUpper() + lastPasswordHash[mac.mid(0,2)].toUpper()); 110 | } else { 111 | /* Bruteforce if not found */ 112 | QString last; 113 | for (int i=0; i <= 255; i++) { 114 | last = QString("%1").arg(i, 2, 16, QLatin1Char('0')); 115 | results.append(wpaPassword.toUpper() + last.toUpper()); 116 | } 117 | } 118 | 119 | return results; 120 | } 121 | 122 | -------------------------------------------------------------------------------- /src/algorithms/HG824xKeygen.h: -------------------------------------------------------------------------------- 1 | /* 2 | * HG824xKeygen.h 3 | * 4 | * Created on: 5 de Ago de 2012 5 | * Author: ruka 6 | */ 7 | 8 | #ifndef HG824xKeygen_H_ 9 | #define HG824xKeygen_H_ 10 | #include "Keygen.h" 11 | class HG824xKeygen : public Keygen{ 12 | public: 13 | HG824xKeygen(QString ssid, QString mac); 14 | 15 | private: 16 | QVector & getKeys() ; 17 | }; 18 | 19 | #endif /* HG824xKeygen_H_ */ 20 | -------------------------------------------------------------------------------- /src/algorithms/HuaweiKeygen.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Rui Araújo, Luís Fonseca 3 | * 4 | * This file is part of Router Keygen. 5 | * 6 | * Router Keygen is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Router Keygen is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Router Keygen. If not, see . 18 | */ 19 | #ifndef HUAWEIKEYGEN_H 20 | #define HUAWEIKEYGEN_H 21 | #include "Keygen.h" 22 | 23 | class HuaweiKeygen : public Keygen 24 | { 25 | public: 26 | HuaweiKeygen(QString ssid, QString mac); 27 | int getSupportState() const; 28 | private: 29 | QVector & getKeys(); 30 | }; 31 | 32 | #endif // HUAWEIKEYGEN_H 33 | -------------------------------------------------------------------------------- /src/algorithms/InfostradaKeygen.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Rui Araújo, Luís Fonseca 3 | * 4 | * This file is part of Router Keygen. 5 | * 6 | * Router Keygen is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Router Keygen is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Router Keygen. If not, see . 18 | */ 19 | #include "InfostradaKeygen.h" 20 | 21 | InfostradaKeygen::InfostradaKeygen(QString ssid, QString mac) : 22 | Keygen(ssid, mac) { 23 | kgname = "Infostrada"; 24 | } 25 | 26 | QVector & InfostradaKeygen::getKeys(){ 27 | QString mac = getMacAddress(); 28 | if ( mac.size() != 12 ) 29 | throw ERROR; 30 | 31 | results.append("2"+mac.toUpper()); 32 | results.append("2"+mac.toLower()); 33 | 34 | return results; 35 | } 36 | -------------------------------------------------------------------------------- /src/algorithms/InfostradaKeygen.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Rui Araújo, Luís Fonseca 3 | * 4 | * This file is part of Router Keygen. 5 | * 6 | * Router Keygen is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Router Keygen is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Router Keygen. If not, see . 18 | */ 19 | #ifndef INFOSTRADAKEYGEN_H 20 | #define INFOSTRADAKEYGEN_H 21 | #include "Keygen.h" 22 | 23 | class InfostradaKeygen : public Keygen 24 | { 25 | public: 26 | InfostradaKeygen(QString ssid, QString mac); 27 | private: 28 | QVector & getKeys(); 29 | }; 30 | 31 | #endif // INFOSTRADAKEYGEN_H 32 | -------------------------------------------------------------------------------- /src/algorithms/InterCableKeygen.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * InterCableKeygen.cpp 3 | * 4 | * Created on: 5 de Ago de 2012 5 | * Author: ruka 6 | */ 7 | 8 | #include "InterCableKeygen.h" 9 | 10 | InterCableKeygen::InterCableKeygen(QString ssid, QString mac) : 11 | Keygen(ssid, mac) { 12 | kgname = "InterCable"; 13 | } 14 | 15 | QVector & InterCableKeygen::getKeys() { 16 | QString mac = getMacAddress(); 17 | if ( mac.length() != 12 ) 18 | throw ERROR; 19 | 20 | QString shortMac = mac.left(10); 21 | int last = mac.right(2).toInt(0, 16); 22 | mac = shortMac + QString("%1").arg(last + 1, 2, 16, QLatin1Char('0')).right(2); 23 | results.append("m" + mac.toLower()); 24 | mac = shortMac + QString("%1").arg(last + 2, 2, 16, QLatin1Char('0')).right(2); 25 | results.append("m" + mac.toLower()); 26 | 27 | return results; 28 | } 29 | -------------------------------------------------------------------------------- /src/algorithms/InterCableKeygen.h: -------------------------------------------------------------------------------- 1 | /* 2 | * InterCableKeygen.h 3 | * 4 | * Created on: 5 de Ago de 2012 5 | * Author: ruka 6 | */ 7 | 8 | #ifndef INTERCABLEKEYGEN_H_ 9 | #define INTERCABLEKEYGEN_H_ 10 | 11 | #include "Keygen.h" 12 | 13 | class InterCableKeygen: public Keygen { 14 | public: 15 | InterCableKeygen(QString ssid, QString mac); 16 | 17 | private: 18 | QVector & getKeys() ; 19 | }; 20 | 21 | #endif /* INTERCABLEKEYGEN_H_ */ 22 | -------------------------------------------------------------------------------- /src/algorithms/Keygen.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Rui Araújo, Luís Fonseca 3 | * 4 | * This file is part of Router Keygen. 5 | * 6 | * Router Keygen is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Router Keygen is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Router Keygen. If not, see . 18 | */ 19 | #include "Keygen.h" 20 | 21 | Keygen::Keygen(QString & ssid, QString & mac) : 22 | stopRequested(false), ssidName(ssid) { 23 | macAddress = mac.replace(":", "").replace("-", "").toUpper(); 24 | } 25 | 26 | QVector & Keygen::getResults() { 27 | results.clear(); 28 | return getKeys(); 29 | } 30 | 31 | void Keygen::stop() { 32 | this->stopRequested = true; 33 | } 34 | 35 | bool Keygen::isStopped() const { 36 | return this->stopRequested; 37 | } 38 | 39 | QString Keygen::getError() const { 40 | return error; 41 | } 42 | 43 | 44 | QString Keygen::getMacAddress() const { 45 | return macAddress; 46 | } 47 | 48 | QString Keygen::getSsidName() const { 49 | return ssidName; 50 | } 51 | 52 | bool Keygen::isStopRequested() const { 53 | return stopRequested; 54 | } 55 | 56 | void Keygen::setError(const QString & error) { 57 | this->error = error; 58 | } 59 | 60 | int Keygen::getSupportState() const{ 61 | return SUPPORTED; 62 | } 63 | -------------------------------------------------------------------------------- /src/algorithms/Keygen.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Rui Araújo, Luís Fonseca 3 | * 4 | * This file is part of Router Keygen. 5 | * 6 | * Router Keygen is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Router Keygen is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Router Keygen. If not, see . 18 | */ 19 | #ifndef Keygen_H 20 | #define Keygen_H 21 | #include 22 | #include 23 | 24 | class Keygen { 25 | public: 26 | const static int ERROR = 0; 27 | const static int SUPPORTED = 0; 28 | const static int UNLIKELY = 1; 29 | const static int UNSUPPORTED = 2; 30 | QString kgname; 31 | Keygen(QString & ssid, QString & mac); 32 | QVector & getResults(); 33 | void stop(); 34 | bool isStopped() const; 35 | QString getError() const; 36 | QString getMacAddress() const; 37 | QString getSsidName() const; 38 | bool isStopRequested() const; 39 | virtual ~Keygen() { 40 | } 41 | 42 | virtual int getSupportState() const; 43 | 44 | protected: 45 | QVector results; 46 | bool stopRequested; 47 | void setError(const QString & error); 48 | private: 49 | virtual QVector & getKeys() = 0; 50 | 51 | QString ssidName; 52 | QString macAddress; 53 | QString error; 54 | 55 | }; 56 | 57 | #endif // Keygen_H 58 | -------------------------------------------------------------------------------- /src/algorithms/OnoKeygen.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Rui Araújo, Luís Fonseca 3 | * 4 | * This file is part of Router Keygen. 5 | * 6 | * Router Keygen is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Router Keygen is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Router Keygen. If not, see . 18 | */ 19 | #include "OnoKeygen.h" 20 | #include 21 | 22 | OnoKeygen::OnoKeygen(QString ssid, QString mac) : 23 | Keygen(ssid, mac) { 24 | kgname = "Ono"; 25 | } 26 | 27 | QVector & OnoKeygen::getKeys() { 28 | QString ssid = getSsidName(); 29 | if (ssid.size() != 13) 30 | throw ERROR; 31 | QString val = ""; 32 | val.setNum(ssid.at(12).digitValue() + 1, 10); 33 | if (val.size() < 2) 34 | val = ssid.left(11) + "0" + val; 35 | else 36 | val = ssid.left(11) + val; 37 | int pseed[4]; 38 | pseed[0] = 0; 39 | pseed[1] = 0; 40 | pseed[2] = 0; 41 | pseed[3] = 0; 42 | int randNumber = 0; 43 | for (int i = 0; i < val.length(); i++) { 44 | pseed[i % 4] ^= (int) val.at(i).toLatin1(); 45 | } 46 | randNumber = pseed[0] | (pseed[1] << 8) | (pseed[2] << 16) 47 | | (pseed[3] << 24); 48 | short tmp = 0; 49 | QString key = "", aux = ""; 50 | 51 | for (int j = 0; j < 5; j++) { 52 | randNumber = (randNumber * 0x343fd + 0x269ec3) & 0xffffffff; 53 | tmp = (short) ((randNumber >> 16) & 0xff); 54 | aux.setNum(tmp, 16); 55 | key += aux.toUpper(); 56 | } 57 | results.append(key); 58 | key = QString::fromLatin1( 59 | QCryptographicHash::hash(padto64(val).toLatin1(), 60 | QCryptographicHash::Md5).toHex().data()); 61 | key.truncate(26); 62 | results.append(key.toUpper()); 63 | return results; 64 | } 65 | 66 | QString OnoKeygen::padto64(QString val) { 67 | if (val == "") 68 | return ""; 69 | QString ret = ""; 70 | for (int i = 0; i < (1 + (64 / (val.length()))); ++i) 71 | ret += val; 72 | return ret.left(64); 73 | } 74 | -------------------------------------------------------------------------------- /src/algorithms/OnoKeygen.h: -------------------------------------------------------------------------------- 1 | #ifndef ONOKEYGEN_H 2 | #define ONOKEYGEN_H 3 | #include "Keygen.h" 4 | 5 | class OnoKeygen : public Keygen 6 | { 7 | public: 8 | OnoKeygen(QString ssid, QString mac); 9 | private: 10 | QVector & getKeys(); 11 | QString padto64( QString val ); 12 | }; 13 | 14 | #endif // ONOKEYGEN_H 15 | -------------------------------------------------------------------------------- /src/algorithms/OteBAUDKeygen.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Rui Araújo, Luís Fonseca 3 | * 4 | * This file is part of Router Keygen. 5 | * 6 | * Router Keygen is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Router Keygen is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Router Keygen. If not, see . 18 | */ 19 | #include "OteBAUDKeygen.h" 20 | 21 | OteBAUDKeygen::OteBAUDKeygen(QString ssid, QString mac) : 22 | Keygen(ssid, mac) { 23 | kgname = "OteBAUD"; 24 | } 25 | 26 | 27 | QVector & OteBAUDKeygen::getKeys() { 28 | if (getMacAddress().length() != 12) { 29 | throw ERROR; 30 | } 31 | results.append("0"+getMacAddress().toLower()); 32 | return results; 33 | } 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /src/algorithms/OteBAUDKeygen.h: -------------------------------------------------------------------------------- 1 | /* 2 | * OteBAUDKeygen.h 3 | * 4 | * Created on: 5 de Ago de 2012 5 | * Author: ruka 6 | */ 7 | 8 | #ifndef OTEBAUDKEYGEN_H_ 9 | #define OTEBAUDKEYGEN_H_ 10 | 11 | #include "Keygen.h" 12 | 13 | class OteBAUDKeygen: public Keygen { 14 | public: 15 | OteBAUDKeygen(QString ssid, QString mac); 16 | 17 | private: 18 | QVector & getKeys() ; 19 | }; 20 | 21 | #endif /* OteBAUDKeygen_H_ */ 22 | -------------------------------------------------------------------------------- /src/algorithms/OteHuaweiKeygen.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Rui Araújo, Luís Fonseca 3 | * 4 | * This file is part of Router Keygen. 5 | * 6 | * Router Keygen is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Router Keygen is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Router Keygen. If not, see . 18 | */ 19 | #include "OteHuaweiKeygen.h" 20 | #include 21 | 22 | OteHuaweiKeygen::OteHuaweiKeygen(QString ssid, QString mac, 23 | QString supported) : 24 | Keygen(ssid, mac), magicValues(supported) { 25 | kgname = "OteHuawei"; 26 | } 27 | 28 | const int OteHuaweiKeygen::MAGIC_NUMBER = 65535; 29 | 30 | QVector & OteHuaweiKeygen::getKeys() { 31 | QString mac = getMacAddress(); 32 | if (mac.length() != 12) { 33 | throw ERROR; 34 | } 35 | QStringList magic = magicValues.split(" "); 36 | QString series = mac.left(2) + mac.mid(6, 2); 37 | int point; 38 | if (series == "E8FD" ) 39 | point = 0; 40 | else if (series == "E8F5") 41 | point = 1; 42 | else if (series == "E8F6") 43 | point = 2; 44 | else 45 | return results; 46 | if (point >= magic.length()) 47 | return results; 48 | QString pass = "000000" + magic.at(point); 49 | results.append(pass.mid(pass.length() - 8)); 50 | return results; 51 | } 52 | -------------------------------------------------------------------------------- /src/algorithms/OteHuaweiKeygen.h: -------------------------------------------------------------------------------- 1 | #ifndef OTEHUAWEIKEYGEN_H 2 | #define OTEHUAWEIKEYGEN_H 3 | #include "Keygen.h" 4 | 5 | class OteHuaweiKeygen : public Keygen 6 | { 7 | public: 8 | OteHuaweiKeygen(QString ssid, QString mac, QString magicValues); 9 | const static int MAGIC_NUMBER; 10 | private: 11 | QVector & getKeys(); 12 | QString magicValues; 13 | 14 | }; 15 | 16 | #endif // OTEHUAWEIKEYGEN_H 17 | -------------------------------------------------------------------------------- /src/algorithms/PBSKeygen.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * PBSKeygen.cpp 3 | * 4 | * Created on: 5 de Ago de 2012 5 | * Author: ruka 6 | */ 7 | 8 | #include "PBSKeygen.h" 9 | #include 10 | 11 | PBSKeygen::PBSKeygen(QString ssid, QString mac) : 12 | Keygen(ssid, mac) { 13 | kgname = "PBS"; 14 | } 15 | 16 | const QString PBSKeygen::lookup = 17 | "0123456789ABCDEFGHIKJLMNOPQRSTUVWXYZabcdefghikjlmnopqrstuvwxyz"; 18 | const unsigned char PBSKeygen::saltSHA256[/*32*/] = { 0x54, 0x45, 0x4F, 0x74, 0x65, 0x6C, 19 | 0xB6, 0xD9, 0x86, 0x96, 0x8D, 0x34, 0x45, 0xD2, 0x3B, 0x15, 0xCA, 0xAF, 20 | 0x12, 0x84, 0x02, 0xAC, 0x56, 0x00, 0x05, 0xCE, 0x20, 0x75, 0x94, 0x3F, 21 | 0xDC, 0xE8 }; 22 | 23 | QVector & PBSKeygen::getKeys() { 24 | SHA256_CTX sha; 25 | 26 | QString macS = getMacAddress(); 27 | if (macS.length() != 12) { 28 | throw ERROR; 29 | } 30 | 31 | char mac[6]; 32 | bool status; 33 | for (int i = 0; i < 12; i += 2) 34 | mac[i / 2] = (macS.mid(i, 1).toInt(&status, 16) << 4) 35 | + macS.mid(i + 1, 1).toInt(&status, 16); 36 | if (!status) 37 | throw ERROR; 38 | mac[5] -= 5; 39 | 40 | unsigned char hash[32]; 41 | SHA256_Init(&sha); 42 | SHA256_Update(&sha, (const void *) saltSHA256, sizeof(saltSHA256)); 43 | SHA256_Update(&sha, (const void *) mac, sizeof(mac)); 44 | SHA256_Final(hash, &sha); 45 | QString key = ""; 46 | for (int i = 0; i < 13; ++i) { 47 | key.append(lookup.at(hash[i] % lookup.length())); 48 | } 49 | results.append(key); 50 | return results; 51 | } 52 | 53 | -------------------------------------------------------------------------------- /src/algorithms/PBSKeygen.h: -------------------------------------------------------------------------------- 1 | /* 2 | * PBSKeygen.h 3 | * 4 | * Created on: 5 de Ago de 2012 5 | * Author: ruka 6 | */ 7 | 8 | #ifndef PBSKEYGEN_H_ 9 | #define PBSKEYGEN_H_ 10 | 11 | #include "Keygen.h" 12 | 13 | class PBSKeygen: public Keygen { 14 | public: 15 | PBSKeygen(QString ssid, QString mac); 16 | 17 | private: 18 | QVector & getKeys() ; 19 | const static QString lookup; 20 | const static unsigned char saltSHA256[/*32*/]; 21 | }; 22 | 23 | #endif /* PBSKEYGEN_H_ */ 24 | -------------------------------------------------------------------------------- /src/algorithms/PirelliKeygen.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Rui Araújo, Luís Fonseca 3 | * 4 | * This file is part of Router Keygen. 5 | * 6 | * Router Keygen is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Router Keygen is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Router Keygen. If not, see . 18 | */ 19 | #include "PirelliKeygen.h" 20 | 21 | PirelliKeygen::PirelliKeygen(QString ssid, QString mac) : 22 | Keygen(ssid, mac) { 23 | kgname = "Pirelli"; 24 | this->hash = new QCryptographicHash(QCryptographicHash::Md5); 25 | ssidIdentifier = ssid.right(12); 26 | } 27 | 28 | PirelliKeygen::~PirelliKeygen() { 29 | delete hash; 30 | } 31 | const unsigned char PirelliKeygen::saltMD5[] = { 0x22, 0x33, 0x11, 0x34, 0x02, 0x81, 32 | 0xFA, 0x22, 0x11, 0x41, 0x68, 0x11, 0x12, 0x01, 0x05, 0x22, 0x71, 0x42, 33 | 0x10, 0x66 }; 34 | 35 | QVector & PirelliKeygen::getKeys() { 36 | bool status = false; 37 | char macBytes[6]; 38 | for (int i = 0; i < 12; i += 2) 39 | macBytes[i / 2] = (ssidIdentifier.mid(i, 1).toInt(&status, 16) << 4) 40 | + ssidIdentifier.mid(i + 1, 1).toInt(&status, 16); 41 | if (!status) 42 | throw ERROR; 43 | hash->reset(); 44 | hash->addData(macBytes, 6); 45 | hash->addData((const char *)saltMD5, 20); 46 | QByteArray resultHash = hash->result(); 47 | char key[5]; 48 | /*Grouping in five groups fo five bits*/ 49 | key[0] = (resultHash.at(0) & 0xF8) >> 3; 50 | key[1] = ((resultHash.at(0) & 0x07) << 2) 51 | | ((resultHash.at(1) & 0xC0) >> 6); 52 | key[2] = (resultHash.at(1) & 0x3E) >> 1; 53 | key[3] = ((resultHash.at(1) & 0x01) << 4) 54 | | ((resultHash.at(2) & 0xF0) >> 4); 55 | key[4] = ((resultHash.at(2) & 0x0F) << 1) 56 | | ((resultHash.at(3) & 0x80) >> 7); 57 | for (int i = 0; i < 5; ++i) 58 | if (key[i] >= 0x0A) 59 | key[i] += 0x57; 60 | results.append(QString::fromLatin1(QByteArray(key, 5).toHex().data())); 61 | return results; 62 | } 63 | -------------------------------------------------------------------------------- /src/algorithms/PirelliKeygen.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Rui Araújo, Luís Fonseca 3 | * 4 | * This file is part of Router Keygen. 5 | * 6 | * Router Keygen is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Router Keygen is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Router Keygen. If not, see . 18 | */ 19 | #ifndef PIRELLIKEYGEN_H 20 | #define PIRELLIKEYGEN_H 21 | #include "Keygen.h" 22 | #include 23 | 24 | class PirelliKeygen: public Keygen { 25 | public: 26 | PirelliKeygen(QString ssid, QString mac); 27 | ~PirelliKeygen(); 28 | private: 29 | QVector & getKeys(); 30 | const static unsigned char saltMD5[]; 31 | QCryptographicHash * hash; 32 | QString ssidIdentifier; 33 | }; 34 | 35 | #endif // PIRELLIKEYGEN_H 36 | -------------------------------------------------------------------------------- /src/algorithms/PldtKeygen.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Alex Stanev 3 | * 4 | * This file is part of Router Keygen. 5 | * 6 | * Router Keygen is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Router Keygen is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Router Keygen. If not, see . 18 | */ 19 | 20 | #include "PldtKeygen.h" 21 | 22 | PldtKeygen::PldtKeygen(QString ssid, QString mac, unsigned short int var): 23 | Keygen(ssid, mac) { 24 | kgname = "Pldt"; 25 | this->var = var; 26 | } 27 | 28 | QVector & PldtKeygen::getKeys() { 29 | QString mac = getMacAddress(); 30 | if ( mac.length() != 12 ) 31 | throw ERROR; 32 | 33 | switch (var) { 34 | case 0: { 35 | results.append("PLDTWIFI" + mac.right(5).toUpper()); 36 | break; 37 | } 38 | case 1: { 39 | unsigned long int last = mac.right(6).toInt(0, 16) ^ 0xffffff; 40 | results.append("wlan" + QString("%1").arg(last, 6, 16, QLatin1Char('0')).right(6).toLower()); 41 | break; 42 | } 43 | default: 44 | throw ERROR; 45 | } 46 | 47 | return results; 48 | } 49 | -------------------------------------------------------------------------------- /src/algorithms/PldtKeygen.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Alex Stanev 3 | * 4 | * This file is part of Router Keygen. 5 | * 6 | * Router Keygen is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Router Keygen is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Router Keygen. If not, see . 18 | */ 19 | 20 | #ifndef PLDTKEYGEN_H_ 21 | #define PLDTKEYGEN_H_ 22 | 23 | #include "Keygen.h" 24 | 25 | class PldtKeygen: public Keygen { 26 | public: 27 | PldtKeygen(QString ssid, QString mac, unsigned short int var); 28 | 29 | private: 30 | QVector & getKeys(); 31 | unsigned short int var; 32 | }; 33 | 34 | #endif /* PLDTKEYGEN_H_ */ 35 | -------------------------------------------------------------------------------- /src/algorithms/SitecomKeygen.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Rui Araújo, Luís Fonseca 3 | * 4 | * This file is part of Router Keygen. 5 | * 6 | * Router Keygen is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Router Keygen is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Router Keygen. If not, see . 18 | */ 19 | #include "SitecomKeygen.h" 20 | #include 21 | #include 22 | 23 | SitecomKeygen::SitecomKeygen(QString ssid, QString mac) : 24 | Keygen(ssid, mac) { 25 | kgname = "Sitecom"; 26 | } 27 | 28 | const QString SitecomKeygen::CHARSET = "123456789abcdefghjkmnpqrstuvwxyzABCDEFGHJKMNPQRSTUVWXYZ"; 29 | 30 | void SitecomKeygen::generateKey(QString mac) { 31 | QString key = ""; 32 | int numericMac = mac.mid(6).split(QRegExp("[A-Fa-f]")).at(0).toInt(); 33 | key += CHARSET.at(((numericMac + mac.at(11).unicode() + mac.at(5).unicode()) * (mac 34 | .at(9).unicode() + mac.at(3).unicode() + mac.at(11).unicode())) % CHARSET.length()); 35 | key += CHARSET.at(((numericMac + mac.at(11).unicode() + mac.at(6).unicode()) * (mac 36 | .at(8).unicode() + mac.at(10).unicode() + mac.at(11).unicode())) % CHARSET.length()); 37 | key += CHARSET.at(((numericMac + mac.at(3).unicode() + mac.at(5).unicode()) * (mac 38 | .at(7).unicode() + mac.at(9).unicode() + mac.at(11).unicode())) % CHARSET.length()); 39 | key += CHARSET.at(((numericMac + mac.at(7).unicode() + mac.at(6).unicode()) * (mac 40 | .at(5).unicode() + mac.at(4).unicode() + mac.at(11).unicode()) % CHARSET.length())); 41 | key += CHARSET.at(((numericMac + mac.at(7).unicode() + mac.at(6).unicode()) * (mac 42 | .at(8).unicode() + mac.at(9).unicode() + mac.at(11).unicode())) % CHARSET.length()); 43 | key += CHARSET.at(((numericMac + mac.at(11).unicode() + mac.at(5).unicode()) * (mac 44 | .at(3).unicode() + mac.at(4).unicode() + mac.at(11).unicode())) % CHARSET.length()); 45 | key += CHARSET.at(((numericMac + mac.at(11).unicode() + mac.at(4).unicode()) * (mac 46 | .at(6).unicode() + mac.at(8).unicode() + mac.at(11).unicode())) % CHARSET.length()); 47 | key += CHARSET.at(((numericMac + mac.at(10).unicode() + mac 48 | .at(11).unicode()) * (mac.at(7).unicode() + mac.at(8).unicode() + mac.at(11).unicode())) % CHARSET.length()); 49 | results.append(key); 50 | 51 | } 52 | 53 | QVector & SitecomKeygen::getKeys() { 54 | QString mac = getMacAddress(); 55 | if ( mac.length() < 12 ) { 56 | throw ERROR; 57 | } 58 | generateKey(mac.toLower()); 59 | generateKey(mac.toUpper()); 60 | QString shortMac = mac.left(11); 61 | int lastChar = mac.right(1).toInt(0, 16); 62 | lastChar = (lastChar + 1) % 0x10; 63 | generateKey(shortMac + QString::number(lastChar, 16).toUpper()); 64 | lastChar = (lastChar + 1) % 0x10; 65 | generateKey(shortMac + QString::number(lastChar, 16).toUpper()); 66 | return results; 67 | 68 | } 69 | -------------------------------------------------------------------------------- /src/algorithms/SitecomKeygen.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Rui Araújo, Luís Fonseca 3 | * 4 | * This file is part of Router Keygen. 5 | * 6 | * Router Keygen is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Router Keygen is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Router Keygen. If not, see . 18 | */ 19 | #ifndef SITECOMKEYGEN_H 20 | #define SITECOMKEYGEN_H 21 | #include "Keygen.h" 22 | 23 | class SitecomKeygen : public Keygen 24 | { 25 | public: 26 | SitecomKeygen(QString ssid, QString mac); 27 | private: 28 | QVector & getKeys(); 29 | void generateKey(QString mac); 30 | const static QString CHARSET; 31 | }; 32 | 33 | #endif // SITECOMKEYGEN_H 34 | -------------------------------------------------------------------------------- /src/algorithms/SitecomWLR2100Keygen.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Alex Stanev 3 | * 4 | * This file is part of Router Keygen. 5 | * 6 | * Router Keygen is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Router Keygen is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Router Keygen. If not, see . 18 | */ 19 | #include "SitecomWLR2100Keygen.h" 20 | #include 21 | #include 22 | 23 | SitecomWLR2100Keygen::SitecomWLR2100Keygen(QString ssid, QString mac) : 24 | Keygen(ssid, mac) { 25 | kgname = "SitecomWLR2100"; 26 | } 27 | 28 | const QString SitecomWLR2100Keygen::ALPHABET = "ABCDEFGHJKLMNPQRSTUVWXYZ"; 29 | 30 | QVector & SitecomWLR2100Keygen::getKeys() { 31 | QString mac = getMacAddress().toLower(); 32 | 33 | if (mac.size() != 12) 34 | throw ERROR; 35 | 36 | QByteArray hash = QCryptographicHash::hash(mac.toLatin1(), 37 | QCryptographicHash::Md5); 38 | 39 | QDataStream halfmd5(hash.right(8)); 40 | quint64 md5int; 41 | halfmd5 >> md5int; 42 | 43 | QString key = ""; 44 | for (int i = 1; i <= 12; i += 1) { 45 | key += ALPHABET.at(md5int%24); 46 | md5int /= 24; 47 | } 48 | this->results.append(key); 49 | return results; 50 | } 51 | -------------------------------------------------------------------------------- /src/algorithms/SitecomWLR2100Keygen.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Alex Stanev 3 | * 4 | * This file is part of Router Keygen. 5 | * 6 | * Router Keygen is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Router Keygen is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Router Keygen. If not, see . 18 | */ 19 | #ifndef SITECOMWLR2100KEYGEN_H 20 | #define SITECOMWLR2100KEYGEN_H 21 | #include "Keygen.h" 22 | 23 | class SitecomWLR2100Keygen : public Keygen 24 | { 25 | public: 26 | SitecomWLR2100Keygen(QString ssid, QString mac); 27 | private: 28 | QVector & getKeys(); 29 | const static QString ALPHABET; 30 | }; 31 | 32 | #endif // SITECOMWLR2100KEYGEN_H 33 | -------------------------------------------------------------------------------- /src/algorithms/SitecomWLR400xKeygen.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Rui Araújo, Luís Fonseca 3 | * 4 | * This file is part of Router Keygen. 5 | * 6 | * Router Keygen is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Router Keygen is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Router Keygen. If not, see . 18 | */ 19 | #include "SitecomWLR400xKeygen.h" 20 | 21 | SitecomWLR400xKeygen::SitecomWLR400xKeygen(QString ssid, QString mac) : 22 | Keygen(ssid, mac) { 23 | kgname = "SitecomWLR400x"; 24 | } 25 | 26 | const QString SitecomWLR400xKeygen::CHARSETS_341[] = {"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ", "W0X1CDYNJU8VOZA0BKL46PQ7RS9T2E5HI3MFG"}; 27 | const QString SitecomWLR400xKeygen::CHARSETS_4000[] = {"23456789ABCDEFGHJKLMNPQRSTUVWXYZ38BZ", "WXCDYNJU8VZABKL46PQ7RS9T2E5H3MFGPWR2"}; 28 | const QString SitecomWLR400xKeygen::CHARSETS_4004[] = {"JKLMNPQRST23456789ABCDEFGHUVWXYZ38BK", "E5MFJUWXCDKL46PQHAB3YNJ8VZ7RS9TR2GPW"}; 29 | const long SitecomWLR400xKeygen::MAGIC1 = 0x98124557; 30 | const long SitecomWLR400xKeygen::MAGIC2 = 0x0004321a; 31 | const long SitecomWLR400xKeygen::MAGIC3 = 0x80000000; 32 | 33 | void SitecomWLR400xKeygen::generateKey(QString mac, const QString charsets[]) { 34 | 35 | long val = mac.mid(4).toLong(0, 16); 36 | int offsets[12]; 37 | 38 | for (int i = 0; i < 12; ++i) { 39 | if ((val & 0x1) == 0) { 40 | val = val ^ MAGIC2; 41 | val = val >> 1; 42 | } 43 | else{ 44 | val = val ^ MAGIC1; 45 | val = val >> 1; 46 | val = val | MAGIC3; 47 | } 48 | int offset = val % charsets[0].size(); 49 | offsets[i] = offset; 50 | } 51 | QString wpakey; 52 | wpakey.append(charsets[0].at(offsets[0])); 53 | for (int i = 0; i < 11; ++i) { 54 | if (offsets[i] != offsets[i+1]) { 55 | wpakey.append(charsets[0].at(offsets[i+1])); 56 | } 57 | else { 58 | int newOffset = (offsets[i] + i) % charsets[0].size(); 59 | wpakey.append(charsets[1].at(newOffset)); 60 | } 61 | } 62 | results.append(wpakey); 63 | } 64 | 65 | QVector & SitecomWLR400xKeygen::getKeys() { 66 | QString mac = getMacAddress(); 67 | if ( mac.length() < 12 ) { 68 | throw ERROR; 69 | } 70 | generateKey(mac, CHARSETS_341); 71 | generateKey(mac, CHARSETS_4000); 72 | generateKey(mac, CHARSETS_4004); 73 | 74 | QString shortMac = mac.left(11); 75 | int lastChar = mac.right(1).toInt(0, 16); 76 | lastChar = (lastChar + 1) % 0x10; 77 | generateKey(shortMac + QString::number(lastChar, 16), CHARSETS_341); 78 | generateKey(shortMac + QString::number(lastChar, 16), CHARSETS_4000); 79 | generateKey(shortMac + QString::number(lastChar, 16), CHARSETS_4004); 80 | lastChar = (lastChar + 3) % 0x10; 81 | generateKey(shortMac + QString::number(lastChar, 16), CHARSETS_341); 82 | generateKey(shortMac + QString::number(lastChar, 16), CHARSETS_4000); 83 | generateKey(shortMac + QString::number(lastChar, 16), CHARSETS_4004); 84 | 85 | return results; 86 | 87 | } 88 | -------------------------------------------------------------------------------- /src/algorithms/SitecomWLR400xKeygen.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Rui Araújo, Luís Fonseca 3 | * 4 | * This file is part of Router Keygen. 5 | * 6 | * Router Keygen is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Router Keygen is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Router Keygen. If not, see . 18 | */ 19 | #ifndef SITECOMWLR400xKEYGEN_H 20 | #define SITECOMWLR400xKEYGEN_H 21 | #include "Keygen.h" 22 | 23 | //http://blog.emaze.net/2014/04/sitecom-firmware-and-wifi.html 24 | class SitecomWLR400xKeygen : public Keygen 25 | { 26 | public: 27 | SitecomWLR400xKeygen(QString ssid, QString mac); 28 | private: 29 | QVector & getKeys(); 30 | void generateKey(QString mac, const QString charsets[]); 31 | const static QString CHARSETS_341[]; 32 | const static QString CHARSETS_4000[]; 33 | const static QString CHARSETS_4004[]; 34 | const static long MAGIC1; 35 | const static long MAGIC2; 36 | const static long MAGIC3; 37 | }; 38 | 39 | #endif // SITECOMWLR400xKEYGEN_H 40 | -------------------------------------------------------------------------------- /src/algorithms/SkyV1Keygen.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Rui Araújo, Luís Fonseca 3 | * 4 | * This file is part of Router Keygen. 5 | * 6 | * Router Keygen is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Router Keygen is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Router Keygen. If not, see . 18 | */ 19 | #include "SkyV1Keygen.h" 20 | #include 21 | 22 | SkyV1Keygen::SkyV1Keygen(QString ssid, QString mac) : 23 | Keygen(ssid, mac) { 24 | kgname = "SkyV1"; 25 | } 26 | 27 | const QString SkyV1Keygen::ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; 28 | 29 | QVector & SkyV1Keygen::getKeys() { 30 | QString mac = getMacAddress(); 31 | if (mac.size() != 12) 32 | throw ERROR; 33 | QByteArray hash = QCryptographicHash::hash(mac.toLatin1(), 34 | QCryptographicHash::Md5); 35 | 36 | QString key = ""; 37 | for (int i = 1; i <= 15; i += 2) { 38 | unsigned char index = hash[i]; 39 | index %= 26; 40 | key += ALPHABET.at(index); 41 | } 42 | this->results.append(key); 43 | return results; 44 | } 45 | -------------------------------------------------------------------------------- /src/algorithms/SkyV1Keygen.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Rui Araújo, Luís Fonseca 3 | * 4 | * This file is part of Router Keygen. 5 | * 6 | * Router Keygen is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Router Keygen is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Router Keygen. If not, see . 18 | */ 19 | #ifndef SKYV1KEYGEN_H 20 | #define SKYV1KEYGEN_H 21 | #include "Keygen.h" 22 | 23 | class SkyV1Keygen : public Keygen 24 | { 25 | public: 26 | SkyV1Keygen(QString ssid, QString mac); 27 | private: 28 | QVector & getKeys(); 29 | const static QString ALPHABET; 30 | 31 | }; 32 | 33 | #endif // SKYV1KEYGEN_H 34 | -------------------------------------------------------------------------------- /src/algorithms/Speedport500Keygen.cpp: -------------------------------------------------------------------------------- 1 | #include "Speedport500Keygen.h" 2 | 3 | Speedport500Keygen::Speedport500Keygen(QString ssid, QString mac, QString minus) : 4 | Keygen(ssid, mac) { 5 | kgname = "Speedport500"; 6 | this->minus = minus; 7 | } 8 | 9 | QVector & Speedport500Keygen::getKeys() { 10 | QString mac = getMacAddress(); 11 | if (mac.size() != 12) 12 | throw ERROR; 13 | 14 | QString ssid = getSsidName(); 15 | QString first = ssid.at(9); 16 | QString block = ssid.at(10) + mac.right(3); 17 | 18 | for (char x = '0'; x <= '9'; ++x) 19 | for (char y = '0'; y <= '9'; ++y) 20 | for (char z = '0'; z <= '9'; ++z) { 21 | this->results.append("SP" + minus + first + z + block + x + y + z ); 22 | } 23 | return results; 24 | } 25 | -------------------------------------------------------------------------------- /src/algorithms/Speedport500Keygen.h: -------------------------------------------------------------------------------- 1 | #ifndef SPEEDPORT500KEYGEN_H 2 | #define SPEEDPORT500KEYGEN_H 3 | #include "Keygen.h" 4 | 5 | class Speedport500Keygen :public Keygen 6 | 7 | { 8 | public: 9 | Speedport500Keygen(QString ssid, QString mac, QString minus); 10 | private: 11 | QVector & getKeys(); 12 | QString minus; 13 | }; 14 | 15 | #endif // SPEEDPORT500KEYGEN_H 16 | -------------------------------------------------------------------------------- /src/algorithms/TecomKeygen.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Rui Araújo, Luís Fonseca 3 | * 4 | * This file is part of Router Keygen. 5 | * 6 | * Router Keygen is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Router Keygen is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Router Keygen. If not, see . 18 | */ 19 | #include "TecomKeygen.h" 20 | #include 21 | 22 | TecomKeygen::TecomKeygen(QString ssid, QString mac) : 23 | Keygen(ssid, mac) { 24 | kgname = "Tecom"; 25 | } 26 | 27 | QVector & TecomKeygen::getKeys() { 28 | QString result; 29 | result = QString::fromLatin1(QCryptographicHash::hash( 30 | getSsidName().toUpper().toLatin1() , 31 | QCryptographicHash::Sha1 ) 32 | .toHex().data()); 33 | result.truncate(26); 34 | this->results.append(result); 35 | return results; 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/algorithms/TecomKeygen.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Rui Araújo, Luís Fonseca 3 | * 4 | * This file is part of Router Keygen. 5 | * 6 | * Router Keygen is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Router Keygen is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Router Keygen. If not, see . 18 | */ 19 | #ifndef TECOMKEYGEN_H 20 | #define TECOMKEYGEN_H 21 | #include "Keygen.h" 22 | 23 | class TecomKeygen: public Keygen { 24 | public: 25 | TecomKeygen(QString ssid, QString mac); 26 | private: 27 | QVector & getKeys(); 28 | }; 29 | 30 | #endif // TECOMKEYGEN_H 31 | -------------------------------------------------------------------------------- /src/algorithms/TeleTuKeygen.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Rui Araújo, Luís Fonseca 3 | * 4 | * This file is part of Router Keygen. 5 | * 6 | * Router Keygen is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Router Keygen is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Router Keygen. If not, see . 18 | */ 19 | #ifndef TELETUKEYGEN_H 20 | #define TELETUKEYGEN_H 21 | #include "Keygen.h" 22 | struct TeleTuMagicInfo; 23 | class TeleTuKeygen: public Keygen { 24 | public: 25 | TeleTuKeygen(QString ssid, QString mac, TeleTuMagicInfo * magicInfo); 26 | private: 27 | TeleTuMagicInfo * magicInfo; 28 | QVector & getKeys(); 29 | }; 30 | 31 | #endif // TELETUKEYGEN_H 32 | -------------------------------------------------------------------------------- /src/algorithms/TeletuKeygen.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Rui Araújo, Luís Fonseca 3 | * 4 | * This file is part of Router Keygen. 5 | * 6 | * Router Keygen is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Router Keygen is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Router Keygen. If not, see . 18 | */ 19 | #include "TeleTuKeygen.h" 20 | #include "config/TeleTuMagicInfo.h" 21 | #include 22 | 23 | TeleTuKeygen::TeleTuKeygen(QString ssid, QString mac, TeleTuMagicInfo * m) : 24 | Keygen(ssid, mac) , magicInfo(m) { 25 | kgname = "TeleTu"; 26 | } 27 | 28 | QVector & TeleTuKeygen::getKeys() { 29 | QString mac = getMacAddress(); 30 | if ( mac.size() < 12 ) 31 | throw ERROR; 32 | int serialInt = ( mac.mid(6).toInt(NULL,16) - magicInfo->base) / magicInfo->divider; 33 | QString serialEnd; 34 | serialEnd.setNum(serialInt); 35 | while (serialEnd.length() < 7) { 36 | serialEnd = "0" + serialEnd; 37 | } 38 | results.append(magicInfo->serial + "Y" + serialEnd); 39 | return results; 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/algorithms/TelseyKeygen.h: -------------------------------------------------------------------------------- 1 | #ifndef TELSEYKEYGEN_H 2 | #define TELSEYKEYGEN_H 3 | #include "Keygen.h" 4 | #include 5 | #include 6 | 7 | class TelseyKeygen: public Keygen { 8 | 9 | public: 10 | TelseyKeygen(QString ssid, QString mac); 11 | private: 12 | QVector & getKeys(); 13 | unsigned int * scrambler(QString mac); 14 | uint32_t hashword(const uint32_t * k, size_t length, uint32_t initval); 15 | }; 16 | 17 | #endif // TELSEYKEYGEN_H 18 | -------------------------------------------------------------------------------- /src/algorithms/ThomsonKeygen.h: -------------------------------------------------------------------------------- 1 | #ifndef THOMSONKEYGEN_H 2 | #define THOMSONKEYGEN_H 3 | #include "Keygen.h" 4 | #include 5 | class ThomsonKeygen: public Keygen { 6 | 7 | public: 8 | ThomsonKeygen(QString ssid, QString mac); 9 | int getSupportState() const; 10 | ~ThomsonKeygen(){} 11 | private: 12 | QVector & getKeys(); 13 | 14 | }; 15 | 16 | #endif // THOMSONKEYGEN_H 17 | -------------------------------------------------------------------------------- /src/algorithms/Tpw4gKeygen.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Alex Stanev 3 | * 4 | * This file is part of Router Keygen. 5 | * 6 | * Router Keygen is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Router Keygen is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Router Keygen. If not, see . 18 | */ 19 | 20 | #include "Tpw4gKeygen.h" 21 | 22 | Tpw4gKeygen::Tpw4gKeygen(QString ssid, QString mac) : 23 | Keygen(ssid, mac) { 24 | kgname = "Tpw4g"; 25 | } 26 | 27 | QVector & Tpw4gKeygen::getKeys() { 28 | QString mac = getMacAddress(); 29 | if ( mac.length() != 12 ) 30 | throw ERROR; 31 | 32 | results.append("8747" + mac.right(6).toUpper()); 33 | 34 | return results; 35 | } 36 | -------------------------------------------------------------------------------- /src/algorithms/Tpw4gKeygen.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Alex Stanev 3 | * 4 | * This file is part of Router Keygen. 5 | * 6 | * Router Keygen is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Router Keygen is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Router Keygen. If not, see . 18 | */ 19 | 20 | #ifndef TPW4GKEYGEN_H_ 21 | #define TPW4GKEYGEN_H_ 22 | 23 | #include "Keygen.h" 24 | 25 | class Tpw4gKeygen: public Keygen { 26 | public: 27 | Tpw4gKeygen(QString ssid, QString mac); 28 | 29 | private: 30 | QVector & getKeys(); 31 | }; 32 | 33 | #endif /* TPW4GKEYGEN_H_ */ 34 | -------------------------------------------------------------------------------- /src/algorithms/Upc07Keygen.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Alex Stanev 3 | * 4 | * Based on http://haxx.in/upc_keys.c 5 | * 6 | * This file is part of Router Keygen. 7 | * 8 | * Router Keygen is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * Router Keygen is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with Router Keygen. If not, see . 20 | */ 21 | 22 | #ifndef UPC07KEYGEN_H 23 | #define UPC07KEYGEN_H 24 | #include "Keygen.h" 25 | 26 | class Upc07Keygen: public Keygen { 27 | private: 28 | const static quint32 magic24; 29 | const static quint32 magic5; 30 | const static quint64 magic0; 31 | const static quint64 magic1; 32 | const static quint64 magic2; 33 | 34 | const static unsigned int max0; 35 | const static unsigned int max1; 36 | const static unsigned int max2; 37 | const static unsigned int max3; 38 | const static char* prefixes[]; 39 | 40 | QString hash2pass(quint8 *in_hash); 41 | quint32 mangle(quint32 *pp); 42 | quint32 upc_generate_ssid(quint32* data, quint32 magic); 43 | 44 | QVector & getKeys(); 45 | public: 46 | Upc07Keygen(QString ssid, QString mac); 47 | int getSupportState() const; 48 | }; 49 | 50 | #endif // UPC07KEYGEN_H 51 | -------------------------------------------------------------------------------- /src/algorithms/Upc07UbeeKeygen.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Alex Stanev 3 | * 4 | * Based on https://github.com/yolosec/upcgen, ubee_keys.c 5 | * 6 | * This file is part of Router Keygen. 7 | * 8 | * Router Keygen is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * Router Keygen is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with Router Keygen. If not, see . 20 | */ 21 | 22 | #ifndef UPC07UBEEKEYGEN_H 23 | #define UPC07UBEEKEYGEN_H 24 | #include "Keygen.h" 25 | 26 | class Upc07UbeeKeygen: public Keygen { 27 | private: 28 | const static char* UBEE_NONINSULTING_ALPHABET; 29 | const static quint16 PROFANITY_COUNT; 30 | const static char* profanities[]; 31 | 32 | // Generates default SSID from source MAC 33 | qint8 ubee_generate_ssid(unsigned const char * mac, unsigned char * ssid, size_t * len); 34 | // Generates default passphrase from source MAC, with profanity checking 35 | qint8 ubee_generate_pass(unsigned const char * mac, unsigned char * passwd, size_t * len); 36 | // Generates default passphrase from source MAC, may contain profanity 37 | qint8 ubee_generate_pass_raw(unsigned const char * mac, unsigned char * hash_buff, unsigned char * passwd); 38 | // Generates a new default passphrase, if the original had profanity as a substring 39 | qint8 ubee_enerate_profanity_free_pass(unsigned char * hash_buff, unsigned char const * new_pass); 40 | // Math ADD operation on MAC address 41 | void incmac(unsigned char * mac, unsigned char * newmac, qint8 delta); 42 | // Read MAC from hex string 43 | qint8 readmac(char const * machex, unsigned char * mac); 44 | 45 | QVector & getKeys(); 46 | public: 47 | Upc07UbeeKeygen(QString ssid, QString mac); 48 | int getSupportState() const; 49 | }; 50 | 51 | #endif // UPC07UBEEKEYGEN_H 52 | -------------------------------------------------------------------------------- /src/algorithms/VerizonKeygen.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Rui Araújo, Luís Fonseca 3 | * 4 | * This file is part of Router Keygen. 5 | * 6 | * Router Keygen is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Router Keygen is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Router Keygen. If not, see . 18 | */ 19 | #include "VerizonKeygen.h" 20 | 21 | VerizonKeygen::VerizonKeygen(QString ssid, QString mac) : 22 | Keygen(ssid, mac) { 23 | kgname = "Verizon"; 24 | } 25 | 26 | QVector & VerizonKeygen::getKeys() { 27 | QChar inverse[5]; 28 | QString ssid = getSsidName(); 29 | inverse[0] = ssid.at(4); 30 | inverse[1] = ssid.at(3); 31 | inverse[2] = ssid.at(2); 32 | inverse[3] = ssid.at(1); 33 | inverse[4] = ssid.at(0); 34 | bool test; 35 | int resultInt = QString::fromRawData(inverse , 5).toInt(&test, 36); 36 | if ( !test ) 37 | throw ERROR; 38 | 39 | QString result; 40 | result.setNum(resultInt , 16); 41 | while ( result.size() < 6 ) 42 | result = "0" + result; 43 | QString mac = getMacAddress(); 44 | if ( mac.isEmpty() ) 45 | { 46 | results.append("1801" + result.toUpper()); 47 | results.append("1F90" + result.toUpper()); 48 | } 49 | else 50 | results.append(mac.mid(2,4) + result.toUpper()); 51 | return results; 52 | } 53 | -------------------------------------------------------------------------------- /src/algorithms/VerizonKeygen.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Rui Araújo, Luís Fonseca 3 | * 4 | * This file is part of Router Keygen. 5 | * 6 | * Router Keygen is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Router Keygen is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Router Keygen. If not, see . 18 | */ 19 | #ifndef VERIZONKEYGEN_H 20 | #define VERIZONKEYGEN_H 21 | #include "Keygen.h" 22 | 23 | class VerizonKeygen : public Keygen 24 | { 25 | public: 26 | VerizonKeygen(QString ssid, QString mac); 27 | private: 28 | QVector & getKeys() ; 29 | }; 30 | 31 | #endif // VERIZONKEYGEN_H 32 | -------------------------------------------------------------------------------- /src/algorithms/WifimediaRKeygen.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * WifimediaRKeygen.cpp 3 | * 4 | * Created on: 5 de Ago de 2012 5 | * Author: ruka 6 | */ 7 | 8 | #include "WifimediaRKeygen.h" 9 | 10 | WifimediaRKeygen::WifimediaRKeygen(QString ssid, QString mac) : 11 | Keygen(ssid, mac) { 12 | kgname = "WifimediaR"; 13 | } 14 | 15 | QVector & WifimediaRKeygen::getKeys() { 16 | QString mac = getMacAddress(); 17 | if ( mac.size() != 12 ) 18 | throw ERROR; 19 | QString possibleKey = mac.left(11).toLower() + "0"; 20 | results.append(possibleKey); 21 | results.append(possibleKey.toUpper()); 22 | return results; 23 | } 24 | 25 | -------------------------------------------------------------------------------- /src/algorithms/WifimediaRKeygen.h: -------------------------------------------------------------------------------- 1 | /* 2 | * WIFIMEDIARKEYGEN.h 3 | * 4 | * Created on: 5 de Ago de 2012 5 | * Author: ruka 6 | */ 7 | 8 | #ifndef WIFIMEDIARKEYGEN_H_ 9 | #define WIFIMEDIARKEYGEN_H_ 10 | #include "Keygen.h" 11 | class WifimediaRKeygen : public Keygen{ 12 | public: 13 | WifimediaRKeygen(QString ssid, QString mac); 14 | 15 | private: 16 | QVector & getKeys() ; 17 | }; 18 | 19 | #endif /* WIFIMEDIARKEYGEN_H_ */ 20 | -------------------------------------------------------------------------------- /src/algorithms/Wlan2Keygen.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Rui Araújo, Luís Fonseca 3 | * 4 | * This file is part of Router Keygen. 5 | * 6 | * Router Keygen is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Router Keygen is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Router Keygen. If not, see . 18 | */ 19 | #include "Wlan2Keygen.h" 20 | 21 | Wlan2Keygen::Wlan2Keygen(QString ssid, QString mac) : 22 | Keygen(ssid, mac) { 23 | kgname = "Wlan2"; 24 | } 25 | 26 | QVector & Wlan2Keygen::getKeys() { 27 | QChar key[26]; 28 | 29 | QString mac = getMacAddress(); 30 | 31 | if (mac.size() != 12) 32 | throw ERROR; 33 | 34 | key[0] = mac.at(10); 35 | key[1] = mac.at(11); 36 | key[2] = mac.at(0); 37 | key[3] = mac.at(1); 38 | key[4] = mac.at(8); 39 | key[5] = mac.at(9); 40 | key[6] = mac.at(2); 41 | key[7] = mac.at(3); 42 | key[8] = mac.at(4); 43 | key[9] = mac.at(5); 44 | key[10] = mac.at(6); 45 | key[11] = mac.at(7); 46 | key[12] = mac.at(10); 47 | key[13] = mac.at(11); 48 | key[14] = mac.at(8); 49 | key[15] = mac.at(9); 50 | key[16] = mac.at(2); 51 | key[17] = mac.at(3); 52 | key[18] = mac.at(4); 53 | key[19] = mac.at(5); 54 | key[20] = mac.at(6); 55 | key[21] = mac.at(7); 56 | key[22] = mac.at(0); 57 | key[23] = mac.at(1); 58 | key[24] = mac.at(4); 59 | key[25] = mac.at(5); 60 | 61 | QChar begin = getSsidName().right(2).at(1); 62 | if (!begin.isDigit()) { 63 | QString cadena(key, 2); 64 | bool test; 65 | int value = QString::fromRawData(key, 2).toInt(&test, 16); 66 | if (!test) { 67 | throw ERROR; 68 | } 69 | value--; 70 | cadena.setNum(value, 16); 71 | if (cadena.size() < 2) 72 | cadena = "0" + cadena; 73 | key[0] = cadena.at(0); 74 | key[1] = cadena.at(1); 75 | } 76 | 77 | results.append(QString(key)); 78 | return results; 79 | } 80 | -------------------------------------------------------------------------------- /src/algorithms/Wlan2Keygen.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Rui Araújo, Luís Fonseca 3 | * 4 | * This file is part of Router Keygen. 5 | * 6 | * Router Keygen is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Router Keygen is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Router Keygen. If not, see . 18 | */ 19 | #ifndef WLAN2KEYGEN_H 20 | #define WLAN2KEYGEN_H 21 | #include "Keygen.h" 22 | 23 | class Wlan2Keygen : public Keygen 24 | { 25 | public: 26 | Wlan2Keygen(QString ssid, QString mac); 27 | private: 28 | QVector & getKeys() ; 29 | 30 | }; 31 | 32 | #endif // WLAN2KEYGEN_H 33 | -------------------------------------------------------------------------------- /src/algorithms/Wlan6Keygen.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Rui Araújo, Luís Fonseca 3 | * 4 | * This file is part of Router Keygen. 5 | * 6 | * Router Keygen is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Router Keygen is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Router Keygen. If not, see . 18 | */ 19 | #include "Wlan6Keygen.h" 20 | 21 | Wlan6Keygen::Wlan6Keygen(QString ssid, QString mac) : 22 | Keygen(ssid, mac) { 23 | kgname = "Wlan6"; 24 | } 25 | 26 | QVector & Wlan6Keygen::getKeys() { 27 | if (getMacAddress().size() != 12) 28 | throw ERROR; 29 | QString ssidStr = getSsidName().right(6); 30 | QString macStr = getMacAddress().right(2); 31 | char ssidSubPart[] = { '1', '2', '3', '4', '5', '6' };/*These values are not revelant.*/ 32 | char bssidLastByte[] = { '6', '6' }; 33 | ssidSubPart[0] = ssidStr.at(0).toLatin1(); 34 | ssidSubPart[1] = ssidStr.at(1).toLatin1(); 35 | ssidSubPart[2] = ssidStr.at(2).toLatin1(); 36 | ssidSubPart[3] = ssidStr.at(3).toLatin1(); 37 | ssidSubPart[4] = ssidStr.at(4).toLatin1(); 38 | ssidSubPart[5] = ssidStr.at(5).toLatin1(); 39 | bssidLastByte[0] = macStr.at(0).toLatin1(); 40 | bssidLastByte[1] = macStr.at(1).toLatin1(); 41 | for (int k = 0; k < 6; ++k) 42 | if (ssidSubPart[k] >= 'A') 43 | ssidSubPart[k] = (char) (ssidSubPart[k] - 55); 44 | 45 | if (bssidLastByte[0] >= 'A') 46 | bssidLastByte[0] = (char) (bssidLastByte[0] - 55); 47 | if (bssidLastByte[1] >= 'A') 48 | bssidLastByte[1] = (char) (bssidLastByte[1] - 55); 49 | 50 | int bytes[13]; 51 | for (int i = 0; i < 10; ++i) { 52 | /*Do not change the order of this instructions*/ 53 | int aux = i + (ssidSubPart[3] & 0xf) + (bssidLastByte[0] & 0xf) 54 | + (bssidLastByte[1] & 0xf); 55 | int aux1 = (ssidSubPart[1] & 0xf) + (ssidSubPart[2] & 0xf) 56 | + (ssidSubPart[4] & 0xf) + (ssidSubPart[5] & 0xf); 57 | bytes[1] = aux ^ (ssidSubPart[5] & 0xf); 58 | bytes[5] = aux ^ (ssidSubPart[4] & 0xf); 59 | bytes[9] = aux ^ (ssidSubPart[3] & 0xf); 60 | bytes[2] = aux1 ^ (ssidSubPart[2] & 0xf); 61 | bytes[6] = aux1 ^ (bssidLastByte[0] & 0xf); 62 | bytes[10] = aux1 ^ (bssidLastByte[1] & 0xf); 63 | bytes[3] = (bssidLastByte[0] & 0xf) ^ (ssidSubPart[5] & 0xf); 64 | bytes[7] = (bssidLastByte[1] & 0xf) ^ (ssidSubPart[4] & 0xf); 65 | bytes[11] = aux ^ aux1; 66 | bytes[4] = bytes[1] ^ bytes[7]; 67 | bytes[8] = bytes[6] ^ bytes[10]; 68 | bytes[12] = bytes[2] ^ bytes[9]; 69 | bytes[0] = bytes[11] ^ bytes[5]; 70 | QString key = "", tmp = ""; 71 | for (int j = 0; j < 13; ++j) { 72 | tmp.setNum(bytes[j] & 0xf, 16); 73 | key += tmp; 74 | } 75 | results.append(key.toUpper()); 76 | } 77 | return results; 78 | } 79 | -------------------------------------------------------------------------------- /src/algorithms/Wlan6Keygen.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Rui Araújo, Luís Fonseca 3 | * 4 | * This file is part of Router Keygen. 5 | * 6 | * Router Keygen is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Router Keygen is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Router Keygen. If not, see . 18 | */ 19 | #ifndef WLAN6KEYGEN_H 20 | #define WLAN6KEYGEN_H 21 | #include "Keygen.h" 22 | 23 | class Wlan6Keygen : public Keygen 24 | { 25 | public: 26 | Wlan6Keygen(QString ssid, QString mac); 27 | private: 28 | QVector & getKeys() ; 29 | }; 30 | 31 | #endif // WLAN6KEYGEN_H 32 | -------------------------------------------------------------------------------- /src/algorithms/ZyxelKeygen.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Rui Araújo, Luís Fonseca 3 | * 4 | * This file is part of Router Keygen. 5 | * 6 | * Router Keygen is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Router Keygen is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Router Keygen. If not, see . 18 | */ 19 | #include "ZyxelKeygen.h" 20 | 21 | ZyxelKeygen::ZyxelKeygen(QString ssid, QString mac) : 22 | Keygen(ssid, mac) { 23 | kgname = "Zyxel"; 24 | this->hash = new QCryptographicHash(QCryptographicHash::Md5); 25 | } 26 | ZyxelKeygen::~ZyxelKeygen() { 27 | delete hash; 28 | } 29 | 30 | 31 | QVector & ZyxelKeygen::getKeys() { 32 | if (getMacAddress().size() != 12) 33 | throw ERROR; 34 | this->hash->reset(); 35 | QString macMod = getMacAddress().left(8) + getSsidName().right(4); 36 | this->hash->addData(macMod.toLower().toLatin1()); 37 | QString result = QString::fromLatin1(this->hash->result().toHex().data()); 38 | result.truncate(20); 39 | this->results.append(result.toUpper()); 40 | return results; 41 | } 42 | -------------------------------------------------------------------------------- /src/algorithms/ZyxelKeygen.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Rui Araújo, Luís Fonseca 3 | * 4 | * This file is part of Router Keygen. 5 | * 6 | * Router Keygen is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Router Keygen is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Router Keygen. If not, see . 18 | */ 19 | #ifndef ZYXELKEYGEN_H 20 | #define ZYXELKEYGEN_H 21 | #include "Keygen.h" 22 | #include 23 | 24 | class ZyxelKeygen: public Keygen { 25 | private: 26 | const static QString magic; 27 | QVector & getKeys() ; 28 | QCryptographicHash * hash; 29 | public: 30 | ZyxelKeygen(QString ssid, QString mac); 31 | ~ZyxelKeygen(); 32 | }; 33 | 34 | #endif // ZYXELKEYGEN_H 35 | -------------------------------------------------------------------------------- /src/config/AliceConfigParser.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Rui Araújo, Luís Fonseca 3 | * 4 | * This file is part of Router Keygen. 5 | * 6 | * Router Keygen is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Router Keygen is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Router Keygen. If not, see . 18 | */ 19 | #include "AliceConfigParser.h" 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | QMap *> * AliceConfigParser::readFile(const QString &fileName) { 27 | QFile file(fileName); 28 | if(!file.open(QIODevice::ReadOnly)) { 29 | return NULL; 30 | } 31 | QTextStream in(&file); 32 | int magic[2]; 33 | QMap *> * supportedAlices = new QMap *>(); 34 | while(!in.atEnd()) { 35 | QString line = in.readLine(); 36 | QStringList infos = line.split(","); 37 | QString name = infos[0]; 38 | QVector * supported = supportedAlices->value(name); 39 | if (supported == NULL) { 40 | supported = new QVector(); 41 | supportedAlices->insert(name, supported); 42 | } 43 | QString serial = infos[1]; 44 | magic[0] = infos[2].toInt(NULL,10); // k 45 | magic[1] = infos[3].toInt(NULL,10); // q 46 | QString mac = infos[4]; 47 | supported->append(new AliceMagicInfo(name, magic, serial, mac)); 48 | } 49 | file.close(); 50 | return supportedAlices; 51 | } 52 | -------------------------------------------------------------------------------- /src/config/AliceConfigParser.h: -------------------------------------------------------------------------------- 1 | #ifndef ALICEHANDLE_H 2 | #define ALICEHANDLE_H 3 | #include "AliceMagicInfo.h" 4 | #include 5 | #include 6 | #include 7 | 8 | class AliceConfigParser 9 | { 10 | private: 11 | AliceConfigParser(){} 12 | ~AliceConfigParser(){} 13 | public: 14 | static QMap *> * readFile(const QString &fileName); 15 | 16 | 17 | }; 18 | 19 | #endif // ALICEHANDLE_H 20 | -------------------------------------------------------------------------------- /src/config/AliceMagicInfo.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Rui Araújo, Luís Fonseca 3 | * 4 | * This file is part of Router Keygen. 5 | * 6 | * Router Keygen is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Router Keygen is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Router Keygen. If not, see . 18 | */ 19 | #include "AliceMagicInfo.h" 20 | 21 | AliceMagicInfo::AliceMagicInfo( QString a , int ma[2] , QString s , QString m ) : 22 | alice(a) , serial(s) , mac(m) 23 | { 24 | this->magic[0] = ma[0]; 25 | this->magic[1] = ma[1]; 26 | } 27 | -------------------------------------------------------------------------------- /src/config/AliceMagicInfo.h: -------------------------------------------------------------------------------- 1 | #ifndef ALICEMAGICINFO_H 2 | #define ALICEMAGICINFO_H 3 | #include 4 | 5 | struct AliceMagicInfo 6 | { 7 | QString alice; 8 | int magic[2]; 9 | QString serial; 10 | QString mac; 11 | AliceMagicInfo( QString alice , int magic[2] , QString serial , QString mac ); 12 | }; 13 | 14 | #endif // ALICEMAGICINFO_H 15 | -------------------------------------------------------------------------------- /src/config/OTEHuaweiConfigParser.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Rui Araújo, Luís Fonseca 3 | * 4 | * This file is part of Router Keygen. 5 | * 6 | * Router Keygen is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Router Keygen is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Router Keygen. If not, see . 18 | */ 19 | #include "OTEHuaweiConfigParser.h" 20 | #include 21 | #include 22 | #include 23 | 24 | 25 | QStringList * OTEHuaweiConfigParser::readFile(const QString &fileName) { 26 | QFile file(fileName); 27 | if(!file.open(QIODevice::ReadOnly)) { 28 | return NULL; 29 | } 30 | QTextStream in(&file); 31 | QStringList * linesInfo = new QStringList(); 32 | while(!in.atEnd()) { 33 | QString line = in.readLine(); 34 | linesInfo->append(line); 35 | } 36 | file.close(); 37 | return linesInfo; 38 | } 39 | -------------------------------------------------------------------------------- /src/config/OTEHuaweiConfigParser.h: -------------------------------------------------------------------------------- 1 | #ifndef OTEHUAWEICONFIGPARSER_H 2 | #define OTEHUAWEICONFIGPARSER_H 3 | #include 4 | 5 | class OTEHuaweiConfigParser 6 | { 7 | private: 8 | OTEHuaweiConfigParser(){} 9 | ~OTEHuaweiConfigParser(){} 10 | public: 11 | static QStringList * readFile(const QString &fileName); 12 | }; 13 | 14 | #endif // OTEHUAWEICONFIGPARSER_H 15 | -------------------------------------------------------------------------------- /src/config/TeleTuConfigParser.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Rui Araújo, Luís Fonseca 3 | * 4 | * This file is part of Router Keygen. 5 | * 6 | * Router Keygen is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Router Keygen is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Router Keygen. If not, see . 18 | */ 19 | #include "TeleTuConfigParser.h" 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | QMap *> * TeleTuConfigParser::readFile(const QString &fileName) { 27 | QFile file(fileName); 28 | if(!file.open(QIODevice::ReadOnly)) { 29 | return NULL; 30 | } 31 | QTextStream in(&file); 32 | int range[2]; 33 | QMap *> * supportedTeleTus = new QMap *>(); 34 | while(!in.atEnd()) { 35 | QString line = in.readLine(); 36 | QStringList infos = line.split(" "); 37 | QString name = infos[0]; 38 | QVector * supported = supportedTeleTus 39 | ->value(name); 40 | if (supported == NULL) { 41 | supported = new QVector(); 42 | supportedTeleTus->insert(name, supported); 43 | } 44 | range[0] = infos[1].toInt(NULL,16); // from 45 | range[1] = infos[2].toInt(NULL,16); // to 46 | QString serial = infos[3]; 47 | int base = infos[4].toInt(NULL,16); 48 | int divider = infos[5].toInt(NULL,10); 49 | supported->append(new TeleTuMagicInfo(range, serial, base, divider)); 50 | } 51 | file.close(); 52 | return supportedTeleTus; 53 | } 54 | -------------------------------------------------------------------------------- /src/config/TeleTuConfigParser.h: -------------------------------------------------------------------------------- 1 | #ifndef TELETUHANDLE_H 2 | #define TELETUHANDLE_H 3 | #include "TeleTuMagicInfo.h" 4 | #include 5 | #include 6 | #include 7 | 8 | class TeleTuConfigParser 9 | { 10 | private: 11 | TeleTuConfigParser(){} 12 | ~TeleTuConfigParser(){} 13 | public: 14 | static QMap *> * readFile(const QString &fileName); 15 | 16 | 17 | }; 18 | 19 | #endif // TELETUHANDLE_H 20 | -------------------------------------------------------------------------------- /src/config/TeleTuMagicInfo.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Rui Araújo, Luís Fonseca 3 | * 4 | * This file is part of Router Keygen. 5 | * 6 | * Router Keygen is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Router Keygen is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Router Keygen. If not, see . 18 | */ 19 | #include "TeleTuMagicInfo.h" 20 | 21 | TeleTuMagicInfo::TeleTuMagicInfo( int ra[2], QString s, int b, int d ) : 22 | base(b) , serial(s) , divider(d) 23 | { 24 | this->range[0] = ra[0]; 25 | this->range[1] = ra[1]; 26 | } 27 | -------------------------------------------------------------------------------- /src/config/TeleTuMagicInfo.h: -------------------------------------------------------------------------------- 1 | #ifndef TELETUMAGICINFO_H 2 | #define TELETUMAGICINFO_H 3 | #include 4 | 5 | struct TeleTuMagicInfo{ 6 | int range[2]; 7 | int base; 8 | QString serial; 9 | int divider; 10 | TeleTuMagicInfo( int range[2], QString serial, int base, int divider); 11 | }; 12 | 13 | #endif // TELETUMAGICINFO_H 14 | -------------------------------------------------------------------------------- /src/dialog/AboutDialog.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Rui Araújo, Luís Fonseca 3 | * 4 | * This file is part of Router Keygen. 5 | * 6 | * Router Keygen is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Router Keygen is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Router Keygen. If not, see . 18 | */ 19 | #include "AboutDialog.h" 20 | #include 21 | #include "ui_aboutdialog.h" 22 | 23 | AboutDialog::AboutDialog(QWidget *parent) : 24 | QDialog(parent), 25 | ui(new Ui::AboutDialog) 26 | { 27 | ui->setupUi(this); 28 | ui->desc->setHtml(ui->desc->toHtml().arg(QCoreApplication::applicationVersion())); 29 | } 30 | 31 | AboutDialog::~AboutDialog() 32 | { 33 | delete ui; 34 | } 35 | -------------------------------------------------------------------------------- /src/dialog/AboutDialog.h: -------------------------------------------------------------------------------- 1 | #ifndef ABOUTDIALOG_H 2 | #define ABOUTDIALOG_H 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class AboutDialog; 8 | } 9 | 10 | class AboutDialog : public QDialog 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | explicit AboutDialog(QWidget *parent = 0); 16 | ~AboutDialog(); 17 | 18 | private: 19 | Ui::AboutDialog *ui; 20 | }; 21 | 22 | #endif // ABOUTDIALOG_H 23 | -------------------------------------------------------------------------------- /src/dialog/UpdateDialog.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Rui Araújo, Luís Fonseca 3 | * 4 | * This file is part of Router Keygen. 5 | * 6 | * Router Keygen is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Router Keygen is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Router Keygen. If not, see . 18 | */ 19 | #include "UpdateDialog.h" 20 | #include "ui_UpdateDialog.h" 21 | #include 22 | #include 23 | 24 | UpdateDialog::UpdateDialog(QString url, QString version, QWidget *parent) : 25 | QDialog(parent), 26 | ui(new Ui::UpdateDialog), url(url) 27 | { 28 | ui->setupUi(this); 29 | connect(ui->openWebsite,SIGNAL(clicked()), this, SLOT(openWebsite())); 30 | connect(ui->close,SIGNAL(clicked()), this, SLOT(closeWindow())); 31 | ui->textBrowser->setHtml(ui->textBrowser->toHtml().arg(version)); 32 | } 33 | 34 | UpdateDialog::~UpdateDialog() 35 | { 36 | delete ui; 37 | } 38 | 39 | void UpdateDialog::changeEvent(QEvent *e) 40 | { 41 | QDialog::changeEvent(e); 42 | switch (e->type()) { 43 | case QEvent::LanguageChange: 44 | ui->retranslateUi(this); 45 | break; 46 | default: 47 | break; 48 | } 49 | } 50 | 51 | void UpdateDialog::openWebsite(){ 52 | QDesktopServices::openUrl(QUrl(url)); 53 | this->closeWindow(); 54 | } 55 | 56 | 57 | void UpdateDialog::closeWindow(){ 58 | close(); 59 | this->deleteLater(); 60 | } 61 | -------------------------------------------------------------------------------- /src/dialog/UpdateDialog.h: -------------------------------------------------------------------------------- 1 | #ifndef UPDATEDIALOG_H 2 | #define UPDATEDIALOG_H 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class UpdateDialog; 8 | } 9 | 10 | class UpdateDialog : public QDialog { 11 | Q_OBJECT 12 | public: 13 | UpdateDialog(QString url, QString version, QWidget *parent = 0); 14 | ~UpdateDialog(); 15 | 16 | protected: 17 | void changeEvent(QEvent *e); 18 | 19 | private: 20 | Ui::UpdateDialog *ui; 21 | QString url; 22 | 23 | private slots: 24 | void openWebsite(); 25 | void closeWindow(); 26 | }; 27 | 28 | #endif // UPDATEDIALOG_H 29 | -------------------------------------------------------------------------------- /src/dialog/WelcomeDialog.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Rui Araújo, Luís Fonseca 3 | * 4 | * This file is part of Router Keygen. 5 | * 6 | * Router Keygen is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Router Keygen is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Router Keygen. If not, see . 18 | */ 19 | #include "WelcomeDialog.h" 20 | #include 21 | #include 22 | #include "ui_welcome_dialog.h" 23 | 24 | WelcomeDialog::WelcomeDialog(QWidget *parent) : 25 | QDialog(parent) , ui(new Ui::WelcomeDialog) { 26 | ui->setupUi(this); 27 | connect(ui->donate,SIGNAL(clicked()), this, SLOT(donatePaypal())); 28 | connect(ui->donate_google, SIGNAL(clicked()),this, SLOT(donateGooglePlay()) ); 29 | } 30 | 31 | WelcomeDialog::~WelcomeDialog(){ 32 | delete ui; 33 | } 34 | 35 | void WelcomeDialog::donatePaypal(){ 36 | QDesktopServices::openUrl(QUrl("https://www.paypal.com/pt/cgi-bin/webscr?cmd=_flow&SESSION=i5165NLrZfxUoHKUVuudmu6le5tVb6c0CX_9CP45rrU1Az-XgWgJbZ5bfJW&dispatch=5885d80a13c0db1f8e263663d3faee8d5348ead9d61c709ee8c979deef3ea735")); 37 | close(); 38 | } 39 | 40 | void WelcomeDialog::donateGooglePlay(){ 41 | QDesktopServices::openUrl(QUrl("https://play.google.com/store/apps/details?id=org.doublecheck.wifiscanner")); 42 | close(); 43 | } 44 | -------------------------------------------------------------------------------- /src/dialog/WelcomeDialog.h: -------------------------------------------------------------------------------- 1 | #ifndef WELCOMEDIALOG_H 2 | #define WELCOMEDIALOG_H 3 | #include 4 | 5 | 6 | namespace Ui { 7 | class WelcomeDialog; 8 | } 9 | 10 | class WelcomeDialog : public QDialog 11 | { 12 | Q_OBJECT 13 | public: 14 | explicit WelcomeDialog(QWidget *parent = 0); 15 | 16 | virtual ~WelcomeDialog(); 17 | private: 18 | Ui::WelcomeDialog *ui; 19 | 20 | private slots: 21 | void donatePaypal(); 22 | void donateGooglePlay(); 23 | 24 | }; 25 | 26 | #endif // WELCOMEDIALOG_H 27 | -------------------------------------------------------------------------------- /src/forms/UpdateDialog.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | UpdateDialog 4 | 5 | 6 | 7 | 0 8 | 0 9 | 320 10 | 182 11 | 12 | 13 | 14 | Updates available 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> 23 | <html><head><meta name="qrichtext" content="1" /><style type="text/css"> 24 | p, li { white-space: pre-wrap; } 25 | </style></head><body style=" font-family:'.Helvetica Neue DeskInterface'; font-size:13pt; font-weight:400; font-style:normal;"> 26 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans'; font-size:10pt;">There is version %1 available.</span></p> 27 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans'; font-size:10pt;"><br /></span></p> 28 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans'; font-size:10pt;">Open the website to download the latest version.</span></p></body></html> 29 | 30 | 31 | 32 | 33 | 34 | 35 | Open Website 36 | 37 | 38 | 39 | 40 | 41 | 42 | Close 43 | 44 | 45 | false 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /src/forms/welcome_dialog.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | WelcomeDialog 4 | 5 | 6 | 7 | 0 8 | 0 9 | 340 10 | 174 11 | 12 | 13 | 14 | RouterKeygen 15 | 16 | 17 | 18 | 19 | 11 20 | 11 21 | 318 22 | 151 23 | 24 | 25 | 26 | 27 | 28 | 29 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> 30 | <html><head><meta name="qrichtext" content="1" /><style type="text/css"> 31 | p, li { white-space: pre-wrap; } 32 | </style></head><body style=" font-family:'Sans'; font-size:10pt; font-weight:400; font-style:normal;"> 33 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif'; font-size:9pt;">Thank you for trying Router Keygen. </span></p> 34 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif'; font-size:9pt;"></p> 35 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif'; font-size:9pt;">If you like this application, please consider donating.</span></p> 36 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif'; font-size:9pt;"></p> 37 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif'; font-size:9pt;">Your donation will motivate the authors to improve on this great open-source tool.</span></p></body></html> 38 | 39 | 40 | 41 | 42 | 43 | 44 | Google Play 45 | 46 | 47 | 48 | 49 | 50 | 51 | Paypal 52 | 53 | 54 | 55 | 56 | 57 | 58 | Close 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | donate_google 67 | donate 68 | 69 | 70 | 71 | 72 | close 73 | clicked() 74 | WelcomeDialog 75 | close() 76 | 77 | 78 | 274 79 | 154 80 | 81 | 82 | 311 83 | 166 84 | 85 | 86 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /src/mac/macloginitemsmanager.h: -------------------------------------------------------------------------------- 1 | #ifndef MACLOGINITEMSMANAGER_H 2 | #define MACLOGINITEMSMANAGER_H 3 | 4 | class MacLoginItemsManager 5 | { 6 | public: 7 | MacLoginItemsManager(); 8 | ~MacLoginItemsManager(); 9 | bool appendRunningApplication() const; 10 | bool removeRunningApplication() const; 11 | bool containsRunningApplication() const; 12 | 13 | private: 14 | bool findRunningApplication(bool remove) const; 15 | 16 | class Private; 17 | Private *d; 18 | }; 19 | #endif // MACLOGINITEMSMANAGER_H 20 | -------------------------------------------------------------------------------- /src/mac/macloginitemsmanager.mm: -------------------------------------------------------------------------------- 1 | #include "macloginitemsmanager.h" 2 | #import 3 | 4 | class MacLoginItemsManager::Private 5 | { 6 | public: 7 | Private(LSSharedFileListRef loginItems) : loginItems(loginItems) { } 8 | 9 | CFURLRef runningApplicationUrl() const 10 | { 11 | // This will retrieve the path for the application, i.e. /Applications/MyApplication.app 12 | NSString *appPath = [[NSBundle mainBundle] bundlePath]; 13 | return reinterpret_cast([NSURL fileURLWithPath: appPath]); 14 | } 15 | 16 | LSSharedFileListRef loginItems; 17 | }; 18 | 19 | MacLoginItemsManager::MacLoginItemsManager() 20 | { 21 | // Create a reference to the shared file list 22 | // We are adding it to the current user only - if we wanted to add it all users, 23 | // use kLSSharedFileListGlobalLoginItems instead of kLSSharedFileListSessionLoginItems 24 | this->d = new MacLoginItemsManager::Private(LSSharedFileListCreate(NULL, kLSSharedFileListSessionLoginItems, NULL)); 25 | } 26 | 27 | MacLoginItemsManager::~MacLoginItemsManager() 28 | { 29 | if (this->d->loginItems) 30 | { 31 | CFRelease(this->d->loginItems); 32 | } 33 | 34 | delete this->d; 35 | } 36 | 37 | bool MacLoginItemsManager::appendRunningApplication() const 38 | { 39 | if (this->d->loginItems) 40 | { 41 | CFMutableDictionaryRef inPropertiesToSet = CFDictionaryCreateMutable(NULL, 1, NULL, NULL); 42 | CFDictionaryAddValue(inPropertiesToSet, kLSSharedFileListLoginItemHidden, kCFBooleanTrue); 43 | 44 | // Add the running application to the list 45 | LSSharedFileListItemRef item = LSSharedFileListInsertItemURL(this->d->loginItems, kLSSharedFileListItemLast, NULL, NULL, this->d->runningApplicationUrl(), inPropertiesToSet, NULL); 46 | if (item) 47 | { 48 | CFRelease(item); 49 | return true; 50 | } 51 | } 52 | 53 | return false; 54 | } 55 | 56 | bool MacLoginItemsManager::removeRunningApplication() const 57 | { 58 | return this->findRunningApplication(true); 59 | } 60 | 61 | bool MacLoginItemsManager::containsRunningApplication() const 62 | { 63 | return this->findRunningApplication(false); 64 | } 65 | 66 | bool MacLoginItemsManager::findRunningApplication(bool remove) const 67 | { 68 | bool success = false; 69 | 70 | if (this->d->loginItems) 71 | { 72 | UInt32 seedValue; 73 | 74 | // Retrieve the list of Login Items and cast them to an NSArray so that it will be easier to iterate 75 | NSArray *loginItemsArray = (NSArray*)LSSharedFileListCopySnapshot(this->d->loginItems, &seedValue); 76 | for (uint i = 0; i < [loginItemsArray count]; i++) 77 | { 78 | LSSharedFileListItemRef itemRef = reinterpret_cast([loginItemsArray objectAtIndex: i]); 79 | 80 | // Resolve the item with URL 81 | CFURLRef url = this->d->runningApplicationUrl(); 82 | if (LSSharedFileListItemResolve(itemRef, 0, reinterpret_cast(&url), NULL) == noErr) 83 | { 84 | NSString *urlPath = [reinterpret_cast(url) path]; 85 | if ([urlPath compare: [[NSBundle mainBundle] bundlePath]] == NSOrderedSame) 86 | { 87 | // If our goal is to remove it, our success is based on whether it's removed 88 | if (remove) 89 | { 90 | success = (LSSharedFileListItemRemove(this->d->loginItems, itemRef) == noErr); 91 | } 92 | else 93 | { 94 | // Otherwise we just wanted to find it, and we did, so return true 95 | return true; 96 | } 97 | } 98 | } 99 | } 100 | 101 | [loginItemsArray release]; 102 | } 103 | 104 | return success; 105 | } 106 | -------------------------------------------------------------------------------- /src/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Rui Araújo, Luís Fonseca 3 | * 4 | * This file is part of Router Keygen. 5 | * 6 | * Router Keygen is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Router Keygen is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Router Keygen. If not, see . 18 | */ 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include "RouterKeygen.h" 25 | #include "wifi/QScanResult.h" 26 | #include "WirelessMatcher.h" 27 | #include "algorithms/Keygen.h" 28 | #include "qcmdlineparser/qcmdlineparser.h" 29 | #include "version.h" 30 | 31 | int main(int argc, char * argv[]) { 32 | /* Run main application */ 33 | QApplication app(argc, argv); 34 | QTranslator translator; 35 | QApplication::setOrganizationName("com.doublecheck"); 36 | QApplication::setApplicationName(PROJECT_NAME); 37 | QApplication::setApplicationVersion(PROJECT_VERSION); 38 | QString qmFile = app.applicationName().toLower() + "_" + QLocale::system().name(); 39 | if ( translator.load(qmFile,":/lang") ) 40 | app.installTranslator(&translator); 41 | 42 | RouterKeygen w; 43 | w.showWithDialog(); 44 | return app.exec(); 45 | } 46 | -------------------------------------------------------------------------------- /src/qcmdlineparser/qcmdlineargument.cpp: -------------------------------------------------------------------------------- 1 | #include "qcmdlineargument.h" 2 | #include 3 | #include 4 | 5 | class QCmdLineArgument::QCmdLineOptionPrivate 6 | { 7 | public: 8 | QCmdLineOptionPrivate(const QString &name, QCmdLineArgument::Action action, const QString &help, const QString &valueName) 9 | : names(name), valueName(valueName), help(help), action(action), isRequired(false) 10 | { 11 | } 12 | 13 | QStringList names; 14 | QString keyName; 15 | QString valueName; 16 | QString help; 17 | QCmdLineArgument::Action action; 18 | QRegExp validator; 19 | bool isRequired; 20 | }; 21 | 22 | QCmdLineArgument::QCmdLineArgument(const QString &name, QCmdLineArgument::Action action, const QString &help, const QString &valueName) 23 | : m_d(new QCmdLineOptionPrivate(name, action, help, valueName)) 24 | { 25 | } 26 | 27 | QCmdLineArgument::QCmdLineArgument(const char *name, QCmdLineArgument::Action action, const QString &help, const QString &valueName) 28 | : m_d(new QCmdLineOptionPrivate(name, action, help, valueName)) 29 | { 30 | } 31 | 32 | QCmdLineArgument::QCmdLineArgument(const QCmdLineArgument &other) : m_d(new QCmdLineOptionPrivate(*other.m_d)) 33 | { 34 | } 35 | 36 | QCmdLineArgument& QCmdLineArgument::operator=(const QCmdLineArgument &other) 37 | { 38 | *m_d = *other.m_d; 39 | return *this; 40 | } 41 | 42 | QCmdLineArgument::~QCmdLineArgument() 43 | { 44 | delete m_d; 45 | } 46 | 47 | QString QCmdLineArgument::keyName() const 48 | { 49 | if (m_d->keyName.isNull()) { 50 | QString tmp = m_d->names.first(); 51 | while (tmp.startsWith('-')) 52 | tmp.remove(0, 1); 53 | m_d->keyName = tmp; 54 | } 55 | return m_d->keyName; 56 | } 57 | 58 | void QCmdLineArgument::setKeyName(const QString &keyName) 59 | { 60 | m_d->keyName = keyName; 61 | } 62 | 63 | QString QCmdLineArgument::name() const 64 | { 65 | return m_d->names.first(); 66 | } 67 | 68 | QString QCmdLineArgument::valueName() const 69 | { 70 | return m_d->valueName; 71 | } 72 | 73 | QCmdLineArgument& QCmdLineArgument::addAlias(const QString &alias) 74 | { 75 | m_d->names << alias; 76 | return *this; 77 | } 78 | 79 | QStringList QCmdLineArgument::aliases() const 80 | { 81 | return m_d->names; 82 | } 83 | 84 | QCmdLineArgument::Action QCmdLineArgument::action() const 85 | { 86 | return m_d->action; 87 | } 88 | 89 | void QCmdLineArgument::setValidator(const QRegExp &validator) 90 | { 91 | m_d->validator = validator; 92 | } 93 | 94 | bool QCmdLineArgument::validate(const QString &value) const 95 | { 96 | if (m_d->validator.isEmpty()) 97 | return true; 98 | #ifndef NDEBUG 99 | if (!m_d->validator.isValid()) 100 | qWarning() << "Invalid regex used to validate argument" << name(); 101 | #endif 102 | return m_d->validator.exactMatch(value); 103 | } 104 | 105 | void QCmdLineArgument::setRequired(bool required) 106 | { 107 | m_d->isRequired = required; 108 | } 109 | 110 | bool QCmdLineArgument::isRequired() const 111 | { 112 | return m_d->isRequired; 113 | } 114 | 115 | void QCmdLineArgument::setHelp(const QString& text) 116 | { 117 | m_d->help = text; 118 | } 119 | 120 | QString QCmdLineArgument::help() const 121 | { 122 | return m_d->help; 123 | } 124 | 125 | -------------------------------------------------------------------------------- /src/qcmdlineparser/qcmdlineargument.h: -------------------------------------------------------------------------------- 1 | #ifndef QCMDLINEARGUMENT_H 2 | #define QCMDLINEARGUMENT_H 3 | 4 | #include 5 | 6 | class QCmdLineArgument 7 | { 8 | public: 9 | enum Action 10 | { 11 | StoreTrue, 12 | StoreValue, 13 | CountOccurences 14 | }; 15 | 16 | QCmdLineArgument(const QString &name, Action action = StoreTrue, const QString &help = QString(), const QString &valueName = QString()); 17 | QCmdLineArgument(const char *name, Action action = StoreTrue, const QString &help = QString(), const QString &valueName = QString()); 18 | QCmdLineArgument(const QCmdLineArgument &other); 19 | QCmdLineArgument& operator=(const QCmdLineArgument &other); 20 | ~QCmdLineArgument(); 21 | 22 | QCmdLineArgument& addAlias(const QString &alias); 23 | QStringList aliases() const; 24 | 25 | QString name() const; 26 | void setKeyName(const QString &keyName); 27 | QString keyName() const; 28 | QString valueName() const; 29 | Action action() const; 30 | void setValidator(const QRegExp &validator); 31 | bool validate(const QString &value) const; 32 | 33 | void setRequired(bool required); 34 | bool isRequired() const; 35 | 36 | void setHelp(const QString &text); 37 | QString help() const; 38 | 39 | private: 40 | class QCmdLineOptionPrivate; 41 | QCmdLineOptionPrivate * const m_d; 42 | }; 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /src/qcmdlineparser/qcmdlineparser.h: -------------------------------------------------------------------------------- 1 | #ifndef QCMDLINEPARSER_H 2 | #define QCMDLINEPARSER_H 3 | 4 | #include 5 | // need qcoreapplication header just for Q_DECLARE_TR_FUNCTIONS macro 6 | #include 7 | #include "qcmdlineargument.h" 8 | 9 | class QCmdLineParser 10 | { 11 | Q_DECLARE_TR_FUNCTIONS(QCmdLineParser) 12 | public: 13 | QCmdLineParser(const QString &description = QString()); 14 | ~QCmdLineParser(); 15 | 16 | /** 17 | * Parse the args and return a nice QVarianMap, if \p error = 0 18 | * and an error occur the error message is printed on stdout and 19 | * the program exits with error code = 1, otherwise the error 20 | * message is stored on error pointer. 21 | */ 22 | QVariantMap parse(int argc, const char **argv, QString *error = 0) const; 23 | QVariantMap parse(const QStringList &args, QString *error = 0) const; 24 | void addOption(const QCmdLineArgument &option); 25 | 26 | // This is only needed when calling usage() or help() methods by your own 27 | // the automatic stuff will use argv[0] unless you set the application name. 28 | void setApplicationName(const QString &name); 29 | 30 | // disable -h and --help options 31 | void disableHelpOption(); 32 | 33 | // overload for syntax sugar 34 | void addOption(const char *option, QCmdLineArgument::Action action, const QString &help = QString(), const QString &alias = QString(), const QString &valueName = QString()); 35 | void addOption(const char *option, const QString &help = QString(), const QString &valueName = QString()); 36 | 37 | QString usage() const; 38 | void setUsage(const QString &usage); 39 | 40 | QString help() const; 41 | 42 | // NOTE: 43 | // IMO is better to provide more syntax sugars, because the act of create a 44 | // QCmdLineOption object and set their properties is a bit boring. 45 | private: 46 | Q_DISABLE_COPY(QCmdLineParser) 47 | 48 | class QCmdLineParserPrivate; 49 | QCmdLineParserPrivate * const m_d; 50 | }; 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /src/wifi/QScanResult.cpp: -------------------------------------------------------------------------------- 1 | #include "QScanResult.h" 2 | #include "algorithms/Keygen.h" 3 | #include "WirelessMatcher.h" 4 | 5 | QScanResult::QScanResult(QString ssid, QString bssid, QString capabilities, int freq, 6 | int level) : 7 | ssid(ssid), bssid(bssid.toUpper()), capabilities(capabilities), 8 | frequency(freq), level(level) , keygens(NULL){ 9 | } 10 | 11 | QScanResult::~QScanResult(){ 12 | if ( keygens != NULL ){ 13 | for ( int i = 0 ; i < keygens->size(); ++i ) 14 | delete keygens->at(i); 15 | delete keygens; 16 | } 17 | } 18 | 19 | QString QScanResult::getMacAddress() const { 20 | return bssid; 21 | } 22 | 23 | QString QScanResult::getSsidName() const { 24 | return ssid; 25 | } 26 | 27 | QString QScanResult::getEncryption() const { 28 | return capabilities; 29 | } 30 | 31 | int QScanResult::getLevel() const { 32 | return level; 33 | } 34 | 35 | int QScanResult::getFrequency() const { 36 | return frequency; 37 | } 38 | 39 | QVector * QScanResult::getKeygens() const { 40 | return keygens; 41 | } 42 | 43 | void QScanResult::checkSupport(WirelessMatcher & matcher){ 44 | keygens = matcher.getKeygens(ssid, bssid); 45 | } 46 | 47 | int QScanResult::getSupportState() const{ 48 | if ( keygens == NULL || keygens->size() == 0) 49 | return Keygen::UNSUPPORTED; 50 | for ( int i = 0; i < keygens->size(); ++i){ 51 | if ( keygens->at(i)->getSupportState() == Keygen::SUPPORTED ) 52 | return Keygen::SUPPORTED; 53 | } 54 | return Keygen::UNLIKELY; 55 | } 56 | 57 | const QString QScanResult::PSK = "PSK"; 58 | const QString QScanResult::WEP = "WEP"; 59 | const QString QScanResult::EAP = "EAP"; 60 | const QString QScanResult::OPEN = "Open"; 61 | 62 | bool QScanResult::isLocked() const{ 63 | return OPEN != getScanResultSecurity(this); 64 | } 65 | 66 | /** 67 | * @return The security of a given {@link ScanResult}. 68 | */ 69 | QString QScanResult::getScanResultSecurity(const QScanResult * scanResult) { 70 | QString cap = scanResult->capabilities; 71 | QString securityModes[] = {WEP, PSK, EAP}; 72 | for (int i = sizeof(securityModes)/sizeof(QString)-1; i >= 0; i--) { 73 | if (cap.contains(securityModes[i])) { 74 | return securityModes[i]; 75 | } 76 | } 77 | return OPEN; 78 | } 79 | -------------------------------------------------------------------------------- /src/wifi/QScanResult.h: -------------------------------------------------------------------------------- 1 | /* 2 | * QScanResult.h 3 | * 4 | * Created on: 3 de Ago de 2012 5 | * Author: ruka 6 | */ 7 | 8 | #ifndef QSCANRESULT_H_ 9 | #define QSCANRESULT_H_ 10 | #include 11 | #include 12 | 13 | class WirelessMatcher; 14 | class Keygen; 15 | 16 | class QScanResult { 17 | public: 18 | QScanResult(QString ssid, QString bssid, QString capabilities = "", int freq = 0, int level= 0) ; 19 | virtual ~QScanResult(); 20 | bool isLocked() const; 21 | 22 | QString getMacAddress() const; 23 | QString getSsidName() const; 24 | int getLevel() const; 25 | int getFrequency() const; 26 | QString getEncryption() const; 27 | int getSupportState() const; 28 | QVector * getKeygens() const; 29 | 30 | 31 | void checkSupport(WirelessMatcher & matcher); 32 | private: 33 | static QString getScanResultSecurity(const QScanResult * scanResult); 34 | 35 | // Constants used for different security types 36 | const static QString PSK; 37 | const static QString WEP; 38 | const static QString EAP; 39 | const static QString OPEN; 40 | QString ssid; 41 | QString bssid; 42 | QString capabilities; 43 | int frequency; 44 | int level; 45 | QVector * keygens; 46 | }; 47 | 48 | #endif /* QSCANRESULT_H_ */ 49 | -------------------------------------------------------------------------------- /src/wifi/QWifiManager.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Rui Araújo, Luís Fonseca 3 | * 4 | * This file is part of Router Keygen. 5 | * 6 | * Router Keygen is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Router Keygen is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Router Keygen. If not, see . 18 | */ 19 | #include "QWifiManager.h" 20 | #include 21 | 22 | 23 | #ifdef Q_OS_UNIX 24 | #ifdef Q_OS_MACX 25 | #include "QWifiManagerPrivateMac.h" 26 | QWifiManager::QWifiManager() : 27 | forceRefresh(false) , scan(NULL), impl(new QWifiManagerPrivateMac()){ 28 | 29 | connect(impl, SIGNAL(scanFinished(int)), this, SLOT(implScanFinished(int)));} 30 | #else 31 | #include "QWifiManagerPrivateUnix.h" 32 | QWifiManager::QWifiManager() : 33 | forceRefresh(false) , scan(NULL), impl(new QWifiManagerPrivateUnix()){ 34 | 35 | connect(impl, SIGNAL(scanFinished(int)), this, SLOT(implScanFinished(int)));} 36 | #endif 37 | #endif 38 | 39 | #ifdef Q_OS_WIN 40 | 41 | #include "QWifiManagerPrivateWin.h" 42 | QWifiManager::QWifiManager() : 43 | forceRefresh(false) , scan(NULL), impl(new QWifiManagerPrivateWin()){ 44 | 45 | connect(impl, SIGNAL(scanFinished(int)), this, SLOT(implScanFinished(int)));} 46 | 47 | #endif 48 | 49 | 50 | QWifiManager::~QWifiManager() { 51 | if (scan != NULL) { 52 | scan->terminate(); //we are using SIGTERM here because we really want it dead! 53 | scan->waitForFinished(); 54 | delete scan; 55 | } 56 | } 57 | void QWifiManager::startScan() { 58 | #ifdef Q_OS_UNIX 59 | if (forceRefresh) { 60 | if ( scan != NULL ){ 61 | if ( scan->state() == QProcess::NotRunning ) 62 | delete scan; 63 | else{ 64 | impl->startScan(); 65 | return; 66 | } 67 | } 68 | scan = new QProcess(this); 69 | QStringList args; 70 | args << "iwlist" << "scan"; 71 | scan->start("pkexec", args); 72 | } 73 | #endif 74 | impl->startScan(); 75 | } 76 | 77 | void QWifiManager::setForceScan(bool refresh) { 78 | forceRefresh = refresh; 79 | } 80 | 81 | QVector > & QWifiManager::getScanResults() { 82 | return impl->getScanResults(); 83 | } 84 | 85 | 86 | void QWifiManager::implScanFinished(int s){ 87 | emit scanFinished(s); 88 | } 89 | 90 | 91 | const QString QWifiManager::PSK = "PSK"; 92 | const QString QWifiManager::WEP = "WEP"; 93 | const QString QWifiManager::EAP = "EAP"; 94 | const QString QWifiManager::OPEN = "Open"; 95 | -------------------------------------------------------------------------------- /src/wifi/QWifiManager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * QWifiManager.h 3 | * 4 | * Created on: 3 de Ago de 2012 5 | * Author: ruka 6 | */ 7 | 8 | #ifndef QWIFIMANAGER_H_ 9 | #define QWIFIMANAGER_H_ 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | class QWifiManagerPrivate; 16 | class QScanResult; 17 | class QWifiManager: public QObject { 18 | Q_OBJECT 19 | public: 20 | QWifiManager() ; 21 | virtual ~QWifiManager(); 22 | void startScan(); 23 | QVector > & getScanResults(); 24 | enum SCAN_RESULT_STATE{ 25 | SCAN_OK = 0, 26 | ERROR_NO_NM, 27 | ERROR_NO_WIFI, 28 | ERROR_NO_WIFI_ENABLED, 29 | ERROR 30 | }; 31 | 32 | 33 | // Constants used for different security types 34 | const static QString PSK; 35 | const static QString WEP; 36 | const static QString EAP; 37 | const static QString OPEN; 38 | void setForceScan(bool); 39 | signals: 40 | void scanFinished(int); 41 | private slots: 42 | void implScanFinished(int); 43 | private: 44 | bool forceRefresh; 45 | QProcess * scan; 46 | QWifiManagerPrivate * impl; 47 | }; 48 | 49 | #endif /* QWIFIMANAGER_H_ */ 50 | -------------------------------------------------------------------------------- /src/wifi/QWifiManagerPrivate.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Rui Araújo, Luís Fonseca 3 | * 4 | * This file is part of Router Keygen. 5 | * 6 | * Router Keygen is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Router Keygen is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Router Keygen. If not, see . 18 | */ 19 | #include "QWifiManagerPrivate.h" 20 | 21 | 22 | QWifiManagerPrivate::QWifiManagerPrivate() { 23 | 24 | } 25 | 26 | QWifiManagerPrivate::~QWifiManagerPrivate() { 27 | } 28 | 29 | QVector > & QWifiManagerPrivate::getScanResults() { 30 | return scanResults; 31 | } 32 | 33 | void QWifiManagerPrivate::clearPreviousScanResults() { 34 | foreach ( QSharedPointer scanResult, scanResults ) 35 | scanResult.clear(); 36 | scanResults.clear(); 37 | } 38 | -------------------------------------------------------------------------------- /src/wifi/QWifiManagerPrivate.h: -------------------------------------------------------------------------------- 1 | /* 2 | * QWifiManagerPrivate.h 3 | * 4 | * Created on: 8 de Ago de 2012 5 | * Author: ruka 6 | */ 7 | 8 | #ifndef QWIFIMANAGERPRIVATE_H_ 9 | #define QWIFIMANAGERPRIVATE_H_ 10 | #include 11 | #include 12 | #include 13 | #include "QScanResult.h" 14 | 15 | class QWifiManagerPrivate: public QObject { 16 | Q_OBJECT 17 | public: 18 | QWifiManagerPrivate(); 19 | virtual ~QWifiManagerPrivate(); 20 | virtual void startScan() = 0; 21 | QVector > & getScanResults(); 22 | 23 | signals: 24 | void scanFinished(int); 25 | 26 | protected: 27 | QVector > scanResults; 28 | void clearPreviousScanResults(); 29 | }; 30 | 31 | #endif /* QWIFIMANAGERPRIVATE_H_ */ 32 | -------------------------------------------------------------------------------- /src/wifi/QWifiManagerPrivateMac.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Rui Araújo, Luís Fonseca 3 | * 4 | * This file is part of Router Keygen. 5 | * 6 | * Router Keygen is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Router Keygen is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Router Keygen. If not, see . 18 | */ 19 | #include "QWifiManagerPrivateMac.h" 20 | #include 21 | #include "QWifiManager.h" 22 | #include 23 | 24 | QWifiManagerPrivateMac::QWifiManagerPrivateMac() : scan(NULL), timerId(-1){ 25 | } 26 | 27 | QWifiManagerPrivateMac::~QWifiManagerPrivateMac() { 28 | if (scan != NULL) { 29 | scan->terminate(); //we are using SIGTERM here because we really want it dead! 30 | scan->waitForFinished(); 31 | delete scan; 32 | } 33 | } 34 | 35 | void QWifiManagerPrivateMac::startScan() { 36 | if ( timerId == -1 ) 37 | timerId = startTimer(120000); 38 | if (scan != NULL ) { 39 | if ( scan->state() == QProcess::NotRunning ) 40 | delete scan; 41 | else 42 | return; 43 | } 44 | scan = new QProcess(); 45 | QStringList args; 46 | args << "-s"; 47 | connect(scan, SIGNAL(finished(int)), this, SLOT(parseResults())); 48 | scan->start("/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport", args); 49 | } 50 | 51 | 52 | void QWifiManagerPrivateMac::parseResults() { 53 | QString reply(scan->readAllStandardOutput()); 54 | QStringList lines = reply.split("\n"); 55 | QString ssid, bssid, enc; 56 | int level; 57 | clearPreviousScanResults(); 58 | if ( lines.size() <= 1 ){ 59 | emit scanFinished(QWifiManager::SCAN_OK); 60 | return; 61 | } 62 | int ssidLimit = lines.at(0).indexOf("BSSID"); 63 | if (ssidLimit == -1 ){ 64 | emit scanFinished(QWifiManager::SCAN_OK); 65 | return; 66 | } 67 | for (int i = 1; i < lines.size(); ++i) { 68 | ssid = lines.at(i).left(ssidLimit).trimmed(); 69 | if ( ssid.length() == 0) 70 | continue; 71 | bssid = lines.at(i).mid(ssidLimit,17).toUpper(); 72 | level = lines.at(i).mid(ssidLimit+18,4).trimmed().toInt() + 100; 73 | if ( lines.at(i).contains("PSK") ) 74 | enc = "PSK"; 75 | else if ( lines.at(i).contains("EAP") ) 76 | enc = "EAP"; 77 | else if ( lines.at(i).contains("WEP") ) 78 | enc = "WEP"; 79 | else 80 | enc = "Open"; 81 | scanResults.append(QSharedPointer(new QScanResult(ssid, bssid, enc, 0, level))); 82 | } 83 | emit scanFinished(QWifiManager::SCAN_OK); 84 | 85 | } 86 | 87 | void QWifiManagerPrivateMac::timerEvent(QTimerEvent *) 88 | { 89 | // qDebug() << "Rescanning"; 90 | startScan(); 91 | } 92 | -------------------------------------------------------------------------------- /src/wifi/QWifiManagerPrivateMac.h: -------------------------------------------------------------------------------- 1 | /* 2 | * QWifiManagerPrivateMac.h 3 | * 4 | * Created on: 8 de Ago de 2012 5 | * Author: ruka 6 | */ 7 | 8 | #ifndef QWIFIMANAGERPRIVATEMAC_H_ 9 | #define QWIFIMANAGERPRIVATEMAC_H_ 10 | 11 | #include "QWifiManagerPrivate.h" 12 | #include 13 | #include 14 | 15 | class QWifiManagerPrivateMac: public QWifiManagerPrivate { 16 | Q_OBJECT 17 | public: 18 | QWifiManagerPrivateMac(); 19 | virtual ~QWifiManagerPrivateMac(); 20 | void startScan(); 21 | 22 | protected: 23 | void timerEvent(QTimerEvent *event); 24 | 25 | 26 | private slots: 27 | void parseResults(); 28 | 29 | private: 30 | QProcess * scan; 31 | int timerId; 32 | }; 33 | 34 | #endif /* QWIFIMANAGERPRIVATEMAC_H_ */ 35 | -------------------------------------------------------------------------------- /src/wifi/QWifiManagerPrivateUnix.h: -------------------------------------------------------------------------------- 1 | /* 2 | * QWifiManagerPrivateUnix.h 3 | * 4 | * Created on: 8 de Ago de 2012 5 | * Author: ruka 6 | */ 7 | 8 | #ifndef QWIFIMANAGERPRIVATEUNIX_H_ 9 | #define QWIFIMANAGERPRIVATEUNIX_H_ 10 | 11 | #include "QWifiManagerPrivate.h" 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | class QWifiManagerPrivateUnix: public QWifiManagerPrivate { 19 | Q_OBJECT 20 | public: 21 | QWifiManagerPrivateUnix(); 22 | virtual ~QWifiManagerPrivateUnix(); 23 | void startScan(); 24 | private slots: 25 | void updateAccessPoints(); 26 | 27 | private: 28 | QDBusInterface * wirelessDevice; 29 | }; 30 | 31 | #endif /* QWIFIMANAGERPRIVATEUNIX_H_ */ 32 | -------------------------------------------------------------------------------- /src/wifi/QWifiManagerPrivateWin.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Rui Araújo, Luís Fonseca 3 | * 4 | * This file is part of Router Keygen. 5 | * 6 | * Router Keygen is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Router Keygen is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Router Keygen. If not, see . 18 | */ 19 | #include "QWifiManagerPrivateWin.h" 20 | #include 21 | #include "QWifiManager.h" 22 | 23 | QWifiManagerPrivateWin::QWifiManagerPrivateWin() : scan(NULL), timerId(-1){ 24 | } 25 | 26 | QWifiManagerPrivateWin::~QWifiManagerPrivateWin() { 27 | if (scan != NULL) { 28 | scan->terminate(); //we are using SIGTERM here because we really want it dead! 29 | scan->waitForFinished(); 30 | delete scan; 31 | } 32 | } 33 | 34 | void QWifiManagerPrivateWin::startScan() { 35 | if ( timerId == -1 ) 36 | timerId = startTimer(120000); 37 | if (scan != NULL ) { 38 | if ( scan->state() == QProcess::NotRunning ) 39 | delete scan; 40 | else 41 | return; 42 | } 43 | scan = new QProcess(); 44 | QStringList args; 45 | args << "wlan" << "show" << "network" << "mode=bssid"; 46 | connect(scan, SIGNAL(finished(int)), this, SLOT(parseResults())); 47 | scan->start("netsh", args); 48 | } 49 | 50 | void QWifiManagerPrivateWin::parseResults() { 51 | QString reply(scan->readAllStandardOutput()); 52 | //qDebug() << reply; 53 | QStringList lines = reply.split("\n"); 54 | QString ssid, bssid, enc; 55 | int level; 56 | clearPreviousScanResults(); 57 | for (int i = 0; i < lines.size(); ++i) { 58 | if (lines.at(i).contains("BSSID")) { 59 | bssid = lines.at(i).mid(lines.at(i).indexOf(":") + 2, 17).toUpper(); 60 | i++; 61 | int pos = lines.at(i).indexOf(":") + 2; 62 | level = lines.at(i).mid(pos, lines.at(i).indexOf("%") - pos).toInt( 63 | NULL, 10); 64 | scanResults.append(QSharedPointer ( new QScanResult(ssid, bssid, enc, 0, level))); 65 | } else if (lines.at(i).contains("SSID")) { 66 | ssid = lines.at(i).mid(lines.at(i).indexOf(":") + 2).remove("\n"); 67 | i += 2; 68 | enc = lines.at(i).mid(lines.at(i).indexOf(":") + 2); 69 | } 70 | 71 | } 72 | emit scanFinished(QWifiManager::SCAN_OK); 73 | } 74 | 75 | void QWifiManagerPrivateWin::timerEvent(QTimerEvent *) 76 | { 77 | // qDebug() << "Rescanning"; 78 | startScan(); 79 | } 80 | -------------------------------------------------------------------------------- /src/wifi/QWifiManagerPrivateWin.h: -------------------------------------------------------------------------------- 1 | /* 2 | * QWifiManagerPrivateWin.h 3 | * 4 | * Created on: 8 de Ago de 2012 5 | * Author: ruka 6 | */ 7 | 8 | #ifndef QWIFIMANAGERPRIVATEWIN_H_ 9 | #define QWIFIMANAGERPRIVATEWIN_H_ 10 | 11 | #include "QWifiManagerPrivate.h" 12 | #include 13 | #include 14 | 15 | class QWifiManagerPrivateWin: public QWifiManagerPrivate { 16 | Q_OBJECT 17 | public: 18 | QWifiManagerPrivateWin(); 19 | virtual ~QWifiManagerPrivateWin(); 20 | void startScan(); 21 | 22 | protected: 23 | void timerEvent(QTimerEvent *event); 24 | 25 | 26 | private slots: 27 | void parseResults(); 28 | 29 | private: 30 | QProcess * scan; 31 | int timerId; 32 | }; 33 | 34 | #endif /* QWIFIMANAGERPRIVATEWIN_H_ */ 35 | -------------------------------------------------------------------------------- /test/.gitignore: -------------------------------------------------------------------------------- 1 | test.pro.user.* 2 | *.o 3 | Makefile 4 | RouterKeygenTest 5 | *.moc 6 | qrc_resources.cpp 7 | -------------------------------------------------------------------------------- /test/test.pro: -------------------------------------------------------------------------------- 1 | QT += core \ 2 | testlib 3 | QT -= gui 4 | TARGET = RouterKeygenTest 5 | TEMPLATE = app 6 | SOURCES += \ 7 | ../src/algorithms/*.cpp \ 8 | ../src/WirelessMatcher.cpp \ 9 | ../src/config/*.cpp \ 10 | ../src/wifi/QScanResult.cpp \ 11 | AlgorithmsTest.cpp 12 | 13 | HEADERS += ../src/algorithms/*.h \ 14 | ../src/config/*.h \ 15 | ../src/wifi/QScanResult.h \ 16 | ../src/WirelessMatcher.h 17 | 18 | INCLUDEPATH += ../src/ 19 | LIBS += -lcrypto 20 | 21 | RESOURCES += ../resources/resources.qrc 22 | 23 | --------------------------------------------------------------------------------