James B. Kuo

31 papers C 7Journal 13Unranked 11
YearRankTypeTitle / Venue / Authors
2014 C conf
ISCAS
Gregory J. Y. Lin, Chienbo B. Hsu, James B. Kuo
2014 conf
ISIC
Chen-Bo Hsu, James B. Kuo
2014 conf
ICECS
Chen-Bo Hsu, Young Sik Hong, James B. Kuo
2014 conf
ISIC
D. H. Lung, S. K. Hu, James B. Kuo, D. Chen, Y. J. Chen
2014 conf
MWSCAS
Chen-Bo Hsu, James B. Kuo
2011 conf
PATMOS
Henry X. F. Huang, Steven R. S. Shen, James B. Kuo
2010 J jnl
Microelectron. Reliab.
H. J. Hung, James B. Kuo, D. Chen, Chih-Sheng Yeh
2010 C conf
ISCAS
Chih-Hsiang Lin, James B. Kuo
2009 conf
PATMOS
Chih-Hsiang Lin, James B. Kuo
2007 conf
PATMOS
Harry I. A. Chen, Edward K. W. Loo, James B. Kuo, Marek Syrzycki
2005 conf
IWSOC
James B. Kuo
2004 conf
ICECS
Hung-Pin Chen, James B. Kuo
2003 conf
ISCAS (5)
P. C. Chen, James B. Kuo
2002 J jnl
IEEE J. Solid State Circuits
Perng-Fei Lin, James B. Kuo
2001 J jnl
IEEE J. Solid State Circuits
Perng-Fei Lin, James B. Kuo
2001 J jnl
IEEE J. Solid State Circuits
S. C. Liu, F. A. Wu, James B. Kuo
2000 C conf
ISCAS
Bo-Ting Wang, James B. Kuo
1998 conf
ICECS
J. H. Lou, James B. Kuo
1997 J jnl
IEEE J. Solid State Circuits
J. H. Lou, James B. Kuo
1996 J jnl
IEEE Trans. Comput. Aided Des. Integr. Circuits Syst.
Y. G. Chen, James B. Kuo
1995 J jnl
IEEE J. Solid State Circuits
James B. Kuo, K. W. Su, J. H. Lou, S. S. Chen, C. S. Chiang
1995 J jnl
IEEE J. Solid State Circuits
James B. Kuo, K. W. Su, J. H. Lou
1994 C conf
ISCAS
James B. Kuo, K. W. Su, J. H. Lou
1994 C conf
ISCAS
James B. Kuo, B. Y. Chen, Mark W. Mao
1993 C conf
ISCAS
James B. Kuo, Hung-Pin Chen, H. J. Huang
1993 J jnl
IEEE J. Solid State Circuits
James B. Kuo, H. J. Liao, H. P. Chen
1993 C conf
ISCAS
Mark W. Mao, B. Y. Chen, James B. Kuo
1992 J jnl
Neural Networks
Mark W. Mao, James B. Kuo
1992 J jnl
IEEE Trans. Comput. Aided Des. Integr. Circuits Syst.
Hwang-Cherng Chow, Wu-Shiung Feng, James B. Kuo
1989 J jnl
IEEE Trans. Comput. Aided Des. Integr. Circuits Syst.
James B. Kuo, Geert P. Rosseel, Robert W. Dutton
1989 J jnl
IEEE Trans. Comput. Aided Des. Integr. Circuits Syst.
James B. Kuo, Tsen-Shau Yang, Robert W. Dutton, Bruce A. Wooley
redb/extractors/pe_extractors/pe_overlay.py
← Index redb/extractors/pe_extractors/pe_overlay.py python
from hashlib import md5, sha1, sha256
import inspect
from datetime import datetime, timezone
from typing import Any

import magic
from magika import Magika

from redb.extractors.enum import Tag
from redb.extractors.pe_extractor import PEExtractor
from redb.models.dataclasses import PEOverlay


class PEOverlayExtractor(PEExtractor):

    def __init__(
        self,
        filepath,
        log,
        exporters=None,
        index_prefix=None,
        elastic_index=None,
        known_benign=False,
        known_malicious=False,
        pe=None,
    ):
        super().__init__(
            filepath,
            log,
            exporters,
            index_prefix,
            elastic_index,
            known_benign,
            known_malicious,
            pe,
        )
        self.elastic_index = self.index_prefix + "-pe_overlay"
        self.log.debug(inspect.currentframe().f_code.co_name)

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

    def _extract_pe_overlay(self):
        self.log.debug(inspect.currentframe().f_code.co_name)
        overlay = self.pe.get_overlay()
        if overlay:
            return PEOverlay(
                _id=sha256(overlay).hexdigest(),
                overlay_size=len(overlay),
                overlay_entropy=self.calculate_entropy(overlay),
                overlay_offset=self.pe.get_overlay_data_start_offset(),
                overlay_mimetype=magic.from_buffer(overlay, mime=True),
                overlay_type=magic.from_buffer(overlay),
                overlay_magika=Magika().identify_bytes(overlay).output.ct_label,
                overlay_sha256=sha256(overlay).hexdigest(),
                overlay_sha1=sha1(overlay).hexdigest(),
                overlay_md5=md5(overlay).hexdigest(),
            )
        return None

    def extract(self):
        try:
            self.log.debug(inspect.currentframe().f_code.co_name)
            overlay = self._extract_pe_overlay()
            # self.export_to_elastic([overlay])  # Let the exporters handle this
            return overlay
        except Exception as e:
            self.log.error(f"Error extracting PE overlay: {e}")
            return None

    def prepare_export_data(self, exporter_type: str) -> Any:
        if exporter_type == "ElasticsearchExporter":
            return self.extract()
        elif exporter_type == "ClickHouseExporter":
            overlay = self.extract()
            if overlay is None:
                return None
            
            data = []
            current_time = datetime.now(timezone.utc)
            
            data.append([
                self.sha256,              # sha256
                self.md5,                 # md5
                self.sha1,                # sha1
                overlay.overlay_size,     # overlay_size
                overlay.overlay_entropy,  # overlay_entropy
                overlay.overlay_offset,   # overlay_offset
                overlay.overlay_mimetype, # overlay_mimetype
                overlay.overlay_type,     # overlay_type
                overlay.overlay_magika,   # overlay_magika
                overlay.overlay_sha256,   # overlay_sha256
                overlay.overlay_sha1,     # overlay_sha1
                overlay.overlay_md5,      # overlay_md5
                current_time             # analysis_date
            ])
            
            column_names = [
                'sha256', 'md5', 'sha1', 'overlay_size', 'overlay_entropy',
                'overlay_offset', 'overlay_mimetype', 'overlay_type', 'overlay_magika',
                'overlay_sha256', 'overlay_sha1', 'overlay_md5',
                'analysis_date'
            ]
            
            if not data:
                return None

            column_type_names = [
                'FixedString(64)', 'FixedString(32)', 'FixedString(40)',
                'UInt64', 'Float64', 'UInt64',
                'LowCardinality(String)', 'LowCardinality(String)', 'LowCardinality(String)',
                'FixedString(64)', 'FixedString(40)', 'FixedString(32)',
                'DateTime64(3, \'UTC\')'
            ]

            return (data, column_names, column_type_names)

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