Python config.password() Examples

The following are 15 code examples of config.password(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module config , or try the search function .
Example #1
Source File: web_server.py    From SSTAP_ip_crawl_tool with GNU General Public License v3.0 6 votes vote down vote up
def rules_login():
    if session.get('username'):
        return redirect(url_for('rules_modify'))
    else:
        if request.method=='GET':
            return render_template('rules_login.html')
        else:
            username = request.form.get('username')
            password = request.form.get('password')
            print(username,password)
            if [password,username] in user_list:
                session['username'] = username#登陆成功设置session
                session.permanent = True#
                app.permanent_session_lifetime = timedelta(minutes=10)#设置session到期时间
                return redirect(url_for('rules_modify'))
            else:
                return render_template('rules_login.html') 
Example #2
Source File: run.py    From showdown with GNU General Public License v3.0 6 votes vote down vote up
def parse_configs():
    env = Env()
    env.read_env()

    config.battle_bot_module = env("BATTLE_BOT", 'safest')
    config.save_replay = env.bool("SAVE_REPLAY", config.save_replay)
    config.use_relative_weights = env.bool("USE_RELATIVE_WEIGHTS", config.use_relative_weights)
    config.gambit_exe_path = env("GAMBIT_PATH", config.gambit_exe_path)
    config.search_depth = int(env("MAX_SEARCH_DEPTH", config.search_depth))
    config.greeting_message = env("GREETING_MESSAGE", config.greeting_message)
    config.battle_ending_message = env("BATTLE_OVER_MESSAGE", config.battle_ending_message)
    config.websocket_uri = env("WEBSOCKET_URI", "sim.smogon.com:8000")
    config.username = env("PS_USERNAME")
    config.password = env("PS_PASSWORD", "")
    config.bot_mode = env("BOT_MODE")
    config.team_name = env("TEAM_NAME", None)
    config.pokemon_mode = env("POKEMON_MODE", constants.DEFAULT_MODE)
    config.run_count = int(env("RUN_COUNT", 1))

    if config.bot_mode == constants.CHALLENGE_USER:
        config.user_to_challenge = env("USER_TO_CHALLENGE")
    init_logging(env("LOG_LEVEL", "DEBUG")) 
Example #3
Source File: utils.py    From vHackXTBot-Python with MIT License 6 votes vote down vote up
def generateURL(self, username, password, uhash, php, **kwargs):
        if not kwargs:
            jsonString = {"": ""}
        else:
            jsonString = kwargs
        currentTimeMillis = str(self.getTime())
        jsonString.update({'time': currentTimeMillis, 'uhash': uhash, 'user': username, 'pass': password})
        jsonString = json.dumps(jsonString, separators=(',', ':'))
        a = self.generateUser(jsonString)
        a2 = self.md5hash(str(len(jsonString)) + self.md5hash(currentTimeMillis))
        str5 = username + self.md5hash(self.md5hash(password))
        str6 = self.md5hash(currentTimeMillis + jsonString)
        a3 = self.md5hash(self.secret + self.md5hash(self.md5hash(self.generateUser(a2))))
        str9 = self.md5hash(a3 + self.generateUser(str5))
        str7 = self.generateUser(str6)
        str8 = self.md5hash(self.md5hash(a3 + self.md5hash(self.md5hash(str9) + str7) + str9 + self.md5hash(str7)))
        return self.url + php + "?user=" + a + "&pass=" + str8 
Example #4
Source File: support.py    From Automate-it with MIT License 5 votes vote down vote up
def send_email(strTo):
    strFrom = config.fromaddr
    msgRoot = MIMEMultipart('related')
    msgRoot['Subject'] = 'Thanks for your ticket'
    msgRoot['From'] = strFrom
    msgRoot['To'] = strTo

    #Add text message to the MIME object
    msgRoot.preamble = 'This is a multi-part message in MIME format.'
    msgAlternative = MIMEMultipart('alternative')
    msgRoot.attach(msgAlternative)
    msgText = MIMEText('This is the alternative plain text message.')
    msgAlternative.attach(msgText)
    msgText = MIMEText('Hi there, <br><br>Thanks for your query with us today.'
                       ' You can look at our <a href="https://google.com">FAQs</a>'
                       ' and we shall get back to you soon.<br><br>'
                       'Thanks,<br>Support Team<br><br><img src="cid:image1">', 'html')
    msgAlternative.attach(msgText)

    #Add logo image to the auto response
    fp = open('google.png', 'rb')
    msgImage = MIMEImage(fp.read())
    fp.close()
    msgImage.add_header('Content-ID', '<image1>')
    msgRoot.attach(msgImage)

    #Start SMTO Server and respond to the customer
    import smtplib
    server = smtplib.SMTP('smtp.gmail.com', 587)
    server.starttls()
    server.login(config.fromaddr, config.password)
    server.sendmail(config.fromaddr, config.toaddr, msgRoot.as_string())
    server.quit()

#Infinite loop to read the inbox for new emails 
#every 60 seconds (1 minute) 
Example #5
Source File: TestEOS.py    From pyeos with Apache License 2.0 5 votes vote down vote up
def setUpClass(cls):
        cls.device = EOS(config.hostname, config.username, config.password, config.use_ssl)
        cls.device.open() 
Example #6
Source File: conftest.py    From LibrERP with GNU Affero General Public License v3.0 5 votes vote down vote up
def __init__(self, config):
        # Prepare the connection to the server
        self.oerp = oerplib.OERP(config.host, protocol=config.protocol, port=config.port)

        # Login (the object returned is a browsable record)
        user = self.oerp.login(config.user, config.password, config.db_name) 
Example #7
Source File: TestFortiOS.py    From pyfg with Apache License 2.0 5 votes vote down vote up
def setUpClass(cls):
        cls.device = FortiOS(config.vm_ip, vdom='test_vdom', username=config.username, password=config.password)
        cls.device.open()

        with open(config.config_file_1, 'r') as f:
            cls.config_1 = f.readlines()
        with open(config.config_file_2, 'r') as f:
            cls.config_2 = f.readlines() 
Example #8
Source File: twitchy.py    From twitchy_the_bot with MIT License 5 votes vote down vote up
def reddit_setup(self):
        print "Logging in"
        r = praw.Reddit("Sidebar livestream updater for /r/{} by /u/andygmb ".format(subreddit))
        r.login(username=username, password=password, disable_warning=True)
        sub = r.get_subreddit(subreddit)
        return r, sub 
Example #9
Source File: run.py    From showdown with GNU General Public License v3.0 5 votes vote down vote up
def showdown():
    parse_configs()

    apply_mods(config.pokemon_mode)

    original_pokedex = deepcopy(pokedex)
    original_move_json = deepcopy(all_move_json)

    ps_websocket_client = await PSWebsocketClient.create(config.username, config.password, config.websocket_uri)
    await ps_websocket_client.login()

    battles_run = 0
    wins = 0
    losses = 0
    while True:
        team = load_team(config.team_name)
        if config.bot_mode == constants.CHALLENGE_USER:
            await ps_websocket_client.challenge_user(config.user_to_challenge, config.pokemon_mode, team)
        elif config.bot_mode == constants.ACCEPT_CHALLENGE:
            await ps_websocket_client.accept_challenge(config.pokemon_mode, team)
        elif config.bot_mode == constants.SEARCH_LADDER:
            await ps_websocket_client.search_for_match(config.pokemon_mode, team)
        else:
            raise ValueError("Invalid Bot Mode")

        winner = await pokemon_battle(ps_websocket_client, config.pokemon_mode)

        if winner == config.username:
            wins += 1
        else:
            losses += 1

        logger.info("W: {}\tL: {}".format(wins, losses))

        check_dictionaries_are_unmodified(original_pokedex, original_move_json)

        battles_run += 1
        if battles_run >= config.run_count:
            break 
Example #10
Source File: utils.py    From vHackXTBot-Python with MIT License 5 votes vote down vote up
def __init__(self):
        self.secret = "aeffI"
        self.url = "https://api.vhack.cc/v/16/"
        self.username = config.user
        self.password = config.password
        self.user_agent = "" 
Example #11
Source File: utils.py    From vHackXTBot-Python with MIT License 5 votes vote down vote up
def requestString(self, username, password, uhash, php, **kwargs):
        logger.debug("Request: {}".format(php))
        self.user_agent = self.generateUA(username + password)
        time.sleep(0.3)
        t = None
        i = 0
        while t is None:
            if i > 10:
                exit(0)
            try:
                req = urllib2.Request(self.generateURL(username, password, uhash, php, **kwargs))
                req.add_header('User-agent', self.user_agent)
                r = urllib2.urlopen(req, context=ssl._create_unverified_context(), timeout=15)
                t = r.read()
                logger.debug("Response:\n{}\n".format(t))
                if t == "5":
                    logger.info("Check your Internet.")
                elif t == "8":
                    logger.info("User/Password wrong!")
                elif t == "10":
                    logger.info("API is updated.")
                elif t == "15":
                    logger.info("You are Banned sorry :(")
                elif t == "99":
                    logger.info("Server is down for Maintenance, please be patient.")
                return t
            except urllib2.URLError as e:
                logger.error('Error: {}'.format(e))
                logger.info('Timeout while requesting "{}"'.format(php))
                time.sleep(1 + i)
            except Exception as e:
                logger.error('Error: {}'.format(e))
                logger.info("Blocked, trying again. Delaying {0} seconds".format(i))
                time.sleep(1 + i)
            i += 1 
Example #12
Source File: utils.py    From vHackXTBot-Python with MIT License 5 votes vote down vote up
def requestStringNoWait(self, username, password, uhash, php, **kwargs):
        self.user_agent = self.generateUA(username + password)
        for i1 in range(0, 10):
            try:
                req = urllib2.Request(self.generateURL(username, password, uhash, php, **kwargs))
                req.add_header('User-agent', self.user_agent)
                r = urllib2.urlopen(req, context=ssl._create_unverified_context(), timeout=15)
                t = r.read()
                # print i1
                return t
            except Exception as e:
                logger.error('Error: {}'.format(e))
                time.sleep(1)
        return "null" 
Example #13
Source File: utils.py    From vHackXTBot-Python with MIT License 5 votes vote down vote up
def requestArray(self, username, password, uhash, php, **kwargs):
        temp = self.requestString(username, password, uhash, php, **kwargs)
        if temp != "null":
            return self.parse(temp)
        else:
            return [] 
Example #14
Source File: player.py    From vHackXTBot-Python with MIT License 5 votes vote down vote up
def removespy(self):
        response = self.ut.requestArray(self.username, self.password, self.uhash, "vh_removeSpyware.php")
        return response 
Example #15
Source File: player.py    From vHackXTBot-Python with MIT License 5 votes vote down vote up
def _init(self):
        """
        {"id":"924198","money":"14501972","ip":"83.58.131.20",
        "inet":"10","hdd":"10","cpu":"10","ram":"14","fw":"256","av":"410","sdk":"580","ipsp":"50","spam":"71","scan":"436","adw":"76",
        "actadw":"","netcoins":"5550","energy":"212286963","score":"10015",
        "urmail":"1","active":"1","elo":"2880","clusterID":null,"position":null,"syslog":null,
        "lastcmsg":"0","rank":32022,"event":"3","bonus":"0","mystery":"0","vipleft":"OFF",
        "hash":"91ec5ed746dfedc0a750d896a4e615c4",
        "uhash":"9832f717079f8664109ac9854846e753282c72cdf42fe33fb33c734923e1931c","use":"0",
        "tournamentActive":"2","boost":"294","actspyware":"0","tos":"1","unreadmsg":"0"}
        :return:
        """
        data = self.ut.requestString(self.username, self.password, self.uhash, "vh_update.php")
        if len(data) == 1:
            logging.warn('Username and password entered in config.py?')
            sys.exit()
        try:
            j = json.loads(data)
            self.setmoney(j['money'])
            self.ip = j['ip']
            self.score = j['score']
            self.netcoins = j['netcoins']
            self.localspyware = j['actspyware']
            self.rank = j['rank']
            self.boosters = j['boost']
            self.remotespyware = j['actadw']
            self.email = int(j['urmail'])
            self.uhash = str(j['uhash'])
            logger.info("\n Your profile :\n\n Your IP: {0}, Your Score:  {1}, Your netcoins {2}, \n Your rank: {3}, Your Booster: {4}, Active Spyware {5} \n\n".format(j['ip'], j['score'], j['netcoins'], j['rank'], j['boost'], j['actspyware']))
        except:
            exit()