Esempio n. 1
0
def getAndConfirmPassword():
    password = getpass(prompt="Enter password: "******"Confirm password: "******"\nError: Passwords did not match\n", "red")
        password = getpass(prompt="Enter password: "******"Confirm password: ")

    return password
Esempio n. 2
0
def removePassword(passwordDict, f):
    listApps(passwordDict, f)

    app = input("Enter app name: ")

    if app in passwordDict:
        del passwordDict[app]
        updateFile(passwordDict, f)
    else:
        cprint("\nError: App doesn't exist\n", "red")
Esempio n. 3
0
def main():
    global here
    while True:
        here = m.grid[pc.pos]
        print(pc.pos)
        print(m.show2d(*pc.pos))
        print(here.look())
        dirs = list(m.get_dirs(*pc.pos))
        names = map(lambda x: cellmap.dir_name(*x), dirs)
        colors.cprint(", ".join(names) + "\n", color=colors.OKGREEN)
        read_command()
Esempio n. 4
0
def copyPassword(passwordDict, f):
    listApps(passwordDict, f)

    app = input("Enter app name: ")

    if app in passwordDict:
        password = passwordDict[app]["password"]
        pyperclip.copy(password)

        cprint("\nPassword copied to clipboard\n", "green")
    else:
        cprint("\nError: App doesn't exist\n", "red")
Esempio n. 5
0
def addPassword(passwordDict, f):
    listApps(passwordDict, f)

    app = input("Enter app name: ")

    if app in passwordDict:
        cprint("\nWarning: App already exists\n", "yellow")
    else:
        url = input("Enter website url: ")
        user = input("Enter email / username: "******"url": url, "user": user, "password": password}
        updateFile(passwordDict, f)
Esempio n. 6
0
def changePassword(passwordDict, f):
    listApps(passwordDict, f)

    app = input("Enter app name: ")

    if app in passwordDict:
        password = getAndConfirmPassword()

        passwordDict[app]["password"] = password
        updateFile(passwordDict, f)

        cprint(f"\nPassword successfully changed for {app}", "green")
    else:
        cprint("\nError: App doesn't exist\n", "red")
Esempio n. 7
0
def viewPassword(passwordDict, f):
    listApps(passwordDict, f)

    app = input("Enter app name: ")

    if app in passwordDict:
        url = passwordDict[app]["url"]
        user = passwordDict[app]["user"]
        password = passwordDict[app]["password"]

        print("""
        ------------- DETAILS -------------
        App name   | {}
        Url        | {}
        Username   | {}
        Password   | {}
        ------------- DETAILS -------------
        """.format(app, url, user, password))
    else:
        cprint("\nError: App doesn't exist\n", "red")
Esempio n. 8
0
    def nextTurn(self):
        self.lastDice = dice =  Dice()
        currentPlayer = self.turnQueue.popFront()

        cprint("{game Turn of {player %s}}" % currentPlayer.name)
        cprint("{game Throw the dice %s}" % str(dice.eyes) )

        if dice.doubles():
            self.jailDoublesCounter += 1

            if currentPlayer in self.injail:
                del self.injail[currentPlayer]

            if self.jailDoublesCounter >= self.cfg['doubles_jail_limit']:
                self.sendPlayerToJail( currentPlayer )
                self.jailDoublesCounter = 0
                self.turnQueue.pushBack(currentPlayer)
                return
            else:
                self.turnQueue.pushFront(currentPlayer)
        else:
            self.jailDoublesCounter = 0
            self.turnQueue.pushBack(currentPlayer)
            if currentPlayer in self.injail:
                if self.injail[currentPlayer] < self.get('jail_tries'):
                    return
                else:
                    self.transferMoney(currentPlayer, BANK, self.get("jail_fee"))

        self.movePlayerForward( currentPlayer, dice.count() )

        cprint("{game new turn queue: %s}" % self.turnQueue )
        currentPlayer( game )
Esempio n. 9
0
def clustered_print(a, m, p):
    COLCODE = {
        'k': 0,  # black
        'r': 1,  # red
        'g': 2,  # green
        'y': 3,  # yellow
        'b': 4,  # blue
        'm': 5,  # magenta
        'c': 6,  # cyan
        'w': 7  # white
    }
    COLORS = [(c1, c2) for c1 in COLCODE for c2 in COLCODE if c1 != c2]
    mI = 0
    for machine in a:
        pI = 0
        for part in machine:
            if m[mI] == p[pI]:
                cprint(part, *COLORS[p[pI] % len(COLORS)])
            else:
                print(part, end='')
            pI += 1
        print()
        mI += 1
    print('-' * 79)
Esempio n. 10
0
def printSuccess(message):
    colors.cprint(f"{message}", fg='g', bg='k', style='b')
Esempio n. 11
0
def quit(passwordDict, f):
    cprint("\nThanks for using urvianoob's Password Manager v1.1!\n", "header")
Esempio n. 12
0
def printDanger(message):
    colors.cprint(f"{message}", fg='r', bg='w', style='b')
Esempio n. 13
0
import bcrypt
from getpass import getpass
import os
from colors import cprint

__location__ = os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file__)))

# shameless plug
cprint("\nurvianoob's Password Manager v1.0\n", "header")

try:
    # if you have these files, then you've already run the setup
    with open(os.path.join(__location__, "password.txt"), "rb") as f:
        f.read()
    with open(os.path.join(__location__, "definitelyNotWhereYourPasswordsAreStored.json"), "rb") as f:
        f.read()

    cprint("Error: you've already setup the password manager\n", "red")

except FileNotFoundError:
    # if files not found, run the setup
    print("Welcome to the initial setup\n")
    print("Please enter a password that's 15 characters or longer\n")

    password = getpass(prompt="Enter your master password: "******"Confirm your master password: "******"\nPlease enter a password that's 15 characters or longer", "yellow")
        else:
            cprint("\nError: passwords did not match\n", "red")
Esempio n. 14
0
def exitShell():
    colors.cprint('\nSee you later :-)\n', fg='b', style='b')
    exit()
Esempio n. 15
0
 def onVisit(self, player, game):
     cprint("{game %s payes tax}" % player)
     game.transferMoney(player, 'freepark', game.get("tax"), 'tax')
     cprint("%s current money: %d" % (player, game.getMoney(player)) )
     cprint("%s current money: %d" % ('freepark', game.getMoney('freepark')) )
Esempio n. 16
0
import os
import sys
import tensorflow.contrib.tensorrt as trt
from tf_trt_models.detection import build_detection_graph
from tx2_config import MODEL, DATA_DIR, CONFIG_FILE, CHECKPOINT_FILE, SERIAL_FILE
sys.path.insert(0, os.path.join(os.getcwd(), 'common'))
from colors import cprint
#cprint=common.colors.cprint

cprint('Freezing tensorflow graph...', 'blue')
try:
    frozen_graph, input_names, output_names = build_detection_graph(
        config=CONFIG_FILE,
        checkpoint=CHECKPOINT_FILE,
        score_threshold=0.3,
        force_nms_cpu=False,
        batch_size=1)
    cprint('Tensorflow graph frozen successfully', 'green')
except Exception as e:
    cprint('Failed to freeze graph', 'error')
    cprint(str(e), 'error')

cprint('Creating inference graph...', 'blue')

try:
    trt_graph = trt.create_inference_graph(input_graph_def=frozen_graph,
                                           outputs=output_names,
                                           max_batch_size=1,
                                           max_workspace_size_bytes=1 << 25,
                                           precision_mode='FP16',
                                           minimum_segment_size=50)
Esempio n. 17
0
def badcmd(msg):
    colors.cprint(msg, color=colors.WARNING)
Esempio n. 18
0
def hprint(msg):
    colors.cprint(msg, color=colors.FAIL)
Esempio n. 19
0
def printInfo(message):
    colors.cprint(f"{message}", fg='w', style='b')
Esempio n. 20
0
def pcprint(msg):
    colors.cprint(msg, color=colors.OKBLUE)
