当前位置: 首页>>代码示例>>Python>>正文


Python Terminal.green方法代码示例

本文整理汇总了Python中blessed.Terminal.green方法的典型用法代码示例。如果您正苦于以下问题:Python Terminal.green方法的具体用法?Python Terminal.green怎么用?Python Terminal.green使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在blessed.Terminal的用法示例。


在下文中一共展示了Terminal.green方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: monitor

# 需要导入模块: from blessed import Terminal [as 别名]
# 或者: from blessed.Terminal import green [as 别名]
def monitor(run_once=False):
    term = Terminal()
    r = redis_client
    with term.fullscreen(), term.hidden_cursor(), term.cbreak():
        val = None
        start_width = int(term.width / 8)
        while val not in (u'q', u'Q',):
            col_width = int(term.width / 8)
            # In case of resize
            if col_width != start_width:
                print(term.clear)
                start_width = col_width
            print(term.move(0, 0) + term.black_on_green(term.center('Host', width=col_width - 1)))
            print(term.move(0, 1 * col_width) + term.black_on_green(term.center('Id', width=col_width - 1)))
            print(term.move(0, 2 * col_width) + term.black_on_green(term.center('Status', width=col_width - 1)))
            print(term.move(0, 3 * col_width) + term.black_on_green(term.center('Pool', width=col_width - 1)))
            print(term.move(0, 4 * col_width) + term.black_on_green(term.center('TQ', width=col_width - 1)))
            print(term.move(0, 5 * col_width) + term.black_on_green(term.center('RQ', width=col_width - 1)))
            print(term.move(0, 6 * col_width) + term.black_on_green(term.center('RC', width=col_width - 1)))
            print(term.move(0, 7 * col_width) + term.black_on_green(term.center('Up', width=col_width - 1)))
            i = 2
            stats = Stat.get_all(r=r)
            print(term.clear_eos())
            for stat in stats:
                # color status
                if stat.status == Conf.WORKING:
                    status = term.green(Conf.WORKING)
                elif stat.status == Conf.STOPPED:
                    status = term.red(Conf.STOPPED)
                elif stat.status == Conf.IDLE:
                    status = Conf.IDLE
                else:
                    status = term.yellow(stat.status)
                # color q's
                tasks = stat.task_q_size
                if tasks > 0:
                    tasks = term.cyan(str(tasks))
                results = stat.done_q_size
                if results > 0:
                    results = term.cyan(str(results))
                # color workers
                workers = len(stat.workers)
                if workers < Conf.WORKERS:
                    workers = term.yellow(str(workers))
                # format uptime
                uptime = (timezone.now() - stat.tob).total_seconds()
                hours, remainder = divmod(uptime, 3600)
                minutes, seconds = divmod(remainder, 60)
                uptime = '%d:%02d:%02d' % (hours, minutes, seconds)
                # print to the terminal
                print(term.move(i, 0) + term.center(stat.host[:col_width - 1], width=col_width - 1))
                print(term.move(i, 1 * col_width) + term.center(stat.cluster_id, width=col_width - 1))
                print(term.move(i, 2 * col_width) + term.center(status, width=col_width - 1))
                print(term.move(i, 3 * col_width) + term.center(workers, width=col_width - 1))
                print(term.move(i, 4 * col_width) + term.center(tasks, width=col_width - 1))
                print(term.move(i, 5 * col_width) + term.center(results, width=col_width - 1))
                print(term.move(i, 6 * col_width) + term.center(stat.reincarnations, width=col_width - 1))
                print(term.move(i, 7 * col_width) + term.center(uptime, width=col_width - 1))
                i += 1
            # for testing
            if run_once:
                return Stat.get_all(r=r)
            print(term.move(i + 2, 0) + term.center('[Press q to quit]'))
            val = term.inkey(timeout=1)
开发者ID:gitter-badger,项目名称:django-q,代码行数:66,代码来源:qmonitor.py

示例2: monitor

