{"id":15640025,"url":"https://github.com/itzmeanjan/lenz","last_synced_at":"2025-04-14T21:53:24.791Z","repository":{"id":106438230,"uuid":"294118831","full_name":"itzmeanjan/lenz","owner":"itzmeanjan","description":"Console based MAP 🗺 : with lots of features 🤩","archived":false,"fork":false,"pushed_at":"2020-09-29T12:25:42.000Z","size":14888,"stargazers_count":86,"open_issues_count":0,"forks_count":4,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-14T21:53:16.656Z","etag":null,"topics":["ascii","cli","connected-peers","console","dns","domain-name","ip","ip2location","location","magnet","magnet-link","map","mapping","maps","network-monitoring","network-visualization","system-administration","torrent"],"latest_commit_sha":null,"homepage":"https://itzmeanjan.github.io/lenz/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc0-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/itzmeanjan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2020-09-09T13:18:00.000Z","updated_at":"2025-04-11T19:14:55.000Z","dependencies_parsed_at":"2023-11-27T16:01:11.483Z","dependency_job_id":"47afdac6-643e-4e7c-8e78-f763541df04c","html_url":"https://github.com/itzmeanjan/lenz","commit_stats":{"total_commits":273,"total_committers":3,"mean_commits":91.0,"dds":0.01098901098901095,"last_synced_commit":"5da17061fae3d1033f98fd3fbc90fa9c943bc482"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itzmeanjan%2Flenz","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itzmeanjan%2Flenz/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itzmeanjan%2Flenz/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itzmeanjan%2Flenz/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/itzmeanjan","download_url":"https://codeload.github.com/itzmeanjan/lenz/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248968754,"owners_count":21191158,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["ascii","cli","connected-peers","console","dns","domain-name","ip","ip2location","location","magnet","magnet-link","map","mapping","maps","network-monitoring","network-visualization","system-administration","torrent"],"created_at":"2024-10-03T11:30:01.051Z","updated_at":"2025-04-14T21:53:24.772Z","avatar_url":"https://github.com/itzmeanjan.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# lenz 🤓\n\n[![NPM Version](https://badgen.net/npm/v/lenz)]() [![NPM Download Count](https://badgen.net/npm/dt/lenz)]() [![Commit Count](https://badgen.net/github/commits/itzmeanjan/lenz)]()\n\nConsole based MAP 🗺, with lots of features packed in 👇\n\n![sc](sc/sc_0.png)\n\n## Table of Contents\n\n- [Why did you write this software ?](#motivation)\n- [What's in box ?](#features)\n- [What do I need to use it ?](#prerequisite)\n- [How do I install it ?](#installation)\n- [How do I use it ?](#usage)\n- [Can I add one new feature ?](#contribution)\n- [Any attribution ?](#attribution)\n\n## Motivation\n\nI was looking for one fully console based geo location data visualiser, with below functionalities \n\n- can keep geo locate machine's connected TCP/ UDP peers 👩‍💻\n- can geo locate any IP Address\n- can geo locate all IPv{4,6} addresses, resolvable from (sub-)domain name\n- can geo locate peers, given torrent 🧲 link\n- _can show my own location on Map_ 🙋\n\nwhich can be used in fully console based environments i.e. ssh-ing into VM, VPS etc.\n\nBut couldn't find one, may be I required to try harder. So I decided to write one, with all these above mentioned functionalites.\n\nI interested in extending its functionalites in coming days, if you find I'm missing certain use case, feel free to let me know/ just raise a PR.\n\n## Features\n\n- Given (sub-)domain name, it can look up all associated server IPv4/6 addresses, showing them in console map 🥴\n- Given IPv4/6 address, can lookup it's location \u0026 show it in console map 🥳\n- Can find all currently active TCP/UDP socket connections from all processes \u0026 marks their respective peers in console map 🤩\n- This will be helpful in understanding which application _( using PID )_ is to talking to which machine \u0026 where is that located\n\n\u003e Note: For 👆 operation, auto refresh has been enabled 🤩\n\n- Given torrent 🧲 link, can look up all peers associated with that infohash \u0026 show them in console map 🤓\n- Given any random URL, parses HTML \u0026 extracts out all static content i.e. {`*.js`, `*.css`, `image/*`} delivery domains \u0026 geo locate them 😎\n- Given Autonomous System Number ( `ASN` ), geo locates all IPv4 addresses owned by this Autonomous System ( `AS` ) 😉🦾\n\n\u003e Caution: 👆 operation is very computationally intensive, for large Autonomous Systems, might take some time to complete, though it keeps streaming, as soon as it finds something useful\n\nIn all these cases, generates a tabular report of all connected peers _( including self )_, who were shown on console map\n\n## Prerequisite\n\nWe need to download [IP2Location™ LITE IP-COUNTRY-REGION-CITY-LATITUDE-LONGITUDE Database](https://lite.ip2location.com/database/ip-country-region-city-latitude-longitude) for using this tool.\n\nConsider using IPv6 Binary version, cause that will also support IPv4 lookup. This specific database I've planned to use is codenamed **db5**.\n\nPlease try to stick with that to avoid unexpected behaviours.\n\nWe'll also need [IP2Location™ LITE IP-ASN Database](https://lite.ip2location.com/database/ip-asn) for using `la` command. See [below](#geo-locate-ipv4-addresses-owned-by-some-autonomous-system--la-).\n  - Please use IPv4 version of ASN Database\n\nAnd we need to have NodeJS( \u003e=12.18.4 ).\n\n## Installation\n\n### Using NPM\n\nThis [software](https://www.npmjs.com/package/lenz) is distributed using NPM.\n\n```bash\nnpm i -g lenz\n```\n\n### Using GITHUB\n\nYou can clone this repo in your machine and run below commands to use this CLI tool.\n\nLets get into project directory\n\n```bash\ngit clone git@github.com:itzmeanjan/lenz.git\ncd lenz/lenz\nnpm install # installing all dependencies\n```\n\nAnd install tool globally. Also make sure you've added NPM global installation path to your system **PATH** variable.\n\n```bash\nnpm i -g .\n```\n\nNow you can use `lenz` from any where in your directory tree.\n\n## Usage\n\nInvoke `lenz` from CLI, supplying proper params for each of supported commands.\n\n\u003e ❌ : Your location, using IP address\n\n\u003e ⭕️ : Peer(s) location\n\n```bash\n5p1d3r:lenz anjan$ lenz\n[+]Author  : Anjan Roy \u003c anjanroy@yandex.com \u003e\n[+]Project : https://github.com/itzmeanjan/lenz\n\nCommands:\n  lenz lm \u003cmagnet\u003e \u003cdb\u003e  Find peers by Torrent Infohash\n  lenz ld \u003cdomain\u003e \u003cdb\u003e  Find location of Domain Name\n  lenz lp \u003cip\u003e \u003cdb\u003e      Find location of IP Address\n  lenz ls \u003cdb\u003e           Find location of open TCP/UDP socket peer(s)\n\nOptions:\n  --version  Show version number                               [boolean]\n  --help     Show help                                         [boolean]\n\nNot enough non-option arguments: got 0, need at least 1\n```\n\n\u003e Please use tool's help option for getting more info related to supported commands.\n\n---\n\n### Show peers by magnet link ( lm )\n\nGet a magnet link \u0026 supply it while invoking `lenz`\n\n![sc](sc/sc_1.gif)\n\n```bash\n5p1d3r:lenz anjan$ lenz lm\nlenz lm \u003cmagnet\u003e \u003cdb\u003e\n\nFind peers by Torrent Infohash\n\nOptions:\n  --version  Show version number                               [boolean]\n  --help     Show help                                         [boolean]\n  --magnet   torrent 🧲 link                                    [string]\n  --db       path to ip2location-db5.bin                        [string]\n\nNot enough non-option arguments: got 0, need at least 2\n```\n\n---\n\n### Look up by domain name ( ld )\n\nDomain name to be resolved to IPv _{4,6}_ addresses \u0026 shown on console map.\n\n![sc](sc/sc_2.gif)\n\n```bash\n5p1d3r:lenz anjan$ lenz ld\nlenz ld \u003cdomain\u003e \u003cdb\u003e\n\nFind location of Domain Name\n\nOptions:\n  --version  Show version number                               [boolean]\n  --help     Show help                                         [boolean]\n  --domain   domain name to be looked up                        [string]\n  --db       path to ip2location-db5.bin                        [string]\n\nNot enough non-option arguments: got 0, need at least 2\n```\n\n---\n\n### Look up by ip address ( lp )\n\nLooks up IPv _{4,6}_  address location \u0026 shows on console map.\n\n![sc](sc/sc_3.gif)\n\n```bash\n5p1d3r:lenz anjan$ lenz lp\nlenz lp \u003cip\u003e \u003cdb\u003e\n\nFind location of IP Address\n\nOptions:\n  --version  Show version number                               [boolean]\n  --help     Show help                                         [boolean]\n  --ip       IP Address to be located                           [string]\n  --db       path to ip2location-db5.bin                        [string]\n\nNot enough non-option arguments: got 0, need at least 2\n```\n\n---\n\n### Find all active TCP/UDP sockets ( ls )\n\nFinds out all active TCP/UDP socket connections \u0026 their peers, which are then shown on console map\n\n![sc](sc/sc_4.gif)\n\n\u003e **Note** : This feature is only available on darwin \u0026 gnu/linux, as of now\n\n\u003e It has runtime dependency on `lsof` \u0026 `awk`\n\n\u003e These two tools are run as child processes of `lenz`\n\n```bash\n5p1d3r:lenz anjan$ lenz ls\nlenz ls \u003cdb\u003e\n\nFind location of open TCP/UDP socket peer(s)\n\nOptions:\n  --version  Show version number                               [boolean]\n  --help     Show help                                         [boolean]\n  --db       path to ip2location-db5.bin                        [string]\n\nNot enough non-option arguments: got 0, need at least 1\n```\n\n---\n\n**Newest Addition**\n\nWhich process is talking to which remote machine, can now be figured out easily \u0026 if required they can be killed using *nix utilities\n\n\u003e Note: Host machine PID to be displayed as NaN\n\n![sc](sc/sc_1.png)\n\n---\n\n### Locate static content delivery domains used in a webpage ( lr )\n\nGiven any webpage URL, parses out its `script`, `link` \u0026 `img` tags, which are used for including static resources into HTML i.e. CSS, JS \u0026 images. If they are delivered from some domain other than this one, extract them out \u0026 then resolve those domain names into IPv4/6 addresses, which are to be geolocated using IP2Location DB5 database. They are also shown on console map.\n\n![sc](sc/sc_5.gif)\n\n```bash\n5p1d3r:lenz anjan$ lenz lr\nlenz lr \u003curl\u003e \u003cdb\u003e [dump]\n\nLocate static content delivery domain(s) used by URL\n\nOptions:\n  --version  Show version number                               [boolean]\n  --help     Show help                                         [boolean]\n  --url      inspect for finding static content delivery domain(s)\n                                                                [string]\n  --db       path to ip2location-db5.bin                        [string]\n  --dump     path to sink-file.json      [string] [default: \"dump.json\"]\n\nNot enough non-option arguments: got 0, need at least 2\n```\n\n---\n\n### Geo Locate IPv4 addresses owned by some Autonomous System ( la )\n\nGiven Autonomous System Number [ `ASN` ] of a certain organization, finds all IPv4 address ranges controlled by `ASN`, and geo locate them using IP2Location DB5 database, which are to be shown on console map.\n\nFor using this command we need two IP2Location database\n\n- [IP2Location™ LITE IP-COUNTRY-REGION-CITY-LATITUDE-LONGITUDE Database](https://lite.ip2location.com/database/ip-country-region-city-latitude-longitude)\n- [IP2Location™ LITE IP-ASN Database](https://lite.ip2location.com/database/ip-asn)\n  - Please use IPv4 version of database\n\n![sc](sc/sc_6.gif)\n\n```bash\n5p1d3r:lenz anjan$ lenz la\nlenz la \u003casn\u003e \u003cdb\u003e \u003casndb\u003e\n\nGeo locate IPv4 addresses owned by Autonomous System\n\nOptions:\n  --version  Show version number                               [boolean]\n  --help     Show help                                         [boolean]\n  --asn      autonomous system number to be looked up\n  --db       path to ip2location-db5.bin                        [string]\n  --asndb    path to ip2location-ipv4-asn.db                    [string]\n\nNot enough non-option arguments: got 0, need at least 3\n```\n\n---\n\n## Contribution\n\nIf you're interested in adding more features to this CLI tool, please raise a PR.\n\n## Attribution\n\nThis non-profit open sourced software uses [IP2Location LITE Database](https://lite.ip2location.com).\n\nThanks to [@IP2Location](https://github.com/ip2location)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitzmeanjan%2Flenz","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fitzmeanjan%2Flenz","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitzmeanjan%2Flenz/lists"}