def do_show(self, line): """ \rShow status of a virtual server \rSyntax: show tcp|udp|fwm <vip> <port> """ syntax = "*** Syntax: show tcp|udp|fwm <vip> <port>" commands = line.split() numeric = self.settings['numeric'] color = self.settings['color'] if len(commands) == 3 or len(commands) == 2: protocol = commands[0] vip = commands[1] if len(commands) == 3: port = commands[2] else: port = None if protocol in self.protocols: d = self.director.show_virtual(vip, port, protocol, numeric, color) f = self.firewall.show_virtual(vip, port, protocol, numeric, color) utils.pager(self.config['pager'], d + f) else: print syntax else: print syntax
def do_status(self, line): """ \rDisplay status of all packet filtering rules """ mangle = self.firewall.show_mangle(self.settings['numeric'], self.settings['color']) ports = self.firewall.show(self.settings['numeric'], self.settings['color']) nat = self.firewall.show_nat(self.settings['numeric']) utils.pager(self.config['pager'], mangle + ports + nat + [''])
def do_show(self, line): """Show director or firewall configuration.""" if line == "director" or line == "firewall": configkey = line + "_config" if not self.config[configkey]: logger.error("'%s' not defined in configuration file!" % configkey) else: lines = utils.print_file(self.config[configkey]) utils.pager(self.config['pager'], lines) else: print "\nsyntax: show <module>\n"
def do_status(self,line): """ \rDisplay status of all virtual servers """ syntax = "*** Syntax: status" numeric = self.settings['numeric'] color = self.settings['color'] if not line: d = self.director.show(numeric, color) d.append('') utils.pager(self.config['pager'], d) else: print syntax
def post(self): channel_id = self.get_argument('channel_id', '') old_query_channel = self.get_argument('old_query_channel', '') if old_query_channel: channel_id = old_query_channel begin_str = self.get_argument('begin_date') end_str = self.get_argument('end_date') c_page = int(self.get_argument('c_page', 0)) _query = make_date_query(begin_str, end_str) if not _query: return self.write(error_res('begin data or end data is error')) if channel_id: _query['channel'] = channel_id res = get_all_conf(page=c_page, col=M_DB.deny_list, query=_query) page_list, can_pre_page, can_next_page = pager(res['totalpage'], c_page) self.render('log.html', begin_date=begin_str, end_date=end_str, channel_id=channel_id, old_query_channel=old_query_channel, all_log=res['all_conf'], totalpage=res['totalpage'], c_page=c_page, page_list=page_list, can_pre_page=can_pre_page, can_next_page=can_next_page)
def do_show(self, line): """ \rShow the running status specific packet filter tables. \rSyntax: show <table> \r<table> can be one of the following nat the NAT table. fwm|mangle the mangle table. filters the input filters table. """ if line == "nat": output = self.firewall.show_nat(self.settings['numeric']) elif line == "filters": output = self.firewall.show(self.settings['numeric'], self.settings['color']) elif line == "mangle" or line == "fwm": output = self.firewall.show_mangle(self.settings['numeric'], self.settings['color']) else: print "*** Syntax: show nat|fwm|mangle|filters" return utils.pager(self.config['pager'], output + [''])
def do_show(self, line): """ \rShow information about a specific real server. \rsyntax: show <server> [<port>] """ syntax = "*** Syntax: show <server> [<port>]" commands = line.split() numeric = self.settings['numeric'] color = self.settings['color'] if len(commands) == 2: host = commands[0] port = commands[1] utils.pager(self.config['pager'], self.director.show_real(host, port, numeric, color)) elif len(commands) == 1: host = commands[0] port = None utils.pager(self.config['pager'], self.director.show_real(host, port, numeric, color)) else: print syntax
async def emojis_(self, ctx, *, name: str = None): """Display all emojis I can see in a paginated embed. Aliases --------- emotes Sub-Commands -------------- guild Examples ---------- <prefix>emojis <prefix>emojis guild {ctx.prefix}emojis {ctx.prefix}emojis guild """ if name: emojis = [e for e in self.bot.emojis if name in e.name] if not emojis: return await ctx.send( f'Could not find any emojis with search term: `{name}`') chunks = [ e async for e in utils.pager( sorted(emojis, key=lambda _: _.name), 8) ] else: chunks = [ e async for e in utils.pager( sorted(self.bot.emojis, key=lambda _: _.name), 8) ] pagey = utils.EmojiPaginator(title='Emojis', chunks=chunks) self.bot.loop.create_task(pagey.paginate(ctx))
async def guild_emojis(self, ctx, *, guild: utils.GuildConverter = None): if not guild: guild = ctx.guild chunks = [ e async for e in utils.pager( sorted(list(guild.emojis), key=lambda _: _.name), 8) ] if not chunks: return await ctx.send('This guild has no custom emojis.') pagey = utils.EmojiPaginator(title=f'Emojis | {ctx.guild.name}', chunks=chunks) self.bot.loop.create_task(pagey.paginate(ctx))
def get(self): begin_date, end_date = make_normal_date_range() _query = make_date_query(begin_date, end_date) res = get_all_conf(col=M_DB.deny_list, query=_query) page_list, can_pre_page, can_next_page = pager(res['totalpage'], 0) self.render('log.html', begin_date=begin_date, end_date=end_date, channel_id='', old_query_channel='', all_log=res['all_conf'], totalpage=res['totalpage'], c_page=0, page_list=page_list, can_pre_page=can_pre_page, can_next_page=can_next_page)