| | import os |
| | import sys |
| | from collections import deque |
| | from werkzeug.middleware.proxy_fix import ProxyFix |
| |
|
| | |
| | os.environ['OAUTHLIB_INSECURE_TRANSPORT'] = '1' |
| |
|
| | from webpass import create_app, socketio, db |
| |
|
| | app = create_app() |
| |
|
| | |
| | |
| | with app.app_context(): |
| | try: |
| | print(" [*] Verifying/Creating database tables...") |
| | db.create_all() |
| | print(" [+] Database initialization complete.") |
| | except Exception as e: |
| | print(f" [!] Database init error: {e}") |
| |
|
| | app.captured_packets = deque(maxlen=1000) |
| |
|
| | @socketio.on('connect') |
| | def handle_connect(): |
| | print(" [+] Client connected to Live Feed") |
| |
|
| | |
| | IS_CLOUD = os.environ.get('SPACE_ID') is not None |
| |
|
| | if IS_CLOUD: |
| | |
| | app.wsgi_app = ProxyFix(app.wsgi_app, x_proto=1, x_host=1) |
| |
|
| | |
| | if not IS_CLOUD: |
| | try: |
| | from webpass.network_monitor import start_packet_capture |
| | from scapy.all import conf |
| | |
| | def get_best_interface(): |
| | try: |
| | iface = conf.iface |
| | print(f" [*] Auto-detected best interface: {iface}") |
| | return iface |
| | except Exception as e: |
| | print(f" [!] Error detecting interface: {e}") |
| | return None |
| | except ImportError: |
| | print(" [!] Scapy not installed locally. Network Monitor disabled.") |
| |
|
| | if __name__ == '__main__': |
| | print("--- WEBPASS SECURITY SERVER STARTING ---") |
| | |
| | if not IS_CLOUD: |
| | target_interface = get_best_interface() |
| | if target_interface: |
| | print(f" [+] Launching Packet Sniffer on: {target_interface}") |
| | start_packet_capture(app, socketio, interface=target_interface) |
| | else: |
| | print(" [*] Running in Cloud Mode. Hardware packet sniffing is disabled.") |
| |
|
| | print(" [+] Server running on http://127.0.0.1:5000") |
| | print("--------------------------------------------") |
| | |
| | socketio.run(app, host='127.0.0.1', port=5000, debug=True, use_reloader=False) |