Esempio n. 1
0
/** Start cracking and does not stop until it has either been interrupted by
    a signal or the password either is found or wordlist or charset is exhausted
*/
int runCrack(char *password, struct custom_salt *cs)
{
	bool found = false;
	uint8_t cpw[128];
	memcpy(cpw, cs->encKeyWorkSpace, 128);

	if (strlen(password) < 32)
		strcpy((char*)cpw, password);
	else {
		strncpy((char*)cpw, password, 32);
	}

	if (!cs->workWithUser && !cs->knownPassword) {
		memcpy(cpw, pad, 32);
		if (cs->e.revision == 2)
			found = runCrackRev2_o(cs, cpw);
		else
			found = runCrackRev3_o(cs, cpw);
	} else if (cs->e.revision == 2) {
		if (cs->workWithUser)
			found = runCrackRev2(cs, cpw);
		else
			/** knownPassword */
			found = runCrackRev2_of(cs, cpw);
	} else {
		if (cs->workWithUser)
			found = runCrackRev3(cs, cpw);
		else
			/** knownPassword */
			found = runCrackRev3_of(cs, cpw);
	}
	return found;
}
Esempio n. 2
0
static void pdf_128b_bench(int numThreads, const unsigned int numCpuCores) {
    clock_t startTime, endTime;
    struct timeval wallTimeStart, wallTimeEnd;
    uint8_t o_string[32] = {0xcf, 0xeb, 0x57, 0x1b, 0xa4, 0x56, 0x35, 0x19,
                            0x4e, 0x09, 0x95, 0x24, 0x23, 0xf3, 0x9b, 0x81,
                            0x05, 0xae, 0xbc, 0xb2, 0x8c, 0x18, 0xd2, 0xbb,
                            0xff, 0x00, 0xc9, 0xaa, 0x3f, 0x36, 0xe3, 0x13};
    uint8_t u_string[32] = {0x72, 0xf6, 0x56, 0x9e, 0xda, 0x7d, 0x20, 0x1a,
                            0x10, 0x6d, 0x8a, 0x5b, 0xfa, 0xb2, 0xe9, 0xc0,
                            0x28, 0xbf, 0x4e, 0x5e, 0x4e, 0x75, 0x8a, 0x41,
                            0x64, 0x00, 0x4e, 0x56, 0xff, 0xfa, 0x01, 0x08};
    uint8_t fileid[16] = {0xc9, 0xaa, 0x55, 0xc3, 0x6f, 0x3f, 0x5e, 0x84,
                          0x0d, 0x3d, 0x96, 0x8b, 0x97, 0xdb, 0xb2, 0xfe};
    EncData e = {
            handler,
            o_string,
            u_string,
            fileid,
            true,
            16, 1, 4, 128, -2359344, 3, 2
    };

    initPDFCrack(&e, NULL, true, NULL, Generative, NULL, charset, 0, 4, true, numThreads, numCpuCores, 1, 1);

    startTime = clock();
    runCrackRev3();
    endTime = clock();
    print_and_clean("PDF (128, user):", getNrProcessed(), &startTime, &endTime);

    initPDFCrack(&e, NULL, false, NULL, Generative, NULL, charset, 0, 4, true, numThreads, numCpuCores, 1, 1);

    startTime = clock();
    runCrackRev3_o();
    endTime = clock();

    print_and_clean("PDF (128, owner):", getNrProcessed(), &startTime, &endTime);

    initPDFCrack(&e, password, false, NULL, Generative, NULL, charset, 0, 4, true, numThreads, numCpuCores, 1, 1);

    startTime = clock();
    runCrackRev3_of();
    endTime = clock();

    print_and_clean("PDF (128, owner, fast):", getNrProcessed(), &startTime, &endTime);
    if (numThreads > 0) {
        printf("\n");
        printf("Benchmark (Wall time):\tAverage Speed (passwords / second):\n");

        initPDFCrack(&e, NULL, true, NULL, Generative, NULL, charset, 0, 5, true, numThreads, numCpuCores, 1, 1);
        gettimeofday(&wallTimeStart, NULL);
        runCrackMultiThreads();
        gettimeofday(&wallTimeEnd, NULL);
        char buf[32];
        sprintf(buf, "PDF (128, user, %i threads):", numThreads);
        print_and_clean_wall_time(buf, getNrProcessed(), wallTimeStart, wallTimeEnd);
    }
}
Esempio n. 3
0
static void
pdf_128b_bench(void) {
  clock_t startTime, endTime;
  uint8_t o_string[32] =   { 0xcf, 0xeb, 0x57, 0x1b, 0xa4, 0x56, 0x35, 0x19,
			     0x4e, 0x09, 0x95, 0x24, 0x23, 0xf3, 0x9b, 0x81,
			     0x05, 0xae, 0xbc, 0xb2, 0x8c, 0x18, 0xd2, 0xbb,
			     0xff, 0x00, 0xc9, 0xaa, 0x3f, 0x36, 0xe3, 0x13 };
  uint8_t u_string[32] =   { 0x72, 0xf6, 0x56, 0x9e, 0xda, 0x7d, 0x20, 0x1a,
			     0x10, 0x6d, 0x8a, 0x5b, 0xfa, 0xb2, 0xe9, 0xc0,
			     0x28, 0xbf, 0x4e, 0x5e, 0x4e, 0x75, 0x8a, 0x41,
			     0x64, 0x00, 0x4e, 0x56, 0xff, 0xfa, 0x01, 0x08 }; 
  uint8_t fileid[16] =     { 0xc9, 0xaa, 0x55, 0xc3, 0x6f, 0x3f, 0x5e, 0x84,
			     0x0d, 0x3d, 0x96, 0x8b, 0x97, 0xdb, 0xb2, 0xfe };
  EncData e = {
    handler,
    o_string,
    u_string,
    fileid,
    true,
    16, 1, 4, 128, -2359344, 3, 2
  };

  initPDFCrack(&e, NULL, true, NULL, Generative, NULL, charset, 0, 4, true);

  startTime = clock();
  runCrackRev3();
  endTime = clock();
  print_and_clean("PDF (128, user):", getNrProcessed(), &startTime, &endTime);

  initPDFCrack(&e, NULL, false, NULL, Generative, NULL, charset, 0, 4, true);

  startTime = clock();
  runCrackRev3_o();
  endTime = clock();

  print_and_clean("PDF (128, owner):", getNrProcessed(), &startTime, &endTime);

  initPDFCrack(&e,password, false, NULL, Generative, NULL, charset, 0, 4,true);

  startTime = clock();
  runCrackRev3_of();
  endTime = clock();

  print_and_clean("PDF (128, owner, fast):", 
		  getNrProcessed(), &startTime, &endTime);
}