Skip to content

Commit

Permalink
Add docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
yannik-dittmar committed Mar 3, 2024
1 parent e0b9d07 commit 18bea56
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
__pycache__
dist
.gitignore
.dockerignore
Dockerfile
23 changes: 23 additions & 0 deletions .github/workflows/publish-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Publish Docker image

jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4

- name: Log in to Docker Hub
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build and push Docker image
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
with:
context: .
file: ./Dockerfile
push: true
tags: kryptolyser/recool:latest
28 changes: 28 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# docker build -t recool .
# docker run -it --rm --net=host -v ./recool-output:/recool/dist kryptolyser/recool -I eth0

FROM golang:1.22.0-bullseye

WORKDIR /recool

# Install dependencies
RUN apt-get update \
&& apt-get install -y \
python3 \
python3-pip \
nmap \
ipv6toolkit \
sudo \
&& apt-get clean
RUN go install github.com/richartkeil/nplan@latest

# Python dependencies
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt

# Install recool
COPY recool.py .
COPY ip_tools.py .

# Run recool
ENTRYPOINT ["python3", "recool.py"]
10 changes: 10 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@ A python script for automatically scanning a network with nmap/scan6 and creatin

__Recool__ is short for __Reconnisance Tool__.

## Docker

The easiest way to scan your network with recool is to use the official docker image.
You can append recool arguments to the docker command as normal.

```sh
docker pull kryptolyser/recool
docker run -it --rm --net=host -v ./dist:/recool/dist kryptolyser/recool -I eth
```

## Requirements

- Python3.9 (might work with earlier versions)
Expand Down
2 changes: 1 addition & 1 deletion ip_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ def update_model(self, export=True):
if export:
self.spinner.text = f'Updating the nplan model...'
os.popen(f'{self.args.nplan} -export -nmap {self.args.storage}/scan.xml -json {self.args.storage}/model.json -drawio {self.args.storage}/drawio.drawio > {self.args.storage}/nplan.log').read()
os.system(f'chmod 666 -R {self.args.storage}')
os.system(f'chmod 777 -R {self.args.storage}')

# Save current state
self.spinner.text = f'Saving the current state... (DO NOT EXIT)'
Expand Down
4 changes: 2 additions & 2 deletions recool.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def parse_arguments():
args.ip = ip_tools.parse_ip(args.ip)

# Create storage folder
args.storage.mkdir(parents=True, exist_ok=True)
args.storage.mkdir(parents=True, exist_ok=True, mode=0o777)

# Format nmap speed argument
args.speed = '-' + args.speed
Expand Down Expand Up @@ -124,7 +124,7 @@ def main():
# Check if scan6 is installed
if not which('scan6') and not args.no_ipv6:
log.error(f'{stylize("ERROR!", STYLE_FAILURE)} {stylize("scan6", STYLE_HIGHLIGHT)} is not installed!')
log.error(f'Run {stylize("sudo apt install ipv6-toolkit", STYLE_HIGHLIGHT)} to install it.')
log.error(f'Run {stylize("sudo apt install ipv6toolkit", STYLE_HIGHLIGHT)} to install it.')
log.error(f'Or disable IPv6 scanning with the {stylize("--no-ipv6", STYLE_HIGHLIGHT)} argument.')
exit(1)

Expand Down

0 comments on commit 18bea56

Please sign in to comment.