# 需要导入模块: from blessed import Terminal [as 别名]
# 或者: from blessed.Terminal import green [as 别名]
def monitor(run_once=False, broker=None):
    if not broker:
        broker = get_broker()
    term = Terminal()
    broker.ping()
    with term.fullscreen(), term.hidden_cursor(), term.cbreak():
        val = None
        start_width = int(term.width / 8)
        while val not in (u'q', u'Q',):
            col_width = int(term.width / 8)
            # In case of resize
            if col_width != start_width:
                print(term.clear())
                start_width = col_width
            print(term.move(0, 0) + term.black_on_green(term.center(_('Host'), width=col_width - 1)))
            print(term.move(0, 1 * col_width) + term.black_on_green(term.center(_('Id'), width=col_width - 1)))
            print(term.move(0, 2 * col_width) + term.black_on_green(term.center(_('State'), width=col_width - 1)))
            print(term.move(0, 3 * col_width) + term.black_on_green(term.center(_('Pool'), width=col_width - 1)))
            print(term.move(0, 4 * col_width) + term.black_on_green(term.center(_('TQ'), width=col_width - 1)))
            print(term.move(0, 5 * col_width) + term.black_on_green(term.center(_('RQ'), width=col_width - 1)))
            print(term.move(0, 6 * col_width) + term.black_on_green(term.center(_('RC'), width=col_width - 1)))
            print(term.move(0, 7 * col_width) + term.black_on_green(term.center(_('Up'), width=col_width - 1)))
            i = 2
            stats = Stat.get_all(broker=broker)
            print(term.clear_eos())
            for stat in stats:
                status = stat.status
                # color status
                if stat.status == Conf.WORKING:
                    status = term.green(str(Conf.WORKING))
                elif stat.status == Conf.STOPPING:
                    status = term.yellow(str(Conf.STOPPING))
                elif stat.status == Conf.STOPPED:
                    status = term.red(str(Conf.STOPPED))
                elif stat.status == Conf.IDLE:
                    status = str(Conf.IDLE)
                # color q's
                tasks = str(stat.task_q_size)
                if stat.task_q_size > 0:
                    tasks = term.cyan(str(stat.task_q_size))
                    if Conf.QUEUE_LIMIT and stat.task_q_size == Conf.QUEUE_LIMIT:
                        tasks = term.green(str(stat.task_q_size))
                results = stat.done_q_size
                if results > 0:
                    results = term.cyan(str(results))
                # color workers
                workers = len(stat.workers)
                if workers < Conf.WORKERS:
                    workers = term.yellow(str(workers))
                # format uptime
                uptime = (timezone.now() - stat.tob).total_seconds()
                hours, remainder = divmod(uptime, 3600)
                minutes, seconds = divmod(remainder, 60)
                uptime = '%d:%02d:%02d' % (hours, minutes, seconds)
                # print to the terminal
                print(term.move(i, 0) + term.center(stat.host[:col_width - 1], width=col_width - 1))
                print(term.move(i, 1 * col_width) + term.center(stat.cluster_id, width=col_width - 1))
                print(term.move(i, 2 * col_width) + term.center(status, width=col_width - 1))
                print(term.move(i, 3 * col_width) + term.center(workers, width=col_width - 1))
                print(term.move(i, 4 * col_width) + term.center(tasks, width=col_width - 1))
                print(term.move(i, 5 * col_width) + term.center(results, width=col_width - 1))
                print(term.move(i, 6 * col_width) + term.center(stat.reincarnations, width=col_width - 1))
                print(term.move(i, 7 * col_width) + term.center(uptime, width=col_width - 1))
                i += 1
            # bottom bar
            i += 1
            queue_size = broker.queue_size()
            lock_size = broker.lock_size()
            if lock_size:
                queue_size = '{}({})'.format(queue_size, lock_size)
            print(term.move(i, 0) + term.white_on_cyan(term.center(broker.info(), width=col_width * 2)))
            print(term.move(i, 2 * col_width) + term.black_on_cyan(term.center(_('Queued'), width=col_width)))
            print(term.move(i, 3 * col_width) + term.white_on_cyan(term.center(queue_size, width=col_width)))
            print(term.move(i, 4 * col_width) + term.black_on_cyan(term.center(_('Success'), width=col_width)))
            print(term.move(i, 5 * col_width) + term.white_on_cyan(
                term.center(models.Success.objects.count(), width=col_width)))
            print(term.move(i, 6 * col_width) + term.black_on_cyan(term.center(_('Failures'), width=col_width)))
            print(term.move(i, 7 * col_width) + term.white_on_cyan(
                term.center(models.Failure.objects.count(), width=col_width)))
            # for testing
            if run_once:
                return Stat.get_all(broker=broker)
            print(term.move(i + 2, 0) + term.center(_('[Press q to quit]')))
            val = term.inkey(timeout=1)
