<commit_before>from nessusapi.session import Session
from getpass import getpass

def authenticate():
    Session(_prompt("Username"),
            _prompt("Password", hidden=True),
            _prompt("Host", "127.0.0.1"),
            _prompt("Port", "8834"))

def _prompt(text, default=None, hidden=False):
    choice = ""
    while choice == "":
        prompt = "{0}{1}: ".format(text, " (default: {0})".format(default) if default else "")
        if hidden:
            choice = getpass(prompt)
        else:
            choice = raw_input(prompt)

        if not choice and default is not None:
            return default
    return choice
            
<commit_msg>Improve interface's session<commit_after>from nessusapi.session import Session
from getpass import getpass

def authenticate():
    print("Connecting to Nessus API")
    host=_prompt("Host", "127.0.0.1")
    port=_prompt("Port", "8834")
    Session(_prompt("Username"),
            _prompt("Password", hidden=True),
            host,
            port)
            

def _prompt(text, default=None, hidden=False):
    choice = ""
    while choice == "":
        prompt = "{0}{1}: ".format(text, " (default: {0})".format(default) if default else "")
        if hidden:
            choice = getpass(prompt)
        else:
            choice = raw_input(prompt)

        if not choice and default is not None:
            return default
    return choice
            

{'fraction_non_alphanumeric': 0.12630844382414516, 'fraction_numerical': 0.018143754361479414, 'mean_word_length': 2.2739726027397262, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2943371', 'n_tokens_mistral': 425, 'n_tokens_neox': 398, 'n_words': 110}