Ejemplo n.º 1
0
QVector<QString> & OteBAUDKeygen::getKeys() {
    if (getMacAddress().length() != 12) {
        throw ERROR;
    }
    results.append("0"+getMacAddress().toLower());
	return results;
}
Ejemplo n.º 2
0
QVector<QString> & ZyxelKeygen::getKeys() {
	if (getMacAddress().size() != 12)
		throw ERROR;
	this->hash->reset();
	QString macMod = getMacAddress().left(8) + getSsidName().right(4);
    this->hash->addData(macMod.toLower().toLatin1());
    QString result = QString::fromLatin1(this->hash->result().toHex().data());
	result.truncate(20);
	this->results.append(result.toUpper());
	return results;
}
Ejemplo n.º 3
0
QVector<QString> & OteKeygen::getKeys() {
    if (getMacAddress().length() == 12) {
        results.append(getMacAddress().toLower());
    } else {
        QString ssidIdentifier = getSsidName().right(6);
        results.append("c87b5b" + ssidIdentifier);
        results.append("fcc897" + ssidIdentifier);
        results.append("681ab2" + ssidIdentifier);
        results.append("b075d5" + ssidIdentifier);
        results.append("384608" + ssidIdentifier);
    }
	return results;
}
Ejemplo n.º 4
0
void authenticator::generateSerial()
{
    v_printf("generate serial......\n");
    uint8_t ser[32];
    int fd = open("/dev/urandom", O_RDONLY);
    if (fd < 0) {
        v_printf("error\n");
    }
    int n;
    while((n = read(fd, ser, 32)) != 32)
        ;

    unsigned char mac[8];
    if (getMacAddress(mac) > 0 ) {
        v_printf("generated mac\n");
        for (int i = 0; i < 6; i++) {
            /*
             * Infect with mac
             */
            ser[i*3] = mac[i];
        }
    }

    char *s = BaseEncoder::encode(ser, 32);
    serial = s;
    storage::getInstance().addSerial(s);
    delete[] s;
}
Ejemplo n.º 5
0
QVector<QString> & PBSKeygen::getKeys() {
	SHA256 sha;

	QString macS = getMacAddress();
	if (macS.length() != 12) {
		throw ERROR;
	}

	char mac[6];
	bool status;
	for (int i = 0; i < 12; i += 2)
		mac[i / 2] = (macS.mid(i, 1).toInt(&status, 16) << 4)
				+ macS.mid(i + 1, 1).toInt(&status, 16);
	if (!status)
		throw ERROR;
	sha.reset();
	sha.addData(saltSHA256, (unsigned long)sizeof(saltSHA256));
	sha.addData(mac, (unsigned long)sizeof(mac));

	unsigned char hash[32];
	sha.result((unsigned char *) hash);
	QString key = "";
	for (int i = 0; i < 13; ++i) {
		key.append(lookup.at(hash[i] % lookup.length()));
	}
	results.append(key);
	return results;
}
Ejemplo n.º 6
0
QVector<QString> & AxtelKeygen::getKeys() {
    QString mac = getMacAddress();
    if ( mac.length() != 12 )
        throw ERROR;
    results.append(mac.mid(2).toUpper());
	return results;
}
Ejemplo n.º 7
0
QVector<QString> & AxtelKeygen::getKeys() {
    QString mac = getMacAddress();
    QString macShort = mac.replace(":", "");
    bool gotResult = false;
    
    if ( macShort.length() != 12 )
        throw ERROR;
        
    QString ssidSubpart = getSsidName().right(4);
    if ( ssidSubpart.toLower() == macShort.right(4).toLower()) {
        results.append(mac.mid(2).toUpper());
        gotResult = true;
    }

    //WPA = (Second octet + 1) + (Fourth octect) + (Fifth octect) + (Sixth octect - 1)
    if (macShort.right(2).toInt(0, 16)-1 == ssidSubpart.right(2).toInt(0, 16)) {
        QString M1 = QString("%1").arg(mac.mid(2, 2).toInt(0, 16) + 1, 2, 16, QChar('0'));
        QString M2 = mac.mid(6, 2);
       
        QString wpaKey = M1 + M2 + ssidSubpart;

        results.append(wpaKey.toUpper());
	    gotResult = true;
	}
	
	if (gotResult) {
	    return results;
	} else {
	    throw ERROR;
	}
}
Ejemplo n.º 8
0
QVector<QString> & PtvKeygen::getKeys() {
    QString mac = getMacAddress();
    if ( mac.size() != 12 )
            throw ERROR;
    results.append(mac.toUpper());
	return results;
}
Ejemplo n.º 9
0
static NXCTRL_VOID
displayConnInfo (LPNXCTRLAPP pApp) {
  struct ifaddrs *ifaddr, *ifa;
  int n;
  char rchHost[NI_MAXHOST];
  char rchBuffer[1024];
  char rchGW[32];
  char rchMacIP[20];
  int nLink, nLevel, nNoise;

  pApp->clearDisplay();
  pApp->setCursor(0, 0);

  if (getifaddrs(&ifaddr) == -1) {
    pApp->writeSTR("ERROR IN CONN INFO");
    pApp->updateDisplay();
    return;
  }

  pApp->setCursor(FONT_WIDTH*3, 0);
  pApp->writeSTR("CONNECTION INFO");

  pApp->setCursor(0, FONT_HEIGHT + 8);

  for (ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next) {
    if (ifa->ifa_addr == NULL) continue;
    n = getnameinfo(ifa->ifa_addr, sizeof(struct sockaddr_in),
                    rchHost, NI_MAXHOST, NULL, 0, NI_NUMERICHOST);
    if (n == 0 && strcmp("lo", ifa->ifa_name)) {
      memset(rchBuffer, 0, 1024);
      sprintf(rchBuffer, "%5s: %s\n", ifa->ifa_name, rchHost);
      pApp->writeSTR(rchBuffer);
    }
  }
  if (getDefaultGW(rchGW)) {
    sprintf(rchBuffer, "%5s: %s\n", "gw", rchGW);
    pApp->writeSTR(rchBuffer);
  }

  if (getWIFIInfo(&nLink, &nLevel, &nNoise)) {
    int nCount;
    sprintf(rchBuffer, "%d/%d/%d", nLink, nLevel, nNoise);
    nCount = (21 - strlen(rchBuffer))/2;
    nCount = nCount < 0 ? 0 : nCount;
    pApp->setCursor(nCount*FONT_WIDTH, 47);
    pApp->writeSTR(rchBuffer);
  }

  pApp->setCursor(0, 57);
  if (getMacAddress("wlan0", rchMacIP)) {
    sprintf(rchBuffer, "  %s", rchMacIP);
    pApp->writeSTR(rchBuffer);
  }

  pApp->updateDisplay();
}
Ejemplo n.º 10
0
const string CCNativeWin32::getUDID()
{
	if (m_macAddress.length() <= 0)
	{
		if (!getMacAddress(m_macAddress))
		{
			m_macAddress = "udid-fixed-1234567890";
		}
	}

	return m_macAddress;
}
std::string PlayerWin::getUserGUID()
{
    if (_userGUID.length() <= 0)
    {
        if (!getMacAddress(_userGUID))
        {
            _userGUID = "guid-fixed-1234567890";
        }
    }

    return _userGUID;
}
Ejemplo n.º 12
0
bool CLASS::probeHardware( void )
{
    // Cache the initial hardware settings auto-loaded from
    // the EEPROM on hardware reset.

    fRegSRR  = ReadReg(SRR) & SRR_REV_MASK;
    fRegCFG  = ReadReg(CFG);
    DEBUG_LOG("Initial SRR = %lx, CFG = %lx\n", fRegSRR, fRegCFG);

    getMacAddress();

    return true;
}
Ejemplo n.º 13
0
InterfaceState getInterfaceState(const std::string &interfaceName)
{
    InterfaceState state;

    if (!interfaceName.empty())
    {
        ifaddrs *interfaces = nullptr;

        if (getifaddrs(&interfaces) == 0)
        {
            try
            {
                for (ifaddrs *interface = interfaces; interface; interface = interface->ifa_next)
                {
                    if (interface->ifa_name == interfaceName)
                    {
                        state.interface = interfaceName;
                        state.macAddress = getMacAddress(interfaceName);

                        if (reinterpret_cast<sockaddr_in*>(interface->ifa_addr)->sin_family == AF_INET)
                        {
                            state.flags = interface->ifa_flags;
                            state.address = inet_ntoa(reinterpret_cast<sockaddr_in*>(interface->ifa_addr)->sin_addr);
                            state.maskAddress = inet_ntoa(reinterpret_cast<sockaddr_in*>(interface->ifa_netmask)->sin_addr);
                            state.broadcastAddress = inet_ntoa(reinterpret_cast<sockaddr_in*>(interface->ifa_broadaddr)->sin_addr);
                            state.addressState = true;

                            break;
                        }
                        else
                            state.addressState = false;
                    }
                }
            }
            catch (...)
            {
                freeifaddrs(interfaces);

                throw;
            }

            freeifaddrs(interfaces);
        }
        else
            throw std::system_error(errno, std::generic_category(), "Network error: unable to read interfaces -");
    }

    return state;
}
Ejemplo n.º 14
0
QVector<QString> & EircomKeygen::getKeys() {
	bool status = false;
	QString result = dectoString(
			getMacAddress().right(6).toInt(&status, 16) + 0x01000000)
			+ "Although your world wonders me, ";
	if (!status)
		throw ERROR;
	result =
            QString::fromLatin1(
                    QCryptographicHash::hash(result.toLatin1(),
							QCryptographicHash::Sha1).toHex().data());
	result.truncate(26);
	results.append(result);
	return results;
}
Ejemplo n.º 15
0
QVector<QString> & SitecomKeygen::getKeys() {
    QString mac = getMacAddress();
    if ( mac.length() < 12 ) {
        throw ERROR;
    }
    generateKey(mac);
    QString shortMac = mac.left(11);
    int lastChar = mac.right(1).toInt(0, 16);
    lastChar = (lastChar + 1) % 0x10;
    generateKey(shortMac + QString::number(lastChar, 16).toUpper());
    lastChar = (lastChar + 1) % 0x10;
    generateKey(shortMac + QString::number(lastChar, 16).toUpper());
	return results;

}
void TimeSpiderSettingsDialog::requestLogin( )
{
	QtSoapMessage request;
	request.setMethod( "request-login", SERVICE_NAMESPACE );
	request.addMethodArgument( "email", "", email->text( ) );
	request.addMethodArgument( "uid", "", getMacAddress( ) );
    
	QString xml = request.toXmlString( );
	qDebug( ) << "Sending SOAP request: " << xml;

	m_soap.setHost( serviceHost->text( ), serviceUseSSL->isChecked( ), servicePort->value( ) );
	m_soap.submitRequest( request, servicePath->text( ) );

	QApplication::setOverrideCursor( QCursor( Qt::WaitCursor ) );
}
Ejemplo n.º 17
0
bool authenticator::validateSerial()
{
    int len;
    unsigned char *ser = BaseEncoder::decode(serial.c_str(), serial.length(), &len);
    unsigned char mac[8];
    if (getMacAddress(mac) > 0 ) {
        v_printf("validating\n");
        for (int i = 0; i < 6; i++)
            if (ser[i*3] != mac[i])
                return false;
    }
    delete[] ser;
    v_printf("serial is valid\n");
    return true;
}
Ejemplo n.º 18
0
QVector<QString> & SkyV1Keygen::getKeys() {
	QString mac = getMacAddress();
	if (mac.size() != 12)
		throw ERROR;
    QByteArray hash = QCryptographicHash::hash(mac.toLatin1(),
			QCryptographicHash::Md5);

	QString key = "";
	for (int i = 1; i <= 15; i += 2) {
		unsigned char index = hash[i];
		index %= 26;
		key += ALPHABET.at(index);
	}
	this->results.append(key);
	return results;
}
Ejemplo n.º 19
0
/** Get the unique name of this server
  *
  * \return A std::string that contains the name or \c "" if not found
  *
  */
