Rafael L. Gomes

66 papers B 14C 9Misc 1Journal 16Unranked 26
YearRankTypeTitle / Venue / Authors
2026 J jnl
IEEE Netw. Lett.
Maria L. M. L. Brito, Maria C. M. M. Ferreira, Ariel L. C. Portela, Rafael L. Gomes
2026 J jnl
IEEE Netw. Lett.
Ivo A. Pimenta, Marcello H. Lee, Luiz F. Bittencourt, Rafael L. Gomes
2025 conf
LADC
João C. C. Lima, Francisco R. M. Campos, Rafael L. Gomes, Emanuel B. Rodrigues, Rossana M. C. Andrade, Clenival L. Silva, Daniel C. Bentes, Alexandre S. Cialdini
2025 conf
LADC
Ariel L. C. Portela, Maria C. M. M. Ferreira, Rafael L. Gomes
2025 conf
LADC
Evellin Serra de Moura, Antônio M. B. Neto, Rafael L. Gomes
2025 conf
LADC
Jessica C. C. Patricio, Carlos H. Paiva, Renan L. Rodrigues, Vanessa C. Lima, Rafael L. Gomes
2025 B conf
NCA
Francisco Valderlan Jorge Nobre, Ramon S. Araujo, Davi O. Alves, Erick S. Nascimento, Lyedson S. Rodrigues, Rafael L. Gomes
2025 conf
LADC
Francisco Valderlan Jorge Nobre, Davi O. Alves, Ramon S. Araujo, Gustavo A. Campos, Rafael L. Gomes
2025 conf
LADC
Wanderson L. Costa, Rafael L. Gomes
2025 J jnl
J. Internet Serv. Appl.
Francisco Valderlan Jorge Nobre, Danielle dos S. Silva, Maria C. M. M. Ferreira, Maria L. M. L. Brito, Thelmo P. de Araújo, Rafael L. Gomes
2024 J jnl
J. Internet Serv. Appl.
Michael S. Souza, Silvio E. S. B. Ribeiro, Vanessa C. Lima, Francisco J. Cardoso, Rafael L. Gomes
2024 conf
LANC
Marcus A. Costa, Yago Melo Costa, Yanne O. Almeida, Francisco J. Cardoso, Rafael L. Gomes
2024 J jnl
Int. J. Commun. Networks Distributed Syst.
Matheus Monteiro Silveira, Maria C. M. M. Ferreira, Rafael L. Gomes
2024 conf
ICAI Workshops
Nadiana Kelly N. Mendes, Francisco Victor da Silva Pinheiro, Victória Tomé Oliveira, Francisco Laurindo C. Junior, Rafael L. Gomes, Rossana M. C. Andrade
2024 conf
LANC
Carlos H. Paiva, Mateus F. Nascimento, Renan L. Rodrigues, Rafael L. Gomes
2024 B conf
CNSM
Maria C. M. M. Ferreira, Silvio E. S. B. Ribeiro, Francisco Valderlan Nobre, Maria Melo Linhares, Thelmo P. de Araújo, Rafael L. Gomes
2024 conf
DCOSS-IoT
Ivo A. Pimenta, Carlos A. Aquino, Yanne O. Almeida, Vanessa C. Lima, Rafael L. Gomes
2024 J jnl
IEEE Trans. Netw. Serv. Manag.
Ariel L. C. Portela, Silvio E. S. B. Ribeiro, Rafael A. Menezes, Thelmo P. de Araújo, Rafael L. Gomes
2023 conf
SBRC
Silvio E. S. B. Ribeiro, Rafael A. Menezes, Ariel L. C. Portela, Thelmo P. de Araújo, Rafael L. Gomes
2023 B conf
NOMS
Matheus Monteiro Silveira, Ariel L. C. Portela, Rafael A. Menezes, Michael S. Souza, Danielle S. Silva, Maria C. Mesquita, Rafael L. Gomes
2022 C conf
ISCC
Ana M. B. C. Quevedo, Carlos H. O. O. Quevedo, Rafael L. Gomes, Samuel F. Camara, Joaquim Celestino Jr.
2022 J jnl
J. Internet Serv. Appl.
Evilásio Costa Junior, Wanderson L. Costa, Ariel L. C. Portela, Leonardo S. Rocha, Rafael L. Gomes, Rossana M. C. Andrade
2022 J jnl
Int. J. Embed. Syst.
Marcus de V. D. da Silva, Eduardo E. Mosca, Rafael L. Gomes
2021 J jnl
IEEE Trans. Netw. Serv. Manag.
Dyego H. L. Oliveira, Thelmo P. de Araújo, Rafael L. Gomes
2021 B conf
DCOSS
Antonia Raiane S. Araujo Cruz, Rafael L. Gomes, Marcial P. Fernandez
2021 conf
CCNC
Diego A. B. Moreira, Humberto P. Marques, Wanderson L. Costa, Joaquim Celestino Jr., Rafael L. Gomes, Michele Nogueira
2021 conf
SBRC Companion
Ariel L. C. Portela, Wanderson L. Costa, Rafael L. Gomes
2021 conf
CCNC
Marcus de V. D. da Silva, Alexandre Rocha, Rafael L. Gomes, Michele Nogueira
2021 conf
SBRC Companion
Dyego H. L. Oliveira, Rafael L. Gomes
2021 B conf
DCOSS
Alexandre Rocha, Eduardo E. Mosca, Gabriel G. Da Silva, Rafael L. Gomes
2021 B conf
DCOSS
Matheus B. Araújo, Matheus Monteiro Silveira, Rafael L. Gomes
2020 C conf
ISCC
Dyego H. L. Oliveira, Francisco M. V. Filho, Thelmo P. de Araújo, Joaquim Celestino Jr., Rafael L. Gomes
2020 C conf
ISCC
Diego A. B. Moreira, Levy G. Chaves, Rafael L. Gomes, Joaquim Celestino Jr.
2020 conf
ICC
Carlos H. O. O. Quevedo, Ana M. B. C. Quevedo, Gustavo A. Campos, Rafael L. Gomes, Joaquim Celestino Jr., Ahmed Serhrouchni
2020 conf
LATINCOM
Wanderson L. Costa, Matheus Monteiro Silveira, Thelmo P. de Araújo, Rafael L. Gomes
2020 J jnl
IEEE Commun. Mag.
Rafael L. Gomes, Luiz F. Bittencourt, Edmundo R. M. Madeira
2020 B conf
NOMS
Gabriel da Silva, Dyego Oliveira, Rafael L. Gomes, Luiz F. Bittencourt, Edmundo R. M. Madeira
2020 J jnl
Trans. Emerg. Telecommun. Technol.
Rafael L. Gomes, Francisco R. P. da Ponte, Arthur Urbano, Luiz F. Bittencourt, Edmundo R. M. Madeira
2019 conf
LATINCOM
Emanuel J. Mendes, Matheus Monteiro Silveira, Matheus B. Araújo, Joaquim Celestino Jr., Rafael L. Gomes
2019 conf
ICC
Francisco Leonardo Jales Martins, Joaquim Celestino Jr., Rafael L. Gomes, Ahmed Patel, Nazim Agoulmine
2019 B conf
IM
Francisco R. P. da Ponte, Rafael L. Gomes, Joaquim Celestino Jr., Walisson F. Pereira, Nelson L. S. da Fonseca
2019 conf
LANOMS
Diego A. B. Moreira, Humberto P. Marques, Joaquim Celestino Jr., Rafael L. Gomes, Aldri Santos, Michele Nogueira
2019 B conf
IM
Rafael L. Gomes, Francisco R. P. da Ponte, Arthur Urbano, Alan Vasconselos, Luiz F. Bittencourt, Edmundo R. M. Madeira
2018 C conf
ISCC
Diego A. B. Moreira, Levy G. Chaves, Bruno A. Lima, Kilvia L. A. de Almeida, Thelmo P. de Araújo, Rafael L. Gomes, Joaquim Celestino Jr., Augusto J. V. Neto
2018 conf
SBRC
Rafael L. Gomes, Francisco R. P. da Ponte, Arthur Urbano, Luiz F. Bittencourt, Edmundo R. M. Madeira
2018 C conf
ISCC
Bruno A. Lima, Carlos H. O. O. Quevedo, Humberto P. Marques, Diego A. B. Moreira, Rafael L. Gomes, Joaquim Celestino Jr., Yacine Ghamri-Doudane
2018 C conf
ISCC
Francisco R. P. da Ponte, Rafael L. Gomes, Joaquim Celestino Jr., Edmundo R. M. Madeira, Ahmed Patel
2018 C conf
ISCC
Rafael L. Gomes, Francisco R. P. da Ponte, Eduardo Coelho Cerqueira, Luiz F. Bittencourt, Edmundo R. M. Madeira, Mario Gerla
2018 C conf
ISCC
Rafael L. Gomes, Arthur Urbano, Francisco R. P. da Ponte, Luiz F. Bittencourt, Edmundo R. M. Madeira
2018 C conf
ISCC
Francisco R. P. da Ponte, Kilvia L. A. de Almeida, Rafael L. Gomes, Joaquim Celestino Jr., Walisson F. Pereira, Nelson L. S. da Fonseca
2017 B conf
GLOBECOM
Ademar Takeo Akabane, Rafael L. Gomes, Richard W. Pazzi, Edmundo R. M. Madeira, Leandro A. Villas
2017 J jnl
Multim. Syst.
Rafael L. Gomes, Luiz Fernando Bittencourt, Edmundo Roberto Mauro Madeira, Eduardo Cerqueira, Mario Gerla
2017 conf
SBRC
Rafael L. Gomes, Luiz F. Bittencourt, Edmundo R. M. Madeira
2017 J jnl
Comput. Commun.
Rafael L. Gomes, Luiz F. Bittencourt, Edmundo R. M. Madeira, Eduardo Cerqueira, Mario Gerla
2016 J jnl
J. Netw. Comput. Appl.
Rafael L. Gomes, Luiz F. Bittencourt, Edmundo R. M. Madeira, Eduardo Cerqueira, Mario Gerla
2016 J jnl
Comput. Networks
Rafael L. Gomes, Luiz F. Bittencourt, Edmundo R. M. Madeira, Eduardo Cerqueira, Mario Gerla
2016 J jnl
IEEE Trans. Netw. Serv. Manag.
Rafael L. Gomes, Luiz F. Bittencourt, Edmundo R. M. Madeira, Eduardo Coelho Cerqueira, Mario Gerla
2016 conf
CCNC
Rafael L. Gomes, Luiz F. Bittencourt, Edmundo R. M. Madeira, Eduardo Cerqueira, Mario Gerla
2015 conf
CCNC
Rafael L. Gomes, Luiz F. Bittencourt, Edmundo R. M. Madeira, Eduardo Cerqueira, Mario Gerla
2015 conf
ICC
Rafael L. Gomes, Luiz F. Bittencourt, Edmundo R. M. Madeira, Eduardo Cerqueira, Mario Gerla
2014 B conf
AINA
Rafael L. Gomes, Luiz F. Bittencourt, Edmundo R. M. Madeira
2014 Misc conf
SAC
Rafael L. Gomes, Luiz F. Bittencourt, Edmundo R. M. Madeira
2014 B conf
GLOBECOM
Rafael L. Gomes, Luiz F. Bittencourt, Edmundo Roberto Mauro Madeira, Eduardo Cerqueira, Mario Gerla
2013 B conf
ICCCN
Rafael L. Gomes, Luiz F. Bittencourt, Edmundo R. M. Madeira
2013 B conf
IM
Rafael L. Gomes, Luiz F. Bittencourt, Edmundo R. M. Madeira
2012 conf
ICON
Rafael L. Gomes, Luiz F. Bittencourt, Edmundo R. M. Madeira
redb/extractors/js_extractors/js_xray.py
← Index redb/extractors/js_extractors/js_xray.py python
"""Subprocess wrapper for the bundled js-x-ray Node bridge.

Mirrors `js_deobfuscator.py`: shell out to a Node script with a per-sample
timeout, kill the process group on hang, demote `FileNotFoundError` to debug
(missing tool is routine — the host either has Node + the bundled package
installed or it doesn't), and return a structured result on success.

The bridge lives at `redb/extractors/js_extractors/scripts/js-xray-runner.js`.
Operators install the JS dependency once with `npm install` in that directory
(or override the path with `JS_XRAY_RUNNER_PATH`).

Configuration (env vars):
    JS_XRAY_RUNNER_PATH   Path to the Node bridge script (default: bundled).
    JS_XRAY_TIMEOUT       Seconds before the subprocess is killed. Default: 30.

`run(source, log)` returns `XRayResult(obfuscator, warnings)` on a successful
analysis, or `XRayResult(None, [])` for any non-success path (binary missing,
timeout, parse failure, etc.). The two unsuccessful states are
indistinguishable to the caller on purpose — they all collapse to "no
js-x-ray verdict, fall back to heuristic".
"""

