| 449 | return pattern.sub(d, source) |
| 450 | |
| 451 | def _decode_xor_byte_arrays(self, source: str) -> str: |
| 452 | p1 = re.compile( |
| 453 | r'bytes\s*\(\s*\[\s*\w+\s*\^\s*(\d+)\s+for\s+\w+\s+in\s+\[([0-9,\s]+)\]\s*\]\s*\)' |
| 454 | ) |
| 455 | def d1(m): |
| 456 | try: |
| 457 | key = int(m.group(1)) |
| 458 | nums = [int(x.strip()) for x in m.group(2).split(',') if x.strip()] |
| 459 | return repr(bytes([n^key for n in nums]).decode('utf-8', errors='replace')) |
| 460 | except Exception: |
| 461 | return m.group(0) |
| 462 | source = p1.sub(d1, source) |
| 463 | p2 = re.compile(r'bytes\s*\(\s*\[([0-9,\s]+)\]\s*\)') |
| 464 | def d2(m): |
| 465 | try: |
| 466 | nums = [int(x.strip()) for x in m.group(1).split(',') if x.strip()] |
| 467 | if all(32<=n<=126 or n in (9,10,13) for n in nums): |
| 468 | return repr(bytes(nums).decode('utf-8', errors='replace')) |
| 469 | except Exception: |
| 470 | pass |
| 471 | return m.group(0) |
| 472 | return p2.sub(d2, source) |
| 473 | |
| 474 | def _decode_xor_comprehension(self, source: str) -> str: |
| 475 | pattern = re.compile( |