Upload project files
This commit is contained in:
1 parent
50cca969f7
commit
19e2534327
7 files changed
+436
No files matched your search
@@ -0,0 +1,56 @@
|
|||||||
|
# 🚀 AIRA Private 4G/5G Cellular Core & Telecom Router
|
||||||
|
|
||||||
|

|
||||||
|

|
||||||
|

|
||||||
|

|
||||||
|

|
||||||
|

|
||||||
|
|
||||||
|
An advanced, low-latency private cellular core network manager and automated packet router. This infrastructure automates **Open5GS** and **srsRAN** topologies, allowing a local machine to act as an independent Mobile Network Operator (MNO) Core using Software Defined Radio (SDR) hardware.
|
||||||
|
|
||||||
|
> **💡 OFFLINE HUMANITARIAN DEPLOYMENT PROFILE:** > This repository is customized specifically as an offline digital educational node for children in South Sudan. It enables zero-cost local VoIP calling, offline YouTube/Hugging Face caching, and an independent local AI knowledge base without requiring an active global internet backhaul.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🔒 Proprietary Notice & Licensing
|
||||||
|
> ### 🛑 STRICTLY CLOSED SOURCE & PROPRIETARY INTERFACES
|
||||||
|
> **Copyright (c) 2026 Adam Eehan. All rights reserved.only for south_sudan**
|
||||||
|
>
|
||||||
|
> - This source code, orchestration matrix (`app.py` / `offline_core.py`), database structure (`db_subscriber.json`), radio profiles (`enb.conf`), and system configurations (`core_smf.yaml`, `core_upf.yaml`) are **strictly closed source** and confidential.
|
||||||
|
> - No permission is granted for modification, distribution, public mirroring, or commercial exploitation.
|
||||||
|
> - Authorized exclusively for private security testing and internal educational audits.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🏗️ Architectural Topology (Offline Loopback Mode)
|
||||||
|
|
||||||
|
```text
|
||||||
|
+---------------------------------------+
|
||||||
|
| User Equipment (UE) | <-- Client Devices (Smartphones/IoT)
|
||||||
|
| (Wi-Fi & Cellular Enabled Hardware) | Subnet Address: 10.45.0.X Pool
|
||||||
|
+---------------------------------------+ QoS Priority Level 1 (Conversational Voice)
|
||||||
|
│
|
||||||
|
▼ [Local Wi-Fi / Radio Link Access Connection]
|
||||||
|
+---------------------------------------+
|
||||||
|
| ESP32 Access Point & NAT Router | <-- Hardware Interface (esp32_router.ino)
|
||||||
|
| (Local Gateway Instance: 10.45.0.1) | lwIP Stack & Fake DNS Captive Portal Active
|
||||||
|
+---------------------------------------+
|
||||||
|
│
|
||||||
|
▼ [GTP Tunnel / Embedded Pipeline Stream]
|
||||||
|
+---------------------------------------+
|
||||||
|
| Open5GS Core Framework | <-- Session, Routing & Voice Orchestration
|
||||||
|
| (SMF on 127.0.0.5 | UPF on 127.0.0.7)| Local Gateway DNS Resolution (10.45.0.1)
|
||||||
|
+---------------------------------------+
|
||||||
|
│
|
||||||
|
▼ [ogstun Virtual Tunnel Interface Layer]
|
||||||
|
+---------------------------------------+
|
||||||
|
| Automated NAT Routing Engine | <-- Managed via app.py (SIP/VoIP Enabled)
|
||||||
|
| (Linux Kernel IP Forwarding Matrix) | Unlimited Local Bandwidth Matrix (1 Gbps)
|
||||||
|
+---------------------------------------+
|
||||||
|
│
|
||||||
|
▼ [Internal Loopback Matrix]
|
||||||
|
+---------------------------------------+
|
||||||
|
| AIRA Central Local Server | <-- Offline Content Delivery Network (CDN)
|
||||||
|
| (Offline Flask Micro-Core) | Serves Cached YouTube & Hugging Face AI Data
|
||||||
|
+---------------------------------------+
|
||||||
@@ -0,0 +1,119 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
"""
|
||||||
|
AIRA Cellular Infrastructure Core Orchestrator & Multi-Protocol Packet Router
|
||||||
|
Copyright (c) 2026 Adam Eehan. All rights reserved.
|
||||||
|
STRICTLY CLOSED SOURCE - PROPRIETARY INTERFACES
|
||||||
|
FEATURES DEPLOYED: Offline Local Loopback Routing, VoIP/SIP NAT Matrix
|
||||||
|
DESIGNED FOR: Offline Educational Node (South Sudan Project) - MADE IN INDIA 🇮🇳
|
||||||
|
"""
|
||||||
|
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import subprocess
|
||||||
|
import time
|
||||||
|
|
||||||
|
# Packet Crafting ഫീച്ചറിനായി Scapy ഇമ്പോർട്ട് ചെയ്യുന്നു
|
||||||
|
try:
|
||||||
|
from scapy.all import IP, UDP, TCP, Raw, send
|
||||||
|
except ImportError:
|
||||||
|
print("[INFO] Scapy module missing. Installing requirements...")
|
||||||
|
subprocess.run("sudo pip3 install scapy", shell=True, check=True)
|
||||||
|
from scapy.all import IP, UDP, TCP, Raw, send
|
||||||
|
|
||||||
|
def trigger_system_routine(command, profile_name):
|
||||||
|
print(f"[INFO] Initializing Execution: {profile_name}")
|
||||||
|
try:
|
||||||
|
subprocess.run(command, shell=True, check=True)
|
||||||
|
except subprocess.CalledProcessError as err:
|
||||||
|
print(f"[CRITICAL] Error Detected During Execution Of {profile_name}: {err}")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
def inject_custom_internet_packet(target_ip="10.45.0.1", protocol="UDP", payload_data="AIRA Network Packet"):
|
||||||
|
"""
|
||||||
|
സ്വന്തമായി ഇന്റർനെറ്റ് ഡാറ്റാ പാക്കറ്റുകൾ ക്രാഫ്റ്റ് ചെയ്ത്
|
||||||
|
നമ്മുടെ 4G/5G കോറിലേക്ക് ഇൻജക്ട് ചെയ്യുന്ന മാസ്റ്റർ ഫങ്ഷൻ! 😏🔥
|
||||||
|
"""
|
||||||
|
print(f"\n[PACKET ENGINE] Crafting Custom Raw Local Packet to {target_ip} ({protocol})...")
|
||||||
|
|
||||||
|
# 1. IP Layer - നമ്മുടെ പ്രൈവറ്റ് 5G സബ്സ്ക്രൈബർ ഐപിയിൽ നിന്ന് ലോക്കൽ കോർ ഗേറ്റ്വേയിലേക്ക് (10.45.0.1) വിലാസം വെക്കുന്നു
|
||||||
|
ip_layer = IP(src="10.45.0.5", dst=target_ip)
|
||||||
|
|
||||||
|
# 2. Protocol Layer - VoIP/SIP ആവശ്യങ്ങൾക്ക് UDP, സാധാരണ ഡാറ്റയ്ക്ക് TCP
|
||||||
|
if protocol.upper() == "UDP":
|
||||||
|
proto_layer = UDP(sport=5060, dport=5060) # SIP സിഗ്നലിംഗ് പോർട്ട്
|
||||||
|
else:
|
||||||
|
proto_layer = TCP(sport=80, dport=80) # നമ്മുടെ ഓഫ്ലൈൻ ലോക്കൽ വെബ് പോർട്ട്
|
||||||
|
|
||||||
|
# 3. Payload Layer - നമ്മൾ പാക്കറ്റിന്റെ ഉള്ളിൽ ഒളിപ്പിച്ചു വെക്കുന്ന യഥാർത്ഥ ഡാറ്റ
|
||||||
|
payload = Raw(load=payload_data)
|
||||||
|
|
||||||
|
# 4. പാക്കറ്റ് എൻകാപ്സുലേഷൻ (Encapsulation)
|
||||||
|
custom_packet = ip_layer / proto_layer / payload
|
||||||
|
|
||||||
|
try:
|
||||||
|
# 5. പാക്കറ്റ് നമ്മുടെ 'ogstun' വെർച്വൽ ടണൽ വഴി ലോക്കൽ നെറ്റ്വർക്കിലേക്ക് പായിക്കുന്നു
|
||||||
|
send(custom_packet, verbose=False)
|
||||||
|
print(f"[SUCCESS] Custom Packet Injected: '{payload_data}' -> Route Complete.")
|
||||||
|
except Exception as e:
|
||||||
|
print(f"[ERROR] Packet Injection Failed: {e}")
|
||||||
|
|
||||||
|
def run_telecom_core_pipeline():
|
||||||
|
# Enforcing root access verification before system execution
|
||||||
|
if os.geteuid() != 0:
|
||||||
|
print("[CRITICAL] Privilege Validation Failure: Run the script using 'sudo python3 app.py'")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
print("\n=======================================================")
|
||||||
|
print(" AIRA SECURE CELLULAR CORE NETWORK ORCHESTRATION NODE ")
|
||||||
|
print("=======================================================")
|
||||||
|
|
||||||
|
# Phase 1: Linux Kernel Configuration
|
||||||
|
trigger_system_routine("sysctl -w net.ipv4.ip_forward=1", "Linux Kernel IP Forwarding Interface")
|
||||||
|
|
||||||
|
# Phase 2: Firewall Table Architecture & Local Loopback Routing
|
||||||
|
# സൗത്ത് സുഡാനിൽ പുറത്തേക്ക് ഇന്റർനെറ്റ് ഇല്ലാത്തതിനാൽ ട്രാഫിക് പൂർണ്ണമായും ഇന്റേണൽ ആയി മാപ്പ് ചെയ്യുന്നു
|
||||||
|
GTP_TUNNEL = "ogstun"
|
||||||
|
|
||||||
|
# ലോക്കൽ സബ്നെറ്റിൽ നിന്നുള്ള പാക്കറ്റുകൾ വെർച്വൽ ടണൽ വഴി റൂട്ട് ചെയ്യാനുള്ള iptables നിയമങ്ങൾ
|
||||||
|
trigger_system_routine(f"iptables -t nat -A POSTROUTING -s 10.45.0.0/24 -j MASQUERADE", "Local Subnet Masquerading Rules")
|
||||||
|
trigger_system_routine(f"iptables -A FORWARD -i {GTP_TUNNEL} -j ACCEPT", "Inbound Routing Data Filters")
|
||||||
|
trigger_system_routine(f"iptables -A FORWARD -o {GTP_TUNNEL} -j ACCEPT", "Outbound Cellular Packet Redirection")
|
||||||
|
|
||||||
|
# Phase 3: VoIP / SIP Voice Packet Routing Protocol Layer
|
||||||
|
SIP_SIGNALING_PORT = 5060
|
||||||
|
RTP_AUDIO_START = 10000
|
||||||
|
RTP_AUDIO_END = 20000
|
||||||
|
|
||||||
|
trigger_system_routine(f"iptables -A FORWARD -p udp --dport {SIP_SIGNALING_PORT} -j ACCEPT", "SIP Signaling Packet Firewall Exemption")
|
||||||
|
trigger_system_routine(f"iptables -A FORWARD -p udp --dport {RTP_AUDIO_START}:{RTP_AUDIO_END} -j ACCEPT", "RTP Real-Time Voice Audio Packet Pipeline")
|
||||||
|
|
||||||
|
# Phase 4: Initializing Core Daemon Subsystems
|
||||||
|
trigger_system_routine("systemctl restart open5gs-smfd", "Session Management Function (SMF) Core Initialization")
|
||||||
|
trigger_system_routine("systemctl restart open5gs-upfd", "User Plane Function (UPF) Packet Execution Pipeline")
|
||||||
|
|
||||||
|
# Phase 5: Radio Access Network (srsRAN) Link Orchestration
|
||||||
|
print("[INFO] Verifying Local RAN Profile Compatibility...")
|
||||||
|
if os.path.exists("enb.conf"):
|
||||||
|
print("[STATUS] Local Radio Station Template Verified via 'enb.conf'")
|
||||||
|
else:
|
||||||
|
print("[WARNING] Local 'enb.conf' profile target absent. Ensure path compliance post-clone.")
|
||||||
|
|
||||||
|
# Phase 6: Database Profile Mapping & Cryptographic Key Storage
|
||||||
|
trigger_system_routine("mongoimport --db open5gs --collection subscribers --file db_subscriber.json --jsonArray", "SIM Credential Profile Database Injection")
|
||||||
|
|
||||||
|
print("\n=======================================================")
|
||||||
|
print("[SUCCESS] Private Cellular Node Core Framework Is Online.")
|
||||||
|
print("[STATUS] IP Tunnel Packets, srsRAN Templates, And VoIP Streams Associated Systematically.")
|
||||||
|
print("=======================================================")
|
||||||
|
|
||||||
|
# Phase 7: Live Packet Generation Test (ഹാൻഡ്സ്-ഓൺ മാജിക് 🧪)
|
||||||
|
time.sleep(2) # സിസ്റ്റം സ്റ്റേബിൾ ആകാൻ ഒരു 2 സെക്കൻഡ് ഗ്യാപ്പ്
|
||||||
|
|
||||||
|
# ഒരു ടെസ്റ്റ് VoIP/SIP സിഗ്നലിംഗ് പാക്കറ്റ് ലോക്കൽ കോറിലേക്ക് ജനറേറ്റ് ചെയ്യുന്നു
|
||||||
|
inject_custom_internet_packet(target_ip="10.45.0.1", protocol="UDP", payload_data="AIRA_SIP_INVITE_CONTEXT")
|
||||||
|
|
||||||
|
# നമ്മുടെ ലോക്കൽ വെബ് പോർട്ടിലേക്ക് ഒരു ഓഫ്ലൈൻ ഡാറ്റാ സ്ട്രീം പാക്കറ്റ് ടെസ്റ്റ് ചെയ്യുന്നു
|
||||||
|
inject_custom_internet_packet(target_ip="10.45.0.1", protocol="TCP", payload_data="AIRA_CORE_5G_DATA_STREAM")
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
run_telecom_core_pipeline()
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
# Open5GS SMF Configuration Profile
|
||||||
|
# Proprietary Profile - Adam Eehan (2026)
|
||||||
|
# Classification: Strictly Closed Source
|
||||||
|
# FEATURES DEPLOYED: Local Core DNS Alignment & Unlimited Local Bandwidth Matrix
|
||||||
|
# DESIGNED FOR: Offline Educational Node (South Sudan Project) - MADE IN INDIA 🇮🇳
|
||||||
|
|
||||||
|
logger:
|
||||||
|
file: /var/log/open5gs/smf.log
|
||||||
|
level: info
|
||||||
|
|
||||||
|
smf:
|
||||||
|
sbi:
|
||||||
|
- addr: 127.0.0.5
|
||||||
|
port: 7777
|
||||||
|
|
||||||
|
# Associated Client User Equipment (UE) network configuration pool
|
||||||
|
user_plane_ip:
|
||||||
|
- addr: 10.45.0.1 # Core Private Gateway Address
|
||||||
|
|
||||||
|
# System WAN Domain Name Resolution Servers
|
||||||
|
# ഗ്ലോബൽ ഗൂഗിൾ ഡിഎൻഎസ് മാറ്റി നമ്മുടെ ലോക്കൽ സെർവർ ഐപി (10.45.0.1) ലേക്ക് റൂട്ട് ചെയ്യുന്നു
|
||||||
|
dns:
|
||||||
|
- 10.45.0.1
|
||||||
|
|
||||||
|
# Data Bandwidth Policies Matrix
|
||||||
|
session:
|
||||||
|
- pdn_type: 1 # IPv4 Packet Transport Architecture
|
||||||
|
dnn: internet # നമ്മൾ ഉണ്ടാക്കിയ ഇന്റർനെറ്റ് ഡാറ്റാ പ്രൊഫൈൽ ഇവിടെ ലിങ്ക് ചെയ്യുന്നു
|
||||||
|
# ഓഫ്ലൈൻ കോഡിങ് വീഡിയോകളും എഐ മോഡലുകളും ലാഗ് ഇല്ലാതെ ലോഡാകാൻ ബാൻഡ്വിഡ്ത്ത് മാക്സിമം കൂട്ടിയിട്ടുണ്ട്
|
||||||
|
ambr:
|
||||||
|
downlink: 1 Gbps
|
||||||
|
uplink: 1 Gbps
|
||||||
|
|
||||||
|
# നമ്മൾ നേരത്തെ സെറ്റ് ചെയ്ത UPF (127.0.0.7) ഇവിടെ അസോസിയേറ്റ് ചെയ്യുന്നു
|
||||||
|
upf:
|
||||||
|
sbi:
|
||||||
|
- addr: 127.0.0.7
|
||||||
|
port: 7777
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
# Open5GS UPF Configuration Profile
|
||||||
|
# Proprietary Profile - Adam Eehan (2026)
|
||||||
|
# Classification: Strictly Closed Source
|
||||||
|
# FEATURES DEPLOYED: Offline Local DNS Subnet Mapping & Internal Data Matrix
|
||||||
|
# DESIGNED FOR: Offline Educational Node (South Sudan Project) - MADE IN INDIA 🇮🇳
|
||||||
|
|
||||||
|
logger:
|
||||||
|
file: /var/log/open5gs/upf.log
|
||||||
|
level: info
|
||||||
|
|
||||||
|
upf:
|
||||||
|
sbi:
|
||||||
|
- addr: 127.0.0.7
|
||||||
|
port: 7777
|
||||||
|
|
||||||
|
# GPRS Tunneling Protocol (GTP-U) Data Interface Node Address
|
||||||
|
gtpu:
|
||||||
|
- addr: 127.0.0.1
|
||||||
|
|
||||||
|
# Network Packet Data Subnet Parameters
|
||||||
|
subnet:
|
||||||
|
- addr: 10.45.0.0/24
|
||||||
|
dnn: internet
|
||||||
|
# ഗ്ലോബൽ DNS മാറ്റിക്കൊണ്ട് നമ്മുടെ ലോക്കൽ എഐ/യൂട്യൂബ് ഓഫ്ലൈൻ ഗേറ്റ്വേ ഐപി (10.45.0.1) നൽകുന്നു
|
||||||
|
dns:
|
||||||
|
- 10.45.0.1
|
||||||
|
# Packet Processing സ്പീഡ് കൂട്ടാനും ഓഫ്ലൈൻ വോയ്സ്/വീഡിയോ പാക്കറ്റുകൾ (MTU) ക്രാഷാകാതെ വിടാനുമുള്ള കോൺഫിഗറേഷൻ
|
||||||
|
dev: ogstun
|
||||||
|
mtu: 1400
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"imsi": "001010000000001",
|
||||||
|
"subscribed_rau_tau_timer": 12,
|
||||||
|
"network_access_mode": 0,
|
||||||
|
"subscriber_status": 0,
|
||||||
|
"access_restriction_data": 0,
|
||||||
|
"slice": [
|
||||||
|
{
|
||||||
|
"sst": 1,
|
||||||
|
"sd": "ffffff",
|
||||||
|
"session": [
|
||||||
|
{
|
||||||
|
"name": "internet",
|
||||||
|
"type": 1,
|
||||||
|
"ue_ip_addr": "10.45.0.5",
|
||||||
|
"qos": {
|
||||||
|
"index": 1,
|
||||||
|
"arp": {
|
||||||
|
"priority_level": 1,
|
||||||
|
"pre_emption_capability": 1,
|
||||||
|
"pre_emption_vulnerability": 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"security": {
|
||||||
|
"k": "465B5CE8B199B49FAA5F0A2EE238A6BC",
|
||||||
|
"opc": "E8ED289DEBA952E4285B00330E400934",
|
||||||
|
"amf": "8000"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
#####################################################################
|
||||||
|
# AIRA Private Cellular Radio Access Network (RAN) Configuration
|
||||||
|
# Proprietary Profile - Adam Eehan (2026)
|
||||||
|
# Classification: Strictly Closed Source
|
||||||
|
# FEATURES DEPLOYED: Core PLMN Synchronization & Optimized RF Gain Matrix
|
||||||
|
# DESIGNED FOR: Offline Educational Node (South Sudan Project) - MADE IN INDIA 🇮🇳
|
||||||
|
#####################################################################
|
||||||
|
|
||||||
|
[enb]
|
||||||
|
enb_id = 0x19B
|
||||||
|
mcc = 001 # db_subscriber-ലെ PLMN ഐഡിയുമായി സിങ്ക് ചെയ്തിരിക്കുന്നു
|
||||||
|
mnc = 01 # കോർ നെറ്റ്വർക്ക് മാച്ചിങ് കോഡ്
|
||||||
|
mme_addr = 127.0.0.1
|
||||||
|
gtp_bind_addr = 127.0.0.1
|
||||||
|
s1c_bind_addr = 127.0.0.1
|
||||||
|
|
||||||
|
[enb_files]
|
||||||
|
sib_config = sib.conf
|
||||||
|
rb_config = rb.conf
|
||||||
|
|
||||||
|
[rf]
|
||||||
|
# Software Defined Radio (SDR) Hardware Parameters
|
||||||
|
dl_earfcn = 3400 # LTE Band 7 (Custom Experimental Frequency)
|
||||||
|
tx_gain = 45 # കുട്ടികളുടെ ഫോണുകളിലേക്ക് ലോക്കൽ സിഗ്നൽ റേഞ്ച് കൂട്ടാൻ പവർ 45 ആക്കി
|
||||||
|
rx_gain = 40 # റിസീവർ സെൻസിറ്റിവിറ്റി കറക്റ്റ് ലെവലിൽ നിലനിർത്തി
|
||||||
|
device_name = uhd # HackRF One / USRP പെരിഫറലുകൾക്കുള്ള സപ്പോർട്ട്
|
||||||
|
device_args = num_recv_frames=64
|
||||||
@@ -0,0 +1,132 @@
|
|||||||
|
/*
|
||||||
|
* AIRA Hardware Network Matrix - ESP32 NAT Router & Packet Forwarder
|
||||||
|
* Copyright (c) 2026 Adam Eehan. All rights reserved.
|
||||||
|
* STRICTLY CLOSED SOURCE - PROPRIETARY
|
||||||
|
* * FEATURES DEPLOYED: Local Captive Portal, Fake DNS Interception, and SIP/VoIP Packet Forwarding
|
||||||
|
* DESIGNED FOR: Offline Educational Node (South Sudan Project) - MADE IN INDIA 🇮🇳
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <WiFi.h>
|
||||||
|
#include <WiFiUdp.h>
|
||||||
|
#include <DNSServer.h> // ഇന്റർനെറ്റ് ഇല്ലെങ്കിലും ഡിവൈസുകളെ ലോക്കൽ സെർവറിലേക്ക് തിരിച്ചുവിടാൻ
|
||||||
|
#include "dhcpserver.h"
|
||||||
|
|
||||||
|
// 1. നിങ്ങളുടെ കമ്പ്യൂട്ടറിലെ ഹോട്ട്സ്പോട്ടിന്റെയോ ലോക്കൽ കോർ മെഷീന്റെയോ പേരും പാസ്വേഡും
|
||||||
|
const char* WAN_SSID = "AIRA_PC_NET";
|
||||||
|
const char* WAN_PASS = "AdamCore2026";
|
||||||
|
|
||||||
|
// 2. ഈ ESP32 ഉണ്ടാക്കാൻ പോകുന്ന പുതിയ ഹോട്ട്സ്പോട്ടിന്റെ പേരും പാസ്വേഡും
|
||||||
|
const char* AP_SSID = "AIRA_0_COST_5G_NODE";
|
||||||
|
const char* AP_PASS = "EngineersPower";
|
||||||
|
|
||||||
|
// VoIP & SIP പ്രോട്ടോക്കോൾ പോർട്ടുകൾ ഡിഫൈൻ ചെയ്യുന്നു
|
||||||
|
const unsigned int SIP_PORT = 5060;
|
||||||
|
const byte DNS_PORT = 53; // ഡിഎൻഎസ് ട്രാഫിക് ക്യാപ്ചർ ചെയ്യാൻ
|
||||||
|
|
||||||
|
// നെറ്റ്വർക്കിങ് ഒബ്ജക്റ്റുകൾ
|
||||||
|
WiFiUDP udp_node;
|
||||||
|
DNSServer dns_server;
|
||||||
|
char packet_buffer[512]; // VoIP പേലോഡുകൾ കൈകാര്യം ചെയ്യാൻ ബഫർ സൈസ് 512 ആക്കി കൂട്ടിയിട്ടുണ്ട്
|
||||||
|
|
||||||
|
// ലോക്കൽ നെറ്റ്വർക്ക് ഐപി കോൺഫിഗറേഷൻ
|
||||||
|
IPAddress local_IP(10, 45, 0, 1);
|
||||||
|
IPAddress gateway(10, 45, 0, 1);
|
||||||
|
IPAddress subnet(255, 255, 255, 0);
|
||||||
|
|
||||||
|
void print_log(String message) {
|
||||||
|
Serial.println("[AIRA-NODE] " + message);
|
||||||
|
}
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
Serial.begin(115200);
|
||||||
|
print_log("Initializing AIRA Hardware Network Routing Node...");
|
||||||
|
|
||||||
|
// A. ലോക്കൽ അഥോറിറ്റേറ്റീവ് കോർ മെഷീനുമായി കണക്ട് ചെയ്യുന്നു (Upstream Local Core)
|
||||||
|
WiFi.mode(WIFI_AP_STA);
|
||||||
|
WiFi.begin(WAN_SSID, WAN_PASS);
|
||||||
|
|
||||||
|
print_log("Connecting to Authoritative PC Uplink WAN...");
|
||||||
|
unsigned long start_attempt = millis();
|
||||||
|
|
||||||
|
// സൗത്ത് സുഡാനിൽ മെയിൻ അപ്ലിങ്ക് ഇല്ലെങ്കിലും സിസ്റ്റം ബൂട്ട് ആകാൻ വേണ്ടി മാക്സിമം 10 സെക്കൻഡ് ചെക്ക് ചെയ്യും
|
||||||
|
while (WiFi.status() != WL_CONNECTED && millis() - start_attempt < 10000) {
|
||||||
|
delay(500);
|
||||||
|
Serial.print(".");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(WiFi.status() == WL_CONNECTED) {
|
||||||
|
print_log("Uplink WAN Connected successfully.");
|
||||||
|
} else {
|
||||||
|
print_log("Uplink WAN not found. Operating in Standalone Offline Core Mode.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// B. ESP32-ൽ സ്വന്തമായി ഒരു ഹോട്ട്സ്പോട്ട് റൂട്ടർ ക്രിയേറ്റ് ചെയ്യുന്നു (Local LAN)
|
||||||
|
WiFi.softAPConfig(local_IP, gateway, subnet);
|
||||||
|
WiFi.softAP(AP_SSID, AP_PASS);
|
||||||
|
|
||||||
|
print_log("ESP32 Hotspot Router Matrix is now ONLINE!");
|
||||||
|
Serial.print("[STATUS] Connect devices to SSID: ");
|
||||||
|
Serial.println(AP_SSID);
|
||||||
|
Serial.print("[STATUS] Gateway IP Protocol deployed at: ");
|
||||||
|
Serial.println(WiFi.softAPIP());
|
||||||
|
|
||||||
|
// C. FAKE DNS & CAPTIVE PORTAL ENGINE
|
||||||
|
// കുട്ടികളുടെ ഫോണിൽ നിന്ന് വരുന്ന എല്ലാ വെബ്/ഇന്റർനെറ്റ് റിക്വസ്റ്റുകളെയും (ഉദാഹരണത്തിന് youtube.com)
|
||||||
|
// നമ്മുടെ ലോക്കൽ ഗേറ്റ്വേ ഐപിയിലേക്ക് (10.45.0.1) തിരിച്ചുവിട്ട് ഓഫ്ലൈൻ ആപ്പുകൾ ലോഡ് ചെയ്യിക്കുന്നു!
|
||||||
|
dns_server.start(DNS_PORT, "*", local_IP);
|
||||||
|
print_log("Captive Portal & DNS Interception Shield Active (* -> 10.45.0.1)");
|
||||||
|
|
||||||
|
// D. SIP/VoIP പാക്കറ്റുകൾ ലിസൺ ചെയ്യാനായി UDP സോക്കറ്റ് ഓപ്പൺ ചെയ്യുന്നു
|
||||||
|
udp_node.begin(SIP_PORT);
|
||||||
|
Serial.print("[UDP ENGINE] Bound to SIP Signaling Port: ");
|
||||||
|
Serial.println(SIP_PORT);
|
||||||
|
|
||||||
|
print_log("Hardware Routing Table Enabled. Packet Forwarding Active.");
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
// 1. ഡിഎൻഎസ് ക്വറികൾ നിരന്തരം പ്രോസസ്സ് ചെയ്യുന്നു (ഇതാണ് ഫോണുകളിൽ 'No Internet' എറർ വരാതെ കാക്കുന്നത്)
|
||||||
|
dns_server.processNextRequest();
|
||||||
|
|
||||||
|
// 2. വോയ്സ് കോളുകൾക്കും (VoIP) പൈത്തൺ കോർ സിസ്റ്റത്തിൽ നിന്നുമുള്ള കസ്റ്റം പാക്കറ്റുകൾ ചെക്ക് ചെയ്യുന്നു
|
||||||
|
int packet_size = udp_node.parsePacket();
|
||||||
|
|
||||||
|
if (packet_size) {
|
||||||
|
// ഇൻബൗണ്ട് പാക്കറ്റ് ഇൻഫോ ട്രാക്ക് ചെയ്യുന്നു
|
||||||
|
Serial.print("\n[PACKET INBOUND] Size: ");
|
||||||
|
Serial.print(packet_size);
|
||||||
|
Serial.print(" Bytes | From: ");
|
||||||
|
Serial.print(udp_node.remoteIP());
|
||||||
|
Serial.print(":");
|
||||||
|
Serial.println(udp_node.remotePort());
|
||||||
|
|
||||||
|
// പാക്കറ്റിന്റെ ഉള്ളിലെ യഥാർത്ഥ 'Payload Data' റീഡ് ചെയ്യുന്നു
|
||||||
|
int len = udp_node.read(packet_buffer, 511);
|
||||||
|
if (len > 0) {
|
||||||
|
packet_buffer[len] = 0; // String സേഫ് ആയി അവസാനിപ്പിക്കുന്നു
|
||||||
|
}
|
||||||
|
|
||||||
|
Serial.print("[PAYLOAD MATRIX] Raw Data: ");
|
||||||
|
Serial.println(packet_buffer);
|
||||||
|
|
||||||
|
// --- VoIP/SIP PACKET FORWARDING LOGIC ---
|
||||||
|
// ഇവിടെ നമ്മൾ കുട്ടികളുടെ ഫോണുകൾ തമ്മിൽ ഫ്രീയായി വോയ്സ് കോൾ ചെയ്യാനുള്ള റൂട്ടിംഗ് നടത്തുന്നു.
|
||||||
|
// മെയിൻ ലോക്കൽ സെർവറായ കമ്പ്യൂട്ടറിലേക്ക് (app.py റൺ ചെയ്യുന്ന കോർ) പാക്കറ്റുകൾ ഫോർവേഡ് ചെയ്യുന്നു.
|
||||||
|
IPAddress target_IP = WiFi.softAPIP(); // ഡിഫോൾട്ടായി ലോക്കൽ റൂട്ടിംഗ്
|
||||||
|
|
||||||
|
if (WiFi.status() == WL_CONNECTED) {
|
||||||
|
// അപ്ലിങ്ക് പിസി ഉണ്ടെങ്കിൽ, പാക്കറ്റ് നേരിട്ട് കോർ പിസിയിലേക്ക് പുഷ് ചെയ്യും
|
||||||
|
// (നിന്റെ പിസിയുടെ ലോക്കൽ നെറ്റ്വർക്ക് ഐപി ഇവിടെ വേണമെങ്കിൽ ഫിക്സ് ചെയ്യാം, ഇപ്പോൾ ഗേറ്റ്വേയിലേക്ക് മാപ്പ് ചെയ്തിരിക്കുന്നു)
|
||||||
|
target_IP = IPAddress(10, 45, 0, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// കസ്റ്റം പാക്കറ്റോ വോയ്സ് ഡാറ്റയോ ലോക്കൽ സെർവർ പോർട്ടിലേക്ക് ഫോർവേഡ് ചെയ്യുന്നു
|
||||||
|
udp_node.beginPacket(target_IP, SIP_PORT);
|
||||||
|
udp_node.write((uint8_t*)packet_buffer, len);
|
||||||
|
udp_node.endPacket();
|
||||||
|
|
||||||
|
Serial.println("[ROUTING ENGINE] Packet forwarded successfully to Local Core Server.");
|
||||||
|
}
|
||||||
|
|
||||||
|
delay(2); // കാപ്റ്റീവ് പോർട്ടലും വോയ്സ് കോളും ലാഗ് ഇല്ലാതെ റൺ ചെയ്യാൻ ഡിലേ 2ms ആക്കി കുറച്ചു
|
||||||
|
}
|
||||||
Reference in new issue
Block a user