def m_start():
  kwargs = {
      'base': 'https://api.iptv.bulsat.com',
      'login': {'usr': __addon__.getSetting('username'),
                'pass': __addon__.getSetting('password')
                },
      'xxx': True,
      'os_id': __ua_os[__addon__.getSetting('dev_id')]['osid'],
      'agent_id': __ua_os[__addon__.getSetting('dev_id')]['ua'],
      'proc_cb': None,
      'app_ver': __addon__.getSetting('app_ver'),
      'path': __data__,
      'timeout': float(__addon__.getSetting('timeout')),
      'dbg': dbg,
      'gen_epg': False
    }

  server.my_serv = server.serv(kwargs)
  server.my_serv.start()
Exemple #2
0
def m_start():
    kwargs = {
        'base': 'https://api.iptv.bulsat.com',
        'login': {
            'usr': __addon__.getSetting('username'),
            'pass': __addon__.getSetting('password')
        },
        'xxx': True,
        'os_id': __ua_os[__addon__.getSetting('dev_id')]['osid'],
        'agent_id': __ua_os[__addon__.getSetting('dev_id')]['ua'],
        'proc_cb': None,
        'app_ver': __addon__.getSetting('app_ver'),
        'path': __data__,
        'timeout': float(__addon__.getSetting('timeout')),
        'dbg': dbg,
        'gen_epg': False
    }

    server.my_serv = server.serv(kwargs)
    server.my_serv.start()
Exemple #3
0
        return True


if __name__ == "__main__":
    # Port 0 means to select an arbitrary unused port

    lctx = LOG.getLogger("schedulerlog", "DH")
    cfg = config.CFG("DaytonaHost", lctx)
    cfg.readCFG("config.ini")

    common.logger.ROLE = "DHOST"
    db = dbaccess.DaytonaDBmon(cfg, LOG.getLogger("dblog", "DH"))
    sch = Scheduler(db, cfg, LOG.getLogger("schedulerlog", "DH"))

    server.serv.role = "DH"
    ase_serv = server.serv()
    server.serv.lctx = LOG.getLogger("listenerlog", "DH")
    ser = server.serv.ThreadedTCPServer((common.get_local_ip(), sch.PORT),
                                        server.serv.ThreadedTCPRequestHandler)
    server.serv.serverInstance = ser
    ip, port = ser.server_address
    server.lctx = LOG.getLogger("listenerlog", "DH")

    # Start a thread with the server -- that thread will then start one
    # more thread for each request
    server_thread = threading.Thread(target=ser.serve_forever)

    # Exit the server thread when the main thread terminates
    server_thread.daemon = True
    server_thread.start()
    lctx.info("Server loop running in thread:" + server_thread.name)
Exemple #4
0
            if c == "r":
                server.my_serv.restart()
    except KeyboardInterrupt:
        print("\nKeyboardInterrupt")
        pass


def __log(fmt, data):
    print(fmt % data)


if __name__ == "__main__":
    if 1 == len(sys.argv):
        import server
        server.log_cb = __log
        server.my_serv = server.serv(host=os.uname()[1])

        main()

        del server.my_serv
    else:
        import base64
        from Crypto import Random
        from Crypto.Cipher import AES

        b = Random.new().read(AES.block_size)
        obj = AES.new(sys.argv[1], AES.MODE_CFB, b)
        with open('./data.txt', 'rb') as fi:
            with open('./data.dat', 'wb') as f:
                f.write(base64.urlsafe_b64encode(obj.encrypt(fi.read())) + b)
Exemple #5
0
import telebot
from telebot import apihelper
import server
import core

# Прописываем прокси и токен
apihelper.proxy = {'https': 'https://149.28.154.226:8080'}
token = "649733112:AAEK-BgclHseZVIGPVKG6BEU05zxVHcZcVE"

# Заводим объект класса telebot.TeleBot
bot = telebot.TeleBot(token)

# Создаём сервер для бота
main_server = server.serv(bot)


# Прописываем все команды и ссылки на их ответы в сервере
@bot.message_handler(commands=["start"])
def start(message):
    main_server.start(message)


@bot.message_handler(commands=["create"])
def create(message):
    main_server.create(message)


@bot.message_handler(commands=["join"])
def join(message):
    main_server.join(message)