Esempio n. 21
0
class PlayerBuyEverything(DummyPlayer):
    def __init__(self, n = "buyer"):
        super().__init__(n)

    def __call__(self, game):
        f = game.getField(self)
        cprint(str(f))
        print(repr(f.get('buyprice')))
        if game.isBuyable(f) and game.getMoney(self) >= f.get('buyprice'):
            game.buyField(self, f)



if __name__ == "__main__":
    game = Game("monopoly.field.yaml")
    game.addPlayer(PlayerBuyEverything("p1"))
    game.addPlayer(DummyPlayer("p2"))
    game.addPlayer(DummyPlayer("p3"))
    game.addPlayer(PlayerBuyEverything("p4"))

    for j in range(1,1000):
        game.nextTurn()

    pprint(game.accounts)

    for f in game.fields:
        if f.owner is not None:
            cprint( "%s\t\t\t%s" % (str(f), f.owner))
        else:
            cprint(str(f))
Esempio n. 22
0
 def movePlayerForward(self, player, number):
     curpos = self.playerPositions[player]
     nextpos = curpos + number
     cprint("{move {player %s} from %d to %d}" % (player, curpos, nextpos))
     self.playerPositions[player] = nextpos
     self.triggerEvents(player, curpos, nextpos)
Esempio n. 23
0
    def transferMoney(self, sender, receiver, amount, reason = "" ):
        cprint("{money transfer $ %d from %s to %s} %s" % (amount, sender, receiver, reason))

        self.accounts[sender] -= amount
        self.accounts[receiver] += amount
Esempio n. 24
0
def printImportant(message):
    colors.cprint(f"{message}", fg='r', bg='k', style='b')
Esempio n. 25
0
def cmdhelp(v):
    msg = "Possible commands are:\n"
    msg += "\n".join(commands.keys())
    msg += "\n"
    colors.cprint(msg, color=colors.WARNING)
Esempio n. 26
0
 def __call__(self, game):
     f = game.getField(self)
     cprint(str(f))
     print(repr(f.get('buyprice')))
     if game.isBuyable(f) and game.getMoney(self) >= f.get('buyprice'):
         game.buyField(self, f)
Esempio n. 27
0
 def onPassing(self, player, game):
     cprint("{game %s passed the start field}" % player)
     game.transferMoney( BANK , player, game.get('startpassmoney'))
     cprint("%s current money: %d" % (player, game.getMoney(player)) )
Esempio n. 28
0
import cellmap
import player
import entity
import event
import colors
import logging
log = logging.getLogger()
sh = logging.StreamHandler()
sh.setLevel(logging.DEBUG)
#sh.setFormatter(logging.Formatter('%(asctime)s %(levelname)s [%(name)s] %(message)s'))
log.addHandler(sh)
log.setLevel(logging.INFO)
log.debug("Started logger")

colors.cprint("Loading map...\n")
m = cellmap.Map()
m.gen(10)

pc = player.Player()
#pc.level_up(5)
pc.weapon = entity.Weapon("Super Sword").power(12035)
entity.player_uuid = pc.uuid
here = m.grid[pc.pos]
colors.cprint("Done!\n")


def main():
    global here
    while True:
        here = m.grid[pc.pos]
        print(pc.pos)
Esempio n. 29
0
from getpass import getpass
import bcrypt
from methods import *
import json
import os
import sys
from colors import cprint

__location__ = os.path.realpath(
    os.path.join(os.getcwd(), os.path.dirname(__file__)))

try:
    with open(os.path.join(__location__, "password.txt"), "rb") as f:
        masterPasswordHash = f.read()
except FileNotFoundError:
    cprint("Manager not setup, please run setup.py", "red")
    sys.exit(1)

cprint("\nurvianoob's Password Manager v1.1\n", "header")
userPassword = getpass(prompt="Please enter the master password: "******"\nError: Incorrect password \n", "red")
    userPassword = getpass(prompt="Please enter the master password: ")

# creates encryption key stuff
f = getFernetKey(password=userPassword)

# decrypts and loads allPasswords into dict object
with open(
        os.path.join(__location__,