James Atwood

13 papers A* 1Journal 9Unranked 3
YearRankTypeTitle / Venue / Authors
2024 J jnl
CoRR
James Atwood, Preethi Lahoti, Ananth Balashankar, Flavien Prost, Ahmad Beirami
2023 J jnl
CoRR
James Atwood, Tina Tian, Ben Packer, Meghana Deodhar, Jilin Chen, Alex Beutel, Flavien Prost, Ahmad Beirami
2020 A* conf
ICLR
David Madras, James Atwood, Alexander D'Amour
2020 conf
FAT*
Alexander D'Amour, Hansa Srinivasan, James Atwood, Pallavi Baljekar, D. Sculley, Yoni Halpern
2019 J jnl
CoRR
David Madras, James Atwood, Alex D'Amour
2019 J jnl
CoRR
James Atwood, Hansa Srinivasan, Yoni Halpern, David Sculley
2018 J jnl
CoRR
Alexey A. Gritsenko, Alex D'Amour, James Atwood, Yoni Halpern, D. Sculley
2017 J jnl
CoRR
James Atwood, Siddharth Pal, Don Towsley, Ananthram Swami
2016 conf
NIPS
James Atwood, Don Towsley
2015 J jnl
CoRR
James Atwood, Don Towsley
2014 J jnl
CoRR
James Atwood, Bruno F. Ribeiro, Don Towsley
2014 conf
WWW (Companion Volume)
James Atwood, Bruno F. Ribeiro, Don Towsley
2014 J jnl
CoRR
James Atwood
redb/extractors/decompiler/bninja/analysis/strings.py
← Index redb/extractors/decompiler/bninja/analysis/strings.py python
from collections import Counter
import math

class StringAnalysis:
    def __init__(self, bv, functions):
        self.bv = bv
        self.functions = functions

    def entropy(self, s: str) -> float:
        """Compute Shannon entropy of a string."""
        if not s:
            return 0.0
        freq = Counter(s)
        length = len(s)
        return -sum((count / length) * math.log2(count / length) for count in freq.values())

    def analyze(self):
        """
        Extract unique strings from the binary.

        Deduplicates by (string, encoding) within the same binary, keeping the
        first occurrence (lowest offset). Cross-binary deduplication and
        aggregation is handled by ClickHouse materialized views.
        """
        strings = {}

        # Sort strings by their starting address
        sorted_entries = sorted(self.bv.strings, key=lambda e: e.start)

        for entry in sorted_entries:
            # Key is the string and its encoding
            key = (entry.value, entry.type.name)

            # Skip if this string (value + encoding) was already added.
            # Because entries are sorted by address, the first one is always kept.
            if key in strings:
                continue

            # Store only the first occurrence with schema-matching field names
            # entry.length is the raw byte length, len(entry.value) is decoded string length
            string_entry = {
                "string": entry.value,
                "string_raw": entry.raw,
                "string_encoding": entry.type.name,
                "string_offset": entry.start,
                "string_length": len(entry.value),
                "string_raw_length": entry.length,
                "string_entropy": self.entropy(entry.value),
            }

            strings[key] = string_entry

        # Return as list for export compatibility
        return list(strings.values())