#1. using Apache:
A. Open command prompt and goto \Apache\bin
B. htdigest -c trac.htdigest trac.localhost dyu (htdigest [filename] [realm] [username])
C. To add more users to the same digest file: do not use the -c option.
#2. using Python:
A. Paste the following into htdigest.py
from optparse import OptionParser
import md5
usage = "usage: %prog [options]"
parser = OptionParser(usage=usage)
parser.add_option("-u", "--username",action="store", dest="username", type = "string",
help="the username for whom to generate a password")
parser.add_option("-p", "--password",action="store", dest="password", type = "string",
help="the password to use")
(options, args) = parser.parse_args()
if (options.username is None) or (options.password is None):
parser.error("You must supply both the username and password")
realm = 'trac'
kd = lambda x: md5.md5(':'.join(x)).hexdigest()
print ':'.join((options.username, realm, kd([options.username, realm, options.password])))
B. python.exe htdigest.py -u dyu -p 123456 >> C:\trac.htdigest
No comments:
Post a Comment