- working with sqlalchemy 0.3.10
- remove duplicate foreign key definitions from tables.py - use _saltchars in passwordutils.py git-svn-id: file:///home/www/usr01/svn/gnuviechadmin/gnuviech.info/gnuviechadmin/trunk@240 a67ec6bc-e5d5-0310-a910-815c51eb3124
This commit is contained in:
parent
aaa23c9c5f
commit
f24de13a6f
8 changed files with 63 additions and 47 deletions
|
@ -1,4 +1,4 @@
|
|||
# -*- coding: UTF-8 -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2007 by Jan Dittberner.
|
||||
#
|
||||
|
@ -24,6 +24,7 @@ import crypt, crack, random
|
|||
_pwchars = []
|
||||
for pair in (('0', '9'), ('A', 'Z'), ('a', 'z')):
|
||||
_pwchars.extend(range(ord(pair[0]), ord(pair[1])))
|
||||
_saltchars = [char for char in _pwchars]
|
||||
for char in "-+/*_@":
|
||||
_pwchars.append(ord(char))
|
||||
|
||||
|
@ -46,7 +47,7 @@ def checkpassword(password):
|
|||
def md5_crypt_password(password):
|
||||
"""Hashes the given password with MD5 and a random salt value."""
|
||||
salt = "".join([chr(letter) for letter in \
|
||||
random.sample(_pwchars, 8)])
|
||||
random.sample(_saltchars, 8)])
|
||||
return crypt.crypt(password, '$1$' + salt)
|
||||
|
||||
def get_pw_tuple(password = None):
|
||||
|
|
11
gnuviechadmin/util/stmtcreator.py
Normal file
11
gnuviechadmin/util/stmtcreator.py
Normal file
|
@ -0,0 +1,11 @@
|
|||
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])
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue