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


Python terminal256.Terminal256Formatter方法代码示例

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


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

示例1: print_packets

# 需要导入模块: from pygments.formatters import terminal256 [as 别名]
# 或者: from pygments.formatters.terminal256 import Terminal256Formatter [as 别名]
def print_packets(path: list, nodes: dict) -> None:
    tokens = []
    for e in path[:-1]:
        node = nodes[e.dst]
        p = node.render()
        line = '{} = {}'.format(node.name.replace('-', '_'), repr(p))
        tokens.extend(list(pygments.lex(line, lexer=Python3Lexer())))

    # p = self.fuzz_node.render()
    node = nodes[path[-1].dst]
    p = node.render()
    line = '{} = {}'.format(node.name.replace('-', '_'), repr(p))

    print(pygments.highlight(line, Python3Lexer(), Terminal256Formatter(style='rrt')))

    # tokens.extend(list(pygments.lex(line, lexer=Python3Lexer())))
    # style = style_from_pygments_cls(get_style_by_name('colorful'))
    # print_formatted_text(PygmentsTokens(tokens), style=style)


# --------------------------------------------------------------- # 
开发者ID:nccgroup,项目名称:fuzzowski,代码行数:23,代码来源:printers.py

示例2: traceback_highlighter_factory

# 需要导入模块: from pygments.formatters import terminal256 [as 别名]
# 或者: from pygments.formatters.terminal256 import Terminal256Formatter [as 别名]
def traceback_highlighter_factory() -> Callable[[str], str]:  # pragma: no cover
    from pygments.lexers.python import PythonTracebackLexer
    lexer = PythonTracebackLexer()
    from pygments.formatters.terminal256 import Terminal256Formatter
    formatter = Terminal256Formatter(style='native')

    def inner(tb):
        return highlight(tb, lexer, formatter)

    from pygments import highlight
    return inner 
开发者ID:rsalmei,项目名称:clearly,代码行数:13,代码来源:code_highlighter.py

示例3: print_python

# 需要导入模块: from pygments.formatters import terminal256 [as 别名]
# 或者: from pygments.formatters.terminal256 import Terminal256Formatter [as 别名]
def print_python(path: list) -> None:
    tokens = []
    block_code = path_to_python(path)
    print(pygments.highlight(block_code, Python3Lexer(), Terminal256Formatter(style='rrt')))

    # tokens.extend(list(pygments.lex(block_code, lexer=Python3Lexer())))
    # print_formatted_text(PygmentsTokens(tokens))

# --------------------------------------------------------------- # 
开发者ID:nccgroup,项目名称:fuzzowski,代码行数:11,代码来源:printers.py

示例4: print_poc

# 需要导入模块: from pygments.formatters import terminal256 [as 别名]
# 或者: from pygments.formatters.terminal256 import Terminal256Formatter [as 别名]
def print_poc(target: Target, path: list,
              receive_data_after_each_request, receive_data_after_fuzz) -> None:
    tokens = []

    exploit_code = get_exploit_code(target, path, receive_data_after_each_request, receive_data_after_fuzz)
    print(pygments.highlight(exploit_code, Python3Lexer(), Terminal256Formatter(style='rrt')))

    # tokens.extend(list(pygments.lex(exploit_code, lexer=Python3Lexer())))
    # print_formatted_text(PygmentsTokens(tokens))

# --------------------------------------------------------------- # 
开发者ID:nccgroup,项目名称:fuzzowski,代码行数:13,代码来源:printers.py


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