Saataa andagii !

This commit is contained in:
Lukian 2024-12-02 11:11:22 +01:00
commit babfe360b6
4 changed files with 51 additions and 0 deletions

24
server/docker-compose.yml Normal file
View file

@ -0,0 +1,24 @@
services:
proxy-server:
build:
context: ./proxy
dockerfile: Dockerfile
network: host
image: proxy-server
container_name: proxy-server
networks:
- server
ports:
- "8080:80"
web-server:
image: nginx:latest
container_name: web-server
networks:
- server
ports:
- "80:80"
networks:
server:
external: false
name: server

6
server/proxy/Dockerfile Normal file
View file

@ -0,0 +1,6 @@
FROM python:slim
WORKDIR /app
COPY . .
RUN pip install -r requirements.txt
EXPOSE 80
CMD ["python", "main.py"]

20
server/proxy/main.py Normal file
View file

@ -0,0 +1,20 @@
from scapy.all import *
class Custom_HTTP_Server(HTTP_Server):
def answer(self, pkt):
if pkt.Path == b"/":
return HTTPResponse() / (
"<!doctype html><html><body><h1>OK</h1></body></html>"
)
else:
return HTTPResponse(
Status_Code=b"404",
Reason_Phrase=b"Not Found",
) / (
"<!doctype html><html><body><h1>404 - Not Found</h1></body></html>"
)
server = HTTP_Server.spawn(
port=80,
iface="eth0",
)

View file

@ -0,0 +1 @@
scapy==2.6.1