Start mineziperd from app

This commit is contained in:
atxr 2024-03-05 11:27:36 +01:00
parent 1aa0573482
commit 2fa66f3860
3 changed files with 17 additions and 8 deletions

View file

@ -4,19 +4,17 @@ RUN apt update && apt install python3-pip ncat -y
RUN useradd -m -s /bin/bash user RUN useradd -m -s /bin/bash user
# USER user USER user
WORKDIR /home/user WORKDIR /home/user
COPY dist/mineziperd . COPY dist/mineziperd .
COPY src/webapp webapp COPY src/webapp webapp
COPY flag.txt . COPY flag.txt .
RUN ./mineziperd &
WORKDIR /home/user/webapp WORKDIR /home/user/webapp
RUN pip install -r requirements.txt RUN pip install -r requirements.txt
EXPOSE 5000 EXPOSE 5000
ENV FLASK_APP=app.py ENV FLASK_APP=app.py
CMD ["flask", "run", "--host", "0.0.0.0"] CMD ["python3", "-m", "flask", "run", "--host", "0.0.0.0"]

View file

@ -13,7 +13,7 @@ port = 5000
url = f"http://{ip}:{port}/upload" url = f"http://{ip}:{port}/upload"
# Reverse shell params # Reverse shell params
ip = "127.0.0.1" my_ip = "127.0.0.1"
my_port = 9001 my_port = 9001

View file

@ -3,6 +3,8 @@ import socket
from struct import pack, unpack from struct import pack, unpack
import hashlib import hashlib
import sys import sys
import time
import os
PORT = 8989 PORT = 8989
@ -27,9 +29,18 @@ def upload():
hash = hashlib.sha256(buf).digest() hash = hashlib.sha256(buf).digest()
# Scan file # Scan file
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) while True:
s.settimeout(10) try:
s.connect(("localhost", PORT)) s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.settimeout(10)
s.connect(("localhost", PORT))
break
except:
print("Restarting mineziper service", file=sys.stdout)
os.system("killall mineziperd")
os.system("~/mineziperd &")
time.sleep(1)
s.send(pack("I", len(buf))) s.send(pack("I", len(buf)))
s.send(buf) s.send(buf)