Campbell Booth

16 papers C 2Journal 9Unranked 5
YearRankTypeTitle / Venue / Authors
2023 J jnl
IEEE Trans. Cloud Comput.
Jiaxuan Han, Qiteng Hong, Mazheruddin H. Syed, Md Asif Uddin Khan, Guangya Yang, Graeme Burt, Campbell Booth
2023 C conf
IECON
Jiaxuan Han, Qiteng Hong, Zhiwang Feng, Graeme Burt, Campbell Booth
2022 J jnl
IEEE Trans. Ind. Electron.
Kanakesh Vatta Kkuni, Guangya Yang, Qiteng Hong, Campbell Booth
2022 J jnl
IEEE Access
Eleni Tsotsopoulou, Xenofon Karagiannis, Panagiotis N. Papadopoulos, Adam Dysko, Mohammad Yazdani-Asrami, Campbell Booth, Dimitrios Tzelepis
2020 J jnl
IEEE Trans. Ind. Electron.
Qiteng Hong, Ibrahim Faiek Abdulhadi, Dimitrios Tzelepis, Andrew J. Roscoe, Ben Marshall, Campbell Booth
2019 J jnl
IEEE Access
Dimitrios Tzelepis, Steven M. Blair, Adam Dysko, Campbell Booth
2019 J jnl
IEEE Access
Suyang Zhou, Di He, Wei Gu, Zhi Wu, Ghulam Abbas, Qiteng Hong, Campbell Booth
2019 C conf
IECON
Kanakesh Vatta Kkuni, Sujay Ghosh, Guangya Yang, Campbell Booth
2018 conf
ISGT Europe
Lewis Hunter, Campbell Booth, Stephen J. Finney, Adrià Junyent-Ferré
2018 J jnl
IEEE Trans. Smart Grid
Dimitrios Tzelepis, Grzegorz Fusiek, Adam Dysko, Pawel Niewczas, Campbell Booth, Xinzhou Dong
2017 conf
ISGT Europe
Qiteng Hong, Ibrahim Faiek Abdulhadi, Andrew J. Roscoe, Campbell Booth
2016 conf
AMPS
John Nelson, Grzegorz Fusiek, Lloyd Clayburn, Pawel Niewczas, Campbell Booth, Philip Orr, Neil Gordon
2016 conf
ISGT Europe
Peter Wall, Negar Shams, Vladimir V. Terzija, Vandad Hamidi, Charlotte Grant, Douglas Wilson, Seán Norris, Kyriaki Maleka, Campbell Booth, Qiteng Hong, Andrew J. Roscoe
2013 conf
AMPS
Philip Orr, Campbell Booth, Grzegorz Fusiek, Pawel Niewczas, Adam Dysko, Fumio Kawano, Phil Beaumont
2001 J jnl
J. Intell. Robotic Syst.
Campbell Booth, James R. McDonald, Stephen D. J. McArthur
1998 J jnl
Neurocomputing
Campbell Booth, Jim R. McDonald
redb/extractors/pe_extractors/pe_imports.py
← Index redb/extractors/pe_extractors/pe_imports.py python
import inspect
from typing import Any, List, Tuple
from datetime import datetime, timezone

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


class PEImportExtractor(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_imports"
        self.log.debug(inspect.currentframe().f_code.co_name)

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

    def _extract_imports(self):
        self.log.debug(inspect.currentframe().f_code.co_name)

        imports_symbols = []
        imports_lib = []
        imports_total = 0
        # pe_import = None
        try:
            directory_entry_import = getattr(self.pe, "DIRECTORY_ENTRY_IMPORT", [])
            imports_total = len(directory_entry_import)
            for entry in directory_entry_import:
                symbols = []
                tmp_import = {}
                libname = entry.dll.decode() if entry.dll else ""
                imports_lib.append(libname)
                # replace . with _ to avoid issues with elastic
                # entryname = entryname.replace(".", "_")
                for symbol in entry.imports:
                    if symbol.name:
                        symbols.append(symbol.name.decode())
                # imports_symbols[entryname] = symbols
                tmp_import[libname] = symbols
                imports_symbols.append(tmp_import)
            return PEImport(
                pe_imports_total=imports_total,
                pe_import_libraryName=imports_lib if imports_lib else None,
                pe_import_functions=imports_symbols if imports_symbols else None,
            )
        except Exception as e:
            self.log.error(f"Extract imports error {self.hash.sha256} Exception: {e}")
        return pe_import

    def extract(self):
        try:
            self.log.debug(inspect.currentframe().f_code.co_name)
            return self._extract_imports()
        except Exception as e:
            self.log.error(f"Extract imports error {self.hash.sha256} Exception: {e}")
            return None

    def prepare_export_data(self, exporter_type: str) -> Any:
        if exporter_type == "ElasticsearchExporter":
            return self.extract()
        elif exporter_type == "ClickHouseExporter":
            imports = self.extract()
            if (
                imports is None
                or imports.pe_imports_total == 0
                or (
                    imports.pe_import_libraryName is None
                    and imports.pe_import_functions is None
                )
            ):
                return None

            # Flatten the data - one row per function import
            data = []
            current_time = datetime.now(timezone.utc)

            for lib_funcs in imports.pe_import_functions:
                for lib, funcs in lib_funcs.items():
                    for func in funcs:
                        data.append(
                            [
                                self.sha256,  # sha256
                                self.md5,  # md5
                                self.sha1,  # sha1
                                lib,  # library_name
                                func,  # function_name
                                current_time,  # analysis_date
                            ]
                        )

            column_names = [
                "sha256",
                "md5",
                "sha1",
                "library_name",
                "function_name",
                "analysis_date",
            ]

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

            if not data:
                return None

            return (data, column_names, column_type_names)

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