r2inspect 2.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- r2inspect-2.0.0/Dockerfile +163 -0
- r2inspect-2.0.0/LICENSE +30 -0
- r2inspect-2.0.0/MANIFEST.in +33 -0
- r2inspect-2.0.0/Makefile +172 -0
- r2inspect-2.0.0/PKG-INFO +272 -0
- r2inspect-2.0.0/README.md +200 -0
- r2inspect-2.0.0/docker-compose.yml +150 -0
- r2inspect-2.0.0/docker-run.bat +188 -0
- r2inspect-2.0.0/docker-run.sh +215 -0
- r2inspect-2.0.0/pyproject.toml +287 -0
- r2inspect-2.0.0/r2inspect/__init__.py +23 -0
- r2inspect-2.0.0/r2inspect/__main__.py +10 -0
- r2inspect-2.0.0/r2inspect/__version__.py +7 -0
- r2inspect-2.0.0/r2inspect/abstractions/__init__.py +80 -0
- r2inspect-2.0.0/r2inspect/abstractions/analysis_result.py +371 -0
- r2inspect-2.0.0/r2inspect/abstractions/base_analyzer.py +636 -0
- r2inspect-2.0.0/r2inspect/abstractions/hashing_strategy.py +411 -0
- r2inspect-2.0.0/r2inspect/adapters/__init__.py +53 -0
- r2inspect-2.0.0/r2inspect/adapters/r2pipe_adapter.py +595 -0
- r2inspect-2.0.0/r2inspect/adapters/validation.py +394 -0
- r2inspect-2.0.0/r2inspect/cli/__init__.py +111 -0
- r2inspect-2.0.0/r2inspect/cli/analysis_runner.py +270 -0
- r2inspect-2.0.0/r2inspect/cli/batch_output.py +536 -0
- r2inspect-2.0.0/r2inspect/cli/batch_processing.py +765 -0
- r2inspect-2.0.0/r2inspect/cli/commands/__init__.py +42 -0
- r2inspect-2.0.0/r2inspect/cli/commands/analyze_command.py +351 -0
- r2inspect-2.0.0/r2inspect/cli/commands/base.py +222 -0
- r2inspect-2.0.0/r2inspect/cli/commands/batch_command.py +338 -0
- r2inspect-2.0.0/r2inspect/cli/commands/config_command.py +180 -0
- r2inspect-2.0.0/r2inspect/cli/commands/interactive_command.py +309 -0
- r2inspect-2.0.0/r2inspect/cli/commands/version_command.py +64 -0
- r2inspect-2.0.0/r2inspect/cli/display.py +1128 -0
- r2inspect-2.0.0/r2inspect/cli/interactive.py +138 -0
- r2inspect-2.0.0/r2inspect/cli/validators.py +349 -0
- r2inspect-2.0.0/r2inspect/cli_main.py +246 -0
- r2inspect-2.0.0/r2inspect/config.py +278 -0
- r2inspect-2.0.0/r2inspect/config_schemas/__init__.py +58 -0
- r2inspect-2.0.0/r2inspect/config_schemas/builder.py +285 -0
- r2inspect-2.0.0/r2inspect/config_schemas/schemas.py +220 -0
- r2inspect-2.0.0/r2inspect/core/__init__.py +46 -0
- r2inspect-2.0.0/r2inspect/core/constants.py +101 -0
- r2inspect-2.0.0/r2inspect/core/file_validator.py +163 -0
- r2inspect-2.0.0/r2inspect/core/inspector.py +824 -0
- r2inspect-2.0.0/r2inspect/core/pipeline_builder.py +173 -0
- r2inspect-2.0.0/r2inspect/core/r2_session.py +172 -0
- r2inspect-2.0.0/r2inspect/core/result_aggregator.py +356 -0
- r2inspect-2.0.0/r2inspect/error_handling/__init__.py +36 -0
- r2inspect-2.0.0/r2inspect/error_handling/policies.py +121 -0
- r2inspect-2.0.0/r2inspect/error_handling/presets.py +242 -0
- r2inspect-2.0.0/r2inspect/error_handling/unified_handler.py +339 -0
- r2inspect-2.0.0/r2inspect/interfaces/__init__.py +72 -0
- r2inspect-2.0.0/r2inspect/interfaces/binary_analyzer.py +385 -0
- r2inspect-2.0.0/r2inspect/lazy_loader.py +553 -0
- r2inspect-2.0.0/r2inspect/modules/__init__.py +50 -0
- r2inspect-2.0.0/r2inspect/modules/anti_analysis.py +563 -0
- r2inspect-2.0.0/r2inspect/modules/authenticode_analyzer.py +321 -0
- r2inspect-2.0.0/r2inspect/modules/binbloom_analyzer.py +786 -0
- r2inspect-2.0.0/r2inspect/modules/bindiff_analyzer.py +699 -0
- r2inspect-2.0.0/r2inspect/modules/binlex_analyzer.py +553 -0
- r2inspect-2.0.0/r2inspect/modules/ccbhash_analyzer.py +480 -0
- r2inspect-2.0.0/r2inspect/modules/compiler_detector.py +807 -0
- r2inspect-2.0.0/r2inspect/modules/crypto_analyzer.py +545 -0
- r2inspect-2.0.0/r2inspect/modules/elf_analyzer.py +382 -0
- r2inspect-2.0.0/r2inspect/modules/exploit_mitigation_analyzer.py +640 -0
- r2inspect-2.0.0/r2inspect/modules/export_analyzer.py +191 -0
- r2inspect-2.0.0/r2inspect/modules/function_analyzer.py +481 -0
- r2inspect-2.0.0/r2inspect/modules/impfuzzy_analyzer.py +386 -0
- r2inspect-2.0.0/r2inspect/modules/import_analyzer.py +905 -0
- r2inspect-2.0.0/r2inspect/modules/macho_analyzer.py +384 -0
- r2inspect-2.0.0/r2inspect/modules/overlay_analyzer.py +491 -0
- r2inspect-2.0.0/r2inspect/modules/packer_detector.py +370 -0
- r2inspect-2.0.0/r2inspect/modules/pe_analyzer.py +584 -0
- r2inspect-2.0.0/r2inspect/modules/resource_analyzer.py +661 -0
- r2inspect-2.0.0/r2inspect/modules/rich_header_analyzer.py +1412 -0
- r2inspect-2.0.0/r2inspect/modules/section_analyzer.py +486 -0
- r2inspect-2.0.0/r2inspect/modules/simhash_analyzer.py +778 -0
- r2inspect-2.0.0/r2inspect/modules/ssdeep_analyzer.py +375 -0
- r2inspect-2.0.0/r2inspect/modules/string_analyzer.py +307 -0
- r2inspect-2.0.0/r2inspect/modules/telfhash_analyzer.py +450 -0
- r2inspect-2.0.0/r2inspect/modules/tlsh_analyzer.py +380 -0
- r2inspect-2.0.0/r2inspect/modules/yara_analyzer.py +471 -0
- r2inspect-2.0.0/r2inspect/pipeline/__init__.py +21 -0
- r2inspect-2.0.0/r2inspect/pipeline/analysis_pipeline.py +675 -0
- r2inspect-2.0.0/r2inspect/pipeline/stages.py +919 -0
- r2inspect-2.0.0/r2inspect/registry/__init__.py +116 -0
- r2inspect-2.0.0/r2inspect/registry/analyzer_registry.py +1150 -0
- r2inspect-2.0.0/r2inspect/registry/default_registry.py +514 -0
- r2inspect-2.0.0/r2inspect/rules/yara/crypto_detection.yar +11 -0
- r2inspect-2.0.0/r2inspect/rules/yara/packer_detection.yar +20 -0
- r2inspect-2.0.0/r2inspect/rules/yara/peid_packers.yar +69457 -0
- r2inspect-2.0.0/r2inspect/rules/yara/suspicious_apis.yar +21 -0
- r2inspect-2.0.0/r2inspect/schemas/__init__.py +212 -0
- r2inspect-2.0.0/r2inspect/schemas/base.py +135 -0
- r2inspect-2.0.0/r2inspect/schemas/converters.py +328 -0
- r2inspect-2.0.0/r2inspect/schemas/format.py +266 -0
- r2inspect-2.0.0/r2inspect/schemas/hashing.py +99 -0
- r2inspect-2.0.0/r2inspect/schemas/metadata.py +330 -0
- r2inspect-2.0.0/r2inspect/schemas/results.py +847 -0
- r2inspect-2.0.0/r2inspect/schemas/security.py +274 -0
- r2inspect-2.0.0/r2inspect/security/__init__.py +22 -0
- r2inspect-2.0.0/r2inspect/security/validators.py +312 -0
- r2inspect-2.0.0/r2inspect/utils/__init__.py +20 -0
- r2inspect-2.0.0/r2inspect/utils/circuit_breaker.py +312 -0
- r2inspect-2.0.0/r2inspect/utils/error_handler.py +465 -0
- r2inspect-2.0.0/r2inspect/utils/hashing.py +83 -0
- r2inspect-2.0.0/r2inspect/utils/logger.py +113 -0
- r2inspect-2.0.0/r2inspect/utils/magic_detector.py +691 -0
- r2inspect-2.0.0/r2inspect/utils/memory_manager.py +406 -0
- r2inspect-2.0.0/r2inspect/utils/output.py +470 -0
- r2inspect-2.0.0/r2inspect/utils/r2_helpers.py +459 -0
- r2inspect-2.0.0/r2inspect/utils/r2_suppress.py +112 -0
- r2inspect-2.0.0/r2inspect/utils/rate_limiter.py +347 -0
- r2inspect-2.0.0/r2inspect/utils/retry_manager.py +398 -0
- r2inspect-2.0.0/r2inspect.egg-info/PKG-INFO +272 -0
- r2inspect-2.0.0/r2inspect.egg-info/SOURCES.txt +122 -0
- r2inspect-2.0.0/r2inspect.egg-info/dependency_links.txt +1 -0
- r2inspect-2.0.0/r2inspect.egg-info/entry_points.txt +2 -0
- r2inspect-2.0.0/r2inspect.egg-info/not-zip-safe +1 -0
- r2inspect-2.0.0/r2inspect.egg-info/requires.txt +42 -0
- r2inspect-2.0.0/r2inspect.egg-info/top_level.txt +1 -0
- r2inspect-2.0.0/requirements-docker.txt +17 -0
- r2inspect-2.0.0/requirements.txt +20 -0
- r2inspect-2.0.0/setup.cfg +4 -0
- r2inspect-2.0.0/setup.py +65 -0
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
# Unified Dockerfile for r2inspect malware analysis tool
|
|
2
|
+
# Supports both development and production builds via build args
|
|
3
|
+
|
|
4
|
+
# Build arguments
|
|
5
|
+
ARG BUILD_TYPE=production
|
|
6
|
+
ARG BASE_IMAGE=python:3.11-slim
|
|
7
|
+
ARG RADARE2_VERSION=master
|
|
8
|
+
|
|
9
|
+
# Multi-stage build
|
|
10
|
+
FROM ${BASE_IMAGE} AS base
|
|
11
|
+
|
|
12
|
+
# Build argument available in all stages
|
|
13
|
+
ARG BUILD_TYPE
|
|
14
|
+
ARG RADARE2_VERSION
|
|
15
|
+
|
|
16
|
+
# Install system dependencies based on build type
|
|
17
|
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
18
|
+
# Core dependencies (always needed)
|
|
19
|
+
gcc \
|
|
20
|
+
g++ \
|
|
21
|
+
make \
|
|
22
|
+
git \
|
|
23
|
+
wget \
|
|
24
|
+
curl \
|
|
25
|
+
pkg-config \
|
|
26
|
+
libssl-dev \
|
|
27
|
+
libmagic-dev \
|
|
28
|
+
file \
|
|
29
|
+
patch \
|
|
30
|
+
libfuzzy-dev \
|
|
31
|
+
python3-dev \
|
|
32
|
+
ssdeep \
|
|
33
|
+
# Development tools (only for dev builds)
|
|
34
|
+
$(if [ "$BUILD_TYPE" = "development" ]; then echo "\
|
|
35
|
+
vim \
|
|
36
|
+
nano \
|
|
37
|
+
less \
|
|
38
|
+
gdb \
|
|
39
|
+
strace \
|
|
40
|
+
ltrace \
|
|
41
|
+
procps \
|
|
42
|
+
net-tools \
|
|
43
|
+
iputils-ping \
|
|
44
|
+
tree \
|
|
45
|
+
htop"; fi) \
|
|
46
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
47
|
+
|
|
48
|
+
# Install radare2 using proper make install method
|
|
49
|
+
RUN echo "Installing radare2 (${RADARE2_VERSION})..." && \
|
|
50
|
+
git clone --depth 1 --branch ${RADARE2_VERSION} https://github.com/radareorg/radare2.git /tmp/radare2 && \
|
|
51
|
+
cd /tmp/radare2 && \
|
|
52
|
+
# Configure and build radare2 properly
|
|
53
|
+
./configure --prefix=/usr/local --with-rpath && \
|
|
54
|
+
make -j$(nproc) && \
|
|
55
|
+
make install && \
|
|
56
|
+
# Update library path
|
|
57
|
+
echo "/usr/local/lib" > /etc/ld.so.conf.d/radare2.conf && \
|
|
58
|
+
ldconfig && \
|
|
59
|
+
# Create additional symlinks for broader accessibility
|
|
60
|
+
ln -sf /usr/local/bin/r2 /usr/bin/r2 && \
|
|
61
|
+
ln -sf /usr/local/bin/radare2 /usr/bin/radare2 && \
|
|
62
|
+
ln -sf /usr/local/bin/r2 /bin/r2 && \
|
|
63
|
+
ln -sf /usr/local/bin/radare2 /bin/radare2 && \
|
|
64
|
+
# Clean up source
|
|
65
|
+
rm -rf /tmp/radare2 && \
|
|
66
|
+
# Verify installation works
|
|
67
|
+
echo "=== Radare2 Installation Verification ===" && \
|
|
68
|
+
r2 -version && \
|
|
69
|
+
which r2 && \
|
|
70
|
+
ls -la /usr/local/bin/r2*
|
|
71
|
+
|
|
72
|
+
# Note: TLSH will be installed via Python package (python-tlsh)
|
|
73
|
+
|
|
74
|
+
# Create virtual environment
|
|
75
|
+
RUN python -m venv /opt/venv
|
|
76
|
+
ENV PATH="/opt/venv/bin:$PATH"
|
|
77
|
+
|
|
78
|
+
# Install Python packages based on build type
|
|
79
|
+
COPY requirements-docker.txt /tmp/
|
|
80
|
+
RUN pip install --no-cache-dir --upgrade pip setuptools wheel && \
|
|
81
|
+
pip install --no-cache-dir -r /tmp/requirements-docker.txt && \
|
|
82
|
+
# Try to install optional packages (may fail, that's OK)
|
|
83
|
+
pip install --no-cache-dir python-tlsh>=4.5.0 || echo "python-tlsh installation failed, will use fallback" && \
|
|
84
|
+
pip install --no-cache-dir ssdeep>=3.4 || echo "ssdeep installation failed, will use system binary" && \
|
|
85
|
+
# Development packages (only for dev builds)
|
|
86
|
+
if [ "$BUILD_TYPE" = "development" ]; then \
|
|
87
|
+
pip install --no-cache-dir \
|
|
88
|
+
ipython \
|
|
89
|
+
ipdb \
|
|
90
|
+
pytest \
|
|
91
|
+
pytest-cov \
|
|
92
|
+
black \
|
|
93
|
+
ruff \
|
|
94
|
+
bandit \
|
|
95
|
+
mypy \
|
|
96
|
+
pre-commit \
|
|
97
|
+
jupyterlab; \
|
|
98
|
+
fi
|
|
99
|
+
|
|
100
|
+
# Create non-root user for security
|
|
101
|
+
RUN useradd -m -u 1000 -s /bin/bash analyst && \
|
|
102
|
+
mkdir -p /app /samples /output /config /workspace && \
|
|
103
|
+
chown -R analyst:analyst /app /samples /output /config /workspace
|
|
104
|
+
|
|
105
|
+
# Set working directory
|
|
106
|
+
WORKDIR /app
|
|
107
|
+
|
|
108
|
+
# Copy application code
|
|
109
|
+
COPY --chown=analyst:analyst . /app/
|
|
110
|
+
|
|
111
|
+
# Install r2inspect package
|
|
112
|
+
# Use editable install for development, regular install for production
|
|
113
|
+
RUN if [ "$BUILD_TYPE" = "development" ]; then \
|
|
114
|
+
pip install -e .; \
|
|
115
|
+
else \
|
|
116
|
+
pip install .; \
|
|
117
|
+
fi
|
|
118
|
+
|
|
119
|
+
# Switch to non-root user
|
|
120
|
+
USER analyst
|
|
121
|
+
|
|
122
|
+
# Create user directories
|
|
123
|
+
RUN mkdir -p /home/analyst/{samples,output,config,workspace,.r2}
|
|
124
|
+
|
|
125
|
+
# Set environment variables for radare2 and r2pipe
|
|
126
|
+
ENV PYTHONUNBUFFERED=1
|
|
127
|
+
ENV R2_NOPLUGINS=1
|
|
128
|
+
ENV R2PIPE_SPAWN=1
|
|
129
|
+
ENV PATH="/usr/local/bin:/usr/bin:/bin:$PATH"
|
|
130
|
+
ENV LD_LIBRARY_PATH="/usr/local/lib:/usr/lib"
|
|
131
|
+
ENV R2_HOME="/usr/local"
|
|
132
|
+
ENV RADARE2_RCFILE=""
|
|
133
|
+
|
|
134
|
+
# Development-specific environment
|
|
135
|
+
RUN if [ "$BUILD_TYPE" = "development" ]; then \
|
|
136
|
+
echo 'export PYTHONDONTWRITEBYTECODE=1' >> /home/analyst/.bashrc && \
|
|
137
|
+
echo 'export PS1="[r2inspect-dev] \u@\h:\w$ "' >> /home/analyst/.bashrc && \
|
|
138
|
+
echo 'alias ll="ls -la"' >> /home/analyst/.bashrc && \
|
|
139
|
+
echo 'alias r2="r2 -A"' >> /home/analyst/.bashrc; \
|
|
140
|
+
fi && \
|
|
141
|
+
# Add radare2 environment to bashrc for all builds
|
|
142
|
+
echo 'export PATH="/usr/local/bin:/usr/bin:/bin:$PATH"' >> /home/analyst/.bashrc && \
|
|
143
|
+
echo 'export LD_LIBRARY_PATH="/usr/local/lib:/usr/lib:$LD_LIBRARY_PATH"' >> /home/analyst/.bashrc && \
|
|
144
|
+
echo 'export R2_HOME="/usr/local"' >> /home/analyst/.bashrc && \
|
|
145
|
+
echo 'export RADARE2_RCFILE=""' >> /home/analyst/.bashrc
|
|
146
|
+
|
|
147
|
+
# Expose port for development web interface (if needed in future)
|
|
148
|
+
EXPOSE 5000
|
|
149
|
+
|
|
150
|
+
# Health check
|
|
151
|
+
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
|
152
|
+
CMD r2 -v && python -c "import r2pipe; print('OK')" || exit 1
|
|
153
|
+
|
|
154
|
+
# Set entrypoint and command based on build type
|
|
155
|
+
RUN if [ "$BUILD_TYPE" = "development" ]; then \
|
|
156
|
+
echo '#!/bin/bash\nexport PATH="/usr/local/bin:/usr/bin:/bin:$PATH"\nexport LD_LIBRARY_PATH="/usr/local/lib:/usr/lib:$LD_LIBRARY_PATH"\nexport R2_HOME="/usr/local"\nexport RADARE2_RCFILE=""\nif [ "$#" -eq 0 ]; then exec /bin/bash; else exec r2inspect "$@"; fi' > /home/analyst/entrypoint.sh; \
|
|
157
|
+
else \
|
|
158
|
+
echo '#!/bin/bash\nexport PATH="/usr/local/bin:/usr/bin:/bin:$PATH"\nexport LD_LIBRARY_PATH="/usr/local/lib:/usr/lib:$LD_LIBRARY_PATH"\nexport R2_HOME="/usr/local"\nexport RADARE2_RCFILE=""\nexec r2inspect "$@"' > /home/analyst/entrypoint.sh; \
|
|
159
|
+
fi && \
|
|
160
|
+
chmod +x /home/analyst/entrypoint.sh
|
|
161
|
+
|
|
162
|
+
ENTRYPOINT ["/home/analyst/entrypoint.sh"]
|
|
163
|
+
CMD ["--help"]
|
r2inspect-2.0.0/LICENSE
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
GNU GENERAL PUBLIC LICENSE
|
|
2
|
+
Version 3, 29 June 2007
|
|
3
|
+
|
|
4
|
+
Copyright (C) 2024 Marc Rivero <mriverolopez@gmail.com>
|
|
5
|
+
|
|
6
|
+
This program is free software: you can redistribute it and/or modify
|
|
7
|
+
it under the terms of the GNU General Public License as published by
|
|
8
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
(at your option) any later version.
|
|
10
|
+
|
|
11
|
+
This program is distributed in the hope that it will be useful,
|
|
12
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
GNU General Public License for more details.
|
|
15
|
+
|
|
16
|
+
You should have received a copy of the GNU General Public License
|
|
17
|
+
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
18
|
+
|
|
19
|
+
--------------------------------------------------------------------------------
|
|
20
|
+
|
|
21
|
+
r2inspect - Advanced Malware Analysis Tool using radare2 and r2pipe
|
|
22
|
+
|
|
23
|
+
Copyright (C) 2024 Marc Rivero (@seifreed)
|
|
24
|
+
|
|
25
|
+
This program comes with ABSOLUTELY NO WARRANTY.
|
|
26
|
+
This is free software, and you are welcome to redistribute it
|
|
27
|
+
under certain conditions; see LICENSE file for details.
|
|
28
|
+
|
|
29
|
+
For the complete GPL-3.0 license text, visit:
|
|
30
|
+
https://www.gnu.org/licenses/gpl-3.0.html
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
include README.md
|
|
2
|
+
include LICENSE
|
|
3
|
+
include requirements.txt
|
|
4
|
+
include requirements-docker.txt
|
|
5
|
+
include pyproject.toml
|
|
6
|
+
|
|
7
|
+
# Include all YARA rules
|
|
8
|
+
recursive-include r2inspect/rules *.yar *.yara
|
|
9
|
+
|
|
10
|
+
# Include Docker files for reference
|
|
11
|
+
include Dockerfile
|
|
12
|
+
include docker-compose.yml
|
|
13
|
+
include DOCKER.md
|
|
14
|
+
include docker-run.sh
|
|
15
|
+
include docker-run.bat
|
|
16
|
+
include test-docker.sh
|
|
17
|
+
|
|
18
|
+
# Include Makefile
|
|
19
|
+
include Makefile
|
|
20
|
+
|
|
21
|
+
# Exclude unnecessary files
|
|
22
|
+
global-exclude *.pyc
|
|
23
|
+
global-exclude *.pyo
|
|
24
|
+
global-exclude *.swp
|
|
25
|
+
global-exclude .DS_Store
|
|
26
|
+
global-exclude __pycache__
|
|
27
|
+
recursive-exclude tests *
|
|
28
|
+
recursive-exclude venv *
|
|
29
|
+
recursive-exclude .git *
|
|
30
|
+
recursive-exclude .qlty *
|
|
31
|
+
recursive-exclude samples *
|
|
32
|
+
recursive-exclude output *
|
|
33
|
+
recursive-exclude config *
|
r2inspect-2.0.0/Makefile
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
# Makefile for r2inspect Docker operations
|
|
2
|
+
.PHONY: help build run shell batch clean push pull test dev prod
|
|
3
|
+
|
|
4
|
+
# Variables
|
|
5
|
+
IMAGE_NAME := r2inspect
|
|
6
|
+
IMAGE_TAG := latest
|
|
7
|
+
FULL_IMAGE := $(IMAGE_NAME):$(IMAGE_TAG)
|
|
8
|
+
CONTAINER_NAME := r2inspect-analysis
|
|
9
|
+
REGISTRY := docker.io
|
|
10
|
+
REGISTRY_USER := your-username
|
|
11
|
+
|
|
12
|
+
# Directories
|
|
13
|
+
SAMPLES_DIR := ./samples
|
|
14
|
+
OUTPUT_DIR := ./output
|
|
15
|
+
CONFIG_DIR := ./config
|
|
16
|
+
|
|
17
|
+
# Colors for output
|
|
18
|
+
RED := \033[0;31m
|
|
19
|
+
GREEN := \033[0;32m
|
|
20
|
+
YELLOW := \033[1;33m
|
|
21
|
+
NC := \033[0m
|
|
22
|
+
|
|
23
|
+
help: ## Show this help message
|
|
24
|
+
@echo "$(GREEN)r2inspect Docker Management$(NC)"
|
|
25
|
+
@echo ""
|
|
26
|
+
@echo "Available targets:"
|
|
27
|
+
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " $(YELLOW)%-15s$(NC) %s\n", $$1, $$2}'
|
|
28
|
+
@echo ""
|
|
29
|
+
@echo "Examples:"
|
|
30
|
+
@echo " make build # Build Docker image"
|
|
31
|
+
@echo " make run FILE=malware.exe # Analyze a file"
|
|
32
|
+
@echo " make batch # Batch analyze samples directory"
|
|
33
|
+
@echo " make shell # Start interactive shell"
|
|
34
|
+
|
|
35
|
+
build: ## Build production Docker image
|
|
36
|
+
@echo "$(YELLOW)Building production Docker image $(FULL_IMAGE)...$(NC)"
|
|
37
|
+
@docker build --build-arg BUILD_TYPE=production -t $(FULL_IMAGE) .
|
|
38
|
+
@echo "$(GREEN)Production build complete!$(NC)"
|
|
39
|
+
|
|
40
|
+
build-dev: ## Build development Docker image
|
|
41
|
+
@echo "$(YELLOW)Building development Docker image $(IMAGE_NAME):dev...$(NC)"
|
|
42
|
+
@docker build --build-arg BUILD_TYPE=development -t $(IMAGE_NAME):dev .
|
|
43
|
+
@echo "$(GREEN)Development build complete!$(NC)"
|
|
44
|
+
|
|
45
|
+
build-nocache: ## Build Docker image without cache
|
|
46
|
+
@echo "$(YELLOW)Building Docker image $(FULL_IMAGE) without cache...$(NC)"
|
|
47
|
+
@docker build --no-cache --build-arg BUILD_TYPE=production -t $(FULL_IMAGE) .
|
|
48
|
+
@echo "$(GREEN)Build complete!$(NC)"
|
|
49
|
+
|
|
50
|
+
build-dev-nocache: ## Build development Docker image without cache
|
|
51
|
+
@echo "$(YELLOW)Building development Docker image $(IMAGE_NAME):dev without cache...$(NC)"
|
|
52
|
+
@docker build --no-cache --build-arg BUILD_TYPE=development -t $(IMAGE_NAME):dev .
|
|
53
|
+
@echo "$(GREEN)Development build complete!$(NC)"
|
|
54
|
+
|
|
55
|
+
run: ## Run r2inspect on a file (use FILE=path/to/file)
|
|
56
|
+
@if [ -z "$(FILE)" ]; then \
|
|
57
|
+
echo "$(RED)Error: Please specify FILE=path/to/file$(NC)"; \
|
|
58
|
+
exit 1; \
|
|
59
|
+
fi
|
|
60
|
+
@echo "$(YELLOW)Analyzing $(FILE)...$(NC)"
|
|
61
|
+
@docker run --rm \
|
|
62
|
+
-v "$(shell pwd)/$(FILE):/tmp/analysis/$(notdir $(FILE)):ro" \
|
|
63
|
+
-v "$(shell pwd)/$(OUTPUT_DIR)":/home/analyst/output:rw \
|
|
64
|
+
--cap-drop=ALL \
|
|
65
|
+
--cap-add=SYS_PTRACE \
|
|
66
|
+
--cap-add=DAC_READ_SEARCH \
|
|
67
|
+
--security-opt=no-new-privileges:true \
|
|
68
|
+
--memory=2g \
|
|
69
|
+
--cpus=2 \
|
|
70
|
+
$(FULL_IMAGE) /tmp/analysis/$(notdir $(FILE)) $(ARGS)
|
|
71
|
+
|
|
72
|
+
shell: ## Start interactive shell in container
|
|
73
|
+
@echo "$(YELLOW)Starting interactive shell...$(NC)"
|
|
74
|
+
@mkdir -p $(SAMPLES_DIR) $(OUTPUT_DIR) $(CONFIG_DIR)
|
|
75
|
+
@docker run --rm -it \
|
|
76
|
+
--name $(CONTAINER_NAME) \
|
|
77
|
+
-v "$(shell pwd)/$(SAMPLES_DIR)":/home/analyst/samples:ro \
|
|
78
|
+
-v "$(shell pwd)/$(OUTPUT_DIR)":/home/analyst/output:rw \
|
|
79
|
+
-v "$(shell pwd)/$(CONFIG_DIR)":/home/analyst/config:ro \
|
|
80
|
+
--cap-drop=ALL \
|
|
81
|
+
--cap-add=SYS_PTRACE \
|
|
82
|
+
--cap-add=DAC_READ_SEARCH \
|
|
83
|
+
--security-opt=no-new-privileges:true \
|
|
84
|
+
--memory=2g \
|
|
85
|
+
--cpus=2 \
|
|
86
|
+
--entrypoint /bin/bash \
|
|
87
|
+
$(FULL_IMAGE)
|
|
88
|
+
|
|
89
|
+
batch: ## Run batch analysis on samples directory
|
|
90
|
+
@echo "$(YELLOW)Running batch analysis on $(SAMPLES_DIR)...$(NC)"
|
|
91
|
+
@mkdir -p $(SAMPLES_DIR) $(OUTPUT_DIR) $(CONFIG_DIR)
|
|
92
|
+
@docker run --rm \
|
|
93
|
+
--name $(CONTAINER_NAME) \
|
|
94
|
+
-v "$(shell pwd)/$(SAMPLES_DIR)":/home/analyst/samples:ro \
|
|
95
|
+
-v "$(shell pwd)/$(OUTPUT_DIR)":/home/analyst/output:rw \
|
|
96
|
+
-v "$(shell pwd)/$(CONFIG_DIR)":/home/analyst/config:ro \
|
|
97
|
+
--cap-drop=ALL \
|
|
98
|
+
--cap-add=SYS_PTRACE \
|
|
99
|
+
--cap-add=DAC_READ_SEARCH \
|
|
100
|
+
--security-opt=no-new-privileges:true \
|
|
101
|
+
--memory=2g \
|
|
102
|
+
--cpus=2 \
|
|
103
|
+
$(FULL_IMAGE) --batch /home/analyst/samples -o /home/analyst/output/batch_results.csv $(ARGS)
|
|
104
|
+
|
|
105
|
+
compose-up: ## Start services with docker-compose
|
|
106
|
+
@echo "$(YELLOW)Starting r2inspect services...$(NC)"
|
|
107
|
+
@docker-compose up -d
|
|
108
|
+
@echo "$(GREEN)Services started!$(NC)"
|
|
109
|
+
|
|
110
|
+
compose-down: ## Stop services with docker-compose
|
|
111
|
+
@echo "$(YELLOW)Stopping r2inspect services...$(NC)"
|
|
112
|
+
@docker-compose down
|
|
113
|
+
@echo "$(GREEN)Services stopped!$(NC)"
|
|
114
|
+
|
|
115
|
+
compose-logs: ## Show docker-compose logs
|
|
116
|
+
@docker-compose logs -f
|
|
117
|
+
|
|
118
|
+
clean: ## Clean up Docker resources
|
|
119
|
+
@echo "$(YELLOW)Cleaning up Docker resources...$(NC)"
|
|
120
|
+
@docker stop $(CONTAINER_NAME) 2>/dev/null || true
|
|
121
|
+
@docker rm $(CONTAINER_NAME) 2>/dev/null || true
|
|
122
|
+
@docker rmi $(FULL_IMAGE) 2>/dev/null || true
|
|
123
|
+
@echo "$(GREEN)Cleanup complete!$(NC)"
|
|
124
|
+
|
|
125
|
+
push: ## Push image to registry
|
|
126
|
+
@echo "$(YELLOW)Pushing image to $(REGISTRY)/$(REGISTRY_USER)/$(FULL_IMAGE)...$(NC)"
|
|
127
|
+
@docker tag $(FULL_IMAGE) $(REGISTRY)/$(REGISTRY_USER)/$(FULL_IMAGE)
|
|
128
|
+
@docker push $(REGISTRY)/$(REGISTRY_USER)/$(FULL_IMAGE)
|
|
129
|
+
@echo "$(GREEN)Push complete!$(NC)"
|
|
130
|
+
|
|
131
|
+
pull: ## Pull image from registry
|
|
132
|
+
@echo "$(YELLOW)Pulling image from $(REGISTRY)/$(REGISTRY_USER)/$(FULL_IMAGE)...$(NC)"
|
|
133
|
+
@docker pull $(REGISTRY)/$(REGISTRY_USER)/$(FULL_IMAGE)
|
|
134
|
+
@docker tag $(REGISTRY)/$(REGISTRY_USER)/$(FULL_IMAGE) $(FULL_IMAGE)
|
|
135
|
+
@echo "$(GREEN)Pull complete!$(NC)"
|
|
136
|
+
|
|
137
|
+
test: ## Test Docker image
|
|
138
|
+
@echo "$(YELLOW)Testing Docker image...$(NC)"
|
|
139
|
+
@docker run --rm $(FULL_IMAGE) --version
|
|
140
|
+
@docker run --rm $(FULL_IMAGE) --help
|
|
141
|
+
@echo "$(GREEN)Tests passed!$(NC)"
|
|
142
|
+
|
|
143
|
+
shell-dev: ## Start interactive shell in development container
|
|
144
|
+
@echo "$(YELLOW)Starting development shell...$(NC)"
|
|
145
|
+
@mkdir -p $(SAMPLES_DIR) $(OUTPUT_DIR) $(CONFIG_DIR)
|
|
146
|
+
@docker run --rm -it \
|
|
147
|
+
--name $(CONTAINER_NAME)-dev \
|
|
148
|
+
-v "$(shell pwd)/$(SAMPLES_DIR)":/home/analyst/samples:ro \
|
|
149
|
+
-v "$(shell pwd)/$(OUTPUT_DIR)":/home/analyst/output:rw \
|
|
150
|
+
-v "$(shell pwd)/$(CONFIG_DIR)":/home/analyst/config:ro \
|
|
151
|
+
-v "$(shell pwd)/r2inspect":/app/r2inspect:rw \
|
|
152
|
+
--cap-drop=ALL \
|
|
153
|
+
--cap-add=SYS_PTRACE \
|
|
154
|
+
--cap-add=DAC_READ_SEARCH \
|
|
155
|
+
--security-opt=no-new-privileges:true \
|
|
156
|
+
--memory=4g \
|
|
157
|
+
--cpus=4 \
|
|
158
|
+
$(IMAGE_NAME):dev
|
|
159
|
+
|
|
160
|
+
stats: ## Show container stats
|
|
161
|
+
@docker stats --no-stream $(CONTAINER_NAME)
|
|
162
|
+
|
|
163
|
+
inspect: ## Inspect the Docker image
|
|
164
|
+
@docker inspect $(FULL_IMAGE)
|
|
165
|
+
|
|
166
|
+
size: ## Show image size
|
|
167
|
+
@echo "$(YELLOW)Image size:$(NC)"
|
|
168
|
+
@docker images $(FULL_IMAGE) --format "table {{.Repository}}\t{{.Tag}}\t{{.Size}}"
|
|
169
|
+
|
|
170
|
+
dirs: ## Create required directories
|
|
171
|
+
@mkdir -p $(SAMPLES_DIR) $(OUTPUT_DIR) $(CONFIG_DIR)
|
|
172
|
+
@echo "$(GREEN)Directories created: $(SAMPLES_DIR), $(OUTPUT_DIR), $(CONFIG_DIR)$(NC)"
|
r2inspect-2.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: r2inspect
|
|
3
|
+
Version: 2.0.0
|
|
4
|
+
Summary: Advanced malware analysis tool using radare2 and r2pipe
|
|
5
|
+
Home-page: https://github.com/seifreed/r2inspect
|
|
6
|
+
Author: Marc Rivero
|
|
7
|
+
Author-email: Marc Rivero <mriverolopez@gmail.com>
|
|
8
|
+
Maintainer-email: Marc Rivero <mriverolopez@gmail.com>
|
|
9
|
+
License: GPL-3.0
|
|
10
|
+
Project-URL: Homepage, https://github.com/seifreed/r2inspect
|
|
11
|
+
Project-URL: Documentation, https://github.com/seifreed/r2inspect/blob/main/README.md
|
|
12
|
+
Project-URL: Repository, https://github.com/seifreed/r2inspect
|
|
13
|
+
Project-URL: Issues, https://github.com/seifreed/r2inspect/issues
|
|
14
|
+
Project-URL: Changelog, https://github.com/seifreed/r2inspect/releases
|
|
15
|
+
Keywords: malware,analysis,radare2,r2pipe,reverse-engineering,security,forensics
|
|
16
|
+
Classifier: Development Status :: 4 - Beta
|
|
17
|
+
Classifier: Intended Audience :: Developers
|
|
18
|
+
Classifier: Intended Audience :: Information Technology
|
|
19
|
+
Classifier: Intended Audience :: Science/Research
|
|
20
|
+
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
|
|
21
|
+
Classifier: Operating System :: OS Independent
|
|
22
|
+
Classifier: Programming Language :: Python :: 3
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
26
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
27
|
+
Classifier: Topic :: Security
|
|
28
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
29
|
+
Classifier: Topic :: System :: Systems Administration
|
|
30
|
+
Classifier: Topic :: Utilities
|
|
31
|
+
Requires-Python: >=3.8
|
|
32
|
+
Description-Content-Type: text/markdown
|
|
33
|
+
License-File: LICENSE
|
|
34
|
+
Requires-Dist: r2pipe>=1.8.0
|
|
35
|
+
Requires-Dist: click>=8.0.0
|
|
36
|
+
Requires-Dist: rich>=13.0.0
|
|
37
|
+
Requires-Dist: colorlog>=6.8.0
|
|
38
|
+
Requires-Dist: pefile>=2023.2.7
|
|
39
|
+
Requires-Dist: yara-python>=4.5.0
|
|
40
|
+
Requires-Dist: python-magic>=0.4.27
|
|
41
|
+
Requires-Dist: pycryptodome>=3.19.0
|
|
42
|
+
Requires-Dist: cryptography>=41.0.0
|
|
43
|
+
Requires-Dist: psutil>=5.9.0
|
|
44
|
+
Requires-Dist: pydantic>=2.5.0
|
|
45
|
+
Requires-Dist: pybloom-live>=4.0.0
|
|
46
|
+
Requires-Dist: simhash>=2.1.0
|
|
47
|
+
Requires-Dist: colorama>=0.4.6
|
|
48
|
+
Requires-Dist: tabulate>=0.9.0
|
|
49
|
+
Requires-Dist: pyfiglet>=0.8.post1
|
|
50
|
+
Requires-Dist: pandas>=1.3.0; python_version < "3.9"
|
|
51
|
+
Requires-Dist: pandas>=1.5.0; python_version >= "3.9" and python_version < "3.11"
|
|
52
|
+
Requires-Dist: pandas>=2.0.0; python_version >= "3.11"
|
|
53
|
+
Requires-Dist: requests>=2.31.0
|
|
54
|
+
Provides-Extra: dev
|
|
55
|
+
Requires-Dist: black>=23.0.0; extra == "dev"
|
|
56
|
+
Requires-Dist: ruff>=0.1.0; extra == "dev"
|
|
57
|
+
Requires-Dist: mypy>=1.0.0; extra == "dev"
|
|
58
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
59
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
60
|
+
Requires-Dist: pre-commit>=3.0.0; extra == "dev"
|
|
61
|
+
Requires-Dist: bandit>=1.7.0; extra == "dev"
|
|
62
|
+
Requires-Dist: mutmut>=2.4.0; extra == "dev"
|
|
63
|
+
Provides-Extra: docker
|
|
64
|
+
Requires-Dist: pycparser>=2.21; extra == "docker"
|
|
65
|
+
Requires-Dist: pyimpfuzzy>=0.1.1; extra == "docker"
|
|
66
|
+
Requires-Dist: python-tlsh>=4.5.0; extra == "docker"
|
|
67
|
+
Requires-Dist: ssdeep>=3.4; extra == "docker"
|
|
68
|
+
Dynamic: author
|
|
69
|
+
Dynamic: home-page
|
|
70
|
+
Dynamic: license-file
|
|
71
|
+
Dynamic: requires-python
|
|
72
|
+
|
|
73
|
+
<p align="center">
|
|
74
|
+
<img src="https://img.shields.io/badge/r2inspect-Malware%20Analysis-blue?style=for-the-badge" alt="r2inspect">
|
|
75
|
+
</p>
|
|
76
|
+
|
|
77
|
+
<h1 align="center">r2inspect</h1>
|
|
78
|
+
|
|
79
|
+
<p align="center">
|
|
80
|
+
<strong>Advanced malware analysis tool powered by radare2 and r2pipe</strong>
|
|
81
|
+
</p>
|
|
82
|
+
|
|
83
|
+
<p align="center">
|
|
84
|
+
<a href="https://pypi.org/project/r2inspect/"><img src="https://img.shields.io/pypi/v/r2inspect?style=flat-square&logo=pypi&logoColor=white" alt="PyPI Version"></a>
|
|
85
|
+
<a href="https://pypi.org/project/r2inspect/"><img src="https://img.shields.io/pypi/pyversions/r2inspect?style=flat-square&logo=python&logoColor=white" alt="Python Versions"></a>
|
|
86
|
+
<a href="https://github.com/seifreed/r2inspect/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-GPL--3.0-green?style=flat-square" alt="License"></a>
|
|
87
|
+
<a href="https://github.com/seifreed/r2inspect/actions"><img src="https://img.shields.io/github/actions/workflow/status/seifreed/r2inspect/test.yml?style=flat-square&logo=github&label=CI" alt="CI Status"></a>
|
|
88
|
+
<a href="https://codecov.io/gh/seifreed/r2inspect"><img src="https://img.shields.io/codecov/c/github/seifreed/r2inspect?style=flat-square" alt="Coverage"></a>
|
|
89
|
+
</p>
|
|
90
|
+
|
|
91
|
+
<p align="center">
|
|
92
|
+
<a href="https://github.com/seifreed/r2inspect/stargazers"><img src="https://img.shields.io/github/stars/seifreed/r2inspect?style=flat-square" alt="GitHub Stars"></a>
|
|
93
|
+
<a href="https://github.com/seifreed/r2inspect/issues"><img src="https://img.shields.io/github/issues/seifreed/r2inspect?style=flat-square" alt="GitHub Issues"></a>
|
|
94
|
+
<a href="https://buymeacoffee.com/seifreed"><img src="https://img.shields.io/badge/Buy%20Me%20a%20Coffee-support-yellow?style=flat-square&logo=buy-me-a-coffee&logoColor=white" alt="Buy Me a Coffee"></a>
|
|
95
|
+
</p>
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## Overview
|
|
100
|
+
|
|
101
|
+
**r2inspect** is a professional malware analysis framework that automates deep static inspection for PE, ELF, and Mach-O binaries using the radare2 ecosystem. It combines format parsing, detection heuristics, and rich reporting to support reverse engineers, incident responders, and threat analysts.
|
|
102
|
+
|
|
103
|
+
### Key Features
|
|
104
|
+
|
|
105
|
+
| Feature | Description |
|
|
106
|
+
|---------|-------------|
|
|
107
|
+
| **Multi-format Support** | PE, ELF, Mach-O format detection and analysis |
|
|
108
|
+
| **String Analysis** | ASCII/Unicode extraction with filtering and decoding |
|
|
109
|
+
| **Packer Detection** | Evidence-based scoring with entropy and signature checks |
|
|
110
|
+
| **Crypto Detection** | API and constant analysis with confidence scoring |
|
|
111
|
+
| **Anti-Analysis** | Anti-debug/VM/sandbox indicators with evidence |
|
|
112
|
+
| **Hashing Suite** | MD5/SHA, SSDeep, TLSH, MACHOC, RichPE, Telfhash, SimHash |
|
|
113
|
+
| **Metadata Analysis** | Sections, imports, exports, resources, overlays |
|
|
114
|
+
| **YARA Integration** | Built-in and custom rule scanning |
|
|
115
|
+
| **Rich Output** | Console tables, JSON, and CSV exports |
|
|
116
|
+
|
|
117
|
+
### Supported Formats
|
|
118
|
+
|
|
119
|
+
```
|
|
120
|
+
Windows PE32 / PE32+ / DLL
|
|
121
|
+
Linux ELF32 / ELF64
|
|
122
|
+
macOS Mach-O / Universal
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## Installation
|
|
128
|
+
|
|
129
|
+
### From PyPI (Recommended)
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
pip install r2inspect
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### From Source
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
git clone https://github.com/seifreed/r2inspect.git
|
|
139
|
+
cd r2inspect
|
|
140
|
+
python -m venv venv
|
|
141
|
+
source venv/bin/activate # Windows: venv\Scripts\activate
|
|
142
|
+
pip install -e .
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Requirements
|
|
146
|
+
|
|
147
|
+
- Python 3.8+
|
|
148
|
+
- radare2 installed and in PATH
|
|
149
|
+
- libmagic (for file type detection)
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## Quick Start
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
# Basic analysis with rich console output
|
|
157
|
+
r2inspect samples/fixtures/hello_pe.exe
|
|
158
|
+
|
|
159
|
+
# JSON output
|
|
160
|
+
r2inspect -j samples/fixtures/hello_pe.exe
|
|
161
|
+
|
|
162
|
+
# CSV output
|
|
163
|
+
r2inspect -c samples/fixtures/hello_pe.exe
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## Usage
|
|
169
|
+
|
|
170
|
+
### Command Line Interface
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
# Full analysis
|
|
174
|
+
r2inspect malware.exe
|
|
175
|
+
|
|
176
|
+
# Save output to file
|
|
177
|
+
r2inspect -j malware.exe -o analysis.json
|
|
178
|
+
|
|
179
|
+
# Analyze a directory (batch mode)
|
|
180
|
+
r2inspect --batch ./samples -j -o ./out
|
|
181
|
+
|
|
182
|
+
# Custom YARA rules
|
|
183
|
+
r2inspect --yara /path/to/rules malware.exe
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### Available Options
|
|
187
|
+
|
|
188
|
+
| Option | Description |
|
|
189
|
+
|--------|-------------|
|
|
190
|
+
| `-i, --interactive` | Interactive analysis shell |
|
|
191
|
+
| `-j, --json` | Output in JSON format |
|
|
192
|
+
| `-c, --csv` | Output in CSV format |
|
|
193
|
+
| `-o, --output` | Output file or directory |
|
|
194
|
+
| `--batch` | Batch mode for directories |
|
|
195
|
+
| `--extensions` | Filter batch by extensions |
|
|
196
|
+
| `--yara` | Custom YARA rules directory |
|
|
197
|
+
| `-x, --xor` | XOR search string |
|
|
198
|
+
| `-v, --verbose` | Verbose output |
|
|
199
|
+
| `--quiet` | Suppress non-critical output |
|
|
200
|
+
| `--threads` | Parallel threads for batch mode |
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
## Python Library
|
|
205
|
+
|
|
206
|
+
```python
|
|
207
|
+
from r2inspect import R2Inspector
|
|
208
|
+
from r2inspect.config import Config
|
|
209
|
+
|
|
210
|
+
config = Config()
|
|
211
|
+
with R2Inspector("malware.exe", config=config) as inspector:
|
|
212
|
+
results = inspector.analyze()
|
|
213
|
+
pe_info = inspector.get_pe_info()
|
|
214
|
+
imports = inspector.get_imports()
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
---
|
|
218
|
+
|
|
219
|
+
## Examples
|
|
220
|
+
|
|
221
|
+
### Analyze Multiple Samples
|
|
222
|
+
|
|
223
|
+
```bash
|
|
224
|
+
r2inspect --batch ./samples --extensions "exe,dll" -j -o ./out
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
### Interactive Mode
|
|
228
|
+
|
|
229
|
+
```
|
|
230
|
+
r2inspect> analyze
|
|
231
|
+
r2inspect> strings
|
|
232
|
+
r2inspect> imports
|
|
233
|
+
r2inspect> quit
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
---
|
|
237
|
+
|
|
238
|
+
## Contributing
|
|
239
|
+
|
|
240
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
241
|
+
|
|
242
|
+
1. Fork the repository
|
|
243
|
+
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
|
|
244
|
+
3. Commit your changes (`git commit -m 'Add amazing feature'`)
|
|
245
|
+
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
246
|
+
5. Open a Pull Request
|
|
247
|
+
|
|
248
|
+
---
|
|
249
|
+
|
|
250
|
+
## Support the Project
|
|
251
|
+
|
|
252
|
+
If you find r2inspect useful, consider supporting its development:
|
|
253
|
+
|
|
254
|
+
<a href="https://buymeacoffee.com/seifreed" target="_blank">
|
|
255
|
+
<img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" height="50">
|
|
256
|
+
</a>
|
|
257
|
+
|
|
258
|
+
---
|
|
259
|
+
|
|
260
|
+
## License
|
|
261
|
+
|
|
262
|
+
GNU General Public License v3.0
|
|
263
|
+
|
|
264
|
+
**Attribution Required:**
|
|
265
|
+
- Author: **Marc Rivero** | [@seifreed](https://github.com/seifreed)
|
|
266
|
+
- Repository: [github.com/seifreed/r2inspect](https://github.com/seifreed/r2inspect)
|
|
267
|
+
|
|
268
|
+
---
|
|
269
|
+
|
|
270
|
+
<p align="center">
|
|
271
|
+
<sub>Made with dedication for the reverse engineering and threat intelligence community</sub>
|
|
272
|
+
</p>
|