コード例 #1
0
class Main:
    def __init__(self):
        self.log = Logging()
        self.config = Config()
        self.console = Console()
        self.console.clear()

    def start(self):
        #  ======================================================
        #  start message

        def clear():
            return os.system('cls')

        clear()

        def wel():
            welmsg = [
                58 * '─', '|  0.01  |' + 12 * ' ' +
                'pyCestra -  World Server' + 11 * ' ' + '|', 58 * "─"
            ]
            for x in welmsg:
                print(bcolors.blue + x + bcolors.cend)

        wel()

        #  ======================================================
        #  connection test

        self.log.info('Connection Test...')
        database = dataSource.Database()
        if database.get_connection():
            self.log.info('Connection Successfully')
        else:
            self.log.warning('Connection ERROR')
            sys.exit(0)

        #  ======================================================
        #  world class test
        world = World()
        world.createWorld()
        #  ======================================================
        #  exchange client test

        exchangeTransferList = []
        exClient = ExchangeClient()
        exClient.initialize(self.config.get_exchange_ip(),
                            self.config.get_exchange_port(),
                            exchangeTransferList)

        self.log.debug('Game Server Start')
        GameServer().initialize(self.config.get_world_ip(),
                                self.config.get_world_port(),
                                exchangeTransferList, world)
コード例 #2
0
ファイル: Web_Info.py プロジェクト: rufherg/Web_InfoCollector
#! /usr/bin/env python
# -*- coding: utf-8 -*-
'''
@File   : Web_Info.py
@Author : DEADF1SH_CAT
@Date   : 2020/11/17 20:49

Description:

Usage:

'''

from core.console import Console

if __name__ == '__main__':
    Console()
コード例 #3
0
 def __init__(self):
     self.log = Logging()
     self.config = Config()
     self.console = Console()
     self.console.clear()
コード例 #4
0
ファイル: main.py プロジェクト: Cestra/pyCestra
def main():
    #  ======================================================
    #  start message

    log = Logging()
    console = Console()
    console.clear()

    def wel():
        welmsg = [
            58 * '─', '|  0.01  |' + 12 * ' ' + 'pyCestra - Logon Server' +
            12 * ' ' + '|', 58 * "─"
        ]
        for x in welmsg:
            print(bcolors.blue + x + bcolors.cend)

    wel()

    # ======================================================
    # preload data

    config = Config()
    config.initialize()

    log.info('Connection Test...')
    database = dataSource.Database()
    if database.get_connection():
        log.info('Connection Successfully')
    else:
        log.warning('Connection ERROR')
        sys.exit(0)

    hostList = dataSource.ServerData()
    hostList.load()
    hostList = hostList.get_server_data()
    log.info('ServerData were loaded')

    accountData = dataSource.AccountData()
    accountData.load()
    accountDataDic = accountData.get_account_data()
    log.info('AccountData were loaded')

    ipbans = dataSource.IpBans().load()
    log.info('IP Bans were loaded')

    dataSource.DatabaseUpdateService().start(accountDataDic,
                                             config.get_update_time())

    # ======================================================
    # socket tests

    print(58 * '-')

    game_client_dic = {}

    LoginServer(config.get_login_ip(), config.get_login_port(),
                game_client_dic, accountDataDic, hostList, ipbans)

    ExchangeServer().start(config.get_exchange_ip(),
                           config.get_exchange_port(), hostList)

    while True:
        time.sleep(15)
        if game_client_dic:
            log.warning('---- game_client_dic ----')
            for x in game_client_dic:
                log.warning(str(x))
            log.warning('-------------------------')
コード例 #5
0
from core.console import Console
import argparse
import signal

if (__name__ == "__main__"):
    parser = argparse.ArgumentParser(
        description="sniff tool packet on the fly")
    parser.add_argument('-i',
                        '--interface',
                        dest='interface',
                        help='set the interface to sniff',
                        default=None)
    parser.add_argument('-f',
                        '--filter',
                        dest='filter',
                        help='set the string filter to sniff',
                        default='tcp and ( port 80)')
    parser.add_argument('-v',
                        '--version',
                        dest='version',
                        help='show version the tool')

    console = Console(parser.parse_args())
    console.cmdloop("sniff tool packet on the fly")
    #signal.signal(signal.SIGINT, signal_handler)
    #sniffer.run()
    signal.pause()
コード例 #6
0
from core.console import Console

if __name__ == "__main__":
    console = Console()
    console.evaluar_argumentos()
コード例 #7
0
ファイル: modulus.py プロジェクト: ganye/modulus_old
def args_parse():
    parser = argparse.ArgumentParser()
    parser.add_argument('--disable-colors', help='Disables text colors.',
                        action='store_true')
    parser.add_argument('-i', '--input-file',
                        help='File to read commands and input from.')
    parser.add_argument('-o', '--output-file', 
                        help='File to write output to.')
    return parser.parse_args()

if __name__ == '__main__':
    args = args_parse()
    
    if args.input_file:
        istream = args.input_file
    else:
        istream = sys.stdin
        
    if args.output_file:
        ostream = args.output_file
    else:
        ostream = sys.stdout
    
    colors = not args.disable_colors
    
    console = Console(istream=istream, ostream=ostream, colors=colors)
    while True:
        user_input = console.get_input()
        console.handle_input(user_input)
コード例 #8
0
#!/usr/bin/env python3
import argparse

from core.console import Console
from core.engine import Engine
from core.interpreter import Interpreter
from ports.art_net import ArtNetPort

if __name__ == '__main__':
    ap = argparse.ArgumentParser(
        description="Theatrical lighting control engine/language interpreter.")
    ap.add_argument(
        'file',
        nargs='?',
        help=
        'A file of lxscript code to run before entering the interactive environment'
    )
    ap.add_argument('--address',
                    help='IP address to send ArtNet data to',
                    default='<broadcast>')
    args = ap.parse_args()

    engine = Engine([ArtNetPort(1, address=args.address)])

    if args.file:
        with open(args.file, 'r') as file:
            Interpreter(engine).run(file.read())

    Console(engine).cmdloop()