0

I have several (old) Linux systems that have users and passwords saved on a local database. The process is simple. Using python, you are asked to enter a password, the entered plain text passwords are processed using python's crypt module and the hashed password is then saved to the database.

For instance,

# Password.py   (not editable)
Debug = 1
import getpass
plain_pass = getpass.getpass()
# e.g. plain_pass="pass"
import crypt
crypt_pass = crypt.crypt( plain_pass, r'$1$xx')
# The salt r'$1$xx' can not be changed
if Debug:
    print (crypt_pass)   # Result:    $1$xx$Ik.nuioJufb1VPeTbLQ.y/

(ignoring security issues for now) I want to provide a simple text file where username and hashed passwords are stored:

Sample Password.txt file
user1 $1$xx$Ik.nuioJufb1VPeTbLQ.y/
user2 $1$xx$x2gmo6Eob2udHl0tNU2Zw0          (password is 123)

A windows server will host the files for all the linux machines, it also provides a user interface where users can modify their passwords or new users can be created.

Using windows (VB or any other win application), how to generate the same hashes as with python's crypt.crypt()?

pass  --->  $1$xx$Ik.nuioJufb1VPeTbLQ.y/
123   --->  $1$xx$x2gmo6Eob2udHl0tNU2Zw0
hello --->  $1$xx$zrPVW4APkg66JghmAwqmA.
üfñ2  --->  $1$xx$CPthCTb1yiYoLfl3VmrJl/
Ñhosko
  • 723
  • 2
  • 8
  • 25
  • 1
    According to the documentation, *the crypt(3) routine, which is a one-way hash function based upon a modified DES algorithm;* Which gives you a starting point, but without knowing what is modified and how, you might not be able to match it. – Ňɏssa Pøngjǣrdenlarp Jan 11 '18 at 16:05
  • It might be better/easier to have a small python scriptlet to perform the hash for you and call it from NET. There are many many posts here on doing that – Ňɏssa Pøngjǣrdenlarp Jan 11 '18 at 16:23
  • I read that crypt module can only run on unix.. https://stackoverflow.com/a/19878202/2798727 Any ideas how to make it also run on windows? – Ñhosko Jan 11 '18 at 16:33

0 Answers0