{"id":37080770,"url":"https://github.com/wachawo/lancalc","last_synced_at":"2026-01-14T09:48:22.130Z","repository":{"id":310121792,"uuid":"1038811619","full_name":"wachawo/lancalc","owner":"wachawo","description":"LanCalc is a desktop application built with PyQt5.","archived":false,"fork":false,"pushed_at":"2025-11-03T15:55:13.000Z","size":62,"stargazers_count":11,"open_issues_count":6,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-11-03T17:26:53.045Z","etag":null,"topics":["address","calculator","ip","network","subnet","system-administration","utilities"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/lancalc/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wachawo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":["wachawo"]}},"created_at":"2025-08-15T21:32:54.000Z","updated_at":"2025-11-03T15:55:18.000Z","dependencies_parsed_at":"2025-08-15T22:46:21.219Z","dependency_job_id":"03f20875-edc9-4c50-91f3-90c7bdaa8dfc","html_url":"https://github.com/wachawo/lancalc","commit_stats":null,"previous_names":["wachawo/lancalc"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/wachawo/lancalc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wachawo%2Flancalc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wachawo%2Flancalc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wachawo%2Flancalc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wachawo%2Flancalc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wachawo","download_url":"https://codeload.github.com/wachawo/lancalc/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wachawo%2Flancalc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28416120,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T08:38:59.149Z","status":"ssl_error","status_checked_at":"2026-01-14T08:38:43.588Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["address","calculator","ip","network","subnet","system-administration","utilities"],"created_at":"2026-01-14T09:48:21.449Z","updated_at":"2026-01-14T09:48:22.115Z","avatar_url":"https://github.com/wachawo.png","language":"Python","funding_links":["https://github.com/sponsors/wachawo"],"categories":[],"sub_categories":[],"readme":"# LanCalc\n\n[![CI](https://github.com/wachawo/lancalc/actions/workflows/ci.yml/badge.svg)](https://github.com/wachawo/lancalc/actions/workflows/ci.yml)\n[![PyPI](https://img.shields.io/pypi/v/lancalc.svg)](https://pypi.org/project/lancalc/)\n[![Python](https://img.shields.io/pypi/pyversions/lancalc.svg)](https://pypi.org/project/lancalc/)\n\nLanCalc is a desktop application built with PyQt5, designed to calculate network configurations for Windows, macOS, and Linux systems.\n\n![image](https://github.com/user-attachments/assets/8a4e1226-7ace-4e53-b154-87e0e311100f)\n\n[Download](https://github.com/wachawo/lancalc/releases)\n\nIt provides a user-friendly interface to compute essential network parameters such as network address, broadcast address, the minimum and maximum host addresses, and the number of hosts within a given subnet. \n\nSupport IPv4 address formats, subnet masks and prefixes. This tool is particularly useful for network administrators and IT professionals who require quick calculations of network parameters.\n\n## Quick Start\n\n### Installation\n\nPython 3.9+ is required.\n\n- Default (with GUI):\n\n```bash\npip3 install lancalc\n```\n\n- CLI-only / headless (avoid installing PyQt5):\n\n```bash\n# Install package without dependencies, then only required CLI deps\npip3 install --no-deps lancalc\npip3 install -r requirements.txt\n```\n\n- Install without GUI dependencies:\n\n```bash\n# Install with nogui extras (excludes PyQt5)\npip3 install 'lancalc[nogui]'\n```\n\n- Install from GitHub:\n\n```bash\n# With GUI (default)\npip3 install 'git+https://github.com/wachawo/lancalc.git'\n\n# CLI-only / headless\npip3 install --no-deps 'git+https://github.com/wachawo/lancalc.git'\npip3 install -r requirements.txt\n\n# Without GUI dependencies\npip3 install 'git+https://github.com/wachawo/lancalc.git#egg=lancalc[nogui]'\n```\n\nIf pip is missing:\n\n```bash\ncurl https://bootstrap.pypa.io/get-pip.py -o /tmp/get-pip.py\npython3 /tmp/get-pip.py\n```\n\nIf the `lancalc` command is not found after installation, add the local packages path to PATH:\n\n```bash\nexport PATH=\"$HOME/.local/bin:$PATH\"\n```\n\nTo permanently add to PATH, add this line to your `~/.bashrc` or `~/.zshrc`:\n\n```bash\necho 'export PATH=\"$HOME/.local/bin:$PATH\"' \u003e\u003e ~/.bashrc\nsource ~/.bashrc\n```\n\nNotes:\n- On Linux, PyQt5 may require system Qt libraries (xcb plugin). If GUI fails to start, ensure a desktop environment is available and try installing system packages (e.g. Debian/Ubuntu: `sudo apt install python3-pyqt5`), or use the CLI-only steps above.\n- In CI/headless environments, prefer the CLI-only steps above to skip GUI dependencies.\n\n## Running the Application\n\n### GUI Mode\n\nAfter installation (default with GUI), launch the application with the command:\n\n```bash\nlancalc\n```\n\nLanCalc auto-detects the environment. If GUI dependencies are unavailable or you are in a headless session, the launcher falls back to CLI help. In such cases, use the CLI examples below.\n\n### CLI Mode\n\nLanCalc also supports command-line interface for automation and scripting:\n\n```bash\n# Basic usage\nlancalc 192.168.1.1/24\n\n# JSON output for parsing\nlancalc 192.168.1.1/24 --json\n\n# Examples\nlancalc 10.0.0.1/8\nlancalc 172.16.0.1/16\nlancalc 192.168.1.100/31  # Point-to-point network\nlancalc 192.168.1.1/32    # Single host\n```\n\nYou can also run via module:\n\n```bash\npython3 -m lancalc 192.168.1.1/24 --json\n```\n\n### Output Format\n\n**Text mode** (default):\n```\nNetwork: 192.168.1.0\nPrefix: /24\nNetmask: 255.255.255.0\nBroadcast: 192.168.1.255\nHostmin: 192.168.1.1\nHostmax: 192.168.1.254\nHosts: 254\n```\n\n**JSON mode** (`--json`):\n```json\n{\n  \"network\": \"192.168.1.0\",\n  \"prefix\": \"/24\",\n  \"netmask\": \"255.255.255.0\",\n  \"broadcast\": \"192.168.1.255\",\n  \"hostmin\": \"192.168.1.1\",\n  \"hostmax\": \"192.168.1.254\",\n  \"hosts\": \"254\",\n  \"comment\": \"\"\n}\n```\n\n### Uninstall\n\n```bash\npip3 uninstall -y lancalc\n```\n\nThat's it! The application will start and automatically detect your current network settings.\n\n## For Developers\n\n### Prerequisites\n\nPython 3.9+ is required. GUI development requires PyQt5 (installed by default).\n\n- Production (CLI only):\n```bash\npip3 install -r requirements.txt\n```\n\n- Editable install with GUI (default):\n```bash\npip3 install -e .\n```\n\n- Editable install without GUI:\n```bash\npip3 install --no-deps -e .\npip3 install -r requirements.txt\n```\n\n- Full dev setup (with GUI):\n```bash\npip3 install -e '.[dev]'\n```\n\n- Dev without GUI:\n```bash\npip3 install --no-deps -e .\npip3 install -r requirements.txt\npip3 install pytest pytest-qt pre-commit flake8\n```\n\n- Reinstall \n```bash\npip3 install -e . --force-reinstall\n```\n\n### Installation for Development\n\nClone the repository and install in development mode:\n\n```bash\ngit clone https://github.com/wachawo/lancalc.git\n```\n\n### Running from Source\n\n```bash\n# GUI (requires PyQt5)\npython3 lancalc/main.py\n\n# CLI\npython3 -m lancalc 192.168.1.1/24\n```\n\n### Development Tools\n\n```bash\npip3 install pre-commit flake8 pytest pytest-qt\npre-commit install\npre-commit run --all-files\npre-commit autoupdate\n```\n\n### Running Tests\n```bash\npytest -v\n```\n\n### Test Build\n```bash\npip3 install -e .\n~/.local/bin/lancalc\n```\n\n### Test Build Linux\n```bash\npip3 install git+file://$(pwd) \nexport PATH=\"$HOME/.local/bin:$PATH\" \nlancalc\n```\n\n### Test Build Windows\n```powershell\npip3 install \"git+file://$(Get-Location)\"\nlancalc\n```\n\n## License\n\nDistributed under the MIT License. See LICENSE for more information.\n\n## Contact\n\n[GitHub](https://github.com/wachawo/lancalc) [Telegram](https://t.me/wachawo)\n\n## Notes\n\nA /31 mask allows the use of 2 addresses. The first will be the network address, the last the broadcast address, and for connecting hosts we use these same addresses.\nLimitations when using a /31 prefix:\nProtocols that use L3 broadcast stop working.\nIn fact, at present there are almost no protocols left that rely on L3 broadcast in their operation. The main currently relevant protocols, such as OSPF, IS-IS, EIGRP, and BGP, use multicast or unicast addresses instead.\nThis limitation can even be seen as an advantage, because it increases resistance to DoS attacks based on broadcast traffic distribution.\nBut not all devices support /31 prefixes.\nOn Juniper and Cisco devices, you can safely use a /31 mask, although Cisco will issue a warning (% Warning: use /31 mask on non point-to-point interface cautiously).\nZyXEL, however, does not allow you to select a /31 mask at all.\nAs a result, there are additional limitations in network operation — from using equipment of different manufacturers to even using equipment from the same vendor but with different firmware versions.\nIf you are not concerned by the above limitations, you can confidently save addresses by using the /31 prefix.\n\nThe use of the /31 prefix is described in detail in RFC 3021 — Using 31-Bit Prefixes on IPv4 Point-to-Point Links.\n\n\n## Special IPv4 Ranges and Cases\n\n### Special Network Types\n\n- **/31 networks**: Show `2*` in Hosts field - both addresses are usable (RFC 3021)\n- **/32 networks**: Show `1*` in Hosts field - single host network\n- The asterisk (*) indicates special network types where all addresses are usable\n\n### Special IPv4 Address Ranges\n\nLanCalc automatically detects and handles special IPv4 address ranges according to RFC specifications. For these ranges, host-related fields show \"*\" and a message field indicates the range type with RFC reference.\n\n#### Supported Special Ranges\n\n| Range | Type | RFC | Description |\n|-------|------|-----|-------------|\n| **127.0.0.0/8** | Loopback | [RFC 3330](docs/RFC.md#rfc-3330---loopback-addresses) | Loopback addresses - not routable on the Internet |\n| **169.254.0.0/16** | Link-local | [RFC 3927](docs/RFC.md#rfc-3927---link-local-addresses) | Link-local addresses - not routable |\n| **224.0.0.0/4** | Multicast | [RFC 5771](docs/RFC.md#rfc-5771---multicast-addresses) | Multicast addresses - not for host addressing |\n| **0.0.0.0/8** | Unspecified | [RFC 1122](docs/RFC.md#rfc-1122---unspecified-addresses) | Unspecified addresses - not for host addressing |\n| **255.255.255.255/32** | Broadcast | [RFC 919](docs/RFC.md#rfc-919---broadcast-address) | Limited broadcast address - not for host addressing |\n\n#### Special Range Behavior\n\nWhen you enter an address from a special range:\n\n**CLI Text Mode:**\n```bash\nlancalc 127.0.0.1/8\n```\n```\nNetwork: 127.0.0.0\nPrefix: /8\nNetmask: 255.0.0.0\nBroadcast: *\nHostmin: 127.0.0.1\nHostmax: 127.255.255.254\nHosts: 16777214\nComment: RFC 3330 Loopback (https://github.com/wachawo/lancalc/blob/main/docs/RFC.md#rfc-3330---loopback-addresses)\n```\n\n**CLI JSON Mode:**\n```bash\nlancalc 224.0.0.1/4 --json\n```\n```json\n{\n  \"network\": \"224.0.0.0\",\n  \"prefix\": \"/4\",\n  \"netmask\": \"240.0.0.0\",\n  \"broadcast\": \"*\",\n  \"hostmin\": \"*\",\n  \"hostmax\": \"*\",\n  \"hosts\": \"*\",\n  \"comment\": \"RFC 5771 Multicast (https://github.com/wachawo/lancalc/blob/main/docs/RFC.md#rfc-5771---multicast-addresses)\"\n}\n```\n\n**GUI Mode:**\n- Host fields (Hostmin, Hostmax, Broadcast, Hosts) show \"*\"\n- Status bar displays the special range message instead of version\n- No special styling or warnings needed\n\n#### JSON Fields\n\nThe JSON output includes the following fields:\n\n- **`comment`**: Description and RFC reference for special ranges (empty for normal unicast addresses)\n- **`hosts`**: Number of available host addresses in the specified subnet\n\nThese fields are always present, making the JSON output format consistent regardless of address type.\n\n## Usage\n\n### Command Line Interface\n\n```bash\n# Basic subnet calculation\nlancalc 192.168.1.1/24\n\n# JSON output\nlancalc 192.168.1.1/24 --json\n\n# Show internal/private IP address\nlancalc --internal\nlancalc -i\n\n# Show external/public IP address\nlancalc --external\nlancalc -e\n\n# Use multiple info flags simultaneously\nlancalc -i -e\nlancalc -i -e --json\n\n# Show version\nlancalc --version\n```\n\n### Examples\n\n**Basic calculation:**\n```bash\n$ lancalc 192.168.1.1/24\nNetwork: 192.168.1.0\nPrefix: /24\nNetmask: 255.255.255.0\nBroadcast: 192.168.1.255\nHostmin: 192.168.1.1\nHostmax: 192.168.1.254\nHosts: 254\n```\n\n**JSON output:**\n```bash\n$ lancalc 192.168.1.1/24 --json\n{\n  \"network\": \"192.168.1.0\",\n  \"prefix\": \"/24\",\n  \"netmask\": \"255.255.255.0\",\n  \"broadcast\": \"192.168.1.255\",\n  \"hostmin\": \"192.168.1.1\",\n  \"hostmax\": \"192.168.1.254\",\n  \"hosts\": \"254\"\n}\n```\n\n**Interface information:**\n```bash\n$ lancalc -i\nAddress: 10.16.69.146\nPrefix: /24\n\n$ lancalc -i --json\n{\"address\": \"10.16.69.146\", \"prefix\": \"/24\"}\n```\n\n**External IP detection:**\n```bash\n$ lancalc -e\nExternal IP: 216.66.18.3\n\n$ lancalc -e --json\n{\"external_ip\": \"216.66.18.3\"}\n```\n\n**Multiple info flags:**\n```bash\n$ lancalc -i -e\nAddress: 10.16.69.146\nPrefix: /24\n\nExternal IP: 216.66.18.3\n\n$ lancalc -i -e --json\n{\"address\": \"10.16.69.146\", \"prefix\": \"/24\"}\n\n{\"external_ip\": \"216.66.18.3\"}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwachawo%2Flancalc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwachawo%2Flancalc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwachawo%2Flancalc/lists"}