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

Method _decode_join_chr_list

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

Source from the content-addressed store, hash-verified

322 return pattern.sub(d, source)
323
324 def _decode_join_chr_list(self, source: str) -> str:
325 p1 = re.compile(r'["\']["\']\.join\s*\(\s*\[?\s*chr\s*\(\s*\w+\s*\)\s+for\s+\w+\s+in\s+\[([0-9,\s]+)\]\s*\]?\s*\)')
326 def d1(m):
327 try:
328 nums = [int(x.strip()) for x in m.group(1).split(',') if x.strip()]
329 r = ''.join(chr(n) for n in nums)
330 return repr(r) if r.isprintable() else m.group(0)
331 except Exception:
332 return m.group(0)
333 source = p1.sub(d1, source)
334 p2 = re.compile(r'["\']["\']\.join\s*\(\s*map\s*\(\s*chr\s*,\s*\[([0-9,\s]+)\]\s*\)\s*\)')
335 def d2(m):
336 try:
337 nums = [int(x.strip()) for x in m.group(1).split(',') if x.strip()]
338 r = ''.join(chr(n) for n in nums)
339 return repr(r) if r.isprintable() else m.group(0)
340 except Exception:
341 return m.group(0)
342 source = p2.sub(d2, source)
343 p3 = re.compile(r'["\']["\']\.join\s*\(\s*\[\s*((?:chr\s*\(\s*\d{1,3}\s*\)\s*,?\s*)+)\]\s*\)')
344 def d3(m):
345 try:
346 nums = [int(x) for x in re.findall(r'chr\s*\(\s*(\d{1,3})\s*\)', m.group(1))]
347 r = ''.join(chr(n) for n in nums)
348 return repr(r) if r.isprintable() else m.group(0)
349 except Exception:
350 return m.group(0)
351 return p3.sub(d3, source)
352
353 def _decode_join_chr_map(self, source: str) -> str:
354 pattern = re.compile(

Callers 1

_single_passMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected