#!/bin/sh
[ `id -u` -ne 0 ] && sudo $0 && exit
echo -n 'Loading lock code hash: '
echo root:$(grep -A 13 lock_code /dev/mtd1|tail -n 1): > /tmp/lockcode
awk '{print substr($1, 6, 13)}' /tmp/lockcode
echo 'Beginning crack (may take 20 minutes or more with some lock codes)...'
echo 'For extra safety, you should uninstall this program once you are done with it.'
john -format:DES -incremental:digits --nolog --pot=/tmp/lockcode.pot /tmp/lockcode > /dev/null 2>&1
echo -n 'Done! Your lock code should be: '
awk '{print substr($1, 15, 8)}' /tmp/lockcode.pot
rm /tmp/lockcode /tmp/lockcode.pot
