Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [day] [month] [year] [list]
Date: Fri, 20 Jul 2012 10:55:31 +0200
From: Frank Dittrich <frank_dittrich@...mail.com>
To: john-dev@...ts.openwall.com
Subject: calc_stat.c: more verbose stderr output for non-ascii characters

When creating a Markov mode stats file, it would be good to see what
non-ascii or non-printable characters are included in the dictionary
file, so make the stderr output more verbose.

$ LC_ALL=C grep -v "[^ -~]" rockyou.txt > rockyou-ascii.txt

Old calc_stat version:
$ ./calc_stat rockyou-ascii.txt stats-rockyou-ascii
Warning, non printable character line 4749 :

New calc_stat version:
$ ./calc_stat rockyou-ascii.txt stats-rockyou-ascii
Warning, non printable character 0x0a line 4749 offset 0:


Frank

>From df6cd13e7d39761c2d408eff980816b7179af5dd Mon Sep 17 00:00:00 2001
From: Frank Dittrich <frank_dittrich@...mail.com>
Date: Fri, 20 Jul 2012 10:42:27 +0200
Subject: [PATCH] calc_stat.c: more verbose stderr output for non-ascii
 characters

---
 src/calc_stat.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/calc_stat.c b/src/calc_stat.c
index 8105bad..7898372 100644
--- a/src/calc_stat.c
+++ b/src/calc_stat.c
@@ -82,12 +82,18 @@ int main(int argc, char * * argv)
 			np = 0;
 			if(C2I(ligne[i])<32)
 			{
-				if (!npflag) fprintf(stderr, "Warning, non printable character line %d : %s\n", nb_lignes, ligne);
+				if (!npflag)
+					fprintf(stderr,
+					        "Warning, non printable character 0x%02x line %d offset %d: %s\n",
+					        (unsigned char)ligne[i], nb_lignes, i, ligne);
 				np += 1;
 			}
 			if(C2I(ligne[i])>127)
 			{
-				if (!npflag) fprintf(stderr, "Warning, non US ascii character line %d : %s\n", nb_lignes, ligne);
+				if (!npflag)
+					fprintf(stderr,
+					        "Warning, non US ascii character 0x%02x line %d offset %d: %s\n",
+					        (unsigned char)ligne[i], nb_lignes, i, ligne);
 				np += 1;
 			}
 			if((i>0) && (C2I(ligne[i-1])<32))
-- 
1.7.7.6


Powered by blists - more mailing lists

Your e-mail address:

Powered by Openwall GNU/*/Linux - Powered by OpenVZ