Rahul Singhal

30 papers A 2B 2Misc 2Journal 10Unranked 14
YearRankTypeTitle / Venue / Authors
2026 J jnl
CoRR
Rahul Singhal, Pradyumna Tambwekar, Karime Maamari
2024 J jnl
IEEE Trans. Comput. Soc. Syst.
Rahul Singhal, Rasha F. Kashef
2024 J jnl
Wirel. Pers. Commun.
Ashish Kumar Verma, Rahul Singhal
2023 conf
ICCCNT
Rahul Singhal, Lakshya Choudhary, Ansh Sarawagi, Mohit Makkar
2023 J jnl
IEEE Des. Test
Amit Pandey, Brendan Tully, Abhijeet Samudra, Ajay Nagarandal, Karthikeyan Natarajan, Rahul Singhal
2022 Misc conf
VTS
Bala Tarun Nelapatla, Rahul Singhal, Michael Daub, Zoran Stanojevics
2022 Misc conf
VTS
Amit Pandey, Brendan Tully, Abhijeet Samudra, Ajay Nagarandal, Karthikeyan Natarajan, Rahul Singhal
2022 J jnl
Wirel. Pers. Commun.
Debasish Pal, Rahul Singhal, Ayan Kumar Bandyopadhyay
2022 J jnl
Int. J. Autom. Control.
Rahul Singhal, Rajesh Kumar, Neeli Satyanarayana
2021 J jnl
Prog. Artif. Intell.
Rahul Singhal, Rajesh Kumar, Neeli Satyanarayana
2021 J jnl
Comput. Electron. Agric.
Rahul Singhal, Rajesh Kumar, Neeli Satyanarayana
2020 A conf
ITC
Haiying Ma, Ligang Lu, Haitao Qian, Jing Han, Xin Wen, Fanjin Meng, Rahul Singhal, Martin Keim, Yu Huang, Wu Yang
2020 J jnl
Wirel. Pers. Commun.
Abhishek Joshi, Rahul Singhal
2020 J jnl
Wirel. Networks
Abhishek Joshi, Rahul Singhal
2020 conf
SICE
Tanishk Dudi, Rahul Singhal, Rajesh Kumar
2020 conf
SICE
Samidha Mridul Verma, Rahul Ravichandran, Rahul Singhal, Rajesh Kumar
2019 conf
ITC-Asia
Haiying Ma, Rui Guo, Quan Jing, Jing Han, Yu Huang, Rahul Singhal, Wu Yang, Xin Wen, Fanjin Meng
2019 conf
ISMVL
Rahul Singhal, Marek A. Perkowski
2019 conf
SoCC
Yu Huang, Rahul Singhal
2018 conf
NATW
Imtiaz Ahmed, Subhash Baraiya, Rahul Singhal
2016 conf
WOCN
V. S. Rakesh Krishna, Rahul Singhal
2016 conf
WOCN
V. S. Rakesh Krishna, Rahul Singhal
2016 B conf
ICTAI
Rahul Singhal, Shubham Goyal, Martin Henz
2015 A conf
AIED
Rahul Singhal, Martin Henz, Shubham Goyal
2014 conf
CSEDU (2)
Rahul Singhal, Martin Henz, Kevin McGee
2014 conf
CSEDU (1)
Rahul Singhal, Martin Henz, Kevin McGee
2014 B conf
ICTAI
Rahul Singhal, Martin Henz
2014 conf
CSEDU (Selected Papers)
Rahul Singhal, Martin Henz
2014 conf
ICACCI
Mayank Garg, Rahul Singhal
2009 conf
ICETET
Sahil Mahajan, Rahul Singhal
redb/extractors/decompiler/apk/apktool_wrapper.py
← Index redb/extractors/decompiler/apk/apktool_wrapper.py python
"""Apktool disassembler subprocess wrapper.

Manages apktool subprocess execution for smali disassembly,
following the CAPA extractor subprocess pattern.
"""

import os
import signal
import subprocess
from typing import List, Optional


class ApktoolDisassembler:
    """Subprocess wrapper for apktool smali disassembly."""

    def __init__(
        self, apktool_path: str = None, timeout: int = None, log=None
    ):
        self.apktool_path = apktool_path or os.getenv("APKTOOL_PATH", "apktool")
        self.timeout = timeout or int(os.getenv("APKTOOL_TIMEOUT", "120"))
        self.log = log

    def disassemble(self, apk_path: str, output_dir: str) -> bool:
        """Run apktool disassembly on an APK file.

        Returns True on success, False on failure.
        """
        cmd = [
            self.apktool_path,
            "d",
            "--no-res",
            "--force",
            "--output", output_dir,
            apk_path,
        ]

        try:
            process = subprocess.Popen(
                cmd,
                stdout=subprocess.PIPE,
                stderr=subprocess.PIPE,
                text=True,
                preexec_fn=os.setsid,
            )

            try:
                stdout, stderr = process.communicate(timeout=self.timeout)
                if process.returncode != 0:
                    if self.log:
                        self.log.warning(
                            f"apktool returned non-zero exit code {process.returncode}: "
                            f"{stderr[:500] if stderr else 'no stderr'}"
                        )
                    return False
                return True

            except subprocess.TimeoutExpired:
                if self.log:
                    self.log.error(
                        f"apktool timed out after {self.timeout}s"
                    )
                try:
                    os.killpg(os.getpgid(process.pid), signal.SIGTERM)
                    process.wait(timeout=3)
                except (ProcessLookupError, subprocess.TimeoutExpired):
                    try:
                        os.killpg(os.getpgid(process.pid), signal.SIGKILL)
                    except ProcessLookupError:
                        pass
                return False

        except FileNotFoundError:
            if self.log:
                self.log.error(
                    f"apktool not found at '{self.apktool_path}'. "
                    "Install apktool or set APKTOOL_PATH env var."
                )
            return False
        except Exception as e:
            if self.log:
                self.log.error(f"apktool execution error: {e}")
            return False

    def get_smali_directories(self, output_dir: str) -> List[str]:
        """Return paths to all smali output directories.

        Handles multi-DEX: smali/, smali_classes2/, smali_classes3/, etc.
        """
        smali_dirs = []
        if not os.path.isdir(output_dir):
            return smali_dirs

        for entry in sorted(os.listdir(output_dir)):
            if entry == "smali" or entry.startswith("smali_classes"):
                full_path = os.path.join(output_dir, entry)
                if os.path.isdir(full_path):
                    smali_dirs.append(full_path)

        return smali_dirs