from passwordutils import * import sys for line in sys.stdin.read().splitlines(): parts = line.split() (email, domain) = parts[0].split("@") username = parts[1][0:5] pwtuple = get_pw_tuple() print "INSERT INTO mailpassword (id, clearpass, cryptpass, uid, gid, home, spamcheck) VALUES ('%s', '%s', '%s', %d, %d, '/home/mail/%s/%s', 'false');" % (parts[1], pwtuple[0], pwtuple[1], int(parts[2]), 119, username, parts[1]) print "INSERT INTO mailaddress (domainid, email, target) VALUES (%d, '%s', '%s');" % (int(parts[3]), email, parts[1])