#!/usr/bin/env python

"""cracf2john.py processes CRACF.TXT files (generated by CRACF program)
into a format suitable for use with JtR."""

import sys

def process_file(filename):
    with open(filename, "r") as f:
        for line in f.readlines():
            data = line.split();
            print "%s:$racf$*%s*%s*%s" % (data[0], data[0], data[-1], data[-2])

if __name__ == "__main__":
    if len(sys.argv) < 2:
        print >>sys.stderr, "Usage: %s <CRACF.TXT>" % sys.argv[0]
        sys.exit(-1)

    for i in range(1, len(sys.argv)):
        process_file(sys.argv[i])


