Skip to content

kareiva/tconnmap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TConMap - Terminal Network Connection Map

A Node.js terminal application that displays a real-world map with live network connection monitoring. Shows active foreign connections as red dots on an ASCII world map using precise geographic data and Braille Unicode characters.

Features

  • 🌍 Real-time World Map: ASCII world map with accurate continent borders using Braille Unicode patterns
  • 🔴 Live Network Monitoring: Real-time display of foreign network connections via netstat -ntu
  • 🌐 GeoIP Integration: Automatic country identification for foreign IP addresses
  • 📍 Visual Connection Display: Red dots placed on countries with active connections
  • 🏷️ Connection Labels: Country codes and IP addresses displayed next to connection points
  • 📏 Mercator Projection: Accurate geographic coordinate conversion
  • 📱 Responsive Design: Automatically adapts to terminal dimensions
  • Auto-refresh: Updates every second to show live connection changes
  • 🎯 Clean Exit: Graceful shutdown with Ctrl+C

Installation

  1. Clone or download this repository
  2. Install dependencies:
    npm install

Usage

Run the application:

npm start

The application will:

  1. Load world geographic data and GeoIP database
  2. Display the world map with continent borders
  3. Monitor network connections in real-time
  4. Show red dots for countries with active foreign connections
  5. Update every second automatically

To exit: Press Ctrl+C

Data Sources

  • World Geography: GeoJSON continent data from public sources
  • GeoIP Database: IP2Location Lite database for country identification
  • Network Data: Live system network connections via netstat -ntu

Map Legend

  • Blue dots (⠀): Ocean/water areas
  • White Braille patterns: Continent borders and coastlines
  • Red dots (●): Countries with active network connections
  • Yellow text: Country codes and IP addresses (e.g., "US 8.8.8.8")

How It Works

Geographic Rendering

  1. Data Loading: Loads GeoJSON continent boundary data
  2. Mercator Projection: Converts latitude/longitude to terminal coordinates
  3. Border Drawing: Uses Bresenham's line algorithm with directional Braille characters
  4. Optimized Display: Excludes Antarctica (below 66.5°S) to maximize usable space

Network Monitoring

  1. Connection Scanning: Executes netstat -ntu to get active TCP/UDP connections
  2. IP Filtering: Filters out private/local addresses (192.168.x.x, 10.x.x.x, etc.)
  3. GeoIP Lookup: Identifies country for each foreign IP using binary search
  4. Visual Mapping: Places red dots at approximate country centers
  5. Label Display: Shows country code and IP address next to each connection

Real-time Updates

  • 1-second refresh cycle: Continuously monitors network changes
  • Dynamic sizing: Adjusts to terminal window resizing
  • Memory efficient: Reuses loaded geographic and GeoIP data

Requirements

  • Node.js: 16+ (for ES modules support)
  • Operating System: Linux/Unix (for netstat command)
  • Terminal: Color support recommended
  • Minimum Size: 40x15 characters
  • Network: Active internet connections to see foreign IPs

Files

Core Application

  • index.js - Main application with map rendering and network monitoring
  • geoip.js - GeoIP lookup module for country identification

Data Files

  • continents-geojson.json - World continent boundary data in GeoJSON format
  • IP2LOCATION-LITE-DB1.CSV - IP-to-country database (253K+ ranges)
  • continent-borders.json - Additional geographic boundary data

Configuration

  • package.json - Project dependencies and scripts
  • package-lock.json - Dependency lock file

Dependencies

  • chalk: Terminal color styling and formatting
  • fs: File system operations for data loading
  • child_process: System command execution for netstat
  • util: Promise utilities for async operations

Privacy & Security

  • Local Processing: All GeoIP lookups performed locally using downloaded database
  • No External Calls: No data sent to external services during operation
  • System Monitoring: Only monitors outbound connections visible to netstat
  • Public IPs Only: Private/internal IP addresses are filtered out

Troubleshooting

No connections showing?

  • Ensure you have active internet connections
  • Try browsing the web or using network applications
  • Check that netstat -ntu works in your terminal

Map looks distorted?

  • Increase terminal window size (minimum 40x15)
  • Ensure terminal supports Unicode Braille characters
  • Try a different terminal emulator if characters don't display properly

Application won't start?

  • Verify Node.js 16+ is installed
  • Run npm install to ensure dependencies are installed
  • Check that data files (GeoJSON, CSV) are present in the directory

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors