mirror of
https://github.com/DarrylNixon/binhop
synced 2024-04-22 12:37:06 -07:00
Add Dockerfile.
This commit is contained in:
parent
fb002fcca2
commit
b88a17e3c7
3 changed files with 96 additions and 1 deletions
80
Dockerfile
Normal file
80
Dockerfile
Normal file
|
@ -0,0 +1,80 @@
|
|||
FROM ubuntu:20.04
|
||||
|
||||
# Based on https://github.com/sheabot/binwalk-docker/blob/main/Dockerfile
|
||||
|
||||
ENV PORT=8080
|
||||
|
||||
# Set shell to bash instead of dash
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
RUN echo "dash dash/sh boolean false" | debconf-set-selections && dpkg-reconfigure dash
|
||||
|
||||
# Binwalk installation instructions from:
|
||||
# https://github.com/ReFirmLabs/binwalk/blob/master/INSTALL.md
|
||||
RUN apt-get update
|
||||
RUN apt-get install -y --no-install-recommends \
|
||||
arj \
|
||||
binwalk \
|
||||
build-essential \
|
||||
bzip2 \
|
||||
cabextract \
|
||||
cramfsswap \
|
||||
default-jdk \
|
||||
git-core \
|
||||
gzip \
|
||||
lhasa \
|
||||
liblzma-dev \
|
||||
liblzo2-dev \
|
||||
liblzo2-dev \
|
||||
lzop \
|
||||
mtd-utils \
|
||||
p7zip \
|
||||
p7zip-full \
|
||||
python3 \
|
||||
python3-lzo \
|
||||
python3-pip \
|
||||
sleuthkit \
|
||||
squashfs-tools \
|
||||
srecord \
|
||||
tar \
|
||||
wget \
|
||||
zlib1g-dev && \
|
||||
apt-get clean && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install sasquatch to extract non-standard SquashFS images
|
||||
RUN git clone https://github.com/devttys0/sasquatch /tmp/sasquatch && \
|
||||
cd /tmp/sasquatch && \
|
||||
./build.sh && \
|
||||
cd / && \
|
||||
rm -rf /tmp/sasquatch
|
||||
|
||||
# Install jefferson to extract JFFS2 file systems
|
||||
RUN pip3 install cstruct && \
|
||||
git clone https://github.com/sviehb/jefferson /tmp/jefferson && \
|
||||
cd /tmp/jefferson && \
|
||||
python3 setup.py install && \
|
||||
cd / && \
|
||||
rm -rf /tmp/jefferson
|
||||
|
||||
# Install ubi_reader to extract UBIFS file systems
|
||||
RUN git clone https://github.com/jrspruitt/ubi_reader /tmp/ubi_reader && \
|
||||
cd /tmp/ubi_reader && \
|
||||
python3 -m pip install . && \
|
||||
cd / && \
|
||||
rm -rf /tmp/ubi_reader
|
||||
|
||||
# Install yaffshiv to extract YAFFS file systems
|
||||
RUN git clone https://github.com/devttys0/yaffshiv /tmp/yaffshiv && \
|
||||
cd /tmp/yaffshiv && \
|
||||
python3 setup.py install && \
|
||||
cd / && \
|
||||
rm -rf /tmp/yaffshiv
|
||||
|
||||
# Install binhop
|
||||
RUN git clone https://sillyhats.mips.uk/pdf/binhop /tmp/binhop && \
|
||||
cd /tmp/binhop && \
|
||||
python3 -m pip install -r requirements.txt
|
||||
|
||||
# Run binhop
|
||||
EXPOSE $PORT
|
||||
CMD cd /tmp/binhop && python3 /tmp/binhop/binhop.py --port $PORT
|
15
README.md
15
README.md
|
@ -17,6 +17,21 @@ take action on the parts that didn't.<br />
|
|||
|
||||
## Installation and Usage
|
||||
|
||||
### Build with Docker (recommended)
|
||||
|
||||
Assuming you have Docker installed and running, you can serve binhop locally with something like:
|
||||
|
||||
```
|
||||
git clone https://github.com/darrylnixon/binhop.git
|
||||
cd binhop
|
||||
docker build . -t csc842/binhop
|
||||
docker run --name binhop -e PORT=3050 -p 3050:3050 --restart=always csc842/binhop
|
||||
```
|
||||
|
||||
Then browse to [http://localhost:3050](http://localhost:3050) and upload a blob.
|
||||
|
||||
### Manually
|
||||
|
||||
To use this script, you need Python 3 and a functioning and "recent" version of `binwalk` installed on your system. In practice, this means you're *probably* going to need to be on an x86/x86_64 Linux, but maybe you have better karma than I do.
|
||||
|
||||
You'll probably also want to install optional `binwalk` dependencies such as `sasquatch`, `jefferson`, and others, depending on the binaries you want to submit. You can learn how to do that in [binwalk's INSTALL.md](https://github.com/ReFirmLabs/binwalk/blob/master/INSTALL.md). `binhop` only "requires" `binwalk`, but it'll fail on binaries for which `binwalk` is dependent on optional modules.
|
||||
|
|
|
@ -134,7 +134,7 @@ async def serve_static(request: web.Request) -> Union[web.FileResponse, web.HTTP
|
|||
|
||||
async def main() -> None:
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--port", "-p", type=int, default=8080, help="Port to serve on")
|
||||
parser.add_argument("--port", "-p", type=int, default=8080, 77help="Port to serve on")
|
||||
args = parser.parse_args()
|
||||
|
||||
app = web.Application()
|
||||
|
|
Loading…
Reference in a new issue