K. Richard Ridderinkhof

16 papers Journal 16
YearRankTypeTitle / Venue / Authors
2023 J jnl
Frontiers Neurorobotics
Natalie Kastel, Casper Hesp, K. Richard Ridderinkhof, Karl J. Friston
2022 J jnl
Frontiers Neurorobotics
Natalie Kastel, Casper Hesp, K. Richard Ridderinkhof, Karl J. Friston
2020 J jnl
J. Cogn. Neurosci.
Michael Rojek-Giffin, Maël Lebreton, H. Steven Scholte, Frans van Winden, K. Richard Ridderinkhof, Carsten K. W. De Dreu
2018 J jnl
J. Cogn. Neurosci.
Marlies E. Vissers, K. Richard Ridderinkhof, Michael X. Cohen, Heleen A. Slagter
2015 J jnl
J. Cogn. Neurosci.
Sara Jahfari, Lourens J. Waldorp, K. Richard Ridderinkhof, H. Steven Scholte
2014 J jnl
J. Cogn. Neurosci.
A. Dilene van Campen, Max C. Keuken, Wery P. M. van den Wildenberg, K. Richard Ridderinkhof
2012 J jnl
J. Cogn. Neurosci.
Scott A. Wylie, Daniel O. Claassen, Hilde M. Huizenga, Kerilyn D. Schewel, K. Richard Ridderinkhof, Theodore R. Bashore, Wery P. M. van den Wildenberg
2012 J jnl
NeuroImage
Janna Cousijn, Reinout W. Wiers, K. Richard Ridderinkhof, Wim van den Brink, Dick J. Veltman, Anna E. Goudriaan
2012 J jnl
J. Cogn. Neurosci.
Roland Nigbur, Michael X. Cohen, K. Richard Ridderinkhof, Birgit Stürmer
2011 J jnl
J. Cogn. Neurosci.
Simon van Gaal, Victor A. F. Lamme, Johannes J. Fahrenfort, K. Richard Ridderinkhof
2011 J jnl
J. Cogn. Neurosci.
Irene van de Vijver, K. Richard Ridderinkhof, Michael X. Cohen
2011 J jnl
J. Cogn. Neurosci.
Nelleke C. van Wouwe, Guido P. H. Band, K. Richard Ridderinkhof
2011 J jnl
J. Cogn. Neurosci.
Simon van Gaal, H. Steven Scholte, Victor A. F. Lamme, Johannes J. Fahrenfort, K. Richard Ridderinkhof
2010 J jnl
J. Cogn. Neurosci.
Wery P. M. van den Wildenberg, Borís Burle, Franck Vidal, Maurits W. van der Molen, K. Richard Ridderinkhof, Thierry Hasbroucq
2010 J jnl
J. Cogn. Neurosci.
Scott A. Wylie, K. Richard Ridderinkhof, Theodore R. Bashore, Wery P. M. van den Wildenberg
2008 J jnl
J. Cogn. Neurosci.
Birte U. Forstmann, Wery P. M. van den Wildenberg, K. Richard Ridderinkhof
redb/extractors/js_extractors/js_content.py
← Index redb/extractors/js_extractors/js_content.py python
"""Persists raw + normalised text into the generic `code_text_content` table.

Reads the raw source and the deobfuscation result directly from the shared
JSContext so no extra compute happens here — both values are computed once
per sample (the source at JSContext construction, the deobfuscation lazily
on first access) and reused by any extractor that needs them.

`text_normalized` is left NULL when the deobfuscation pass produced no
output, so analysts can distinguish "we tried and got nothing" from
"normalisation succeeded".
"""

import inspect
from datetime import datetime, timezone
from typing import Any

from redb.extractors.enum import Tag
from redb.extractors.js_extractor import JSExtractor


class JSContentExtractor(JSExtractor):

    def __init__(
        self, filepath, log, exporters=None, index_prefix=None,
        known_benign=False, known_malicious=False, source=None, context=None,
    ):
        super().__init__(
            filepath, log, exporters, index_prefix,
            known_benign, known_malicious, source, context=context,
        )
        self.content_row = None
        self.log.debug(inspect.currentframe().f_code.co_name)

    def tag(self):
        return Tag.JS_CONTENT.value

    def extract(self):
        src = self.js_source
        if not src:
            return None

        deobfuscated, normalizer_used = self._context.deobfuscated

        self.content_row = {
            "content_type": self._context.content_type,
            "text_raw": src,
            "text_normalized": deobfuscated,  # may be None
            "normalizer_used": normalizer_used,  # may be None
        }
        return self.content_row

    def prepare_export_data(self, exporter_type: str) -> Any:
        if exporter_type != "ClickHouseExporter":
            return None
        if not self.content_row:
            return None

        r = self.content_row
        data = [[
            self.sha256,
            r["content_type"],
            r["text_raw"],
            r["text_normalized"],
            r["normalizer_used"],
            datetime.now(timezone.utc),
        ]]

        column_names = [
            "sha256",
            "content_type",
            "text_raw",
            "text_normalized",
            "normalizer_used",
            "analysis_date",
        ]

        column_type_names = [
            "FixedString(64)",
            "LowCardinality(String)",
            "String",
            "Nullable(String)",
            "Nullable(String)",
            "DateTime64(3, 'UTC')",
        ]

        return (data, column_names, column_type_names)

    def get_clickhouse_table(self) -> str:
        return "code_text_content"