Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
__pycache__/
*.pyc
.env
Binary file not shown.
90 changes: 63 additions & 27 deletions omni_sentinel_24h_monitor.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,69 @@
import time
import sys
import os
import random
from src.governance_engine.gsri_scoring_engine import GSRIScoringEngine
from src.infrastructure.pqc_worm_logger import PQCWormLogger
from src.infrastructure.tpm_attestor import TPMAttestor


def run_iteration(iteration, gsri_engine, worm_logger, tpm_attestor):

Check notice on line 9 in omni_sentinel_24h_monitor.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

omni_sentinel_24h_monitor.py#L9

Method run_iteration has 43 lines of code (limit is 20)

Check notice on line 9 in omni_sentinel_24h_monitor.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

omni_sentinel_24h_monitor.py#L9

Missing function docstring

Check notice on line 9 in omni_sentinel_24h_monitor.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

omni_sentinel_24h_monitor.py#L9

Missing function or method docstring
timestamp = time.strftime("%Y-%m-%d %H:%M:%S")

# 1. review telemetry (simulated)
# Enhanced to include regulatory compliance factors for MAS FEAT and HKMA Ethics
telemetry = {
"alignment_drift": random.uniform(0.01, 0.15),

Check warning on line 15 in omni_sentinel_24h_monitor.py

View check run for this annotation

Codeac.io / Codeac Code Quality

B311

Standard pseudo-random generators are not suitable for security/cryptographic purposes.
"compute_anomaly": random.uniform(0.01, 0.1),

Check warning on line 16 in omni_sentinel_24h_monitor.py

View check run for this annotation

Codeac.io / Codeac Code Quality

B311

Standard pseudo-random generators are not suitable for security/cryptographic purposes.
"breakout_probability": random.uniform(0.001, 0.05),

Check warning on line 17 in omni_sentinel_24h_monitor.py

View check run for this annotation

Codeac.io / Codeac Code Quality

B311

Standard pseudo-random generators are not suitable for security/cryptographic purposes.

Check warning on line 17 in omni_sentinel_24h_monitor.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

omni_sentinel_24h_monitor.py#L17

Depending on the context, generating weak random numbers may expose cryptographic functions, which rely on these numbers, to be exploitable.

Check warning on line 17 in omni_sentinel_24h_monitor.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

omni_sentinel_24h_monitor.py#L17

Standard pseudo-random generators are not suitable for security/cryptographic purposes.

Check warning on line 17 in omni_sentinel_24h_monitor.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

omni_sentinel_24h_monitor.py#L17

Standard pseudo-random generators are not suitable for security/cryptographic purposes. (B311)
"selection_rates": {
"expert_node_retail_01": random.uniform(0.75, 0.85),

Check warning on line 19 in omni_sentinel_24h_monitor.py

View check run for this annotation

Codeac.io / Codeac Code Quality

B311

Standard pseudo-random generators are not suitable for security/cryptographic purposes.

Check warning on line 19 in omni_sentinel_24h_monitor.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

omni_sentinel_24h_monitor.py#L19

Depending on the context, generating weak random numbers may expose cryptographic functions, which rely on these numbers, to be exploitable.

Check warning on line 19 in omni_sentinel_24h_monitor.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

omni_sentinel_24h_monitor.py#L19

Standard pseudo-random generators are not suitable for security/cryptographic purposes.

Check warning on line 19 in omni_sentinel_24h_monitor.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

omni_sentinel_24h_monitor.py#L19

Standard pseudo-random generators are not suitable for security/cryptographic purposes. (B311)
"expert_node_retail_02": random.uniform(0.75, 0.85)

Check warning on line 20 in omni_sentinel_24h_monitor.py

View check run for this annotation

Codeac.io / Codeac Code Quality

B311

Standard pseudo-random generators are not suitable for security/cryptographic purposes.

Check warning on line 20 in omni_sentinel_24h_monitor.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

omni_sentinel_24h_monitor.py#L20

Depending on the context, generating weak random numbers may expose cryptographic functions, which rely on these numbers, to be exploitable.

Check warning on line 20 in omni_sentinel_24h_monitor.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

omni_sentinel_24h_monitor.py#L20

Standard pseudo-random generators are not suitable for security/cryptographic purposes.

Check warning on line 20 in omni_sentinel_24h_monitor.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

omni_sentinel_24h_monitor.py#L20

Standard pseudo-random generators are not suitable for security/cryptographic purposes. (B311)
},
"attributions": {
"input_variance": random.uniform(-0.1, 0.1),

Check warning on line 23 in omni_sentinel_24h_monitor.py

View check run for this annotation

Codeac.io / Codeac Code Quality

B311

Standard pseudo-random generators are not suitable for security/cryptographic purposes.

Check warning on line 23 in omni_sentinel_24h_monitor.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

omni_sentinel_24h_monitor.py#L23

Depending on the context, generating weak random numbers may expose cryptographic functions, which rely on these numbers, to be exploitable.

Check warning on line 23 in omni_sentinel_24h_monitor.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

omni_sentinel_24h_monitor.py#L23

Standard pseudo-random generators are not suitable for security/cryptographic purposes.

Check warning on line 23 in omni_sentinel_24h_monitor.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

omni_sentinel_24h_monitor.py#L23

Standard pseudo-random generators are not suitable for security/cryptographic purposes. (B311)
"weight_entropy": random.uniform(0.0, 1.0)

Check warning on line 24 in omni_sentinel_24h_monitor.py

View check run for this annotation

Codeac.io / Codeac Code Quality

B311

Standard pseudo-random generators are not suitable for security/cryptographic purposes.

Check warning on line 24 in omni_sentinel_24h_monitor.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

omni_sentinel_24h_monitor.py#L24

Depending on the context, generating weak random numbers may expose cryptographic functions, which rely on these numbers, to be exploitable.

Check warning on line 24 in omni_sentinel_24h_monitor.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

omni_sentinel_24h_monitor.py#L24

Standard pseudo-random generators are not suitable for security/cryptographic purposes.

Check warning on line 24 in omni_sentinel_24h_monitor.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

omni_sentinel_24h_monitor.py#L24

Standard pseudo-random generators are not suitable for security/cryptographic purposes. (B311)
}
}

