-
Notifications
You must be signed in to change notification settings - Fork 2
/
run_format_raw.sh
36 lines (28 loc) · 1.34 KB
/
run_format_raw.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#! /bin/sh
# Script to call format generators for "raw" formats
# Copyright © 2015 Aleksey Cherepanov <[email protected]>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted.
M="$1"
F="raw-$M-dk"
N=raw"`printf %s "$M" | sed -e 's/.*/\U&/'`"_my_fmt_plug
if ! printf %s "`pwd`" | grep 'john-devkit-temp$' >/dev/null; then
echo "You should be john-devkit-temp/ folder"
exit 1
fi
if ! test -e ../john-devkit-dirty/ ; then
echo "There should ../john-devkit-dirty/ with all the code"
exit 1
fi
if ! test -e JohnTheRipper/ ; then
echo "There should JohnTheRipper/ folder here"
exit 1
fi
echo "Writing..."
echo "Format: $F"
echo "File: $N"
# %% make option for tcc
time pypy "../john-devkit-dirty/format_john_$M.py" "" "" > "JohnTheRipper/src/$N.c" && (cd JohnTheRipper/src/ && time tcc -c -o $N.o $N.c && RELEASE_BLD="-Wfatal-errors -g" make -s && ../run/john --test=5 "--format=$F")
#time pypy "../john-devkit-dirty/format_john_$M.py" "" "" > "JohnTheRipper/src/$N.c" && (cd JohnTheRipper/src/ && RELEASE_BLD="-Wfatal-errors -g" make -s && ../run/john --test=5 "--format=$F")
objdump -d "JohnTheRipper/src/$N.o" | sed -ne '/<crypt_all>/,/^$/ p' > asm && wc -l asm; perl -pe 's/[^\t]*\t//; s/\t.*//' asm | tail -n +2 | perl -pe 's/\s+//g' | perl -lne 'print(length($_) / 2, " bytes of code")'