Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assorted fixes prompted by testing on Solaris #5485

Merged
merged 5 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions doc/MARKOV
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ as input the "stat" file and a file with a single cracked password per line.
Here is a sample output:

*******************************************************************************
user@host:run$ ./mkvcalcproba stats /tmp/passwordlist
user@host:run$ ./mkvcalcproba stats password.lst
test 33+16+28+20 97 4 40030907 45
password 29+16+30+22+51+25+24+30 227 8 2698006565378672 177
32'[[! 55+24+98+1000+23+29 1229 6 39949021871 1169
Expand All @@ -194,7 +194,7 @@ meaning of the column:
2/ Sum of all "markov probabilities" of every letter of the word. This is
supposed to help identify which parts of the password makes them strong. The
number "1000" is written when no 1st/2nd letter combinations were found in the
stat file (for exemple ' then [ here).
stat file (for example ' then [ here).
3/ Markov strength
4/ Password length
5/ Rank when bruteforced "stupidly" (a, b, c, ..., aa, ab, ac ...) considering
Expand Down
2 changes: 1 addition & 1 deletion src/tests/test_externals.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ for mode in `$JOHN --list=ext-modes`; do
fi
done

$JOHN --external=KDEPaste --stdout --max-candidates=10000 | tr -c '\n' .
$JOHN --external=KDEPaste --stdout --max-candidates=10000 | sed 's/././g'

for mode in `$JOHN --list=ext-hybrids` `./john --list=ext-filters`; do
$JOHN -w --external=$mode --stdout --max-candidates=10000
Expand Down
29 changes: 17 additions & 12 deletions src/tests/unit-tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,12 @@
#include "../sha2.h"

char *_fgetl_pad = NULL;
#ifdef __sun
/* Solaris fprintf() seems to get confused at around 16384 */
#define _FGETL_PAD_SIZE 16000
#else
#define _FGETL_PAD_SIZE 19000
#endif
#define _ISHEX_CNT 260
// if we miss a line(s), only show 1 error. This variable is used to adjust
// the linecount since we don't have the expected line count (we missed
Expand Down Expand Up @@ -618,9 +623,9 @@ void _nontest_gen_fgetl_files(int generate) {

if (!generate) {
// if !generate, then delete
unlink("/tmp/jnk.txt");
unlink("/tmp/jnkd.txt");
unlink("/tmp/jnkfu.txt");
unlink("jnk.txt");
unlink("jnkd.txt");
unlink("jnkfu.txt");
return;
}
/* first, setup the fgetl 'pad' data (moved from main() function. */
Expand All @@ -630,9 +635,9 @@ void _nontest_gen_fgetl_files(int generate) {
_fgetl_pad[_FGETL_PAD_SIZE] = 0;

start_test(__FUNCTION__); inc_test(); inc_test(); inc_test();
fp = fopen("/tmp/jnk.txt", "wb");
fp1 = fopen("/tmp/jnkd.txt", "wb");
fp2 = fopen("/tmp/jnkfu.txt", "wb");
fp = fopen("jnk.txt", "wb");
fp1 = fopen("jnkd.txt", "wb");
fp2 = fopen("jnkfu.txt", "wb");
for (i = 0; i < 5999; ++i) {
char *is_null = "";
char null_or_space = ' ';
Expand Down Expand Up @@ -782,17 +787,17 @@ void test_fgetl() {
start_test(__FUNCTION__);

_fgetl_fudge = 0;
_tst_fget_l_ll("/tmp/jnk.txt", 1);
_tst_fget_l_ll("/tmp/jnkd.txt", 1);
_tst_fget_l_ll("/tmp/jnkfu.txt", 1);
_tst_fget_l_ll("jnk.txt", 1);
_tst_fget_l_ll("jnkd.txt", 1);
_tst_fget_l_ll("jnkfu.txt", 1);
end_test();
}
// char *fgetll(char *s, size_t size, FILE *stream)
void test_fgetll() {
start_test(__FUNCTION__);
_tst_fget_l_ll("/tmp/jnk.txt", 0);
_tst_fget_l_ll("/tmp/jnkd.txt", 0);
_tst_fget_l_ll("/tmp/jnkfu.txt", 0);
_tst_fget_l_ll("jnk.txt", 0);
_tst_fget_l_ll("jnkd.txt", 0);
_tst_fget_l_ll("jnkfu.txt", 0);
end_test();
}
// void *strncpy_pad(void *dst, const void *src, size_t size, uint8_t pad)
Expand Down
7 changes: 7 additions & 0 deletions src/timeroast_common_plug.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

#include <stdio.h>

#include "arch.h"
#include "formats.h"
#include "memory.h"
#include "common.h"
Expand Down Expand Up @@ -67,6 +68,9 @@ void *timeroast_binary(char *ciphertext)
v |= ((unsigned int)(atoi16[ARCH_INDEX(hash[7])])) << 24;
hash += 8;

#if !ARCH_LITTLE_ENDIAN
v = JOHNSWAP(v);
#endif
binary[i] = v;
}
return binary;
Expand All @@ -92,6 +96,9 @@ void *timeroast_salt(char *ciphertext)
v |= ((unsigned int)(atoi16[ARCH_INDEX(hash[7])])) << 24;
hash += 8;

#if !ARCH_LITTLE_ENDIAN
v = JOHNSWAP(v);
#endif
salt[i] = v;
}
return salt;
Expand Down
3 changes: 3 additions & 0 deletions src/timeroast_fmt_plug.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,9 @@ static int crypt_all(int *pcount, struct db_salt *salt)
if (new_key)
{
nt_hash(count);
#if !ARCH_LITTLE_ENDIAN
swap(last, count * 4);
#endif
new_key = 0;
}

Expand Down