Open magnumripper opened 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.
When using -show
, color could be great too.
Some test cases:
col = 0
appropriately for next line).Λορεμ ιπσθμ δολορ σιτ αμετ, πλατονεμ vολθπτατιβθσ ιν σιτ, εθ ερατ ιντερπρεταρισ μεα. Vιξ φεθγιατ δεσερθντ ελοqθεντιαμ θτ, μεα εα αθδιαμ φαβελλασ, περ πριμισ τιμεαμ δισcερε cθ. Cθ δολορ ρεcτεqθε δισπθτατιονι μει, μοvετ vοcεντ εθμ αν. Vενιαμ περσεcθτι θσθ νο, σαλθτανδι ιτθπερατα ρεπθδιανδαε αν vιμ. Γραεcι αδιπισcι cονσεcτετθερ νο σεα. Αδ qθο προβο ρατιονιβθσ, qθοδ σιντ cονσεcτετθερ πρι θτ.
Some notes and ideas that hit me:
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.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.-
something we can break right after (but not remove like we'd do with a whitespace)./
and \
same as -
above, for when breaking a long file path: We can break right after but do not remove it.-
.--
even though it later has a -
" (so we'd not break a word such as --single-wordlist
) but that too may be overkill, or even not wanted.
john.c
setsjohn_terminal_locale
fromLC_*
. 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/orstrlen_enc()
(tounicode.[ch]
) for counting characters, not bytes. We already havestrlen16()
that returns number of characters (number of 16-bit words) for a string encoded in UTF-16.
options.terminal_enc
for eg. being UTF_8
or not.strlen_any()
will count number of characters, not bytes (in particular, our messages may include file paths encoded in UTF-8 or not). This function can be safely used even when you're not sure input is UTF-8 or some legacy encoding, or a mix...
Something like:
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:
--log-no-rule-details
and--log-no-mode-details
while--log-none
would deprecate the current-nolog
. Perhaps this should be considered.I have initial code for this, but it really needs some thought to end up really good.