scapy.themes

Color themes for the interactive console.

class scapy.themes.AnsiColorTheme[source]

Bases: ColorTheme

class scapy.themes.BlackAndWhite[source]

Bases: AnsiColorTheme, NoTheme

class scapy.themes.BrightTheme[source]

Bases: AnsiColorTheme

style_emph_field_name = '\x1b[33m\x1b[1m'
style_emph_field_value = '\x1b[32m\x1b[1m'
style_even = '\x1b[30m\x1b[1m'
style_fail = '\x1b[31m\x1b[1m'
style_field_name = '\x1b[33m\x1b[1m'
style_field_value = '\x1b[35m\x1b[1m'
style_id = '\x1b[33m\x1b[1m'
style_layer_name = '\x1b[31m\x1b[1m'
style_left = '\x1b[36m\x1b[7m'
style_normal = '\x1b[0m'
style_odd = '\x1b[30m'
style_packetlist_name = '\x1b[31m\x1b[1m'
style_packetlist_proto = '\x1b[33m\x1b[1m'
style_packetlist_value = '\x1b[35m\x1b[1m'
style_punct = '\x1b[0m'
style_right = '\x1b[35m\x1b[7m'
style_success = '\x1b[34m\x1b[1m'
class scapy.themes.ColorOnBlackTheme[source]

Bases: AnsiColorTheme

Color theme for black backgrounds

style_active = '\x1b[37m\x1b[1m'
style_closed = '\x1b[30m\x1b[1m'
style_emph_field_name = '\x1b[36m\x1b[1m'
style_emph_field_value = '\x1b[31m\x1b[1m'
style_even = '\x1b[30m\x1b[1m'
style_fail = '\x1b[31m\x1b[1m'
style_field_name = '\x1b[36m'
style_field_value = '\x1b[35m\x1b[1m'
style_id = '\x1b[32m'
style_layer_name = '\x1b[33m\x1b[1m'
style_left = '\x1b[36m\x1b[1m'
style_normal = '\x1b[0m'
style_not_printable = '\x1b[30m\x1b[1m'
style_odd = '\x1b[37m'
style_opening = '\x1b[33m'
style_packetlist_name = '\x1b[30m\x1b[1m'
style_packetlist_proto = '\x1b[33m\x1b[1m'
style_packetlist_value = '\x1b[35m\x1b[1m'
style_prompt = '\x1b[32m\x1b[1m'
style_punct = '\x1b[0m'
style_right = '\x1b[31m\x1b[1m'
style_success = '\x1b[32m'
class scapy.themes.ColorTable[source]

Bases: object

ansi_to_pygments(x: str) str[source]

Transform ansi encoded text to Pygments text

colors = {'bg_black': ('\x1b[40m', 'bg:#ansiblack'), 'bg_blue': ('\x1b[44m', 'bg:#ansiblue'), 'bg_cyan': ('\x1b[46m', 'bg:#ansicyan'), 'bg_green': ('\x1b[42m', 'bg:#ansigreen'), 'bg_purple': ('\x1b[45m', 'bg:#ansipurple'), 'bg_red': ('\x1b[41m', 'bg:#ansired'), 'bg_reset': ('\x1b[49m', 'noinherit'), 'bg_white': ('\x1b[47m', 'bg:#ansiwhite'), 'bg_yellow': ('\x1b[43m', 'bg:#ansiyellow'), 'black': ('\x1b[30m', '#ansiblack'), 'blink': ('\x1b[5m', ''), 'blue': ('\x1b[34m', '#ansiblue'), 'bold': ('\x1b[1m', 'bold'), 'cyan': ('\x1b[36m', '#ansicyan'), 'green': ('\x1b[32m', '#ansigreen'), 'grey': ('\x1b[38;5;246m', '#ansiwhite'), 'invert': ('\x1b[7m', ''), 'normal': ('\x1b[0m', 'noinherit'), 'purple': ('\x1b[35m', '#ansipurple'), 'red': ('\x1b[31m', '#ansired'), 'reset': ('\x1b[39m', 'noinherit'), 'uline': ('\x1b[4m', 'underline'), 'white': ('\x1b[37m', '#ansiwhite'), 'yellow': ('\x1b[33m', '#ansiyellow')}
inv_map = {'\x1b[0m': 'noinherit', '\x1b[1m': 'bold', '\x1b[30m': '#ansiblack', '\x1b[31m': '#ansired', '\x1b[32m': '#ansigreen', '\x1b[33m': '#ansiyellow', '\x1b[34m': '#ansiblue', '\x1b[35m': '#ansipurple', '\x1b[36m': '#ansicyan', '\x1b[37m': '#ansiwhite', '\x1b[38;5;246m': '#ansiwhite', '\x1b[39m': 'noinherit', '\x1b[40m': 'bg:#ansiblack', '\x1b[41m': 'bg:#ansired', '\x1b[42m': 'bg:#ansigreen', '\x1b[43m': 'bg:#ansiyellow', '\x1b[44m': 'bg:#ansiblue', '\x1b[45m': 'bg:#ansipurple', '\x1b[46m': 'bg:#ansicyan', '\x1b[47m': 'bg:#ansiwhite', '\x1b[49m': 'noinherit', '\x1b[4m': 'underline', '\x1b[5m': '', '\x1b[7m': ''}
class scapy.themes.ColorTheme[source]

Bases: object

format(string: str, fmt: str) str[source]
style_active = ''
style_closed = ''
style_depreciate_field_name = ''
style_emph_field_name = ''
style_emph_field_value = ''
style_even = ''
style_fail = ''
style_field_name = ''
style_field_value = ''
style_id = ''
style_layer_name = ''
style_left = ''
style_normal = ''
style_not_printable = ''
style_odd = ''
style_opening = ''
style_packetlist_name = ''
style_packetlist_proto = ''
style_packetlist_value = ''
style_prompt = ''
style_punct = ''
style_right = ''
style_success = ''
class scapy.themes.DefaultTheme[source]

Bases: AnsiColorTheme

style_active = '\x1b[30m'
style_closed = '\x1b[37m'
style_depreciate_field_name = '\x1b[38;5;246m'
style_emph_field_name = '\x1b[34m\x1b[4m\x1b[1m'
style_emph_field_value = '\x1b[35m\x1b[4m\x1b[1m'
style_even = '\x1b[30m\x1b[1m'
style_fail = '\x1b[31m\x1b[1m'
style_field_name = '\x1b[34m'
style_field_value = '\x1b[35m'
style_id = '\x1b[34m\x1b[1m'
style_layer_name = '\x1b[31m\x1b[1m'
style_left = '\x1b[34m\x1b[7m'
style_normal = '\x1b[0m'
style_not_printable = '\x1b[37m'
style_odd = '\x1b[30m'
style_opening = '\x1b[33m'
style_packetlist_name = '\x1b[31m\x1b[1m'
style_packetlist_proto = '\x1b[34m'
style_packetlist_value = '\x1b[35m'
style_prompt = '\x1b[34m\x1b[1m'
style_punct = '\x1b[0m'
style_right = '\x1b[31m\x1b[7m'
style_success = '\x1b[34m\x1b[1m'
class scapy.themes.FormatTheme[source]

Bases: ColorTheme

class scapy.themes.HTMLTheme[source]

Bases: FormatTheme

style_emph_field_name = '<span class=emph_field_name>%s</span>'
style_emph_field_value = '<span class=emph_field_value>%s</span>'
style_even = '<span class=even>%s</span>'
style_fail = '<span class=fail>%s</span>'
style_field_name = '<span class=field_name>%s</span>'
style_field_value = '<span class=field_value>%s</span>'
style_layer_name = '<span class=layer_name>%s</span>'
style_left = '<span class=left>%s</span>'
style_not_printable = '<span class=not_printable>%s</span>'
style_odd = '<span class=odd>%s</span>'
style_packetlist_name = '<span class=packetlist_name>%s</span>'
style_packetlist_proto = '<span class=packetlist_proto>%s</span>'
style_packetlist_value = '<span class=packetlist_value>%s</span>'
style_prompt = '<span class=prompt>%s</span>'
style_right = '<span class=right>%s</span>'
style_success = '<span class=success>%s</span>'
class scapy.themes.HTMLTheme2[source]

Bases: HTMLTheme

style_emph_field_name = '#[#span class=emph_field_name#]#%s#[#/span#]#'
style_emph_field_value = '#[#span class=emph_field_value#]#%s#[#/span#]#'
style_even = '#[#span class=even#]#%s#[#/span#]#'
style_fail = '#[#span class=fail#]#%s#[#/span#]#'
style_field_name = '#[#span class=field_name#]#%s#[#/span#]#'
style_field_value = '#[#span class=field_value#]#%s#[#/span#]#'
style_layer_name = '#[#span class=layer_name#]#%s#[#/span#]#'
style_left = '#[#span class=left#]#%s#[#/span#]#'
style_not_printable = '#[#span class=not_printable#]#%s#[#/span#]#'
style_odd = '#[#span class=odd#]#%s#[#/span#]#'
style_packetlist_name = '#[#span class=packetlist_name#]#%s#[#/span#]#'
style_packetlist_proto = '#[#span class=packetlist_proto#]#%s#[#/span#]#'
style_packetlist_value = '#[#span class=packetlist_value#]#%s#[#/span#]#'
style_prompt = '#[#span class=prompt#]#%s#[#/span#]#'
style_right = '#[#span class=right#]#%s#[#/span#]#'
style_success = '#[#span class=success#]#%s#[#/span#]#'
class scapy.themes.LatexTheme[source]

Bases: FormatTheme

You can prepend the output from this theme with ttobeyspacesobeylinestinynoindent

style_emph_field_name = '\\textcolor{blue}{\\underline{%s}}'
style_emph_field_value = '\\textcolor{purple}{\\underline{%s}}'
style_fail = '\\textcolor{red}{\\bf %s}'
style_field_name = '\\textcolor{blue}{%s}'
style_field_value = '\\textcolor{purple}{%s}'
style_layer_name = '\\textcolor{red}{\\bf %s}'
style_left = '\\textcolor{blue}{%s}'
style_not_printable = '\\textcolor{gray}{%s}'
style_packetlist_name = '\\textcolor{red}{\\bf %s}'
style_packetlist_proto = '\\textcolor{blue}{%s}'
style_packetlist_value = '\\textcolor{purple}{%s}'
style_prompt = '\\textcolor{blue}{%s}'
style_right = '\\textcolor{red}{%s}'
style_success = '\\textcolor{blue}{\\bf %s}'
class scapy.themes.LatexTheme2[source]

Bases: FormatTheme

style_emph_field_name = '@`@textcolor@[@blue@]@@[@@`@underline@[@%s@]@@]@'
style_emph_field_value = '@`@textcolor@[@purple@]@@[@@`@underline@[@%s@]@@]@'
style_even = '@`@textcolor@[@gray@]@@[@@`@bfseries@[@@]@%s@]@'
style_fail = '@`@textcolor@[@red@]@@[@@`@bfseries@[@@]@%s@]@'
style_field_name = '@`@textcolor@[@blue@]@@[@%s@]@'
style_field_value = '@`@textcolor@[@purple@]@@[@%s@]@'
style_layer_name = '@`@textcolor@[@red@]@@[@@`@bfseries@[@@]@%s@]@'
style_left = '@`@textcolor@[@blue@]@@[@%s@]@'
style_not_printable = '@`@textcolor@[@gray@]@@[@%s@]@'
style_packetlist_name = '@`@textcolor@[@red@]@@[@@`@bfseries@[@@]@%s@]@'
style_packetlist_proto = '@`@textcolor@[@blue@]@@[@%s@]@'
style_packetlist_value = '@`@textcolor@[@purple@]@@[@%s@]@'
style_prompt = '@`@textcolor@[@blue@]@@[@%s@]@'
style_right = '@`@textcolor@[@red@]@@[@%s@]@'
style_success = '@`@textcolor@[@blue@]@@[@@`@bfseries@[@@]@%s@]@'
class scapy.themes.NoTheme[source]

Bases: ColorTheme

class scapy.themes.RastaTheme[source]

Bases: AnsiColorTheme

style_emph_field_name = '\x1b[32m'
style_emph_field_value = '\x1b[32m'
style_even = '\x1b[33m'
style_fail = '\x1b[31m'
style_field_name = '\x1b[33m\x1b[1m'
style_field_value = '\x1b[32m\x1b[1m'
style_id = '\x1b[32m\x1b[1m'
style_layer_name = '\x1b[31m\x1b[1m'
style_left = '\x1b[33m\x1b[7m'
style_normal = '\x1b[0m\x1b[32m\x1b[1m'
style_not_printable = '\x1b[32m'
style_odd = '\x1b[32m'
style_packetlist_name = '\x1b[31m\x1b[1m'
style_packetlist_proto = '\x1b[33m\x1b[1m'
style_packetlist_value = '\x1b[32m\x1b[1m'
style_prompt = '\x1b[33m\x1b[1m'
style_punct = '\x1b[31m'
style_right = '\x1b[31m\x1b[7m'
style_success = '\x1b[31m\x1b[1m'
scapy.themes.apply_ipython_style(shell: Any) None[source]

Updates the specified IPython console shell with the conf.color_theme scapy theme.

scapy.themes.create_styler(fmt: str | None = None, before: str = '', after: str = '', fmt2: str = '%s') _ColorFormatterType[source]