/* * Remove the previously-cracked hashes marked with "binary = NULL" by * ldr_load_pot_line(). */ static void ldr_remove_marked(struct db_main *db) { struct db_salt *current_salt, *last_salt; struct db_password *current_pw, *last_pw; last_salt = NULL; if ((current_salt = db->salts)) do { last_pw = NULL; if ((current_pw = current_salt->list)) do { if (!current_pw->binary) { db->password_count--; current_salt->count--; if (last_pw) last_pw->next = current_pw->next; else current_salt->list = current_pw->next; } else { last_pw = current_pw; if (db->options->showuncracked) { if (!options.utf8 && options.report_utf8) { UTF8 utf8login[PLAINTEXT_BUFFER_SIZE + 1]; enc_to_utf8_r(current_pw->login, utf8login, PLAINTEXT_BUFFER_SIZE); printf("%s%c%s\n",utf8login,db->options->field_sep_char,current_pw->source); } else printf("%s%c%s\n",current_pw->login,db->options->field_sep_char,current_pw->source); } } } while ((current_pw = current_pw->next)); if (!current_salt->list) { db->salt_count--; if (last_salt) last_salt->next = current_salt->next; else db->salts = current_salt->next; } else last_salt = current_salt; } while ((current_salt = current_salt->next)); }
static void status_print_cracking(char *percent) { unsigned int time = status_get_time(); char *key, saved_key[PLAINTEXT_BUFFER_SIZE] = ""; char s_cps[64], cand[32] = ""; emms(); if (!(options.flags & FLG_STATUS_CHK)) if ((key = crk_get_key2())) strnzcpy(saved_key, key, PLAINTEXT_BUFFER_SIZE); if (showcand) sprintf(cand, "/%.0f", (double)((long long)status.crypts.hi << 32) + status.crypts.lo); #ifdef HAVE_MPI // we need to print until cr in one call, otherwise output gets interleaved char nodeid[11] = ""; if (mpi_p > 1) snprintf(nodeid, sizeof(nodeid), "%3d: ", mpi_id); nodeid[sizeof(nodeid)-1] = 0; char trying[256]; if ((options.flags & FLG_STATUS_CHK) || !(status.crypts.lo | status.crypts.hi)) trying[0] = 0; else { UTF8 t1buf[PLAINTEXT_BUFFER_SIZE + 1]; UTF8 t2buf[PLAINTEXT_BUFFER_SIZE + 1]; char *t1, *t2; if (options.report_utf8 && !options.utf8) { t1 = (char*)enc_to_utf8_r(crk_get_key1(), t1buf, PLAINTEXT_BUFFER_SIZE); t2 = (char*)enc_to_utf8_r(saved_key, t2buf, PLAINTEXT_BUFFER_SIZE); } else { t1 = crk_get_key1(); t2 = saved_key; } snprintf(trying, sizeof(trying), "%strying: %s%s%s", mpi_p > 1 ? " " : " ", t1, t2[0] ? " - " : "", t2); } fprintf(stderr, "%s" "guesses: %u%s%s" "time: %u:%02u:%02u:%02u" "%s%s%s" "c/s: %s" "%s\n", nodeid, status.guess_count, cand, mpi_p > 1 ? " " : " ", time / 86400, time % 86400 / 3600, time % 3600 / 60, time % 60, strncmp(percent, " 100", 4) ? percent : " DONE", status_get_ETA(percent,time), mpi_p > 1 ? " " : " ", status_get_cps(s_cps), trying); #else fprintf(stderr, "guesses: %u%s " "time: %u:%02u:%02u:%02u" "%s%s " "c/s: %s", status.guess_count, cand, time / 86400, time % 86400 / 3600, time % 3600 / 60, time % 60, strncmp(percent, " 100", 4) ? percent : " DONE", status_get_ETA(percent,time), status_get_cps(s_cps)); if ((options.flags & FLG_STATUS_CHK) || !(status.crypts.lo | status.crypts.hi)) fputc('\n', stderr); else { UTF8 t1buf[PLAINTEXT_BUFFER_SIZE + 1]; UTF8 t2buf[PLAINTEXT_BUFFER_SIZE + 1]; char *t1, *t2; if (options.report_utf8 && !options.utf8) { t1 = (char*)enc_to_utf8_r(crk_get_key1(), t1buf, PLAINTEXT_BUFFER_SIZE); t2 = (char*)enc_to_utf8_r(saved_key, t2buf, PLAINTEXT_BUFFER_SIZE); } else { t1 = crk_get_key1(); t2 = saved_key; } fprintf(stderr, " trying: %s%s%s\n", t1, t2[0] ? " - " : "", t2); } #endif }
static void status_print_cracking(char *percent) { unsigned int time = status_get_time(); char *key1, key2[PLAINTEXT_BUFFER_SIZE]; UTF8 t1buf[PLAINTEXT_BUFFER_SIZE + 1]; int64 g; char s_gps[32], s_pps[32], s_crypts_ps[32], s_combs_ps[32]; char s[1024], *p; char sc[32]; int n; key1 = NULL; key2[0] = 0; if (!(options.flags & FLG_STATUS_CHK) && (status.crypts.lo | status.crypts.hi)) { char *key = crk_get_key2(); if (key) strnzcpy(key2, key, sizeof(key2)); key1 = crk_get_key1(); if (options.report_utf8 && !options.utf8) { UTF8 t2buf[PLAINTEXT_BUFFER_SIZE + 1]; char *t; key1 = (char*)enc_to_utf8_r(key1, t1buf, PLAINTEXT_BUFFER_SIZE); t = (char*)enc_to_utf8_r(key2, t2buf, PLAINTEXT_BUFFER_SIZE); strnzcpy(key2, t, sizeof(key2)); } } p = s; #ifndef HAVE_MPI if (options.fork) { #else if (options.fork || mpi_p > 1) { #endif n = sprintf(p, "%u ", options.node_min); if (n > 0) p += n; } if (showcand) { unsigned long long cands = ((unsigned long long) status.cands.hi << 32) + status.cands.lo; sprintf(sc, " %llup", cands); } g.lo = status.guess_count; g.hi = 0; n = sprintf(p, "%ug%s %u:%02u:%02u:%02u%.100s%s %.31sg/s ", status.guess_count, showcand ? sc : "", time / 86400, time % 86400 / 3600, time % 3600 / 60, time % 60, strncmp(percent, " 100", 4) ? percent : " DONE", status_get_ETA(percent,time), status_get_cps(s_gps, &g, 0)); if (n > 0) p += n; if (!status.compat) { n = sprintf(p, "%.31sp/s %.31sc/s ", status_get_cps(s_pps, &status.cands, 0), status_get_cps(s_crypts_ps, &status.crypts, 0)); if (n > 0) p += n; } n = sprintf(p, "%.31sC/s%s%.200s%s%.200s\n", status_get_cps(s_combs_ps, &status.combs, status.combs_ehi), key1 ? " " : "", key1 ? key1 : "", key2[0] ? ".." : "", key2); if (n > 0) p += n; fwrite(s, p - s, 1, stderr); } static void status_print_stdout(char *percent) { unsigned int time = status_get_time(); char *key; char s_pps[32], s_p[32]; key = NULL; if (!(options.flags & FLG_STATUS_CHK) && (status.cands.lo | status.cands.hi)) key = crk_get_key1(); fprintf(stderr, "%sp %u:%02u:%02u:%02u%s%s %sp/s%s%s\n", status_get_c(s_p, &status.cands, 0), time / 86400, time % 86400 / 3600, time % 3600 / 60, time % 60, strncmp(percent, " 100", 4) ? percent : " DONE", status_get_ETA(percent,time), status_get_cps(s_pps, &status.cands, 0), key ? " " : "", key ? key : ""); }