from __future__ import annotations

import json
import os
import signal
import subprocess
import tempfile
from dataclasses import dataclass, field
from typing import List, Optional

# Bundled bridge: redb/extractors/js_extractors/scripts/js-xray-runner.js
_DEFAULT_RUNNER = os.path.join(
    os.path.dirname(__file__), "scripts", "js-xray-runner.js"
)
_DEFAULT_NODE = "node"
_DEFAULT_TIMEOUT_SECS = 30


@dataclass
class XRayResult:
    """Parsed js-x-ray output. `obfuscator` is the recognised family name
    (e.g. "jsfuck", "obfuscator.io") or None when js-x-ray did not flag the
    code. `warnings` carries every {kind, value} pair the analyser produced;
    the heuristic uses it as a corroborating signal. `avg_identifier_length`
    is js-x-ray's own AST-derived figure — used as a fallback for the
    heuristic's `avg_identifier_length<2` strong signal when pyjsparser
    can't parse the source (anything ES2015+ trips it)."""

    obfuscator: Optional[str] = None
    warnings: List[dict] = field(default_factory=list)
    avg_identifier_length: Optional[float] = None

    @property
    def flagged(self) -> bool:
        return self.obfuscator is not None


def _empty() -> XRayResult:
    return XRayResult(obfuscator=None, warnings=[])


