Пример #1
0
    def ask_for_keys(force_change = False): ## Asks for keys, what else?
        global client_id, client_secret, password, keys
        if force_change:
            FOO.change_flow(True)
        else:
            FOO.yn_question ("""\
            Do you want to set up new keys?""")
        while FOO.flow_control_is(True):
            FOO.text("""
            Please type in your keys as asked""", skip = True)
            client_id     = FOO.question ("... Client ID ..: ")
            client_secret = FOO.question (". Client Secret : ")
            password      = FOO.question ("... Password ...: ")
            keys = {'client_id': client_id, 'client_secret': client_secret, 'password': password}
            FOO.yn_question ("""\
            Do you want to make any changes to the previous keys?""")

        FOO.text("""
        Alright! It seems you have your keys ready and you're good to go!
        """)
Пример #2
0
    def ask_for_password():
        global my_password
        FOO.change_flow(True)
        while FOO.flow_control_is(True):
            my_password = FOO.question("""
            Now please enter your custom password.
            Create a new one if you don't have one already.

            Password: """)
            if not FOO.ANNOYANCE and my_password:
                FOO.text("""
                Oops, sorry! That was plain-text. Don't worry, this is no error, it's just that \
                I can't help it, because there's no cross-platform Python \
                function that I know of which has predictable 'asterisk' behavior.""",
                """
                Also, you're the developer, it's up to you to create your desired behavior. I'm \
                but a humble automatic TUTORIAL.""", end = "")
                FOO.ANNOYANCE = True
            elif not my_password:
                if not FOO.ANNOYANCE2:
                    FOO.text("""
                    Really!? No password? Well, we've got a badass here, your call.""", end = "")
                    FOO.ANNOYANCE2 = True
                else:
                    FOO.text("<blank password>", end = "", skip = True)
            FOO.yn_question("""
            Do you want to change your password?""")
Пример #3
0
    def store_keys_routine():
        FOO.text("""
        So, we'll store the keys you provided.
        """)
        try:
            store_keys
        except NameError:
            FOO.text("""\
            First we need to import store_keys, which is found in src/security/key_handling.py
            """)
            
            ####################################
            ## imports are important

            from src.security.key_handling import store_keys
            FOO.echo_import (store_keys)
            FOO.text("", end = "")
            
            ####################################
            
        FOO.text("""
        Now I will call

        >> store_keys({username},{{...}},'***') # <- Your keys and password go here
        
        This function has other optional fields. Most relevantly context='OGS' is default \
        behavior, but it can be changed to 'OGS_Beta for testing.'""".format(username = repr(username)))
        
        while not FOO.flow_control_is(True):
            try:
                store_keys(username, keys, my_password)
                FOO.text("""
                We've successfully stored your keys. Now you can simply use your username and \
                password to retrieve them every time.
                """)
                FOO.change_flow(True)
            except ValueError as e:
                FOO.text("""
                Something about your keys doesn't look right...
                I got this error message: {error}
                """.format(error = e))
                ask_for_keys(force_change = True)
Пример #4
0
    I. FIRST THINGS FIRST:


    1- You need to get your own CLIENT ID and CLIENT SECRET, so that you'll be logging in from your own copy of the script. \
    So go here https://online-go.com/developer and create one. Congratulations! you're "officially" a developer.

    2- You need your own client PASSWORD, also provided by OGS. So here https://online-go.com/user/settings there's \
    an Application Specific Password: you should create one. You've probably done this much so far.""""""\
    If you havent, go now, and get the three keys, and come back when you're ready. I'll be waiting for you...""")
    FOO.text("""\
    3- Now you'll store your keys.""","""Yeah, you heard it right, store them.""",
    """
    -- But what about that "not checking [the keys] in to source control" I read about in OGS Api? --""",
    """
    Well, tough luck, buddy!""",
    """Fortunately, we can get along just fine. I'll obfuscate the keys for you.
    It's a simple and very breakable XOR encryption, but since you'll only be storing your own, \
    and your custom chosen password you won't need to write down anywhere, this is as good as it gets.
    (Also Leira is telling me he hopes to come up with a better system later on)

    """,
    end ="")

    FOO.text("""
    We need to import the proper modules for this purpose:
    These files can be found at the src/security directory

    """)

    #############################
    ## imports are important