Пример #1
0
def install(macid):
    print('Enter admin pendrive to continue')
    try:
        driveletter = drive()
        os.chdir('{}:\\bankadmin'.format(driveletter))
    except:
        print('Access denied')
    try:
        with open('Password.txt') as passw:
            passwhash = passw.read()
            passw.close()
        passinput = getpass('Enter password: '******'mkdir "Cashvault"')
            os.chdir('Cashvault')
            os.system('type nul > cash.txt')
            with open('cash.txt', 'w') as vault:
                vault.write('0')
                vault.close()
            os.chdir(cwd)
            os.system('type nul > macid.info')
            with open('macid.info', 'w') as f:
                f.write(macid)
                f.close()
            os.system('attrib +s +h macid.info')
            os.system('attrib +s +h Cashvault')
            print('$AdminShell> Machine Installation was successful')
            sys.exit()
    except:
        pass
Пример #2
0
def vaultrefill(OTP):
    while True:
        OTPpass = input('Enter OTP to refill: ')
        if str.encode(SHA.sha_encode(OTPpass)) == OTP:
            with open('Cashvault\\cash.txt') as vault:
                cash = int(vault.read())
                cash += 5000000
                vault.close()
            with open('Cashvault\\cash.txt', 'w') as vault:
                vault.write(str(cash))
                vault.close()
            break
Пример #3
0
    def adminaccess(self):
        print('Enter admin pendrive to continue')
        cwd = os.getcwd()
        while True:
            try:
                driveletter = self.drive()
                os.chdir('{}:\\bankadmin'.format(driveletter))
                with open('Password.txt') as passw:
                    passwhash = passw.read()
                    passw.close()

                passinput = getpass('Enter password: ')
                if SHA.sha_encode(passinput) == passwhash:

                    self.access = True
                else:
                    pass
                if self.access:
                    os.chdir(cwd)
                    break
            except:
                pass
Пример #4
0
def login():
    username = input('Enter your Username: '******'loginreq {}'.format(username).encode())
    permission = s.recv(100).decode('utf-8')
    if permission == '#a':
        print('(Entered characters will not be printed!!)')
        password = getpass('Enter your Password: '******'utf-8')
        if permission == '#a':
            s.send(' '.encode())
            userdetails = []
            x = s.recv(65536).decode('utf-8').replace("Decimal('", '')
            x = x[:-3] + ']'
            userdetails = eval(x)

            while True:
                usercash = int(userdetails[3])

                print('Your Cash: {}'.format(str(usercash)))
                print('Enter your choice: ')
                print('1. Withdraw')
                print('2. Deposit')
                print('3. User Profile')
                print('4. Log Out')

                opt = input('> ')
                if opt == '1':
                    while True:
                        try:
                            cashw = int(
                                input(
                                    'Enter the money you want to withdraw: '))
                        except:
                            print('Enter an integer only')
                        if cashw <= usercash and cashw <= cash():
                            s.send('withdrawal {} {} {}'.format(
                                userdetails[0], userdetails[2],
                                str(cashw)).encode())
                            if s.recv(100).decode('utf-8') == '#d':
                                print('{} rupees has been withdrawn'.format(
                                    str(cashw)))
                                cashwd(int('-{}'.format(cashw)))
                            break
                        else:
                            print(
                                'Entered amount is more than your balance or ATM vault has not enough money'
                            )
                elif opt == '2':
                    try:
                        cashd = int(
                            input('Enter the money you want to deposit: '))
                    except:
                        print('Enter an integer only')
                    s.send('depositreq {} {} {}'.format(
                        userdetails[0], userdetails[2], str(cashd)).encode())
                    if s.recv(100).decode('utf-8') == '#d':
                        print('{} rupees has been deposited'.format(
                            str(cashd)))
                        cashwd(int(cashd))
                elif opt == '3':
                    s.send('profreq {}'.format(userdetails[1]).encode())
                    print(s.recv(65535).decode('utf-8'))
                elif opt == '4':
                    break
                else:
                    continue
                x = s.recv(65536).decode('utf-8').replace("Decimal('", '')
                x = x[:-3] + ']'
                userdetails = eval(x)
        else:
            print('Wrong Password')
    else:
        print('Wrong Username')