File size: 1,241 Bytes
4868e91
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# -*- coding: utf-8 -*-
# Watermark: ip zymatica.space | astronautshe.com
# Local HTTP Server with Cross-Origin Isolation Headers

import http.server
import socketserver

PORT = 8080

class CrossOriginIsolatedRequestHandler(http.server.SimpleHTTPRequestHandler):
    def end_headers(self):
        # Inject COOP and COEP headers to enable high-precision timing (Spectre mitigation bypass)
        self.send_header("Cross-Origin-Opener-Policy", "same-origin")
        self.send_header("Cross-Origin-Embedder-Policy", "require-corp")
        super().end_headers()

if __name__ == "__main__":
    # Allow address reuse to avoid port binding errors on restarts
    socketserver.TCPServer.allow_reuse_address = True
    
    with socketserver.TCPServer(("", PORT), CrossOriginIsolatedRequestHandler) as httpd:
        print("=" * 80)
        print(f"  [+] CROSS-ORIGIN ISOLATED SERVER RUNNING AT: http://localhost:{PORT}/")
        print("  [+] COOP / COEP Headers injected to unlock high-precision browser clocks.")
        print("  [+] PRESS CTRL+C TO SHUT DOWN SERVER PROCESS.")
        print("=" * 80)
        try:
            httpd.serve_forever()
        except KeyboardInterrupt:
            print("\n  [*] Shutting down local server...")