repl.it
@gcard03/

Password-3

Python

No description

fork
loading
Files
  • main.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# ...
import sys
import getpass
#...
#...
# ...
x=6
y=5
tries2=13
passes=0
for tries in range(0,3):
    password ="F"+str(x)+"G"+str(y)
    print("Old Password = "+password)
    print("Try "+str(tries2+1)+":")
    passkey=input("password: ")
    if x<=5 and x/2 != int(x/2):
        Text1 ='x='+str(x+2)
        x+=4
    elif x<5 and x/2 == int(x/2):
        Text1 ='x='+str(x+4)
        x+=2
    elif x>5 and x/2 != int(x/2):
        Text1 ='x='+str(x-1)
        x-=5
    elif x>=5 and x/2 == int(x/2):
        Text1 ='x='+str(x-3)
        x-=1
    if y<5 and y/2 != int(y/2):
        Text2 ='y='+str(y+4)
        y+=4
    elif y<=5 and y/2 == int(y/2):
        Text2 ='y='+str(y+2)
        y+=2
    elif y>=5 and y/2 != int(y/2):
        Text2 ='y='+str(y-5)
        y-=5
    elif y>5 and y/2 == int(y/2):
        Text2 ='y='+str(y-1)
        y-=1
    password="F"+str(x)+"G"+str(y)
    if passkey==password:
        print("password correct")
        Text3="tries2="+str(tries2+1)
        Text4="passes="+str(passes+1)
        tries2+=1
        passes+=1
    else:
        print("password incorrect")
        Text3="tries2="+str(tries2+1)
        Text4="passes="+str(passes)
        tries2+=1
    File = open(sys.argv[0],'r').readlines()
    if not Text1+chr(10) in File:
        SaveFile=open(sys.argv[0],'w')
        for i in range(0,len(File)):
            if i<8:  
                SaveFile.write(File[i])
            if i==8:
                SaveFile.write(Text1+"\n")
            if i==9:
                SaveFile.write(Text2+"\n")
            if i==10:
                SaveFile.write(Text3+"\n")
            if i==11:
                SaveFile.write(Text4+"\n")
            if i>11: 
                SaveFile.write(File[i])
        SaveFile.close()
#...
?