#!/usr/bin/env python
import sys
import subprocess

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

    with open(sys.argv[1]) as f:
        for line in f.readlines():
            line = line.rstrip()
            if line.startswith('#'):
                continue
            username = "AAAAAAAA"
            p = subprocess.Popen("./racf-hashgen %s '%s'" % (username, line), shell = True, stdout = subprocess.PIPE)
            (o, e) = p.communicate()
            print "user-%s:$racf$*%s" % (line, o.rstrip())
