Warning, /frameworks/kdesu/autotests/su is written in an unsupported language. File is not indexed.
0001 #!/usr/bin/env python3 0002 0003 import sys 0004 import getpass 0005 from enum import Enum, unique 0006 from subprocess import call 0007 0008 0009 @unique 0010 class State(Enum): 0011 NEW = 1 0012 SECOND = 2 0013 THIRD = 3 0014 GOOD = 4 0015 FAIL = 5 0016 0017 class Su: 0018 0019 def __init__(self): 0020 self.state = State.NEW 0021 self.read = None 0022 self.password = 'ilovekde' 0023 0024 def process(self): 0025 if self.state == State.NEW: 0026 self.read = getpass.getpass('Password: ') 0027 if self.read == self.password: 0028 self.state = State.GOOD 0029 call([sys.argv[3]]) 0030 exit(0) 0031 else: 0032 self.state = State.FAIL 0033 print("su: Authentication failure") 0034 exit(1) 0035 0036 su = Su() 0037 while True: 0038 su.process()