开发者ID:Koed00,项目名称:django-q,代码行数:86,代码来源:monitor.py

示例3: BrowseRouters

# 需要导入模块: from blessed import Terminal [as 别名]
# 或者: from blessed.Terminal import green [as 别名]

#.........这里部分代码省略.........
                        elif val.is_sequence:
                            if val.code == self.term.KEY_DOWN:
                                self.move_down()
                            if val.code == self.term.KEY_UP:
                                self.move_up()
                        elif val == u'j':
                            self.move_down()
                        elif val == u'k':
                            self.move_up()
                        elif val == u'r':
                            self.rebuild_router()
                        if self.interactive:
                            self.print_routers()
                            val = self.term.inkey(timeout=3)
                        elif len(self.routers) and all(map(
                            lambda x: x.last_fetch, self.routers
                        )):
                            self.print_routers()
                            val = u'q'
                    self._exit()
        except KeyboardInterrupt:
            self._exit()
            raise

    def fetch_routers(self):
        with self.conn:
            cursor = self.conn.cursor()
            cursor.execute('SELECT * FROM routers ORDER BY id ASC;')
            self.routers = cursor.fetchall()

    @property
    def window(self):
        offset = 0
        routers = self.routers
        visible_height = self.term.height - 2
        if len(routers) > visible_height:
            offset = self.position
            offset = min(offset, len(routers) - visible_height - 1)
        return offset, routers[offset:(offset+visible_height+1)]

    def print_routers(self):
        offset, routers = self.window
        with self.term.location():
            for i, r in enumerate(routers):
                if r.latest is None:
                    age = '<loading>'.ljust(11)
                elif r.latest:
                    age = self.term.green('LATEST'.ljust(11))
                elif not r.latest:
                    age = self.term.red('OUT-OF-DATE')
                args = [
                    r.id,
                    r.name,
                    self.router_states[r.status](r.status.ljust(7)),
                    age,
                    r.image_name,
                    'at',
                    r.booted_at
                ]
                if i + offset == self.position:
                    args = map(self.term.reverse, args[:-3]) + args[-3:]
                print self.term.move(i, 0) + ' '.join(args)

    def make_message(self, router):
        return {
            'command': commands.ROUTER_REBUILD,
            'router_id': router.id,
            'tenant_id': router.tenant_id
        }

    def rebuild_router(self):
        offset, routers = self.window
        r = routers[self.position-offset]
        r.status = 'REBUILD'
        self.send_message(self.make_message(r))

    def move_up(self):
        self.position = max(0, self.position-1)

    def move_down(self):
        self.position = min(len(self.routers)-1, self.position+1)

    @property
    def router_states(self):
        return {
            'ACTIVE': self.term.green,
            'BUILD': self.term.yellow,
            'BOOT': self.term.yellow,
            'REBUILD': self.term.yellow,
            'DOWN': self.term.red,
            'ERROR': self.term.red
        }

    def _exit(self):
        if self.interactive:
            print 'Deleting %s...' % self.fh.name
        self.fh.close()
        os.remove(self.fh.name)
        if self.interactive:
            print 'Exiting...'
开发者ID:jordant,项目名称:akanda-rug,代码行数:104,代码来源:browse.py

示例4: monitor

