Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Samba password hashes generator (sambapasswords.py)

1 view
Skip to first unread message

Arcady Genkin

unread,
Dec 15, 2003, 12:30:57 PM12/15/03
to
Summary
-------
sambapasswords.py is a native Python module for generating the NT MD4
and the LanMan password hashes, as used by Samba and various versions
of Windows for storing encrypted passwords for the user and machine
accounts. This code can be useful, for instance, for managing the
Samba passwords from a Python program without the overhead and
insecurity[1] of invoking the `smbpasswd' utility in batch mode.

Availability
------------
The module is available for download from the below URL. It is
released under the BSD-style software license.

http://www.cdf.toronto.edu/~agenkin/py/index.pyc/software/

This module relies on the pycrypto Python module, which can be
downloaded from the following URL:

http://www.amk.ca/python/code/crypto.html

Background
----------
The module was written as part of an account managing software package
to create and manage Unix and Samba user accounts en masse (up to over
a thousand accounts in one run). With this many accounts I wanted
native editing of the Unix `passwd' and the Samba `smbpasswd' files.
The first one was easy, but the latter turned out to be trickier than
I thought, since the password hashes used by Windows (especially the
LanMan hash) are not generated in a straight-forward way; I could not
find any proper documentation and it took me a lot of figuring out to
get the hash generation working properly in Python.

Later I received a lot of enquiries from people trying to accomplish
the same thing, and I thought that releasing this code may be a useful
thing for the Python community.

Footnotes:
[1] Running the `smbpasswd' command in batch mode entails supplying
the clear text password as one of the command line arguments.

--
Arcady Genkin : CDF Systems Administrator
http://www.cdf.toronto.edu/~agenkin/contact.html

Culture saves nothing and nobody; nor does it justify. But it is a
product of man: he projects himself onto it and recognises himself
in it; this critical mirror alone shows him his image.
Jean-Paul Sartre, ``Words''

0 new messages