示例#1
0
int oLaucher::GenDictCrunch()
{

    oPrograms dats;

    GetPathUtils(5, &dats);

#ifdef Q_OS_WIN    

    if(QFile::exists(dats.pathExec)==false)
        return -2;

#endif    

    oSqlite db;
    QSqlQuery datos;    


    if(db.GetCruch(&datos)!=0)
        return -1;

    oBase base;    

    connect(procCrunch, SIGNAL(errorOccurred(QProcess::ProcessError)), this, SLOT(launchErrorCrunch(QProcess::ProcessError)));
    connect(procCrunch, SIGNAL(finished(int)), this, SLOT(CrunchFinish(int)));
    connect(procCrunch, SIGNAL(readyReadStandardOutput()), this, SLOT(readStdOutCrunch()));
    connect(procCrunch, SIGNAL(readyReadStandardError()), this, SLOT(readStdErrCrunch()));
    //connect(procCrunch, SIGNAL(error(QProcess::ProcessError)), this, SLOT(launchingError(QProcess::ProcessError)));

    do
    {

        while(true)
        {

            pathDictName = FOLDERDICT;
            pathDictName.append(base.GetRandStr(8));
            pathDictName.append(".dic");

            if(QFile::exists(pathDictName)==false)
                break;

            else
                qDebug() << "[!] Dict" << pathDictName << "previamente creado se intentara crear otro randPath";

        }

        idCrunchDict = datos.value(3).toInt();

        dats.args.clear();
        GetParamDictCrunch(datos.value(1).toString(), datos.value(2).toString(), pathDictName, datos.value(0).toString(), &dats.args);
        qDebug() << "\n[+] Generate Dict [Crunch].. " << dats.pathExec << dats.args << "\n";
        procCrunch->start(dats.pathExec, dats.args);       


    #ifdef Q_OS_WIN
        while(procCrunch->isOpen())
        {
            //qDebug() << "IS OPEN xD";

            CheckIdleUser();
            Sleep(1000);	
        }

    #endif



    #ifdef Q_OS_LINUX
        procCrunch->waitForFinished(-1);
    #endif            



        //procCrunch->close();

    } while(datos.next());

    return 0;

}
示例#2
0
void AutoSave_Timer() {

	/* 'fired every minute */
	static int Minutos = 0;
	static int MinutosLatsClean = 0;
	static int MinsPjesSave = 0;
	static int MinsSendMotd = 0;

	static int PrintConsole = 0;

	Minutos = Minutos + 1;
	MinsPjesSave = MinsPjesSave + 1;
	MinsSendMotd = MinsSendMotd + 1;

	double tmpHappyHour;

	/* Imprimir en la consola el numero de users */
	PrintConsole++;
	if (PrintConsole >= IntervaloImprimirEnConsola) {
		std::cerr << vb6::dateToString(vb6::Now()) << " Online: " << NumUsers << std::endl;
		PrintConsole = 0;
	}

	/* ' HappyHour */
	iDay = vb6::Weekday(vb6::Now());
	tmpHappyHour = HappyHourDays[iDay];

	if (tmpHappyHour != HappyHour) {

		if (HappyHourActivated) {
			/* ' Reestablece la exp de los npcs */
			if (HappyHour != 0) {
				UpdateNpcsExp(1 / HappyHour);
			}
		}

		/* ' Desactiva */
		if (tmpHappyHour == 1) {
			SendData(SendTarget_ToAll, 0,
					dakara::protocol::server::BuildConsoleMsg("¡Ha concluido la Happy Hour!", FontTypeNames_FONTTYPE_DIOS));

			HappyHourActivated = false;

			/* ' Activa */
		} else {
			UpdateNpcsExp(tmpHappyHour);

			if (HappyHour != 1) {
				SendData(SendTarget_ToAll, 0,
						dakara::protocol::server::BuildConsoleMsg(
								"Se ha modificado la Happy Hour, a partir de ahora las criaturas aumentan su experiencia en un "
										+ vb6::CStr(vb6::Round((tmpHappyHour - 1) * 100, 2)) + "%",
								FontTypeNames_FONTTYPE_DIOS));
			} else {
				SendData(SendTarget_ToAll, 0,
						dakara::protocol::server::BuildConsoleMsg(
								"¡Ha comenzado la Happy Hour! ¡Las criaturas aumentan su experiencia en un "
										+ vb6::CStr(vb6::Round((tmpHappyHour - 1) * 100, 2)) + "%!",
								FontTypeNames_FONTTYPE_DIOS));
			}

			HappyHourActivated = true;
		}

		HappyHour = tmpHappyHour;
	}

	AreasOptimizacion();

	/* 'Actualizamos el centinela */
	PasarMinutoCentinela();

	if (Minutos == MinutosWs - 1) {
		SendData(SendTarget_ToAll, 0,
				dakara::protocol::server::BuildConsoleMsg("Worldsave en 1 minuto ...", FontTypeNames_FONTTYPE_VENENO));
	}

	if (Minutos >= MinutosWs) {
		DoBackUp();
		aClon->VaciarColeccion();
		Minutos = 0;
	}

	if (MinsPjesSave == MinutosGuardarUsuarios - 1) {
		SendData(SendTarget_ToAll, 0,
				dakara::protocol::server::BuildConsoleMsg("CharSave en 1 minuto ...", FontTypeNames_FONTTYPE_VENENO));
	} else if (MinsPjesSave >= MinutosGuardarUsuarios) {
		ActualizaExperiencias();
		GuardarUsuarios();
		MinsPjesSave = 0;
	}

	if (MinutosLatsClean >= 15) {
		MinutosLatsClean = 0;
		/* 'respawn de los guardias en las pos originales */
		ReSpawnOrigPosNpcs();
		LimpiarMundo();
	} else {
		MinutosLatsClean = MinutosLatsClean + 1;
	}

	if (MinsSendMotd >= MinutosMotd) {
		int i;
		for (i = (1); i <= (LastUser); i++) {
			if (UserList[i].flags.UserLogged) {
				SendMOTD(i);
			}
		}
		MinsSendMotd = 0;
	}

	PurgarPenas();
	CheckIdleUser();

	LogNumUsers();
}
示例#3
0
int oLaucher::Crack(QSqlQuery qry)
{            

    
    pathFileName = qry.value(0).toString();
    pathDictName = qry.value(1).toString();
    AplicarDict = qry.value(2).toBool();
    hashFileName = qry.value(5).toString();
    hashDictName = qry.value(4).toString();
    int ret = 0;    

    //qDebug() << "[!] ATTACK:: " << qry.value(0).toString() << "DICT " << qry.value(1).toString();

    if(QFile::exists(pathFileName)==false)
    {
        return -1;
    }

    if(QFile::exists(pathDictName)==false)
    {
        return -2;
    }

    QFileInfo fileInf(pathFileName);
    QString extension = fileInf.suffix();
    oPrograms dats;    
    QString fileTmpPass;    

    connect(proc, SIGNAL(errorOccurred(QProcess::ProcessError)), this, SLOT(launchingError(QProcess::ProcessError)));
    //connect(proc, SIGNAL(finished(int)), this, SLOT(ProcCerrado(int)));
    connect(proc, SIGNAL(readyReadStandardOutput()), this, SLOT(readStdOut()));
    connect(proc, SIGNAL(readyReadStandardError()), this, SLOT(readStdErr()));
    connect(proc, SIGNAL(error(QProcess::ProcessError)), this, SLOT(launchingError(QProcess::ProcessError)));


    fileTmpPass = fileTmpPass + "/tmp/filePwd" + QString::number(qrand() % 1000);    

    #ifdef Q_OS_WIN32
        fileTmpPass = getenv("TMP");
        fileTmpPass = fileTmpPass + "\\filePwd" + QString::number(qrand() % 1000);
    #endif

    QFile::remove(fileTmpPass);




    if(extension.compare("cap", Qt::CaseInsensitive)==0)
    {

        // Crackea con Pyrit

        qDebug() << "[!] Es un CAP";

        crackerProgram = 3;

        //QString strTmp = "attack_cowpatty";
        oSqlite db;
        QSqlQuery qry;

        GetPathUtils(crackerProgram, &dats);

        if(db.GetInfWpa(&qry, hashFileName)>=0)
        {
            //GetParamPyrit(pathFileName, qry.value(0).toString(), qry.value(1).toString(), pathDictName, &dats.args);
        }
    }




    if(extension.compare("hccap", Qt::CaseInsensitive)==0)
    {
        // Crackea con oclHashcat

        crackerProgram = 2;

        qDebug() << "[!] Es un HCCAP";

        GetParamHascat(pathFileName, AplicarDict, "QVariant::String", pathDictName, &dats.args);

        GetPathUtils(crackerProgram, &dats);

    }





    if(extension.compare("pdf", Qt::CaseInsensitive)==0)
    {
        qDebug() << "[+] Es un PDF";

        GetPathUtils(1, &dats);
        dats.args << pathDictName;

        if(AplicarDict)
            dats.args << pathDictName;

            else
            {
                //Aplicar fuerza bruta
            }

        proc->start(dats.pathExec, dats.args);



        while(proc->isOpen())
        {
            //qDebug() << "IS OPEN xD";


	#ifdef Q_OS_WIN
            CheckIdleUser();
            Sleep(1000);
	#endif

        }

    }





    if(extension.compare("rar", Qt::CaseInsensitive)==0)
    {
        //qDebug() << "[+] Es un rar";

        GetPathUtils(1, &dats);
        dats.args << pathDictName;

        if(AplicarDict)
            dats.args << pathDictName;

            else
            {
                //Aplicar fuerza bruta
            }


        proc->start(dats.pathExec, dats.args);
        //proc->waitForFinished(-1);
    }





    if(extension.compare("docx", Qt::CaseInsensitive)==0)
    {
        //qDebug() << "[+] Es un MS DOCX";

        GetPathUtils(1, &dats);
        dats.args << pathDictName;

        if(AplicarDict)
            dats.args << pathDictName;

            else
            {
                //Aplicar fuerza bruta
            }

        proc->start(dats.pathExec, dats.args);
        //proc->waitForFinished(-1);
    }


    qDebug() << "[+] Launching .. " << dats.pathExec << dats.args;
    proc->start(dats.pathExec, dats.args);
    proc->waitForFinished(-1);
    AnalyzeOutput(fileTmpPass, crackerProgram);

    delete proc;
    return ret;
}