# 2. calculate G-SRI and Regulatory Compliance Remediation
gsri = gsri_engine.calculate_gsri(telemetry)
compliance = gsri_engine.verify_compliance(telemetry)

# Integrated check: Safety now depends on both G-SRI and Regulatory Fairness (MAS FEAT)
status = "GREEN" if gsri_engine.is_safe(gsri, compliance) else "RED"

# 3. TPM Attestation
attestation = tpm_attestor.validate_attestation()
pcr_match = attestation["PCR_MATCH"]

# 4. Log to WORM with PQC Signature
# Including compliance audit trails (ZK-proof hashes and CAE integrity seals)
log_entries = [
{
"timestamp": timestamp,
"iteration": iteration,
"G-SRI": gsri,
"status": status,
"PCR_MATCH": pcr_match,
"regulatory_audit": {
"mas_feat_proof": compliance["mas_feat"]["proof_hash"],
"hkma_ethics_cae_seal": compliance["hkma_ethics_cae"].get("integrity_seal")
}
}
]
batch_id = time.strftime("%Y%m%d_%H%M%S")
worm_file = worm_logger.commit_batch(batch_id, log_entries)

return {
"timestamp": timestamp,
"iteration": iteration,
"G-SRI": gsri,
"status": status,
"PCR_MATCH": pcr_match,
"WORM_FILE": worm_file
}


def main():
print("Omni-Sentinel Cognitive Execution Environment - 24h Monitor Initializing...")

Expand All @@ -17,44 +75,22 @@
while True:
try:
iteration += 1
timestamp = time.strftime("%Y-%m-%d %H:%M:%S")

# 1. review telemetry (simulated)
telemetry = {
"alignment_drift": random.uniform(0.01, 0.15),
"compute_anomaly": random.uniform(0.01, 0.1),
"breakout_probability": random.uniform(0.001, 0.05)
}

# 2. calculate G-SRI
gsri = gsri_engine.calculate_gsri(telemetry)
status = "GREEN" if gsri_engine.is_safe(gsri) else "RED"

# 3. TPM Attestation
attestation = tpm_attestor.validate_attestation()
pcr_match = attestation["PCR_MATCH"]

# 4. Log to WORM
log_entries = [
{"timestamp": timestamp, "G-SRI": gsri, "status": status, "PCR_MATCH": pcr_match}
]
batch_id = time.strftime("%Y%m%d_%H%M%S")
worm_file = worm_logger.commit_batch(batch_id, log_entries)
result = run_iteration(iteration, gsri_engine, worm_logger, tpm_attestor)

# 5. Output to stdout (for monitor.log)
print(f"[{timestamp}] Iteration {iteration}: G-SRI={gsri} | Status={status} | PCR_MATCH={pcr_match} | WORM_FILE={worm_file}")
print(f"[{result['timestamp']}] Iteration {iteration}: G-SRI={result['G-SRI']} | Status={result['status']} | PCR_MATCH={result['PCR_MATCH']} | WORM_FILE={result['WORM_FILE']}")

Check notice on line 81 in omni_sentinel_24h_monitor.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

omni_sentinel_24h_monitor.py#L81

Line too long (188/120)

Check notice on line 81 in omni_sentinel_24h_monitor.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

omni_sentinel_24h_monitor.py#L81

Line too long (188/120)

Check notice on line 81 in omni_sentinel_24h_monitor.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

omni_sentinel_24h_monitor.py#L81

Line too long (188/159) (line-too-long)
sys.stdout.flush()

# Sleep for 60 seconds (requirement was 15 min check, 1 min allows faster verification for now)
# In a real 24h script we might use longer intervals, but instructions said 15 mins for first checkpoint.
# Sleep for 60 seconds for real-time monitoring simulation
time.sleep(60)

except KeyboardInterrupt:
print("Monitoring stopped by user.")
break
except Exception as e:

Check warning on line 90 in omni_sentinel_24h_monitor.py

View check run for this annotation

Codeac.io / Codeac Code Quality

broad-exception-caught

Catching too general exception Exception
print(f"Error in monitoring loop: {e}")
time.sleep(10)


if __name__ == "__main__":
main()
Binary file not shown.
Binary file not shown.
5 changes: 4 additions & 1 deletion src/governance_engine/compliance_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import json
import numpy as np


class MASFEATCompliance:
"""
Implements MAS FEAT (Fairness, Ethics, Accountability and Transparency) compliance.
Expand Down Expand Up @@ -43,6 +44,7 @@ def generate_zk_fairness_proof(self, selection_rates, threshold=0.1):
"metrics": {"dp_diff": round(dp_diff, 4)}
}


class HKMAEthicsCompliance:
"""
Implements HKMA Ethics compliance.
Expand Down Expand Up @@ -71,11 +73,12 @@ def generate_cae(self, attribution_data):
}
return envelope


class ComplianceEngine:
def __init__(self):
self.mas_feat = MASFEATCompliance()
self.hkma_ethics = HKMAEthicsCompliance()
self.maturity_score = 3.0 # Target Maturity Score for Q4 2026
self.maturity_score = 3.0 # Target Maturity Score for Q4 2026

def run_remediation_audit(self, telemetry):
"""
Expand Down
2 changes: 2 additions & 0 deletions src/governance_engine/gsri_scoring_engine.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import numpy as np
from src.governance_engine.compliance_engine import ComplianceEngine


class GSRIScoringEngine:
"""
Bayesian-based systemic risk monitor for the Omni-Sentinel environment.
Expand Down Expand Up @@ -30,7 +31,7 @@
# Posterior risk (simplified)
posterior = (likelihood * self.prior_risk) / (likelihood * self.prior_risk + (1 - likelihood) * (1 - self.prior_risk))

gsri = posterior * 100

Check warning on line 34 in src/governance_engine/gsri_scoring_engine.py

View check run for this annotation

Codeac.io / Codeac Code Quality

redefined-outer-name

Redefining name 'gsri' from outer scope (line 64)
return round(gsri, 2)

def verify_compliance(self, telemetry_data):
Expand All @@ -39,7 +40,7 @@
"""
return self.compliance_engine.run_remediation_audit(telemetry_data)

def is_safe(self, gsri, compliance_results=None):

Check warning on line 43 in src/governance_engine/gsri_scoring_engine.py

View check run for this annotation

Codeac.io / Codeac Code Quality

redefined-outer-name

Redefining name 'gsri' from outer scope (line 64)
"""
Determines if the environment is safe based on GSRI and optional compliance status.
"""
Expand All @@ -50,6 +51,7 @@

return gsri < self.threshold


if __name__ == "__main__":
engine = GSRIScoringEngine()
test_data = {
Expand Down
Binary file modified src/infrastructure/__pycache__/pqc_worm_logger.cpython-312.pyc
Binary file not shown.
Binary file modified src/infrastructure/__pycache__/tpm_attestor.cpython-312.pyc
Binary file not shown.
2 changes: 2 additions & 0 deletions src/infrastructure/pqc_worm_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import json
import os


class PQCWormLogger:
"""
ML-DSA signed WORM audit logging simulation.
Expand All @@ -19,7 +20,7 @@
# In a real scenario, this would use a Dilithium/ML-DSA private key
return hashlib.sha3_512(content + b"private_key_sim").hexdigest()

