예제 #1
0
파일: webserver.py 프로젝트: wolfy852/Code
def setup(code):
    global bot
    bot = code
    id = str(gen(0, 10000000))
    bot.set('webserver.object', id)

    # Nasty area, we check for configuration options, some are required and some arent
    if not bot.config('webserver'):
        return
    if not bot.config('webserver_password'):
        return output.warning('To use the builtin webserver, you must set a password in the config', 'WEBSERVER')
    port = bot.config('webserver_port', 8888)
    thread.start_new_thread(checkstate, (bot, input, id,))
    thread.start_new_thread(init, (str(host), int(port),))
예제 #2
0
 def solve_lesson():
     while True:
         wait_interval(RESP_TIME)
         try:
             links = driver \
                     .find_element_by_css_selector('ul.ets-ui-acc-act-nav') \
                     .find_elements_by_tag_name('a')[:-1]
             for i in links:
                 actid = i.get_attribute('data-act-id')
                 actid = actid.split('!')[-1]
                 driver.execute_script( script \
                         .replace('<act-id>',actid) \
                         .replace('<score>',str(100-gen(0,5))) \
                         .replace('<time-cost>',str(gen(2,5)))\
                         )
                 pass
             wait_interval(RESP_TIME)
             driver.find_element_by_css_selector(
                 'li.ets-ui-acc-act-nav-summary').click()
             wait_interval(RESP_TIME)
             finished = (driver.find_element_by_tag_name(
                 '.ets-btn-white > span:nth-child(1)').text == '返回到单元')
             driver.find_element_by_css_selector(
                 'div.ets-btn-white.ets-btn-large').click()
             if finished:
                 break
         except ElementClickInterceptedException:
             pass
         except:
             pass
         try:
             driver.find_element_by_css_selector(
                 'a.tck-ui-ft-link.tck-ui-ft-cancel').click()
         except:
             pass
     return None
예제 #3
0
 def drawFlag(self, qp):
     if self.flag:
         x, y, len_ = gen(0,
                          self.width() - 1), gen(0,
                                                 self.height() - 1), gen(
                                                     0,
                                                     self.width() // 2)
         qp.setBrush(QColor(gen(0, 255), gen(0, 255), gen(0, 255)))
         qp.drawEllipse(x, y, len_, len_)
         self.flag = False
예제 #4
0
파일: webserver.py 프로젝트: CHCMATT/Code
def setup(code):
    id = str(gen(0, 10000000))
    code.set("webserver.object", id)

    # Nasty area, we check for configuration options, some are required and some arent
    if not hasattr(code.config, "run_webserver") or not hasattr(code.config, "webserver_pass"):
        return
    if not code.config.run_webserver:
        return
    if not code.config.webserver_pass:
        output.error("To use webserver.py you must have a password setup in default.py!")
        return
    if not hasattr(code.config, "webserver_port"):
        port = 8888
    else:
        port = code.config.webserver_port
    Sender = CollectData(code, input, id)
    Sender.start()  # Initiate the thread.
    thread.start_new_thread(init, (str(host), int(port)))
예제 #5
0
파일: webserver.py 프로젝트: wolfy852/Code
def setup(code):
    global bot
    bot = code
    id = str(gen(0, 10000000))
    bot.set('webserver.object', id)

    # Nasty area, we check for configuration options, some are required and some arent
    if not bot.config('webserver'):
        return
    if not bot.config('webserver_password'):
        return output.warning(
            'To use the builtin webserver, you must set a password in the config',
            'WEBSERVER')
    port = bot.config('webserver_port', 8888)
    thread.start_new_thread(checkstate, (
        bot,
        input,
        id,
    ))
    thread.start_new_thread(init, (
        str(host),
        int(port),
    ))
예제 #6
0
import os, flask
import json, xmltodict, urllib2
from HTMLParser import HTMLParser as h
import utils, time
from random import randint as gen
import settings

app = flask.Flask(__name__)
app.secret_key = str(gen(0,1000000000000))

params = settings.params

methods = {
    #'getLatestChatsWithLimit': [10],
    #'getMotd': [], # MOTD
    'getPlugins': [],
    'getPlayerNames': [], # Player list
    'getOfflinePlayerNames': [], # Offline users
    'getPlayerCount': [], # Online player count
    'getPlayerLimit': [], # Max players
    'getServerVersion': [], # Get MC version (has the spigot tag on it)
    'system.getDiskFreeSpace': [], # Amount of free HDD
    'system.getDiskSize': [], # Total HDD space
    'system.getJavaMemoryTotal': [], # RAM Allocated
    'system.getJavaMemoryUsage': [] # RAM used
}

@app.route('/')
@app.route('/<page>')
def index_handler(page="index"):
    page = page.lower()