Module refinery.units.obfuscation.js.comments
Expand source code Browse git
from __future__ import annotations
import re
from refinery.lib.patterns import formats
from refinery.units.obfuscation import Deobfuscator, StringLiterals
class deob_js_comments(Deobfuscator):
"""
JavaScript deobfuscator that removes comments from the script.
"""
def deobfuscate(self, data):
strings = StringLiterals(str(formats.string), data)
@strings.outside
def remove(_):
return ''
data = re.sub(R'/\*.*?\*/', remove, data, flags=re.DOTALL)
data = re.sub(R'(?m)//.*$', remove, data)
return data
Classes
class deob_js_comments-
JavaScript deobfuscator that removes comments from the script.
Expand source code Browse git
class deob_js_comments(Deobfuscator): """ JavaScript deobfuscator that removes comments from the script. """ def deobfuscate(self, data): strings = StringLiterals(str(formats.string), data) @strings.outside def remove(_): return '' data = re.sub(R'/\*.*?\*/', remove, data, flags=re.DOTALL) data = re.sub(R'(?m)//.*$', remove, data) return dataAncestors
Subclasses
Methods
def deobfuscate(self, data)-
Expand source code Browse git
def deobfuscate(self, data): strings = StringLiterals(str(formats.string), data) @strings.outside def remove(_): return '' data = re.sub(R'/\*.*?\*/', remove, data, flags=re.DOTALL) data = re.sub(R'(?m)//.*$', remove, data) return data
Inherited members