### Run Lumen Server Source: https://github.com/naim94a/lumen/blob/master/README.md Starts the Lumen server using a configuration file. Ensure the config.toml file exists. ```bash ./lumen -c config.toml ``` -------------------------------- ### Lumen TOML Configuration Example Source: https://github.com/naim94a/lumen/wiki/Setting-up-Lumen This TOML file configures Lumen's network interface, TLS settings, and database connection details. Ensure the `connection_info` string is correctly formatted for your PostgreSQL setup. ```toml [lumina] # Set the interface on which Lumen will listen on. bind_addr = "0.0.0.0:1234" # Sets if IDA must use TLS or not. use_tls = false # This section is only required when `use_tls` is set to true. [lumina.tls] # Specify the server's certificate. # Clients connecting to the server must match this certificate. # If the certificate is password protected, the password can be specified in the `PKCSPASSWD` environment variable. server_cert = "private/certs/animul.p12" [database] # Specifies a postgresql connection string. All variables can be found here: https://docs.rs/tokio-postgres/0.6.0/tokio_postgres/config/struct.Config.html connection_info = "host=127.0.0.1 port=32768 user=postgres password=1" # Sets if the database connection should be made using TLS. use_tls = false # If the database requires a secure connection, paths to server-ca and client-id certificates can be set here: #server_ca = "db_ca.pem" #client_id = "db_id.p12" ``` -------------------------------- ### Database Schema Setup Source: https://context7.com/naim94a/lumen/llms.txt SQL script to initialize the lumendb database and create tables for users, files, database associations, and function metadata. ```sql -- Manual schema setup (alternative to diesel migrations) -- Create the lumen database CREATE DATABASE lumendb; -- Connect and create tables \c lumendb -- Users table stores IDA license information CREATE TABLE users ( id SERIAL PRIMARY KEY, lic_id BYTEA NOT NULL, lic_data BYTEA NOT NULL, hostname VARCHAR NOT NULL, UNIQUE (lic_id, lic_data, hostname) ); -- Files table stores analyzed binary checksums CREATE TABLE files ( id SERIAL PRIMARY KEY, chksum BYTEA NOT NULL UNIQUE ); -- Database associations CREATE TABLE dbs ( id SERIAL PRIMARY KEY, user_id INTEGER REFERENCES users(id), file_id INTEGER REFERENCES files(id), file_path VARCHAR NOT NULL, idb_path VARCHAR NOT NULL, UNIQUE (user_id, file_id, file_path, idb_path) ); -- Functions table stores signatures and metadata CREATE TABLE funcs ( id SERIAL PRIMARY KEY, name VARCHAR NOT NULL, len INTEGER NOT NULL, chksum BYTEA NOT NULL, metadata BYTEA NOT NULL, rank INTEGER NOT NULL, db_id INTEGER REFERENCES dbs(id), update_dt TIMESTAMP DEFAULT CURRENT_TIMESTAMP, UNIQUE (chksum, db_id) ); CREATE INDEX idx_funcs_chksum ON funcs(chksum); ``` -------------------------------- ### Install and Run Diesel CLI for PostgreSQL Migrations Source: https://github.com/naim94a/lumen/blob/master/README.md Installs the Diesel CLI for PostgreSQL and runs database migrations. Ensure PostgreSQL is installed and accessible. ```bash cargo install diesel_cli --no-default-features -Fpostgres diesel --config-file common/diesel.toml \ --database-url postgres://postgres:password@localhost/lumen \ migration run ``` -------------------------------- ### Configure IDA Pro < 8.1 Lumina Settings Source: https://github.com/naim94a/lumen/blob/master/README.md Example configuration for older IDA Pro versions. Modify ida.cfg to set the Lumen server host, port, and TLS status. ```C LUMINA_HOST = "192.168.1.1"; LUMINA_PORT = 1234 // Only if TLS isn't used: LUMINA_TLS = NO ``` -------------------------------- ### Setup IDA Pro Lumina Server (Windows) Source: https://github.com/naim94a/lumen/blob/master/README.md Batch script to configure IDA Pro for Lumen on Windows. Sets the LUMINA_TLS environment variable and launches IDA. Save as ida_lumen.bat. ```batch set LUMINA_TLS=false %1 ``` -------------------------------- ### Windows Setup Script for IDA Pro Source: https://context7.com/naim94a/lumen/llms.txt This batch script configures environment variables for Lumen host, port, and TLS settings before executing the provided command. Ensure Lumen server details are correctly set. ```batch :: Windows setup script (ida_lumen.bat) @echo off set LUMINA_HOST=192.168.1.100 set LUMINA_PORT=1234 set LUMINA_TLS=false %1 :: Usage: ida_lumen.bat ida64.exe ``` -------------------------------- ### Setup IDA Pro Lumina Server (Linux) Source: https://github.com/naim94a/lumen/blob/master/README.md Shell script to configure IDA Pro for Lumen on Linux. Sets the LUMINA_TLS environment variable and launches IDA. Save as ida_lumen.sh and make executable. ```shell #!/bin/sh export LUMINA_TLS=false $1 ``` -------------------------------- ### Diesel CLI for PostgreSQL Migrations Source: https://context7.com/naim94a/lumen/llms.txt Installs the Diesel CLI with PostgreSQL support and runs database migrations using a specified configuration file and database URL. This sets up the necessary tables for storing function metadata. ```bash # Install diesel CLI with PostgreSQL support cargo install diesel_cli --no-default-features -F postgres # Run migrations to create tables diesel --config-file common/diesel.toml \ --database-url postgres://lumina:password@localhost/lumendb \ migration run # Database tables created: # - users: IDA license info and hostnames # - files: Binary file checksums (MD5) # - dbs: IDB database paths and associations ``` -------------------------------- ### Export Public Key for IDA Source: https://github.com/naim94a/lumen/wiki/Creating-TLS-Certificates Extract the public key from the certificate and save it as a .crt file. This file should be copied to the IDA installation folder. ```sh # export public-key for IDA; Copy hexrays.crt to IDA installation folder openssl x509 -in lumen.pem -out hexrays.crt ``` -------------------------------- ### Query Functions by File Hash using cURL Source: https://context7.com/naim94a/lumen/llms.txt Retrieve all function signatures for a given binary file using its MD5 hash. The response is a JSON array of function objects. Ensure `jq` is installed for pretty-printing the output. ```bash # Get all functions in a file by MD5 hash curl -s http://localhost:8082/api/files/d41d8cd98f00b204e9800998ecf8427e | jq ``` ```json [ { "hash": "a1b2c3d4e5f6789012345678abcdef01", "len": 256, "name": "main" }, { "hash": "fedcba9876543210fedcba9876543210", "len": 128, "name": "initialize_subsystem" } ] ``` ```bash # Example with real binary analysis # 1. Get MD5 of your binary md5sum /path/to/binary.exe # Output: 0123456789abcdef0123456789abcdef /path/to/binary.exe # 2. Query Lumen for known functions curl -s http://localhost:8082/api/files/0123456789abcdef0123456789abcdef ``` -------------------------------- ### Docker Commands for Lumen Source: https://context7.com/naim94a/lumen/llms.txt Manage the Lumen Docker stack using Docker Compose commands. Start the services in detached mode, view logs, and manage custom TLS certificates and configuration files within the ./dockershare directory. ```bash # Start the stack docker-compose up -d # View logs docker-compose logs -f lumina # Custom TLS setup: place certificates in ./dockershare/ # - lumen.p12: Server certificate for IDA connections # - config.toml: Custom configuration (optional) # Generated hexrays.crt will appear in ./dockershare/ for IDA configuration ``` -------------------------------- ### Build Lumen from Source Source: https://github.com/naim94a/lumen/wiki/Setting-up-Lumen Follow these steps to clone the Lumen repository and build the release executable using Cargo. ```bash git clone https://github.com/naim94a/lumen cd lumen cargo build --release ``` -------------------------------- ### Build and Run Lumen Server Source: https://context7.com/naim94a/lumen/llms.txt Build the Lumen server from source using Cargo and run it with a specified configuration file. Environment variables can be used to control logging and certificate passwords. ```bash # Build from source git clone https://github.com/naim94a/lumen.git cd lumen cargo build --release # Run with default config ./target/release/lumen -c config.toml # Environment variables export PKCSPASSWD="your_certificate_password" # For encrypted TLS certificates export RUST_LOG="lumen=debug" # Enable debug logging # Example output on successful start # [INFO lumen::server] starting private lumen server... # [INFO lumen::server] starting http api server on 0.0.0.0:8082 # [INFO lumen::server] listening on 0.0.0.0:1234 secure=false ``` -------------------------------- ### Create PostgreSQL Database Source: https://github.com/naim94a/lumen/wiki/Setting-up-Lumen Use the `createdb` command to initialize a new PostgreSQL database for Lumen. ```sh createdb lumendb ``` -------------------------------- ### Apply Database Schema Source: https://github.com/naim94a/lumen/wiki/Setting-up-Lumen Execute the `schema.sql` script using `psql` to create the necessary tables in the Lumen database. ```sh psql < schema.sql ``` -------------------------------- ### Lumen Server Configuration (TOML) Source: https://context7.com/naim94a/lumen/llms.txt Configure Lumen server settings including network bindings, TLS, database connection, and optional HTTP API. Ensure correct paths for TLS certificates when use_tls is enabled. ```toml [lumina] # Address for IDA Pro connections bind_addr = "0.0.0.0:1234" # Enable TLS for secure connections use_tls = false # Server name displayed in IDA output server_name = "lumen" # Allow clients to delete metadata allow_deletes = false # Limit function histories returned (0 = disabled) get_history_limit = 50 # TLS configuration (required when use_tls = true) [lumina.tls] server_cert = "path/to/lumen.p12" [database] # PostgreSQL connection string connection_info = "postgres://lumina:password@localhost/lumendb" use_tls = false # Optional: TLS certificates for database connection # server_ca = "db_ca.pem" # client_id = "db_id.p12" # Optional: Enable HTTP API server [api_server] bind_addr = "0.0.0.0:8082" ``` -------------------------------- ### Server Configuration Limits Source: https://context7.com/naim94a/lumen/llms.txt Configuration settings for timeouts and resource limits, provided in TOML format and Rust implementation. ```toml # Add to config.toml for custom limits [limits] # Maximum idle time between commands (default: 1 hour) command_timeout = { secs = 3600, nanos = 0 } # Maximum time for PULL_MD queries (default: 4 minutes) pull_md_timeout = { secs = 240, nanos = 0 } # Maximum time to wait for HELLO message (default: 15 seconds) hello_timeout = { secs = 15, nanos = 0 } # Maximum time for TLS handshake (default: 10 seconds) tls_handshake_timeout = { secs = 10, nanos = 0 } ``` ```rust // Default limit values (in code) impl Default for Limits { fn default() -> Self { Self { command_timeout: Duration::from_secs(3600), // 1 hour pull_md_timeout: Duration::from_secs(4 * 60), // 4 minutes hello_timeout: Duration::from_secs(15), // 15 seconds tls_handshake_timeout: Duration::from_secs(10), // 10 seconds } } } ``` -------------------------------- ### IDA Pro Configuration for Lumen Source: https://context7.com/naim94a/lumen/llms.txt Configure IDA Pro 8.1+ to connect to the Lumen server by setting environment variables for the host, port, and TLS status. The provided script is a template for Linux systems. ```bash # Linux setup script (ida_lumen.sh) #!/bin/sh export LUMINA_HOST=192.168.1.100 export LUMINA_PORT=1234 export LUMINA_TLS=false $1 ``` -------------------------------- ### Docker Compose for Lumen Deployment Source: https://context7.com/naim94a/lumen/llms.txt Deploy Lumen and PostgreSQL using Docker Compose for a production environment. Configure database credentials and map ports for Lumina and HTTP API access. Mount volumes for persistent data and custom TLS certificates. ```yaml # docker-compose.yml name: lumen volumes: postgres_data: services: db: image: postgres:15.1-alpine container_name: lumina-postgres healthcheck: test: ["CMD", "pg_isready", "-U", "lumina"] interval: 5s retries: 10 timeout: 5s environment: POSTGRES_USER: lumina POSTGRES_DB: lumina POSTGRES_PASSWORD: your_secure_password expose: - "5432" volumes: - postgres_data:/var/lib/postgresql lumina: image: ghcr.io/naim94a/lumen:master depends_on: db: condition: service_healthy ports: - 1234:1234 # Lumina protocol - 8082:8082 # HTTP API environment: PKCSPASSWD: ${PKCSPASSWD} DATABASE_URL: postgres://lumina:your_secure_password@db/lumina volumes: - ./dockershare:/dockershare links: - db ``` -------------------------------- ### HTTP API - Query Functions by File Hash Source: https://context7.com/naim94a/lumen/llms.txt Retrieve all function signatures associated with a specific binary file using its MD5 hash. ```APIDOC ## GET /api/files/{hash} ### Description Retrieve all function signatures associated with a specific binary file using its MD5 hash. ### Method GET ### Endpoint /api/files/{hash} ### Parameters #### Path Parameters - **hash** (string) - Required - The MD5 hash of the binary file. ### Response #### Success Response (200) - **array** - A list of function objects. - **hash** (string) - The MD5 hash of the function signature. - **len** (integer) - The length of the function. - **name** (string) - The name of the function. ### Response Example ```json [ { "hash": "a1b2c3d4e5f6789012345678abcdef01", "len": 256, "name": "main" }, { "hash": "fedcba9876543210fedcba9876543210", "len": 128, "name": "initialize_subsystem" } ] ``` ``` -------------------------------- ### Generate TLS Certificates for Lumen Source: https://github.com/naim94a/lumen/blob/master/README.md Commands to generate self-signed TLS certificates for Lumen communication with IDA Pro. Includes creating a certificate, converting to PKCS12, and exporting the public key for IDA. ```bash # create a certificate openssl req -x509 -newkey rsa:4096 -keyout lumen_key.pem -out lumen_crt.pem -days 365 -nodes # convert to pkcs12 for lumen; used for `lumen.tls` in config openssl pkcs12 -export -out lumen.p12 -inkey lumen_key.pem -in lumen_crt.pem # export public-key for IDA; Copy hexrays.crt to IDA installation folder openssl x509 -in lumen_crt.pem -out hexrays.crt ``` -------------------------------- ### Configure OpenSSL for Server Authentication Source: https://github.com/naim94a/lumen/wiki/Creating-TLS-Certificates Modify the openssl.conf file to include the 'serverAuth' extension in certificate requests. This is necessary for some IDA versions. ```ini [ v3_req ] extendedKeyUsage = serverAuth ``` -------------------------------- ### HTTP API - Query Function Details by Hash Source: https://context7.com/naim94a/lumen/llms.txt Retrieve detailed function information including name, comments, and associated files by function signature hash. ```APIDOC ## GET /api/funcs/{hash} ### Description Retrieve detailed function information including name, comments, and associated files by function signature hash. ### Method GET ### Endpoint /api/funcs/{hash} ### Parameters #### Path Parameters - **hash** (string) - Required - The function signature hash. ### Response #### Success Response (200) - **array** - A list of function detail objects. - **name** (string) - The name of the function. - **length** (integer) - The length of the function. - **comments** (array) - A list of comments associated with the function. - **type** (object) - The type of comment. - **Function** (object) - Indicates a comment on the function itself. - **repeatable** (boolean) - Whether the comment can be repeated. - **Byte** (object) - Indicates a comment at a specific byte offset. - **repeatable** (boolean) - Whether the comment can be repeated. - **Anterior** (string) - Indicates a comment appearing before an instruction. - **Posterior** (string) - Indicates a comment appearing after an instruction. - **comment** (string) - The comment text. - **offset** (integer) - The offset within the function where the comment applies (for Byte, Anterior, Posterior types). - **in_files** (array) - A list of file hashes where this function is found. ### Response Example ```json [ { "name": "decrypt_payload", "length": 512, "comments": [ { "type": {"Function": {"repeatable": false}}, "comment": "Decrypts AES-256 encrypted payload using hardcoded key" }, { "offset": 16, "type": {"Byte": {"repeatable": true}}, "comment": "XOR key initialization" }, { "offset": 48, "type": "Anterior", "comment": "; Main decryption loop" }, { "offset": 128, "type": "Posterior", "comment": "; Returns decrypted buffer pointer" } ], "in_files": [ "0123456789abcdef0123456789abcdef", "fedcba9876543210fedcba9876543210" ] } ] ``` ``` -------------------------------- ### Generate Lumen Certificate and Key Source: https://github.com/naim94a/lumen/wiki/Creating-TLS-Certificates Create a self-signed certificate and private key with the server authentication extension. The certificate is valid for 365 days. ```sh # create a certificate openssl req -x509 -newkey rsa:4096 -keyout lumen_key.pem -out lumen_crt.pem -days 365 -nodes -extensions v3_req ``` -------------------------------- ### Convert Certificate to PKCS12 Format Source: https://github.com/naim94a/lumen/wiki/Creating-TLS-Certificates Export the generated certificate and private key into a PKCS12 file, which is a common format for storing cryptographic objects. ```sh # convert to pkcs12 for lumen. openssl pkcs12 -export -out lumen.p12 -inkey lumen_key.pem -in lumen_crt.pem ``` -------------------------------- ### Fetch Prometheus Server Metrics Source: https://context7.com/naim94a/lumen/llms.txt Retrieve Prometheus-compatible metrics from the Lumen server to monitor activity and performance. This endpoint provides counters and gauges for various server operations. ```bash # Fetch server metrics curl -s http://localhost:8082/metrics ``` ```text # Example metrics output # HELP lumen_pulls_total Total number of function pulls # TYPE lumen_pulls_total counter lumen_pulls_total 15234 # HELP lumen_pushes_total Total number of function pushes # TYPE lumen_pushes_total counter lumen_pushes_total 8921 # HELP lumen_new_funcs_total Total new functions added # TYPE lumen_new_funcs_total counter lumen_new_funcs_total 4523 # HELP lumen_queried_funcs_total Total functions queried # TYPE lumen_queried_funcs_total counter lumen_queried_funcs_total 45678 # HELP lumen_active_connections Current active connections # TYPE lumen_active_connections gauge lumen_active_connections 3 # HELP lumen_lumina_version Client protocol versions # TYPE lumen_lumina_version counter lumen_lumina_version{protocol_version="5"} 127 lumen_lumina_version{protocol_version="4"} 43 ``` -------------------------------- ### HTTP API - Prometheus Metrics Source: https://context7.com/naim94a/lumen/llms.txt Monitor server activity and performance through the Prometheus-compatible metrics endpoint. ```APIDOC ## GET /metrics ### Description Exposes Prometheus-compatible metrics for monitoring server activity and performance. ### Method GET ### Endpoint /metrics ### Response #### Success Response (200) - **text/plain** - Prometheus metrics format. ### Response Example ``` # HELP lumen_pulls_total Total number of function pulls # TYPE lumen_pulls_total counter lumen_pulls_total 15234 # HELP lumen_pushes_total Total number of function pushes # TYPE lumen_pushes_total counter lumen_pushes_total 8921 # HELP lumen_new_funcs_total Total new functions added # TYPE lumen_new_funcs_total counter lumen_new_funcs_total 4523 # HELP lumen_queried_funcs_total Total functions queried # TYPE lumen_queried_funcs_total counter lumen_queried_funcs_total 45678 # HELP lumen_active_connections Current active connections # TYPE lumen_active_connections gauge lumen_active_connections 3 # HELP lumen_lumina_version Client protocol versions # TYPE lumen_lumina_version counter lumen_lumina_version{protocol_version="5"} 127 lumen_lumina_version{protocol_version="4"} 43 ``` ``` -------------------------------- ### Prometheus Scrape Configuration Source: https://context7.com/naim94a/lumen/llms.txt This YAML configuration defines how Prometheus should scrape metrics from the Lumen server. It specifies the job name, target, metrics path, and scrape interval. ```yaml # Prometheus scrape configuration scrape_configs: - job_name: 'lumen' static_configs: - targets: ['localhost:8082'] metrics_path: '/metrics' scrape_interval: 30s ``` -------------------------------- ### Query Function Details by Hash using cURL Source: https://context7.com/naim94a/lumen/llms.txt Retrieve detailed information about a specific function, including its name, length, comments, and associated files, using its signature hash. Comments can be of various types like 'Function', 'Byte', 'Anterior', or 'Posterior'. ```bash # Get function details by signature hash curl -s http://localhost:8082/api/funcs/a1b2c3d4e5f6789012345678abcdef01 | jq ``` ```json [ { "name": "decrypt_payload", "length": 512, "comments": [ { "type": {"Function": {"repeatable": false}}, "comment": "Decrypts AES-256 encrypted payload using hardcoded key" }, { "offset": 16, "type": {"Byte": {"repeatable": true}}, "comment": "XOR key initialization" }, { "offset": 48, "type": "Anterior", "comment": "; Main decryption loop" }, { "offset": 128, "type": "Posterior", "comment": "; Returns decrypted buffer pointer" } ], "in_files": [ "0123456789abcdef0123456789abcdef", "fedcba9876543210fedcba9876543210" ] } ] ``` ```text # Comment types explained: # - Function: Comment on the function itself (repeatable or not) # - Byte: Comment at specific offset within function # - Anterior: Comment appearing before an instruction # - Posterior: Comment appearing after an instruction ``` -------------------------------- ### Generate TLS Certificates for Lumen Source: https://context7.com/naim94a/lumen/llms.txt Generate self-signed TLS certificates for secure Lumen server connections. This process involves creating an RSA key, a certificate signing request, and exporting to PKCS12 and PEM formats. Ensure the openssl.cnf includes the 'v3_req' extension for server authentication. ```bash # Configure openssl for server authentication (add to openssl.cnf) # [ v3_req ] # extendedKeyUsage = serverAuth # Generate certificate with 4096-bit RSA key openssl req -x509 -newkey rsa:4096 \ -keyout lumen_key.pem \ -out lumen_crt.pem \ -days 365 \ -nodes \ -extensions v3_req \ -subj "/CN=lumen-server" # Convert to PKCS12 format for Lumen server openssl pkcs12 -export \ -out lumen.p12 \ -inkey lumen_key.pem \ -in lumen_crt.pem \ -passout pass:your_password # Export public certificate for IDA Pro # Copy hexrays.crt to IDA installation directory openssl x509 -in lumen_crt.pem -out hexrays.crt # Verify the certificate openssl x509 -in hexrays.crt -text -noout ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.