Module refinery.units.scripting.php
Expand source code Browse git
from __future__ import annotations
from refinery.lib.scripts.php.deobfuscation import deobfuscate
from refinery.lib.scripts.php.model import PhpScript
from refinery.lib.scripts.php.parser import PhpParser
from refinery.lib.scripts.php.synth import PhpSynthesizer
from refinery.units.scripting import IterativeDeobfuscator
class php(IterativeDeobfuscator):
"""
AST-based PHP deobfuscator and pretty-printer.
Parses the script into an abstract syntax tree, applies simplifying transformations, and
synthesizes clean output. No deobfuscation passes are registered yet, so this currently only
pretty-prints the input. This deobfuscator iterates until stable; running it twice does not
change the output.
"""
def parse(self, data: str) -> PhpScript:
return PhpParser(data).parse()
transform = staticmethod(deobfuscate)
def synthesize(self, ast: PhpScript) -> str:
return PhpSynthesizer().convert(ast)
Classes
class php (timeout=500)-
AST-based PHP deobfuscator and pretty-printer.
Parses the script into an abstract syntax tree, applies simplifying transformations, and synthesizes clean output. No deobfuscation passes are registered yet, so this currently only pretty-prints the input. This deobfuscator iterates until stable; running it twice does not change the output.
Expand source code Browse git
class php(IterativeDeobfuscator): """ AST-based PHP deobfuscator and pretty-printer. Parses the script into an abstract syntax tree, applies simplifying transformations, and synthesizes clean output. No deobfuscation passes are registered yet, so this currently only pretty-prints the input. This deobfuscator iterates until stable; running it twice does not change the output. """ def parse(self, data: str) -> PhpScript: return PhpParser(data).parse() transform = staticmethod(deobfuscate) def synthesize(self, ast: PhpScript) -> str: return PhpSynthesizer().convert(ast)Ancestors
Subclasses
Class variables
var reverse-
The type of the None singleton.
Static methods
def transform(ast, max_steps=0)-
Apply all available deobfuscators to the input. No passes are registered yet, so this is a no-op that always reports zero applied transformations.
Expand source code Browse git
def deobfuscate(ast: PhpScript, max_steps: int = 0) -> int: """ Apply all available deobfuscators to the input. No passes are registered yet, so this is a no-op that always reports zero applied transformations. """ return _pipeline.run(ast, max_steps=max_steps)
Methods
def parse(self, data)-
Expand source code Browse git
def parse(self, data: str) -> PhpScript: return PhpParser(data).parse() def synthesize(self, ast)-
Expand source code Browse git
def synthesize(self, ast: PhpScript) -> str: return PhpSynthesizer().convert(ast)
Inherited members