Wo ist in dem skript der Fehler???
Verfasst: Mittwoch 8. Juli 2009, 16:07
Hi!
bin heute hier eingetreten, weil ich ein Problem habe.
Ich hab mir in den Kopf gesetzt eine "einfache" MD5-Passwortabfrage zu schreiben, das Skript müsste eigentlich funktionieren, klappt aber dochnicht.
Könnt ihr mir helfen???
def pwd():
from hashlib import md5
from os import chdir
from os.path import exists
from os.path import join
if exists('c:\Programme\pwd.txt')== 0:
mypath= join('c:\Programme')
chdir(mypath)
mkdir('pwd')
chdir('pwd')
myfile = file('pwd.txt', 'w')
mystring = 'NMl3+o\xe6*c\xaf\xe5aq\xfd7%'
myfile.write(mystring)
myfile.close()
x = raw_input('Gib das Passwort ein: ')
if md5(x).digest() == myfile.read():
print 'sie sind eingeloggt'
a = raw_input('möchten sie das Passwort ändern? (j/n):')
if a=='j':
s = raw_input('geben sie das alte passwort ein:')
w = raw_input('geben sie das neue passwort ein:')
t = raw_input('geben sie das neue passwort erneut ein:')
if md5(s).digest()== myfile.read():
if w == t:
p = md5(t).digest()
c= open ('c:\Programme\pwd.txt')
myfile.write(p)
myfile.close()
print 'das passwort wurde geändert','\n','Hashcode:', p
else:
print 'das passwort ist falsch'
else:
print 'ok, dann nicht'
else: print 'das war wohl nix'
bin heute hier eingetreten, weil ich ein Problem habe.
Ich hab mir in den Kopf gesetzt eine "einfache" MD5-Passwortabfrage zu schreiben, das Skript müsste eigentlich funktionieren, klappt aber dochnicht.
Könnt ihr mir helfen???
def pwd():
from hashlib import md5
from os import chdir
from os.path import exists
from os.path import join
if exists('c:\Programme\pwd.txt')== 0:
mypath= join('c:\Programme')
chdir(mypath)
mkdir('pwd')
chdir('pwd')
myfile = file('pwd.txt', 'w')
mystring = 'NMl3+o\xe6*c\xaf\xe5aq\xfd7%'
myfile.write(mystring)
myfile.close()
x = raw_input('Gib das Passwort ein: ')
if md5(x).digest() == myfile.read():
print 'sie sind eingeloggt'
a = raw_input('möchten sie das Passwort ändern? (j/n):')
if a=='j':
s = raw_input('geben sie das alte passwort ein:')
w = raw_input('geben sie das neue passwort ein:')
t = raw_input('geben sie das neue passwort erneut ein:')
if md5(s).digest()== myfile.read():
if w == t:
p = md5(t).digest()
c= open ('c:\Programme\pwd.txt')
myfile.write(p)
myfile.close()
print 'das passwort wurde geändert','\n','Hashcode:', p
else:
print 'das passwort ist falsch'
else:
print 'ok, dann nicht'
else: print 'das war wohl nix'