def commit_batch(self, batch_id, entries):

Check warning on line 23 in src/infrastructure/pqc_worm_logger.py

View check run for this annotation

Codeac.io / Codeac Code Quality

redefined-outer-name

Redefining name 'batch_id' from outer scope (line 48)

Check warning on line 23 in src/infrastructure/pqc_worm_logger.py

View check run for this annotation

Codeac.io / Codeac Code Quality

redefined-outer-name

Redefining name 'entries' from outer scope (line 49)
"""Commits a batch of logs with a PQC signature."""
timestamp = time.strftime("%Y%m%d_%H%M%S")
batch_data = {
Expand All @@ -34,13 +35,14 @@

# WORM behavior: fail if file exists
if os.path.exists(filepath):
raise Exception(f"WORM Violation: File {filename} already exists and is locked.")

Check warning on line 38 in src/infrastructure/pqc_worm_logger.py

View check run for this annotation

Codeac.io / Codeac Code Quality

broad-exception-raised

Raising too general exception: Exception

with open(filepath, "w") as f:

Check warning on line 40 in src/infrastructure/pqc_worm_logger.py

View check run for this annotation

Codeac.io / Codeac Code Quality

unspecified-encoding

Using open without explicitly specifying an encoding
json.dump(batch_data, f, indent=2)

return filename


if __name__ == "__main__":
logger = PQCWormLogger()
batch_id = "20260601_TEST"
Expand Down
8 changes: 5 additions & 3 deletions src/infrastructure/tpm_attestor.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import hashlib


class TPMAttestor:
"""
TEE/TPM PCR attestation simulation.
Expand All @@ -8,9 +9,9 @@ class TPMAttestor:
def __init__(self):
# Simulated Golden PCR values (Simplified)
self.golden_pcr = {
"PCR_0": "a1b2c3d4e5f6g7h8i9j0", # Core Boot
"PCR_7": "f6g7h8i9j0a1b2c3d4e5", # Secure Boot State
"PCR_10": "c3d4e5f6g7h8i9j0a1b2" # IMA logs
"PCR_0": "a1b2c3d4e5f6g7h8i9j0", # Core Boot
"PCR_7": "f6g7h8i9j0a1b2c3d4e5", # Secure Boot State
"PCR_10": "c3d4e5f6g7h8i9j0a1b2" # IMA logs
}

def measure_runtime_pcr(self):
Expand All @@ -29,6 +30,7 @@ def validate_attestation(self):
"evidence": hashlib.sha256(str(current_pcr).encode()).hexdigest()
}


if __name__ == "__main__":
attestor = TPMAttestor()
result = attestor.validate_attestation()
Expand Down
Binary file removed tests/__pycache__/__init__.cpython-312.pyc
Binary file not shown.
Binary file modified tests/__pycache__/test_compliance.cpython-312.pyc
Binary file not shown.
Binary file modified tests/__pycache__/test_governance.cpython-312.pyc
Binary file not shown.
Binary file added tests/__pycache__/test_monitor.cpython-312.pyc
Binary file not shown.
4 changes: 3 additions & 1 deletion tests/test_compliance.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from src.governance_engine.compliance_engine import ComplianceEngine, MASFEATCompliance, HKMAEthicsCompliance
from src.governance_engine.gsri_scoring_engine import GSRIScoringEngine


class TestComplianceSystem(unittest.TestCase):
def setUp(self):
self.engine = ComplianceEngine()
Expand Down Expand Up @@ -34,7 +35,7 @@ def test_gsri_compliance_integration(self):
gsri_engine = GSRIScoringEngine()
telemetry = {
"drift": 0.05,
"selection_rates": {"a": 0.5, "b": 0.8} # Unfair
"selection_rates": {"a": 0.5, "b": 0.8} # Unfair
}
gsri = gsri_engine.calculate_gsri(telemetry)
compliance = gsri_engine.verify_compliance(telemetry)
Expand All @@ -43,5 +44,6 @@ def test_gsri_compliance_integration(self):
self.assertFalse(compliance["mas_feat"]["fairness_verified"])
self.assertEqual(compliance["ethics_maturity_score"], 3.0)


if __name__ == "__main__":
unittest.main()
2 changes: 2 additions & 0 deletions tests/test_governance.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from src.infrastructure.pqc_worm_logger import PQCWormLogger
from src.infrastructure.tpm_attestor import TPMAttestor


class TestGovernanceSystem(unittest.TestCase):
def setUp(self):
self.test_bucket = "test_worm_bucket"
Expand Down Expand Up @@ -39,7 +40,7 @@
filepath = os.path.join(self.test_bucket, filename)
self.assertTrue(os.path.exists(filepath))

with open(filepath, 'r') as f:

Check warning on line 43 in tests/test_governance.py

View check run for this annotation

Codeac.io / Codeac Code Quality

unspecified-encoding

Using open without explicitly specifying an encoding
data = json.load(f)
self.assertEqual(data["batch_id"], batch_id)
self.assertIn("pqc_signature", data)
Expand All @@ -50,5 +51,6 @@
self.assertTrue(result["PCR_MATCH"])
self.assertEqual(result["status"], "VALIDATED")


if __name__ == "__main__":
unittest.main()
48 changes: 48 additions & 0 deletions tests/test_monitor.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import unittest

Check notice on line 1 in tests/test_monitor.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

tests/test_monitor.py#L1

Missing module docstring

Check notice on line 1 in tests/test_monitor.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

tests/test_monitor.py#L1

Missing module docstring

Check warning on line 1 in tests/test_monitor.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

tests/test_monitor.py#L1

import missing `from __future__ import absolute_import`
import os
import shutil
import json
from src.governance_engine.gsri_scoring_engine import GSRIScoringEngine
from src.infrastructure.pqc_worm_logger import PQCWormLogger
from src.infrastructure.tpm_attestor import TPMAttestor
from omni_sentinel_24h_monitor import run_iteration


class TestMonitorSystem(unittest.TestCase):

Check notice on line 11 in tests/test_monitor.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

tests/test_monitor.py#L11

Missing class docstring

Check notice on line 11 in tests/test_monitor.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

tests/test_monitor.py#L11

Missing class docstring
def setUp(self):
self.test_bucket = "test_monitor_worm_bucket"
if os.path.exists(self.test_bucket):
shutil.rmtree(self.test_bucket)
self.gsri_engine = GSRIScoringEngine()
self.worm_logger = PQCWormLogger(bucket_path=self.test_bucket)
self.tpm_attestor = TPMAttestor()

def tearDown(self):
if os.path.exists(self.test_bucket):
shutil.rmtree(self.test_bucket)

def test_run_iteration(self):

Check notice on line 24 in tests/test_monitor.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

tests/test_monitor.py#L24

Missing function or method docstring

Check notice on line 24 in tests/test_monitor.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

tests/test_monitor.py#L24

Missing method docstring
# Run a single iteration
result = run_iteration(1, self.gsri_engine, self.worm_logger, self.tpm_attestor)

# Basic field checks
self.assertEqual(result["iteration"], 1)
self.assertIn("G-SRI", result)
self.assertIn("status", result)
self.assertIn("PCR_MATCH", result)
self.assertIn("WORM_FILE", result)

# Verify WORM file exists and contains regulatory audit data
filepath = os.path.join(self.test_bucket, result["WORM_FILE"])
self.assertTrue(os.path.exists(filepath))

with open(filepath, 'r') as f:

Check warning on line 39 in tests/test_monitor.py

View check run for this annotation

Codeac.io / Codeac Code Quality

unspecified-encoding

Using open without explicitly specifying an encoding

Check warning on line 39 in tests/test_monitor.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

tests/test_monitor.py#L39

Missing 'encoding' parameter. 'open()' uses device locale encodings by default, corrupting files with special characters.

Check warning on line 39 in tests/test_monitor.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

tests/test_monitor.py#L39

Using open without explicitly specifying an encoding

Check notice on line 39 in tests/test_monitor.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

tests/test_monitor.py#L39

Variable name "f" doesn't conform to '[a-z_][a-z0-9_]{2,30}$' pattern

Check notice on line 39 in tests/test_monitor.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

tests/test_monitor.py#L39

Variable name "f" doesn't conform to '[a-z_][a-z0-9_]{2,30}$' pattern
data = json.load(f)
Comment thread
OneFineStarstuff marked this conversation as resolved.
entry = data["entries"][0]
self.assertIn("regulatory_audit", entry)
self.assertIn("mas_feat_proof", entry["regulatory_audit"])
self.assertIn("hkma_ethics_cae_seal", entry["regulatory_audit"])


if __name__ == "__main__":
unittest.main()