Xiang Chen

18 papers Journal 9Unranked 9
YearRankTypeTitle / Venue / Authors
2024 J jnl
IEEE Open J. Commun. Soc.
Yu Han, Xiang Chen, Manxi Wang, Long Shi, Zhongming Feng
2021 J jnl
Phys. Commun.
Changbo Hou, Yuqian Li, Xiang Chen, Jing Zhang
2021 J jnl
Secur. Commun. Networks
Yinghua Tian, Nae Zheng, Xiang Chen, Liuyang Gao
2020 J jnl
Int. J. Perform. Eng.
Changbo Hou, Xiao Zhang, Xiang Chen
2020 J jnl
Mob. Networks Appl.
Xiaojun Hao, Zhaoyue Zhang, Xiang Chen
2020 J jnl
IEEE Access
Ying Li, Xiang Chen, Yun Lin, Gautam Srivastava, Shuai Liu
2019 J jnl
IEEE Access
Xiang Chen, Xiaojun Hao
2019 J jnl
Symmetry
Shuai Liu, Xiang Chen, Ying Li, Xiaochun Cheng
2018 conf
ICCCS (6)
Hui Han, YuLong Ying, Xiang Chen
2018 conf
ADHIP
Haojun Zhao, Ruowu Wu, Hui Han, Xiang Chen, Yuyao Li, Yun Lin
2018 conf
ADHIP
Hui Han, Xianglong Zhou, Xiang Chen, Ruowu Wu, Yun Lin
2018 conf
ADHIP
Ruowu Wu, Yuyao Li, Hui Han, Xiang Chen, Yun Lin
2018 conf
ADHIP
Xiang Chen, Jie Chang, Hui Han, Ruowu Wu, Yun Lin
2018 conf
ICCCS (6)
Xiang Chen, Jingchao Li, Hui Han
2018 conf
ICCCS (4)
Ruowu Wu, Sen Wang, Hui Han, Xiang Chen, Xuhong Yin, Yun Lin
2018 J jnl
Mob. Networks Appl.
Hui Han, Jingchao Li, Xiang Chen
2018 conf
ADHIP
Ying Li, Xiang Chen, Jie Chang, Yun Lin
2017 conf
CSPS
Hui Han, Xiang Chen, Yun Lin
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())