OXIESEC PANEL
- Current Dir:
/
/
snap
/
certbot
/
4730
/
lib
/
python3.12
/
site-packages
/
pip
/
_vendor
/
rich
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
06/10/2025 09:51:14 PM
rwxr-xr-x
📄
__init__.py
5.95 KB
06/10/2025 09:50:50 PM
rw-r--r--
📄
__main__.py
8.28 KB
06/10/2025 09:50:50 PM
rw-r--r--
📁
__pycache__
-
06/10/2025 09:51:14 PM
rwxr-xr-x
📄
_cell_widths.py
9.97 KB
06/10/2025 09:50:50 PM
rw-r--r--
📄
_emoji_codes.py
136.95 KB
06/10/2025 09:50:50 PM
rw-r--r--
📄
_emoji_replace.py
1.04 KB
06/10/2025 09:50:50 PM
rw-r--r--
📄
_export_format.py
2.08 KB
06/10/2025 09:50:50 PM
rw-r--r--
📄
_extension.py
265 bytes
06/10/2025 09:50:50 PM
rw-r--r--
📄
_fileno.py
799 bytes
06/10/2025 09:50:50 PM
rw-r--r--
📄
_inspect.py
9.43 KB
06/10/2025 09:50:50 PM
rw-r--r--
📄
_log_render.py
3.15 KB
06/10/2025 09:50:50 PM
rw-r--r--
📄
_loop.py
1.21 KB
06/10/2025 09:50:50 PM
rw-r--r--
📄
_null_file.py
1.36 KB
06/10/2025 09:50:50 PM
rw-r--r--
📄
_palettes.py
6.9 KB
06/10/2025 09:50:50 PM
rw-r--r--
📄
_pick.py
423 bytes
06/10/2025 09:50:50 PM
rw-r--r--
📄
_ratio.py
5.34 KB
06/10/2025 09:50:50 PM
rw-r--r--
📄
_spinners.py
19.45 KB
06/10/2025 09:50:50 PM
rw-r--r--
📄
_stack.py
351 bytes
06/10/2025 09:50:50 PM
rw-r--r--
📄
_timer.py
417 bytes
06/10/2025 09:50:50 PM
rw-r--r--
📄
_win32_console.py
22.22 KB
06/10/2025 09:50:50 PM
rw-r--r--
📄
_windows.py
1.88 KB
06/10/2025 09:50:50 PM
rw-r--r--
📄
_windows_renderer.py
2.72 KB
06/10/2025 09:50:50 PM
rw-r--r--
📄
_wrap.py
3.32 KB
06/10/2025 09:50:50 PM
rw-r--r--
📄
abc.py
890 bytes
06/10/2025 09:50:50 PM
rw-r--r--
📄
align.py
10.22 KB
06/10/2025 09:50:50 PM
rw-r--r--
📄
ansi.py
6.76 KB
06/10/2025 09:50:50 PM
rw-r--r--
📄
bar.py
3.19 KB
06/10/2025 09:50:50 PM
rw-r--r--
📄
box.py
10.58 KB
06/10/2025 09:50:50 PM
rw-r--r--
📄
cells.py
5.01 KB
06/10/2025 09:50:50 PM
rw-r--r--
📄
color.py
17.78 KB
06/10/2025 09:50:50 PM
rw-r--r--
📄
color_triplet.py
1.03 KB
06/10/2025 09:50:50 PM
rw-r--r--
📄
columns.py
6.96 KB
06/10/2025 09:50:50 PM
rw-r--r--
📄
console.py
98.21 KB
06/10/2025 09:50:50 PM
rw-r--r--
📄
constrain.py
1.26 KB
06/10/2025 09:50:50 PM
rw-r--r--
📄
containers.py
5.37 KB
06/10/2025 09:50:50 PM
rw-r--r--
📄
control.py
6.47 KB
06/10/2025 09:50:50 PM
rw-r--r--
📄
default_styles.py
8.06 KB
06/10/2025 09:50:50 PM
rw-r--r--
📄
diagnose.py
998 bytes
06/10/2025 09:50:50 PM
rw-r--r--
📄
emoji.py
2.44 KB
06/10/2025 09:50:50 PM
rw-r--r--
📄
errors.py
642 bytes
06/10/2025 09:50:50 PM
rw-r--r--
📄
file_proxy.py
1.64 KB
06/10/2025 09:50:50 PM
rw-r--r--
📄
filesize.py
2.43 KB
06/10/2025 09:50:50 PM
rw-r--r--
📄
highlighter.py
9.36 KB
06/10/2025 09:50:50 PM
rw-r--r--
📄
json.py
4.91 KB
06/10/2025 09:50:50 PM
rw-r--r--
📄
jupyter.py
3.18 KB
06/10/2025 09:50:50 PM
rw-r--r--
📄
layout.py
13.68 KB
06/10/2025 09:50:50 PM
rw-r--r--
📄
live.py
13.94 KB
06/10/2025 09:50:50 PM
rw-r--r--
📄
live_render.py
3.58 KB
06/10/2025 09:50:50 PM
rw-r--r--
📄
logging.py
12.17 KB
06/10/2025 09:50:50 PM
rw-r--r--
📄
markup.py
8.25 KB
06/10/2025 09:50:50 PM
rw-r--r--
📄
measure.py
5.18 KB
06/10/2025 09:50:50 PM
rw-r--r--
📄
padding.py
4.79 KB
06/10/2025 09:50:50 PM
rw-r--r--
📄
pager.py
828 bytes
06/10/2025 09:50:50 PM
rw-r--r--
📄
palette.py
3.32 KB
06/10/2025 09:50:50 PM
rw-r--r--
📄
panel.py
10.96 KB
06/10/2025 09:50:50 PM
rw-r--r--
📄
pretty.py
35.54 KB
06/10/2025 09:50:50 PM
rw-r--r--
📄
progress.py
58.94 KB
06/10/2025 09:50:50 PM
rw-r--r--
📄
progress_bar.py
7.97 KB
06/10/2025 09:50:50 PM
rw-r--r--
📄
prompt.py
12.16 KB
06/10/2025 09:50:50 PM
rw-r--r--
📄
protocol.py
1.36 KB
06/10/2025 09:50:50 PM
rw-r--r--
📄
py.typed
0 bytes
06/10/2025 09:50:50 PM
rw-r--r--
📄
region.py
166 bytes
06/10/2025 09:50:50 PM
rw-r--r--
📄
repr.py
4.33 KB
06/10/2025 09:50:50 PM
rw-r--r--
📄
rule.py
4.49 KB
06/10/2025 09:50:50 PM
rw-r--r--
📄
scope.py
2.78 KB
06/10/2025 09:50:50 PM
rw-r--r--
📄
screen.py
1.55 KB
06/10/2025 09:50:50 PM
rw-r--r--
📄
segment.py
24.16 KB
06/10/2025 09:50:50 PM
rw-r--r--
📄
spinner.py
4.26 KB
06/10/2025 09:50:50 PM
rw-r--r--
📄
status.py
4.32 KB
06/10/2025 09:50:50 PM
rw-r--r--
📄
style.py
26.42 KB
06/10/2025 09:50:50 PM
rw-r--r--
📄
styled.py
1.23 KB
06/10/2025 09:50:50 PM
rw-r--r--
📄
syntax.py
34.92 KB
06/10/2025 09:50:50 PM
rw-r--r--
📄
table.py
39.11 KB
06/10/2025 09:50:50 PM
rw-r--r--
📄
terminal_theme.py
3.29 KB
06/10/2025 09:50:50 PM
rw-r--r--
📄
text.py
46.44 KB
06/10/2025 09:50:50 PM
rw-r--r--
📄
theme.py
3.68 KB
06/10/2025 09:50:50 PM
rw-r--r--
📄
themes.py
102 bytes
06/10/2025 09:50:50 PM
rw-r--r--
📄
traceback.py
34.35 KB
06/10/2025 09:50:50 PM
rw-r--r--
📄
tree.py
9.23 KB
06/10/2025 09:50:50 PM
rw-r--r--
Editing: highlighter.py
Close
import re from abc import ABC, abstractmethod from typing import List, Union from .text import Span, Text def _combine_regex(*regexes: str) -> str: """Combine a number of regexes in to a single regex. Returns: str: New regex with all regexes ORed together. """ return "|".join(regexes) class Highlighter(ABC): """Abstract base class for highlighters.""" def __call__(self, text: Union[str, Text]) -> Text: """Highlight a str or Text instance. Args: text (Union[str, ~Text]): Text to highlight. Raises: TypeError: If not called with text or str. Returns: Text: A test instance with highlighting applied. """ if isinstance(text, str): highlight_text = Text(text) elif isinstance(text, Text): highlight_text = text.copy() else: raise TypeError(f"str or Text instance required, not {text!r}") self.highlight(highlight_text) return highlight_text @abstractmethod def highlight(self, text: Text) -> None: """Apply highlighting in place to text. Args: text (~Text): A text object highlight. """ class NullHighlighter(Highlighter): """A highlighter object that doesn't highlight. May be used to disable highlighting entirely. """ def highlight(self, text: Text) -> None: """Nothing to do""" class RegexHighlighter(Highlighter): """Applies highlighting from a list of regular expressions.""" highlights: List[str] = [] base_style: str = "" def highlight(self, text: Text) -> None: """Highlight :class:`rich.text.Text` using regular expressions. Args: text (~Text): Text to highlighted. """ highlight_regex = text.highlight_regex for re_highlight in self.highlights: highlight_regex(re_highlight, style_prefix=self.base_style) class ReprHighlighter(RegexHighlighter): """Highlights the text typically produced from ``__repr__`` methods.""" base_style = "repr." highlights = [ r"(?P<tag_start><)(?P<tag_name>[-\w.:|]*)(?P<tag_contents>[\w\W]*)(?P<tag_end>>)", r'(?P<attrib_name>[\w_]{1,50})=(?P<attrib_value>"?[\w_]+"?)?', r"(?P<brace>[][{}()])", _combine_regex( r"(?P<ipv4>[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})", r"(?P<ipv6>([A-Fa-f0-9]{1,4}::?){1,7}[A-Fa-f0-9]{1,4})", r"(?P<eui64>(?:[0-9A-Fa-f]{1,2}-){7}[0-9A-Fa-f]{1,2}|(?:[0-9A-Fa-f]{1,2}:){7}[0-9A-Fa-f]{1,2}|(?:[0-9A-Fa-f]{4}\.){3}[0-9A-Fa-f]{4})", r"(?P<eui48>(?:[0-9A-Fa-f]{1,2}-){5}[0-9A-Fa-f]{1,2}|(?:[0-9A-Fa-f]{1,2}:){5}[0-9A-Fa-f]{1,2}|(?:[0-9A-Fa-f]{4}\.){2}[0-9A-Fa-f]{4})", r"(?P<uuid>[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12})", r"(?P<call>[\w.]*?)\(", r"\b(?P<bool_true>True)\b|\b(?P<bool_false>False)\b|\b(?P<none>None)\b", r"(?P<ellipsis>\.\.\.)", r"(?P<number_complex>(?<!\w)(?:\-?[0-9]+\.?[0-9]*(?:e[-+]?\d+?)?)(?:[-+](?:[0-9]+\.?[0-9]*(?:e[-+]?\d+)?))?j)", r"(?P<number>(?<!\w)\-?[0-9]+\.?[0-9]*(e[-+]?\d+?)?\b|0x[0-9a-fA-F]*)", r"(?P<path>\B(/[-\w._+]+)*\/)(?P<filename>[-\w._+]*)?", r"(?<![\\\w])(?P<str>b?'''.*?(?<!\\)'''|b?'.*?(?<!\\)'|b?\"\"\".*?(?<!\\)\"\"\"|b?\".*?(?<!\\)\")", r"(?P<url>(file|https|http|ws|wss)://[-0-9a-zA-Z$_+!`(),.?/;:&=%#~@]*)", ), ] class JSONHighlighter(RegexHighlighter): """Highlights JSON""" # Captures the start and end of JSON strings, handling escaped quotes JSON_STR = r"(?<![\\\w])(?P<str>b?\".*?(?<!\\)\")" JSON_WHITESPACE = {" ", "\n", "\r", "\t"} base_style = "json." highlights = [ _combine_regex( r"(?P<brace>[\{\[\(\)\]\}])", r"\b(?P<bool_true>true)\b|\b(?P<bool_false>false)\b|\b(?P<null>null)\b", r"(?P<number>(?<!\w)\-?[0-9]+\.?[0-9]*(e[\-\+]?\d+?)?\b|0x[0-9a-fA-F]*)", JSON_STR, ), ] def highlight(self, text: Text) -> None: super().highlight(text) # Additional work to handle highlighting JSON keys plain = text.plain append = text.spans.append whitespace = self.JSON_WHITESPACE for match in re.finditer(self.JSON_STR, plain): start, end = match.span() cursor = end while cursor < len(plain): char = plain[cursor] cursor += 1 if char == ":": append(Span(start, end, "json.key")) elif char in whitespace: continue break class ISO8601Highlighter(RegexHighlighter): """Highlights the ISO8601 date time strings. Regex reference: https://www.oreilly.com/library/view/regular-expressions-cookbook/9781449327453/ch04s07.html """ base_style = "iso8601." highlights = [ # # Dates # # Calendar month (e.g. 2008-08). The hyphen is required r"^(?P<year>[0-9]{4})-(?P<month>1[0-2]|0[1-9])$", # Calendar date w/o hyphens (e.g. 20080830) r"^(?P<date>(?P<year>[0-9]{4})(?P<month>1[0-2]|0[1-9])(?P<day>3[01]|0[1-9]|[12][0-9]))$", # Ordinal date (e.g. 2008-243). The hyphen is optional r"^(?P<date>(?P<year>[0-9]{4})-?(?P<day>36[0-6]|3[0-5][0-9]|[12][0-9]{2}|0[1-9][0-9]|00[1-9]))$", # # Weeks # # Week of the year (e.g., 2008-W35). The hyphen is optional r"^(?P<date>(?P<year>[0-9]{4})-?W(?P<week>5[0-3]|[1-4][0-9]|0[1-9]))$", # Week date (e.g., 2008-W35-6). The hyphens are optional r"^(?P<date>(?P<year>[0-9]{4})-?W(?P<week>5[0-3]|[1-4][0-9]|0[1-9])-?(?P<day>[1-7]))$", # # Times # # Hours and minutes (e.g., 17:21). The colon is optional r"^(?P<time>(?P<hour>2[0-3]|[01][0-9]):?(?P<minute>[0-5][0-9]))$", # Hours, minutes, and seconds w/o colons (e.g., 172159) r"^(?P<time>(?P<hour>2[0-3]|[01][0-9])(?P<minute>[0-5][0-9])(?P<second>[0-5][0-9]))$", # Time zone designator (e.g., Z, +07 or +07:00). The colons and the minutes are optional r"^(?P<timezone>(Z|[+-](?:2[0-3]|[01][0-9])(?::?(?:[0-5][0-9]))?))$", # Hours, minutes, and seconds with time zone designator (e.g., 17:21:59+07:00). # All the colons are optional. The minutes in the time zone designator are also optional r"^(?P<time>(?P<hour>2[0-3]|[01][0-9])(?P<minute>[0-5][0-9])(?P<second>[0-5][0-9]))(?P<timezone>Z|[+-](?:2[0-3]|[01][0-9])(?::?(?:[0-5][0-9]))?)$", # # Date and Time # # Calendar date with hours, minutes, and seconds (e.g., 2008-08-30 17:21:59 or 20080830 172159). # A space is required between the date and the time. The hyphens and colons are optional. # This regex matches dates and times that specify some hyphens or colons but omit others. # This does not follow ISO 8601 r"^(?P<date>(?P<year>[0-9]{4})(?P<hyphen>-)?(?P<month>1[0-2]|0[1-9])(?(hyphen)-)(?P<day>3[01]|0[1-9]|[12][0-9])) (?P<time>(?P<hour>2[0-3]|[01][0-9])(?(hyphen):)(?P<minute>[0-5][0-9])(?(hyphen):)(?P<second>[0-5][0-9]))$", # # XML Schema dates and times # # Date, with optional time zone (e.g., 2008-08-30 or 2008-08-30+07:00). # Hyphens are required. This is the XML Schema 'date' type r"^(?P<date>(?P<year>-?(?:[1-9][0-9]*)?[0-9]{4})-(?P<month>1[0-2]|0[1-9])-(?P<day>3[01]|0[1-9]|[12][0-9]))(?P<timezone>Z|[+-](?:2[0-3]|[01][0-9]):[0-5][0-9])?$", # Time, with optional fractional seconds and time zone (e.g., 01:45:36 or 01:45:36.123+07:00). # There is no limit on the number of digits for the fractional seconds. This is the XML Schema 'time' type r"^(?P<time>(?P<hour>2[0-3]|[01][0-9]):(?P<minute>[0-5][0-9]):(?P<second>[0-5][0-9])(?P<frac>\.[0-9]+)?)(?P<timezone>Z|[+-](?:2[0-3]|[01][0-9]):[0-5][0-9])?$", # Date and time, with optional fractional seconds and time zone (e.g., 2008-08-30T01:45:36 or 2008-08-30T01:45:36.123Z). # This is the XML Schema 'dateTime' type r"^(?P<date>(?P<year>-?(?:[1-9][0-9]*)?[0-9]{4})-(?P<month>1[0-2]|0[1-9])-(?P<day>3[01]|0[1-9]|[12][0-9]))T(?P<time>(?P<hour>2[0-3]|[01][0-9]):(?P<minute>[0-5][0-9]):(?P<second>[0-5][0-9])(?P<ms>\.[0-9]+)?)(?P<timezone>Z|[+-](?:2[0-3]|[01][0-9]):[0-5][0-9])?$", ] if __name__ == "__main__": # pragma: no cover from .console import Console console = Console() console.print("[bold green]hello world![/bold green]") console.print("'[bold green]hello world![/bold green]'") console.print(" /foo") console.print("/foo/") console.print("/foo/bar") console.print("foo/bar/baz") console.print("/foo/bar/baz?foo=bar+egg&egg=baz") console.print("/foo/bar/baz/") console.print("/foo/bar/baz/egg") console.print("/foo/bar/baz/egg.py") console.print("/foo/bar/baz/egg.py word") console.print(" /foo/bar/baz/egg.py word") console.print("foo /foo/bar/baz/egg.py word") console.print("foo /foo/bar/ba._++z/egg+.py word") console.print("https://example.org?foo=bar#header") console.print(1234567.34) console.print(1 / 2) console.print(-1 / 123123123123) console.print( "127.0.1.1 bar 192.168.1.4 2001:0db8:85a3:0000:0000:8a2e:0370:7334 foo" ) import json console.print_json(json.dumps(obj={"name": "apple", "count": 1}), indent=None)