MCPcopy Create free account
hub / github.com/Fadi002/de4py / _decode_codecs_hex

Method _decode_codecs_hex

de4py/engines/onyx/string_decoder.py:521–532  ·  view source on GitHub ↗
(self, source: str)

Source from the content-addressed store, hash-verified

519 return pattern.sub(d, source)
520
521 def _decode_codecs_hex(self, source: str) -> str:
522 pattern = re.compile(
523 r'codecs\.decode\s*\(\s*(b["\'][0-9a-fA-F]+["\'])\s*,\s*["\']hex_codec["\']\s*\)'
524 r'(?:\.decode\s*\([^)]*\))?'
525 )
526 def d(m):
527 try:
528 raw = ast.literal_eval(m.group(1))
529 return repr(bytes.fromhex(raw.decode('ascii')).decode('utf-8', errors='replace'))
530 except Exception:
531 return m.group(0)
532 return pattern.sub(d, source)
533
534 def _decode_reversed_string(self, source: str) -> str:
535 p1 = re.compile(r'["\']["\']\.join\s*\(\s*reversed\s*\(\s*(["\'][^"\']+["\'])\s*\)\s*\)')

Callers 1

_single_passMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected