Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing docker python version and adding a docker compose file. Updati… #857

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
FROM python:3.6

COPY requirements.txt /tmp/requirements.txt
RUN python -m pip install -r /tmp/requirements.txt
FROM python:3.7-bookworm

WORKDIR /routersploit
COPY . .

CMD ["python", "rsf.py"]
RUN useradd rts -U -m && \
chown -R rts:rts /routersploit

USER rts
COPY requirements.txt .
RUN pip install --user --no-cache-dir -r requirements.txt

COPY routersploit routersploit
COPY rsf.py rsf.py

# Not actually needed since present in docker-compose already
CMD ["python", "rsf.py"]
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,14 @@ python3 rsf.py
```
git clone https://www.github.com/threat9/routersploit
cd routersploit
docker build -t routersploit .
docker run -it --rm routersploit
docker compose up --build -d
docker attach routersploit
```
### To run again without rebuild

```
docker start routersploit
docker attach routersploit
```

# Update
Expand Down
11 changes: 11 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
services:
routersploit:
build:
context: .
dockerfile: Dockerfile
container_name: routersploit
environment:
- PYTHONUNBUFFERED=1
stdin_open: true
tty: true
command: ["python","rsf.py"]
7 changes: 6 additions & 1 deletion routersploit/interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,14 @@ def get_command_handler(self, command):

def start(self):
""" Routersploit main entry point. Starting interpreter loop. """


if not sys.stdin.isatty():
print_info("stdin is not a TTY. Ensure `stdin_open` and `tty` are set")
sys.exit(1)

print_info(self.banner)
printer_queue.join()

while True:
try:
command, args, kwargs = self.parse_line(input(self.prompt))
Expand Down