# 需要导入模块: from blessed import Terminal [as 别名]
# 或者: from blessed.Terminal import green [as 别名]
def monitor(run_once=False):
    term = Terminal()
    r = redis_client
    try:
        redis_client.ping()
    except Exception as e:
        print(term.red("Can not connect to Redis server."))
        logger.exception(e)
        raise e
    with term.fullscreen(), term.hidden_cursor(), term.cbreak():
        val = None
        start_width = int(term.width / 8)
        while val not in (u"q", u"Q"):
            col_width = int(term.width / 8)
            # In case of resize
            if col_width != start_width:
                print(term.clear)
                start_width = col_width
            print(term.move(0, 0) + term.black_on_green(term.center(_("Host"), width=col_width - 1)))
            print(term.move(0, 1 * col_width) + term.black_on_green(term.center(_("Id"), width=col_width - 1)))
            print(term.move(0, 2 * col_width) + term.black_on_green(term.center(_("State"), width=col_width - 1)))
            print(term.move(0, 3 * col_width) + term.black_on_green(term.center(_("Pool"), width=col_width - 1)))
            print(term.move(0, 4 * col_width) + term.black_on_green(term.center(_("TQ"), width=col_width - 1)))
            print(term.move(0, 5 * col_width) + term.black_on_green(term.center(_("RQ"), width=col_width - 1)))
            print(term.move(0, 6 * col_width) + term.black_on_green(term.center(_("RC"), width=col_width - 1)))
            print(term.move(0, 7 * col_width) + term.black_on_green(term.center(_("Up"), width=col_width - 1)))
            i = 2
            stats = Stat.get_all(r=r)
            print(term.clear_eos())
            for stat in stats:
                status = stat.status
                # color status
                if stat.status == Conf.WORKING:
                    status = term.green(str(Conf.WORKING))
                elif stat.status == Conf.STOPPING:
                    status = term.yellow(str(Conf.STOPPING))
                elif stat.status == Conf.STOPPED:
                    status = term.red(str(Conf.STOPPED))
                elif stat.status == Conf.IDLE:
                    status = str(Conf.IDLE)
                # color q's
                tasks = stat.task_q_size
                if tasks > 0:
                    tasks = term.cyan(str(tasks))
                results = stat.done_q_size
                if results > 0:
                    results = term.cyan(str(results))
                # color workers
                workers = len(stat.workers)
                if workers < Conf.WORKERS:
                    workers = term.yellow(str(workers))
                # format uptime
                uptime = (timezone.now() - stat.tob).total_seconds()
                hours, remainder = divmod(uptime, 3600)
                minutes, seconds = divmod(remainder, 60)
                uptime = "%d:%02d:%02d" % (hours, minutes, seconds)
                # print to the terminal
                print(term.move(i, 0) + term.center(stat.host[: col_width - 1], width=col_width - 1))
                print(term.move(i, 1 * col_width) + term.center(stat.cluster_id, width=col_width - 1))
                print(term.move(i, 2 * col_width) + term.center(status, width=col_width - 1))
                print(term.move(i, 3 * col_width) + term.center(workers, width=col_width - 1))
                print(term.move(i, 4 * col_width) + term.center(tasks, width=col_width - 1))
                print(term.move(i, 5 * col_width) + term.center(results, width=col_width - 1))
                print(term.move(i, 6 * col_width) + term.center(stat.reincarnations, width=col_width - 1))
                print(term.move(i, 7 * col_width) + term.center(uptime, width=col_width - 1))
                i += 1
            # for testing
            if run_once:
                return Stat.get_all(r=r)
            print(term.move(i + 2, 0) + term.center(_("[Press q to quit]")))
            val = term.inkey(timeout=1)
开发者ID:KorayAgaya,项目名称:django-q,代码行数:73,代码来源:monitor.py

示例5: getattr

# 需要导入模块: from blessed import Terminal [as 别名]
# 或者: from blessed.Terminal import green [as 别名]
            return lambda text, *a, **kw: getattr(text, name)(*a, **kw)
        return str.__getattribute__(self, name)

    def __call__(self, text):
        return text


try:
    from blessed import Terminal
except ImportError, exc:
    Terminal = FakeTerminal


TERMINAL = Terminal()
FLAGS = {
    'done': TERMINAL.green('done'),
    'orphan': TERMINAL.standout(TERMINAL.red('ORPHAN')),
    'outdated_fs_version': TERMINAL.standout(
        TERMINAL.red('FS-VERSION-OUTDATED')),
    'deferrable': TERMINAL.standout(TERMINAL.blue('DEFERRABLE')),
    'proposed': TERMINAL.blue('proposed')}


def print_table(data, titles=None, colspace=1):
    if titles:
        data.insert(0, map(TERMINAL.bright_black, titles))

    column_lengths = map(max, zip(*map(
                lambda row: map(TERMINAL.length, row), data)))
    for row in data:
        for col_num, cell in enumerate(row):
开发者ID:4teamwork,项目名称:ftw.upgrade,代码行数:33,代码来源:terminal.py

示例6: D

# 需要导入模块: from blessed import Terminal [as 别名]
# 或者: from blessed.Terminal import green [as 别名]
		shares_marker = ""

		hashrate_change = ""
		hashrate_diff = ""
		hashrate_marker = ""

		shares_A = D(metrics_A["shares"])
		shares_B = D(metrics_B["shares"])
		
		hashrate_A = D(metrics_A["hashrate"])
		hashrate_B = D(metrics_B["hashrate"])
		
		if(shares_A < shares_B):
			shares_change = "UP"
			shares_diff = shares_B - shares_A
			shares_marker = t.bold(t.green('UP')) 
		
		if(shares_B < shares_A):
			shares_change = "DOWN"
			shares_diff = abs(shares_A - shares_B)
			shares_marker = t.bold(t.red('DOWN'))

		if(hashrate_A < hashrate_B):
			hashrate_change = "UP"
			hashrate_diff = hashrate_B - hashrate_A
			hashrate_marker = t.bold(t.green('UP'))

		if(hashrate_A > hashrate_B):
			hashrate_change = "DOWN"
			hashrate_diff = abs(hashrate_A - hashrate_B)
			hashrate_marker = t.bold(t.red('DOWN'))			
开发者ID:ArcAster,项目名称:EtherPool-Stats,代码行数:33,代码来源:logger.py

示例7: threaded_sniff

