forked from rednaga/APKiD
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update to use Yara v3.11 (rednaga#166)
Update to Yara 3.11 and reduce docker layers Yara-python now includes an important fix for using the dex module so we can use it directly.
- Loading branch information
1 parent
982e759
commit 9c072a0
Showing
4 changed files
with
13 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,22 @@ | ||
FROM python:3-slim | ||
LABEL maintainer="Caleb Fenton" | ||
|
||
RUN groupadd -g 999 appuser && \ | ||
useradd -r -u 999 -g appuser appuser | ||
|
||
RUN apt-get update -qq && \ | ||
apt-get install -y git build-essential gcc pandoc | ||
RUN pip install --upgrade pip setuptools wheel | ||
|
||
# Disabled until Yara patch is applied | ||
#RUN pip wheel --wheel-dir=/tmp/yara-python --build-option="build" --build-option="--enable-dex" git+https://github.com/VirusTotal/[email protected] | ||
#RUN pip install --no-index --find-links=/tmp/yara-python yara-python | ||
#RUN rm -rf /tmp/yara-python | ||
|
||
RUN apt-get install -y curl | ||
RUN git clone --recursive -b "v3.10.0" https://github.com/VirusTotal/yara-python.git /tmp/yara-python | ||
RUN git config --global user.email "[email protected]" | ||
RUN git config --global user.name "APKiD User" | ||
WORKDIR /tmp/yara-python | ||
RUN cd yara && \ | ||
curl https://patch-diff.githubusercontent.com/raw/VirusTotal/yara/pull/1073.patch | git am | ||
RUN cd /tmp/yara-python | ||
RUN python setup.py build --enable-dex | ||
RUN python setup.py install | ||
|
||
RUN pip install --no-cache-dir --upgrade pip setuptools wheel curl && \ | ||
pip wheel --quiet --no-cache-dir --wheel-dir=/tmp/yara-python --build-option="build" --build-option="--enable-dex" git+https://github.com/VirusTotal/[email protected] && \ | ||
pip install --quiet --no-cache-dir --no-index --find-links=/tmp/yara-python yara-python && \ | ||
rm -rf /tmp/yara-python | ||
|
||
WORKDIR /apkid | ||
COPY . . | ||
|
||
RUN python prep-release.py | ||
RUN pip install -e . | ||
RUN python prep-release.py && \ | ||
pip install -e . | ||
|
||
# Place to bind a mount point to for scratch pad work | ||
RUN mkdir /input | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,26 +18,11 @@ For more information on what this tool can be used for, check out: | |
|
||
# Installing | ||
|
||
Installation is unfortunately a bit involved until a [pull request](https://github.com/VirusTotal/yara/pull/1073) is merged in a dependency. Here's how you do it: | ||
|
||
```bash | ||
git clone --recursive -b "v3.10.0" https://github.com/VirusTotal/yara-python.git /tmp/yara-python | ||
cd /tmp/yara-python/yara | ||
curl https://patch-diff.githubusercontent.com/raw/VirusTotal/yara/pull/1073.patch | git am | ||
cd .. | ||
python setup.py build --enable-dex | ||
python setup.py install | ||
``` | ||
|
||
Without this patch to Yara, the dexlib1 detection rule will fail as will any rule relying on string sizes. | ||
|
||
If this patch wasn't needed, here's how you'd install. First, install [yara-python](https://github.com/VirusTotal/yara-python) with `--enable-dex` to compile Yara's DEX module: | ||
|
||
```bash | ||
# Don't use this method, for now. | ||
#pip install --upgrade wheel | ||
#pip wheel --wheel-dir=/tmp/yara-python --build-option="build" --build-option="--enable-dex" git+https://github.com/VirusTotal/[email protected] | ||
#pip install --no-index --find-links=/tmp/yara-python yara-python | ||
pip install --upgrade wheel | ||
pip wheel --wheel-dir=/tmp/yara-python --build-option="build" --build-option="--enable-dex" git+https://github.com/VirusTotal/[email protected] | ||
pip install --no-index --find-links=/tmp/yara-python yara-python | ||
``` | ||
|
||
Finally, install APKiD: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters