Changed the web server to be on the same program than the scapy program
This commit is contained in:
parent
077b4e68b8
commit
9f0101b1c3
8 changed files with 42 additions and 32 deletions
|
@ -1,28 +1,9 @@
|
|||
services:
|
||||
proxy-server:
|
||||
web:
|
||||
build:
|
||||
context: ./proxy-server
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
container_name: proxy-server
|
||||
networks:
|
||||
server:
|
||||
ipv4_address: 172.16.150.100
|
||||
ports:
|
||||
- 8080:80
|
||||
|
||||
web-server:
|
||||
image: nginx:latest
|
||||
container_name: web-server
|
||||
networks:
|
||||
server:
|
||||
ipv4_address: 172.16.150.101
|
||||
container_name: web
|
||||
ports:
|
||||
- 80:80
|
||||
|
||||
networks:
|
||||
server:
|
||||
ipam:
|
||||
driver: default
|
||||
config:
|
||||
- subnet: 172.16.150.0/24
|
||||
|
||||
|
|
11
server/index.html
Normal file
11
server/index.html
Normal file
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Basic web server</title>
|
||||
<link rel="stylesheet" href="style.css">
|
||||
</head>
|
||||
<body>
|
||||
<h1>Hello, world!</h1>
|
||||
</body>
|
||||
</html>
|
||||
|
22
server/main.py
Normal file
22
server/main.py
Normal file
|
@ -0,0 +1,22 @@
|
|||
from scapy.all import *
|
||||
import http.server
|
||||
import socketserver
|
||||
import threading
|
||||
|
||||
PORT = 80
|
||||
|
||||
Handler = http.server.SimpleHTTPRequestHandler
|
||||
http = socketserver.TCPServer(("", PORT), Handler)
|
||||
|
||||
def handler(pkt):
|
||||
print(pkt)
|
||||
|
||||
def sniff_packets():
|
||||
sniff(filter=f"tcp port {PORT}", prn=handler)
|
||||
|
||||
if __name__ == "__main__":
|
||||
sniffer = threading.Thread(target=sniff_packets)
|
||||
sniffer.start()
|
||||
http.serve_forever()
|
||||
print("serving at port", PORT)
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
from scapy.all import *
|
||||
|
||||
PORT = 80
|
||||
|
||||
def handler(pkt):
|
||||
print(pkt)
|
||||
|
||||
if __name__ == "__main__":
|
||||
sniff(filter=f"tcp port {PORT}", prn=handler)
|
||||
|
6
server/style.css
Normal file
6
server/style.css
Normal file
|
@ -0,0 +1,6 @@
|
|||
body {
|
||||
background-color: black;
|
||||
color: white;
|
||||
font-family: "Comic Sans MS";
|
||||
text-align: center;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue