Saataa Andagii !

This commit is contained in:
Lukian 2024-12-10 12:57:56 +01:00
parent f7cf2333c5
commit 556380e4f1
5 changed files with 28 additions and 28 deletions

2
.gitignore vendored
View file

@ -1 +1 @@
.venv/

View file

@ -1,19 +1,28 @@
services:
proxy-server:
image: proxy-server:latest
build:
context: ./proxy-server
dockerfile: Dockerfile
container_name: proxy-server
networks:
- server
server:
ipv4_address: 172.16.150.100
ports:
- "8080:80"
- 8080:80
web-server:
image: nginx:latest
container_name: web-server
networks:
- server
server:
ipv4_address: 172.16.150.101
ports:
- 80:80
networks:
server:
external: false
name: server
ipam:
driver: default
config:
- subnet: 172.16.150.0/24

1
server/proxy-server/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
.venv/

View file

@ -1,6 +1,7 @@
FROM python:alpine
WORKDIR /app
COPY . .
RUN pip install -r requirements.txt
RUN apk add libpcap bash && pip install -r requirements.txt
EXPOSE 80
CMD python main.py
CMD ["python", "-u", "main.py"]

View file

@ -1,21 +1,10 @@
from scapy.layers.http import *
from scapy.layers.ntlm import *
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>"
)
PORT = 80
def handler(pkt):
print(pkt)
if __name__ == "__main__":
sniff(filter=f"tcp port {PORT}", prn=handler)
server = HTTP_Server.spawn(
port=80,
iface="eth0",
)