def run(source: str, log) -> XRayResult:
    if not source:
        return _empty()

    runner = os.getenv("JS_XRAY_RUNNER_PATH", _DEFAULT_RUNNER)
    node_bin = os.getenv("JS_XRAY_NODE_BIN", _DEFAULT_NODE)
    timeout = int(os.getenv("JS_XRAY_TIMEOUT", str(_DEFAULT_TIMEOUT_SECS)))

    if not os.path.exists(runner):
        log.debug(f"js-x-ray runner not found at {runner}")
        return _empty()

    # Skip the subprocess entirely when the JS dependency isn't installed.
    # Without this, every call to a host that has `node` but never ran
    # `npm install` next to the runner would still fork node, get a require
    # error, and exit nonzero — wasted ~50–200ms per JS sample (and per test).
    runner_dir = os.path.dirname(runner)
    if not os.path.isdir(os.path.join(runner_dir, "node_modules", "@nodesecure", "js-x-ray")):
        log.debug(f"@nodesecure/js-x-ray not installed in {runner_dir}")
        return _empty()

    tmp_path = None
    try:
        with tempfile.NamedTemporaryFile(
            suffix=".js", mode="w", delete=False, encoding="utf-8"
        ) as tmp:
            tmp.write(source)
            tmp_path = tmp.name

        try:
            process = subprocess.Popen(
                [node_bin, runner, tmp_path],
                stdout=subprocess.PIPE,
                stderr=subprocess.PIPE,
                preexec_fn=os.setsid,
            )
            try:
                stdout, stderr = process.communicate(timeout=timeout)
            except subprocess.TimeoutExpired:
                # Kill the whole process group so any node helpers die too.
                try:
                    os.killpg(os.getpgid(process.pid), signal.SIGTERM)
                    process.wait(timeout=5)
                except Exception:
                    try:
                        os.killpg(os.getpgid(process.pid), signal.SIGKILL)
                    except Exception:
                        pass
                log.warning(f"js-x-ray timed out after {timeout}s")
                return _empty()

            if process.returncode != 0:
                err = stderr.decode("utf-8", errors="replace").strip()
                log.debug(f"js-x-ray exited {process.returncode}: {err}")
                return _empty()

            text = stdout.decode("utf-8", errors="replace").strip()
            if not text:
                return _empty()

            try:
                payload = json.loads(text)
            except json.JSONDecodeError as e:
                log.warning(f"js-x-ray emitted non-JSON output: {e}")
                return _empty()

            obfuscator = payload.get("obfuscator")
            warnings = payload.get("warnings") or []
            if not isinstance(warnings, list):
                warnings = []

            ids_avg = payload.get("idsLengthAvg")
            if not isinstance(ids_avg, (int, float)):
                ids_avg = None

            return XRayResult(
                obfuscator=obfuscator,
                warnings=warnings,
                avg_identifier_length=ids_avg,
            )
        finally:
            if tmp_path:
                try:
                    os.unlink(tmp_path)
                except Exception:
                    pass
    except FileNotFoundError:
        log.debug(f"node binary not found at {node_bin}")
        return _empty()
    except Exception as e:
        log.error(f"js-x-ray subprocess error: {e}")
        return _empty()