Skip to content

Commit f34289e

Browse files
committed
Improved pw_len_finder.sh
1 parent ea446bd commit f34289e

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

pw_len_finder.sh

+17-14
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11
#!/bin/sh
22

3-
# Use this script to find the length of the password data, within a file. There are formats used
4-
# which have a shorter PLAINTEXTLEN than the input file was creatd with. In those cases, we must
5-
# add a smaller expected count into the jtrts.dat file, on the line which that format uses.
6-
# often, this is seen in the GPU formats. At some time, this logic may be added INTO the TS, and
7-
# have the TS compute the lengths of passwords, and then use the --list=format-all-details to fine
8-
# out just what the PLAINTEXT_LENGTH is listed for the format, to be able to auto compute this
9-
# information. However, until the TS is changed to handle this automatically, this script will
10-
# help to get the jtrts.dat file to have the right data.
3+
# Use this script to find the length of the password data, within a file. There
4+
# are formats used which have a shorter PLAINTEXTLEN than the input file was
5+
# created with. In those cases, we must add a smaller expected count into the
6+
# jtrts.dat file, on the line which that format uses. Often, this is seen in the
7+
# GPU formats. At some time, this logic may be added INTO the TS, and have the
8+
# TS compute the lengths of passwords, and then use the
9+
# --list=format-all-details to find out just what the PLAINTEXT_LENGTH is listed
10+
# for the format, to be able to auto compute this information. However, until
11+
# the TS is changed to handle this automatically, this script will help to get
12+
# the jtrts.dat file to have the right data.
1113

12-
# NOTE, this script get ALL data from field 5 on. So, it is assumed the file is :pass:: (pass being
13-
# in the 5th field). We simply drop 2 from the length, to get the proper length of the password).
14-
# This allows passwords to contain the ':' char, BUT requires 2 :: chars tailing the line. Currently
15-
# pass_gen.pl has been written to write files like this. However, this 'may' have to be adjusted on
16-
# any input file lacking this structure.
14+
# v2 made by magnum, adding a sum column. This is awful code, it should be pure
15+
# perl. But it works like a champ :)
1716

18-
cat $1 | cut -d: -f5- | perl -ne 'use bytes; chomp; $l=length; $l-=2; print "$l\n"' | sort -n | uniq -c | sort -nk2
17+
echo "num\tlen\tsum"
18+
grep -v '^#!comment:' $1 | cut -d: -f5 |
19+
perl -ne 'use bytes; chomp; print length, "\n"' |
20+
sort -n | uniq -c | sort -nk2 |
21+
perl -ne 'chomp; @f = split; $s += $f[0]; print "$f[0]\t$f[1]\t$s\n"'

0 commit comments

Comments
 (0)