# 需要导入模块: from blessed import Terminal [as 别名]
# 或者: from blessed.Terminal import green [as 别名]
def threaded_sniff():
    q = Queue()
    sniffer = Thread(target = threaded_sniff_target, args = (q,))
    sniffer.daemon = True
    sniffer.start()
    time.sleep(1)
    t = Terminal()
    pkt_type = ""
    ip_src = None
    
    while True:
        try:
            pkt = q.get(timeout = 1)
            if pkt.haslayer(Ether):
                ethsrc = pkt.getlayer(Ether).src
                ethdst = pkt.getlayer(Ether).dst
            else:
                # Skip non-Ethernet packets
                pass
            if pkt.haslayer(IP):
                ipsrc = pkt.getlayer(IP).src
                ipdst = pkt.getlayer(IP).dst
                ttl = pkt.getlayer(IP).ttl
            else:
                # Skip non-IP packets
                pass
            if pkt.haslayer(TCP):
                sport = pkt.getlayer(TCP).sport
                dport = pkt.getlayer(TCP).dport
                pkt_type = "TCP"
            elif pkt.haslayer(UDP):
                sport = pkt.getlayer(UDP).sport
                dport = pkt.getlayer(UDP).dport
                pkt_type = "UDP"
                
            if pkt.haslayer(DNS):
                pkt_type = "DNS"

            if pkt.haslayer(NTP):
                pkt_type = "NTP"
                
            if pkt.haslayer(ICMP):
                pkt_type = "ICMP"
                
            if pkt.haslayer(http.HTTP):
                pkt_type = "HTTP"
                
            if pkt.haslayer(TLS):
                pkt_type = "TLS"
                
            if not dbconn.isipaddrindb(ipsrc):
                # OS detection based on TTL
                ret_ttl = getttl(ttl)
                if ret_ttl is None:
                    if pkt.haslayer(TCP) or pkt.haslayer(UDP):
                        print "T", t.blue("%s" % datetime.datetime.now().strftime('%H:%M:%S')), t.bold_magenta("{:>4}".format(pkt_type)), "MAC src addr", t.cyan("%s" % ethsrc), "MAC dst addr", t.cyan("%s" % ethdst), "TTL", t.red("{:>7}".format(ttl)), "IP src addr", t.green("{:>15}".format(ipsrc)), "IP dst addr", t.green("{:>15}".format(ipdst)), "src port", t.yellow("{:>5}".format(sport)), "dst port",  t.yellow("{:>5}".format(dport))
                    elif pkt.haslayer(ICMP):
                        print "T", t.blue("%s" % datetime.datetime.now().strftime('%H:%M:%S')), t.bold_magenta("{:>4}".format(pkt_type)), "MAC src addr", t.cyan("%s" % ethsrc), "MAC dst addr", t.cyan("%s" % ethdst), "TTL", t.red("{:>7}".format(ttl)), "IP src addr", t.green("{:>15}".format(ipsrc)), "IP dst addr", t.green("{:>15}".format(ipdst))
                        if pkt.getlayer(ICMP).type == 0x08:
                            print t.move_right, t.move_right, t.move_right, t.move_right, "ICMP Message type", t.green("Echo request"), "Sequence number", t.cyan("%s" % pkt.getlayer(ICMP).seq)
                        elif pkt.getlayer(ICMP).type == 0x00:
                            print t.move_right, t.move_right,t.move_right, t.move_right, "ICMP Message type", t.green("Echo response"), "Sequence number", t.cyan("%s" % pkt.getlayer(ICMP).seq)
                else:
                    if pkt.haslayer(TCP) or pkt.haslayer(UDP):
                        print "T", t.blue("%s" % datetime.datetime.now().strftime('%H:%M:%S')), t.bold_magenta("{:>4}".format(pkt_type)), "MAC src addr", t.cyan("%s" % ethsrc), "MAC dst addr", t.cyan("%s" % ethdst), "OSv", t.red("%s" % ret_ttl), "IP src addr", t.green("{:>15}".format(ipsrc)), "IP dst addr", t.green("{:>15}".format(ipdst)), "src port", t.yellow("{:>5}".format(sport)), "dst port",  t.yellow("{:>5}".format(dport))
                    elif pkt.haslayer(ICMP):                        
                        print "T", t.blue("%s" % datetime.datetime.now().strftime('%H:%M:%S')), t.bold_magenta("{:>4}".format(pkt_type)), "MAC src addr", t.cyan("%s" % ethsrc), "MAC dst addr", t.cyan("%s" % ethdst), "OSv", t.red("%s" % ret_ttl), "IP src addr", t.green("{:>15}".format(ipsrc)), "IP dst addr", t.green("{:>15}".format(ipdst))
                        if pkt.getlayer(ICMP).type == 0x08:
                            print t.move_right, t.move_right,t.move_right, t.move_right, "ICMP Message type", t.green("Echo request"), "Sequence number", t.cyan("%s" % pkt.getlayer(ICMP).seq)
                        elif pkt.getlayer(ICMP).type == 0x00:
                            print t.move_right, t.move_right,t.move_right, t.move_right, "ICMP Message type", t.green("Echo response"), "Sequence number", t.cyan("%s" % pkt.getlayer(ICMP).seq)
                # Print out additional information if the packet contains HTTP requests or responses
                if pkt.haslayer(DNS):
                    dns_layer = pkt.getlayer(DNS)
                    if 'an' in dns_layer.fields:
                        if dns_layer.fields['an'] is not None:
                            if dns_layer.fields['an'].fields['type'] == 0x01:
                                print t.move_right, t.move_right, "DNS response", t.yellow("A"), "record for hostname", t.cyan("%s" % dns_layer.fields['an'].fields['rrname'][:-1]), "has IP address", t.green("%s" % str(dns_layer.fields['an'].fields['rdata']))
                        elif 'qd' in dns_layer.fields:
                            if dns_layer.fields['qd'].fields['qtype'] == 0x01:
                                print t.move_right, t.move_right, "DNS request", t.yellow("A"), "record for hostname", t.cyan("%s" % dns_layer.fields['qd'].fields['qname'][:-1])

                # Print out additional information if the packet contains HTTP requests or responses
                if pkt.haslayer(http.HTTPRequest):
                    http_pkt = pkt.getlayer(http.HTTPRequest)
                    print t.move_right, t.move_right, "HTTP Method", t.yellow("%s" % http_pkt.fields['Method']), "Host", t.cyan("%s" % http_pkt.fields['Host']), "Path", t.green("%s" % http_pkt.fields['Path']),"User-Agent", t.blue("%s" % http_pkt.fields['User-Agent'])
                elif pkt.haslayer(http.HTTPResponse):
                    http_pkt = pkt.getlayer(http.HTTPResponse)
                    try:
                        print t.move_right, t.move_right, "HTTP Response from", t.green("%s" % http_pkt.fields['Server']), "Date", t.yellow("%s" % http_pkt.fields['Date'])
                    except:
                        pass
                        
                # Print out additional information if the packet is part of a TLS connection
                if pkt.haslayer(TLS):
                    try:
                        tls_packet = pkt.getlayer(TLS)
                        tls_record = tls_packet.fields['records'][0]
                        tls_record_type = tls_packet.fields['records'][0].fields['content_type']
                        if tls_record_type == 0x17:
#.........这里部分代码省略.........
开发者ID:phreaklets,项目名称:kraken,代码行数:103,代码来源:cuttlefish.py


注:本文中的blessed.Terminal.green方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。