std::string RainbruRPG::Server::UniqueName::getUniqueName(void){
  std::string svr="svr";
  std::string mac=getMacAddress("eth0");
  svr+=mac;

  if (mac==""){
    LOGE("Cannot found mac address for eth0");
    return "";
  }
  else{
    LOGCATS("Server's unique name is ");
    LOGCATS(svr.c_str());
    LOGCAT();
    return svr;
  }
}
Ejemplo n.º 20
0
//*****************************************************************************
//! registerMdnsService
//!
//! Registers the mDNS Service.
//!
//! Service settings for type and port are set in simplelinklibrary.h
//!
//! Returns: On success returns 0
//!
//****************************************************************************
int registerMdnsService()
{
	int iretVal;
	unsigned int i;

	// Create mDNS Service Name
	for (i = 0; i < 40; i++)
		mdnsServiceName[i] = 0x00;

	// Obtain the device name
	char * deviceName = getDeviceName();

	strcat(mdnsServiceName, (const char *)deviceName);
	strcat(mdnsServiceName, MDNS_SERVICE);

	// Create mDNS Text
	for (i = 0; i < 50; i++)
		mdnsText[i] = 0x00;

	// Obtain the MAC Address
	char * macAddress = getMacAddress();

	strcat(mdnsText, "mac=");
	strcat(mdnsText, macAddress);
	strcat(mdnsText, ";ver=");
	strcat(mdnsText, DEVICE_VERSION);
	strcat(mdnsText, ";man=");
	strcat(mdnsText, DEVICE_MANUFACTURE);
	strcat(mdnsText, ";mod=");
	strcat(mdnsText, DEVICE_MODEL);
	strcat(mdnsText, "\0");

	int strSvrLength = strlen(mdnsServiceName);
	int strTxtLength = strlen(mdnsText);

	//Unregisters the mDNS service.
	unregisterMdnsService();

	//Registering for the mDNS service.
	iretVal = sl_NetAppMDNSRegisterService((const signed char *)mdnsServiceName,strlen(mdnsServiceName),
			(const signed char *)mdnsText,strlen(mdnsText)+1, UDPPORT, TTL, UNIQUE_SERVICE);

	return iretVal;
}
Ejemplo n.º 21
0
void ethIfInitialize(Properties* properties)
{
    UInt32 nameLen;

    ethIf.ifCount = 1;

    strcpy(ethIf.devList[0].description, langTextNone());
    memcpy(ethIf.devList[0].macAddress, InvalidMac, 6);

    if (!properties->ports.Eth.disabled) {
        if (loadPacketLibrary()) {
	        pcapPacketGetAdapterNames(NULL, &nameLen);
            if (nameLen > 0) {
                char* nameStr = malloc(nameLen);

	            if (pcapPacketGetAdapterNames(nameStr, &nameLen)) {
                    char* devName;

                    for (devName = nameStr; *devName; devName += strlen(devName) + 1) {
                        if (!getMacAddress(devName, ethIf.devList[ethIf.ifCount].macAddress)) {
                            continue;
                        }

                        sprintf(ethIf.devList[ethIf.ifCount].description, "[%s]  - %s",
                                mactos(ethIf.devList[ethIf.ifCount].macAddress), iptos(getIpAddress(devName)));
                        strcpy(ethIf.devList[ethIf.ifCount].devName, devName);

                        if (++ethIf.ifCount == 32) {
                            break;
                        }
                    }
                }
                free(nameStr);
            }
        }
    }

    ethIf.currIf = properties->ports.Eth.ethIndex;
    if (ethIf.currIf < 0 || ethIf.currIf >= ethIf.ifCount) {
        ethIf.currIf = 0;
    }

    parseMac(ethIf.defaultMac, properties->ports.Eth.macAddress);
}
Ejemplo n.º 22
0
QVector<QString> & ArcadyanKeygen::getKeys() {
	QString mac = getMacAddress();
	if (mac.length() != 12) {
		throw ERROR;
	}
	bool status;
	QString C1 = "";
	C1.setNum(mac.right(4).toInt(&status, 16),10);

	while (C1.length() < 5)
		C1 = "0" + C1;

	unsigned char S7 = C1.mid(1,1).toInt(&status, 16);
	unsigned char S8 = C1.mid(2,1).toInt(&status, 16);
	unsigned char S9 = C1.mid(3,1).toInt(&status, 16);
	unsigned char S10 = C1.mid(4,1).toInt(&status, 16);
	unsigned char M9 = mac.mid(8,1).toInt(&status, 16);
	unsigned char M10 = mac.mid(9,1).toInt(&status, 16);
	unsigned char M11 = mac.mid(10,1).toInt(&status, 16);
	unsigned char M12 = mac.mid(11,1).toInt(&status, 16);
	if ( !status  )
		throw ERROR;

    unsigned int K1 = (S7 + S8 + M11 + M12) & 0x0f;
    unsigned int K2 = (M9 + M10 +S9 + S10) & 0x0f;

	QString X1;X1.setNum(K1 ^ S10, 16);
	QString X2;X2.setNum(K1 ^ S9, 16);
	QString X3;X3.setNum(K1 ^ S8, 16);
	QString Y1;Y1.setNum(K2 ^ M10, 16);
	QString Y2;Y2.setNum(K2 ^ M11, 16);
	QString Y3;Y3.setNum(K2 ^ M12, 16);
	QString Z1;Z1.setNum(M11 ^ S10, 16);
	QString Z2;Z2.setNum(M12 ^ S9, 16);
	QString Z3;Z3.setNum(K1 ^ K2, 16);

	QString wpaKey = X1 + Y1 + Z1 + X2 + Y2 + Z2 + X3 + Y3 + Z3;
	results.append(wpaKey.toUpper());

    if (wpaKey.indexOf('0')!=-1) {
        results.append(wpaKey.replace("0", "1").toUpper());
    }
	return results;
}
Ejemplo n.º 23
0
QVector<QString> & AliceGermanyKeygen::getKeys() {
    QString mac = getMacAddress();
    if (mac.size() != 12)
        throw ERROR;
    QString macEth = mac.right(6);
    int macEthInt = macEth.toInt(NULL, 16)-1;
    if ( macEthInt < 0 )
        macEthInt = 0xFFFFFF;
    macEth.setNum(macEthInt, 16);
    while ( macEth.size() < 6 )
        macEth = "0"+ macEth;
    macEth = mac.left(6) + macEth;
    this->hash->reset();
    this->hash->addData(macEth.toLower().toLatin1());
    QString result = QString::fromLatin1(this->hash->result().toHex().data());
    result.truncate(12);
    this->results.append(QString(result.toLatin1().toBase64()));
    return results;
}
Ejemplo n.º 24
0
int VBoxNetDhcp::init()
{
    int rc = this->VBoxNetBaseService::init();
    AssertRCReturn(rc, rc);

    NetworkManager *netManager = NetworkManager::getNetworkManager();

    netManager->setOurAddress(getIpv4Address());
    netManager->setOurNetmask(getIpv4Netmask());
    netManager->setOurMac(getMacAddress());
    netManager->setService(this);

    if (isMainNeeded())
        rc = initWithMain();
    else
        rc = initNoMain();

    AssertRCReturn(rc, rc);

    return VINF_SUCCESS;
}
Ejemplo n.º 25
0
QVector<QString> & OteHuaweiKeygen::getKeys() {
    QString mac = getMacAddress();
    if (mac.length() != 12) {
        throw ERROR;
    }
    QStringList magic = magicValues.split(" ");
    QString series = mac.left(2) + mac.mid(6, 2);
    int point;
    if (series == "E8FD" )
        point = 0;
    else if (series == "E8F5")
        point = 1;
    else if (series == "E8F6")
        point = 2;
    else
        return results;
    if (point >= magic.length())
        return results;
    QString pass = "******" + magic.at(point);
    results.append(pass.mid(pass.length() - 8));
    return results;
}
Ejemplo n.º 26
0
QVector<QString> & BssidKeygen::getKeys() {
    QString mac = getMacAddress();
    if ( mac.length() != 12 )
        throw ERROR;

    /* Apply offset value */
    if (offset != 0) {
        QString shortMac = mac.left(10);
        int last = mac.right(2).toInt(0, 16);
        mac = shortMac + QString("%1").arg(last + offset, 2, 16, QLatin1Char('0')).right(2);
    }
    
    /* Check flags */
    if (flags & FlagLen8) {
        if (flags & FlagUc)
            results.append(mac.right(8).toUpper());
        if (flags & FlagLc)
            results.append(mac.right(8).toLower());
    }
    if (flags & FlagLen10) {
        if (flags & FlagUc)
            results.append(mac.right(10).toUpper());
        if (flags & FlagLc)
            results.append(mac.right(10).toLower());
    }
    if (flags & FlagLen12) {
        if (flags & FlagUc)
            results.append(mac.toUpper());
        if (flags & FlagLc)
            results.append(mac.toLower());
    }

    if (results.isEmpty())
        throw ERROR;

    return results;
}
Ejemplo n.º 27
0
QVector<QString> & HG824xKeygen::getKeys() {
    QString mac = getMacAddress();
    if ( mac.size() != 12 )
            throw ERROR;
    QString wpaPassword;
    wpaPassword.append(mac.mid(6,2));
    int lastPair = mac.mid(10,2).toInt(0, 16);
    if ( lastPair <= 8 ) {
        int fifthPair = (mac.mid(8, 2).toInt(0, 16) - 1) & 0xFF;
        wpaPassword.append(QString::number(fifthPair, 16));
    } else {
        wpaPassword.append(mac.mid(8,2));
    }
    int lastChar = mac.mid(11).toInt(0, 16);
    if ( lastChar <= 8 ) {
        int nextPart = (mac.mid(10,1).toInt(0, 16)-1) & 0xF;
        wpaPassword.append(QString::number(nextPart, 16));
    } else {
        wpaPassword.append(mac.mid(10,1));
    }
    switch (lastChar) {
        case 8:
            wpaPassword.append("F");
            break;
        case 9:
            wpaPassword.append("0");
            break;
        case 0xA:
            wpaPassword.append("1");
            break;
        case 0xB:
            wpaPassword.append("2");
            break;
        case 0xC:
            wpaPassword.append("3");
            break;
        case 0xD:
            wpaPassword.append("4");
            break;
        case 0xE:
            wpaPassword.append("5");
            break;
        case 0xF:
            wpaPassword.append("6");
            break;
        case 0:
            wpaPassword.append("7");
            break;
        case 1:
            wpaPassword.append("8");
            break;
        case 2:
            wpaPassword.append("9");
            break;
        case 3:
            wpaPassword.append("A");
            break;
        case 4:
            wpaPassword.append("B");
            break;
        case 5:
            wpaPassword.append("C");
            break;
        case 6:
            wpaPassword.append("D");
            break;
        case 7:
            wpaPassword.append("E");
            break;
        default:
            throw ERROR;
    }
    QHash<QString, QString> lastPasswordHash;
    lastPasswordHash["00"] = "0D";
    lastPasswordHash["08"] = "05";
    lastPasswordHash["10"] = "0E";
    lastPasswordHash["20"] = "1F";
    lastPasswordHash["28"] = "03";
    lastPasswordHash["48"] = "24";
    lastPasswordHash["70"] = "20";
    lastPasswordHash["80"] = "06";
    lastPasswordHash["AC"] = "1A";
    lastPasswordHash["CC"] = "12";
    lastPasswordHash["D4"] = "35";
    lastPasswordHash["E0"] = "0C";
    lastPasswordHash["F8"] = "21";
    if (!lastPasswordHash.contains(mac.mid(0,2))) {
        throw ERROR;
    }
    wpaPassword.append(lastPasswordHash[mac.mid(0,2)]);
    results.append(wpaPassword.toUpper());
	return results;
}
Ejemplo n.º 28
0
QVector<QString> & AliceItalyKeygen::getKeys() {

	if (supportedAlice->isEmpty())
        throw ERROR;
    SHA256_CTX sha;
    unsigned char hash[32];

	bool status;

	for (int j = 0; j < supportedAlice->size(); ++j) {/*For pre AGPF 4.5.0sx*/
		QString serialStr = supportedAlice->at(j)->serial + "X";
        int k = supportedAlice->at(j)->magic[0];
        int Q = supportedAlice->at(j)->magic[1];
		int serial = (getSsidName().right(8).toInt(&status, 10) - Q) / k;
		QString tmp = "";
		tmp.setNum(serial);
		for (int i = 0; i < 7 - tmp.length(); i++) {
			serialStr += "0";
		}
		serialStr += tmp;

		char mac[6];
		QString key = "";

		QString macS = getMacAddress();
		if (macS.size() == 12) {

			for (int i = 0; i < 12; i += 2)
				mac[i / 2] = (macS.mid(i, 1).toInt(&status, 16) << 4)
						+ macS.mid(i + 1, 1).toInt(&status, 16);

			/* Compute the hash */
            SHA256_Init(&sha);
            SHA256_Update(&sha, (const void *) ALICE_SEED, sizeof(ALICE_SEED));
            SHA256_Update(&sha, (const void *) serialStr.toLatin1().data(), serialStr.size());
            SHA256_Update(&sha, (const void *) mac, sizeof(mac));
            SHA256_Final(hash, &sha);

			for (int i = 0; i < 24; ++i) {
				key += preInitCharset.at(hash[i] & 0xFF);
			}
			if (!results.contains(key))
				results.append(key);
		}

		/*For post AGPF 4.5.0sx*/
		QString macEth = macS.left(6);
        for (int extraNumber = 0;extraNumber < 10; ++extraNumber) {
			QString calc = "";
			calc.setNum(extraNumber);
			calc += getSsidName().right(8);
			calc.setNum(calc.toInt(&status, 10), 16);
			calc = calc.toUpper();
			if (macEth.at(5) == calc.at(0)) {
				macEth += calc.right(6);
				break;
            }
		}

        if (macEth == macS.left(6)) {
            continue;
        }
		for (int i = 0; i < 12; i += 2)
			mac[i / 2] = (macEth.mid(i, 1).toInt(&status, 16) << 4)
					+ macEth.mid(i + 1, 1).toInt(&status, 16);
		/* Compute the hash */
        SHA256_Init(&sha);
        SHA256_Update(&sha, (const void *) ALICE_SEED, sizeof(ALICE_SEED));
        SHA256_Update(&sha, (const void *) serialStr.toLatin1().data(), serialStr.size());
        SHA256_Update(&sha, (const void *) mac, sizeof(mac));
        SHA256_Final(hash, &sha);

		key = "";
		for (int i = 0; i < 24; ++i)
			key += preInitCharset.at(hash[i] & 0xFF);
		if (!results.contains(key))
			results.append(key);
	}
	return results;

}
Ejemplo n.º 29
0
const char *Interface::getMacAddressStr() {
	unsigned const char *mac = getMacAddress();
	sprintf(mac_str,"%.2x:%.2x:%.2x:%.2x:%.2x:%.2x", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
	return mac_str;
}
Ejemplo n.º 30
0
QVector<QString> & HuaweiKeygen::getKeys() {
    int a0[]= {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
    int a1[]= {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
    int a2[]= {0,13,10,7,5,8,15,2,10,7,0,13,15,2,5,8};
    int a3[]= {0,1,3,2,7,6,4,5,15,14,12,13,8,9,11,10};
    int a5[]= {0,4,8,12,0,4,8,12,0,4,8,12,0,4,8,12};
    int a7[]= {0,8,0,8,1,9,1,9,2,10,2,10,3,11,3,11};
    int a8[]= {0,5,11,14,6,3,13,8,12,9,7,2,10,15,1,4};
    int a10[]= {0,14,13,3,11,5,6,8,6,8,11,5,13,3,0,14};
    int a14[]= {0,1,3,2,7,6,4,5,14,15,13,12,9,8,10,11};
    int a15[]= {0,1,3,2,6,7,5,4,13,12,14,15,11,10,8,9};
    int n5[]= {0,5,1,4,6,3,7,2,12,9,13,8,10,15,11,14};
    int n6[]= {0,14,4,10,11,5,15,1,6,8,2,12,13,3,9,7};
    int n7[]= {0,9,0,9,5,12,5,12,10,3,10,3,15,6,15,6};
    int n11[]= {0,14,13,3,9,7,4,10,6,8,11,5,15,1,2,12};
    int n12[]= {0,13,10,7,4,9,14,3,10,7,0,13,14,3,4,9};
    int n13[]= {0,1,3,2,6,7,5,4,15,14,12,13,9,8,10,11};
    int n14[]= {0,1,3,2,4,5,7,6,12,13,15,14,8,9,11,10};
    int n31[]= {0,10,4,14,9,3,13,7,2,8,6,12,11,1,15,5};
    int key[]= {30,31,32,33,34,35,36,37,38,39,61,62,63,64,65,66};
    QString macAd = getMacAddress();
    if ( macAd.size() != 12 )
            throw ERROR;
    int mac[12];
    bool status;
    for ( int i = 0 ; i < 12 ; ++i)
    {
            mac[i] =  macAd.mid(i, 1).toInt(&status, 16);
            if ( !status )
                throw ERROR;
    }
    int ya=(a2[mac[0]])^(n11[mac[1]])^(a7[mac[2]])^(a8[mac[3]])^(a14[mac[4]])^
                    (a5[mac[5]])^(a5[mac[6]])^(a2[mac[7]])^(a0[mac[8]])^(a1[mac[9]])^
                    (a15[mac[10]])^(a0[mac[11]])^13;
    int yb=(n5[mac[0]])^(n12[mac[1]])^(a5[mac[2]])^(a7[mac[3]])^(a2[mac[4]])^
                    (a14[mac[5]])^(a1[mac[6]])^(a5[mac[7]])^(a0[mac[8]])^(a0[mac[9]])^
                    (n31[mac[10]])^(a15[mac[11]])^4;
    int yc=(a3[mac[0]])^(a5[mac[1]])^(a2[mac[2]])^(a10[mac[3]])^(a7[mac[4]])^
                    (a8[mac[5]])^(a14[mac[6]])^(a5[mac[7]])^(a5[mac[8]])^(a2[mac[9]])^
                    (a0[mac[10]])^(a1[mac[11]])^7;
    int yd=(n6[mac[0]])^(n13[mac[1]])^(a8[mac[2]])^(a2[mac[3]])^(a5[mac[4]])^
                    (a7[mac[5]])^(a2[mac[6]])^(a14[mac[7]])^(a1[mac[8]])^(a5[mac[9]])^
                    (a0[mac[10]])^(a0[mac[11]])^14;
    int ye=(n7[mac[0]])^(n14[mac[1]])^(a3[mac[2]])^(a5[mac[3]])^(a2[mac[4]])^
                    (a10[mac[5]])^(a7[mac[6]])^(a8[mac[7]])^(a14[mac[8]])^(a5[mac[9]])^
                    (a5[mac[10]])^(a2[mac[11]])^7;
    QString num , keyString ="";
    num.setNum(key[ya]);
    keyString += num;
    num.setNum(key[yb]);
    keyString += num;
    num.setNum(key[yc]);
    keyString += num;
    num.setNum(key[yd]);
    keyString += num;
    num.setNum(key[ye]);
    keyString += num;
    results.append(keyString);
    return results;

}