openwall / john

John the Ripper jumbo - advanced offline password cracker, which supports hundreds of hash and cipher types, and runs on many operating systems, CPUs, GPUs, and even some FPGAs
https://www.openwall.com/john/
Other
10.09k stars 2.08k forks source link

Add a log_print() function #3511

Open magnumripper opened 5 years ago

magnumripper commented 5 years ago

Something like:

    log_print(int verbosity, bool main_only, char *format, ...)

Goals: Any code that now prints to stderr and/or log with a bunch of conditions (with 3-10 lines of code each time) could be replaced with a single call to a shared function in logger.c with following options:

I have initial code for this, but it really needs some thought to end up really good.

magnumripper commented 5 years ago

For screen output, while at it we could easily ensure words don't break at line wrap. We either can know the terminal size or just default to 80.

magnumripper commented 4 years ago

4086

magnumripper commented 4 years ago

When using -show, color could be great too.

magnumripper commented 3 years ago

Some test cases:

Some notes and ideas that hit me:

magnumripper commented 3 years ago
  • john.c sets john_terminal_locale from LC_*. We need to look at it. For example, our output might contain a file name encoded in multi-byte UTF-8.
  • We should add strlen_utf8() and/or strlen_enc() (to unicode.[ch]) for counting characters, not bytes. We already have strlen16() that returns number of characters (number of 16-bit words) for a string encoded in UTF-16.

4406 adds this: