Example #1
0
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 %sp/s%s%s\n",
	    status_get_c(s_p, &status.cands, 0),
	    time / 86400, time % 86400 / 3600, time % 3600 / 60, time % 60,
	    percent,
	    status_get_cps(s_pps, &status.cands, 0),
	    key ? " " : "", key ? key : "");
}
Example #2
0
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 : "");
}