Start mineziperd from app
This commit is contained in:
parent
1aa0573482
commit
2fa66f3860
3 changed files with 17 additions and 8 deletions
|
|
@ -4,19 +4,17 @@ RUN apt update && apt install python3-pip ncat -y
|
|||
|
||||
RUN useradd -m -s /bin/bash user
|
||||
|
||||
# USER user
|
||||
USER user
|
||||
WORKDIR /home/user
|
||||
|
||||
COPY dist/mineziperd .
|
||||
COPY src/webapp webapp
|
||||
COPY flag.txt .
|
||||
|
||||
RUN ./mineziperd &
|
||||
|
||||
WORKDIR /home/user/webapp
|
||||
|
||||
RUN pip install -r requirements.txt
|
||||
|
||||
EXPOSE 5000
|
||||
ENV FLASK_APP=app.py
|
||||
CMD ["flask", "run", "--host", "0.0.0.0"]
|
||||
CMD ["python3", "-m", "flask", "run", "--host", "0.0.0.0"]
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ port = 5000
|
|||
url = f"http://{ip}:{port}/upload"
|
||||
|
||||
# Reverse shell params
|
||||
ip = "127.0.0.1"
|
||||
my_ip = "127.0.0.1"
|
||||
my_port = 9001
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ import socket
|
|||
from struct import pack, unpack
|
||||
import hashlib
|
||||
import sys
|
||||
import time
|
||||
import os
|
||||
|
||||
PORT = 8989
|
||||
|
||||
|
|
@ -27,9 +29,18 @@ def upload():
|
|||
hash = hashlib.sha256(buf).digest()
|
||||
|
||||
# Scan file
|
||||
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
s.settimeout(10)
|
||||
s.connect(("localhost", PORT))
|
||||
while True:
|
||||
try:
|
||||
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(buf)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue