# IpSurv
"IpSurv" is a command-line program for surveying IP addresses, host information, and more. Also "IpSurv" is extensible program by Python.
<div align="center">
[![CI - Test](https://github.com/deer-hunt/ipsurv/actions/workflows/unit-tests.yml/badge.svg)](https://github.com/deer-hunt/ipsurv/actions/workflows/unit-tests.yml)
[![Coverage](https://codecov.io/github/deer-hunt/ipsurv/coverage.svg?branch=main)](https://codecov.io/gh/deer-hunt/ipsurv)
</div>
<img src="https://raw.githubusercontent.com/deer-hunt/ipsurv/main/docs/images/ipsurv.gif" alt="ipsurv" width="100%" />
## Installation
```bash
$ pip install ipsurv
or
$ pip3 install ipsurv
```
## Requirements
- ```python``` and ```pip``` command
- Python 3.0 or later version.
> If you'd like to use in Python 2.7, you can refactor to Python 2.7 code easily. See "development_debug.md".
## Usage
**Specify IP using Argument**
```bash
$ cat ips.txt|python3 -m ipsurv 192.168.1.10
$ cat ips.txt|python3 -m ipsurv 192.168.1.10 192.168.1.11
```
**Specify IP using PIPE**
```bash
$ cat ips.txt|python3 -m ipsurv
$ cat apache.log|python3 -m ipsurv
```
**Example result**
```bash
8.8.8.8:53,8.8.8.0,US,ICMP_OK,TCP_OK,UDP_OK
```
## Survey-mode
"IpSurv" have two Survey-mode. Those are "Survey IPs" and "Survey Self".
| Survey-mode | Description |
|-------------------|------------------------|
| **Survey IPs** | Primary mode. Surveying IP or Host or URL. |
| **Survey Self** | Surveying self IP. |
**Survey Self e.g.**
```bash
$ ipsurv self
Ip: 144.160.*.*
Hostname:
Organization: AS797 AT&T Services, Inc.
Country: US
City: San Jose
Region: California
Postal: 95103
Geo: 37.3394,-121.8950
Timezone: America/Los_Angeles
LocalIp: 10.0.2.5
LocalDns: ['8.8.8.8', '8.8.4.4']
```
## Features of "Survey IPs mode"
- Grouping by IP or Subnet.
- Skip duplicate by the group.
- Autodetect IP in line. Trying to resolve the name automatically.
- Autodetect delimiter-char.
- Customize output format. There are many format.
- Output JSON format.
- Show headers.
- Check ICMP, TCP, UDP, HTTP.
- Set timeout.
- Load env variable. And changing arguments and internal configures.
## Command options
"IpSurv" have many options. Please read [Command Arguments(.md) reference](./docs/command_arguments.md).
**Options**
```
[-h] [--verbose {0,1,2,3}] [--log LOG] [--disable_env]
[--resolve RESOLVE] [--autodetect AUTODETECT]
[--begin BEGIN] [--end END] [--collect COLLECT]
[--all_collect] [--timeout TIMEOUT] [--group GROUP]
[--skip_duplicate {0,1,2}] [--format FORMAT]
[--no_original] [--sequence] [--enclose ENCLOSE]
[--delimiter DELIMITER] [--alt_delimiter ALT_DELIMITER]
[--headers {0,1,2,3}] [--json {0,1,2}] [--json_list]
[--exhaustive] [--icmp ICMP] [--tcp TCP] [--udp UDP]
[--http {0,1,2}] [--version]
[target [target ...]]
```
**Example options**
```bash
$ cat ips.txt|python3 -m ipsurv --group=24
$ cat ips.txt|python3 -m ipsurv --group=network
$ cat ips.txt|python3 -m ipsurv --format="{country},{name}"
$ cat ips.txt|python3 -m ipsurv --format="{country},{ip_int},{handle},{port43}"
$ cat /var/log/httpd/access_log|ipsurv --ident --no_original
$ cat ips.txt|python3 -m ipsurv --group=255.255.255.0
$ cat ips.txt|python3 -m ipsurv --delimiter="\t"
$ cat ips.txt|python3 -m ipsurv --format="{group}\t{ip_int}\t{country}\t{handle}\t{port43}"
$ cat ips.txt|python3 -m ipsurv --format="{country},{ip_int},{handle},{port43},{icmp},{port},{tcp}" --group=network --icmp=1 --tcp=1 --timeout=2
```
## Example result
```bash
$ cat .dev/test/government.txt|ipsurv --headers=1 --format="{status},{group},{country},{name},{cidr},{http},{http_h2}" --group=network --http=2
original,status,group,country,name,cidr,http,http_h2
www.whitehouse.gov,OK,192.0.64.1,US,AUTOMATTIC,192.0.64.0/18,HTTP_OK,HTTP2
www.state.gov,OK,3.165.0.1,US,AMAZON-CF,3.165.0.0/16,HTTP_OK,HTTP2
www.treasury.gov,OK,23.32.0.1,US,AKAMAI,23.32.0.0/11,HTTP_OK,HTTP2
www.gov.uk,OK,151.101.0.1,US,SKYCA-3,151.101.0.0/16,HTTP_OK,HTTP2
www.gouvernement.fr,OK,217.70.184.1,FR,GANDIFR-NET4,217.70.184.0/24,HTTP_OK,HTTP1
www.diplomatie.gouv.fr,OK,77.128.0.1,FR,FR-SFR-20100831,77.128.0.0/11,HTTP_OK,HTTP1
www.economie.gouv.fr,OK,141.101.88.1,EU,CLOUDFLARE-EU,141.101.88.0/21,HTTP_OK,HTTP2
www.bundesregierung.de,OK,185.173.230.1,DE,BABIEL-NET-230,185.173.230.0/24,HTTP_OK,HTTP2
```
## Path summary
| Directory | Description |
|-----------------------|-----------------------------------------------------|
| `.github` | GitHub Actions files (actions, templates) |
| `docs` | Documentation files |
| `example_data` | Sample data files for testing |
| `examples` | Example programs |
| `ipsurv` | Main package/Sources |
| `tests` | Test files |
## Documents
| Title | Path |
|-------------------------------|---------------------------------------------|
| **Command arguments reference** | [command_arguments.md](./docs/command_arguments.md) |
| **Command examples** | [command_examples.md](./docs/command_examples.md) |
| **Program architecture and Classes** | [program_architecture_classes.md](./docs/program_architecture_classes.md) |
| **Customizing and Examples** | [customize_examples.md](./docs/customize_examples.md) |
| **Development and Debugging** | [development_debug.md](./docs/development_debug.md) |
## Debugging
In verbose mode, outputting internal data and behaviors in detail.
```bash
$ python -m ipsurv --verbose=2 #INFO
$ python -m ipsurv --verbose=3 #DEBUG
```
## Dependencies
```dnspython```, ```ipaddress```
Raw data
{
"_id": null,
"home_page": null,
"name": "ipsurv",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.0",
"maintainer_email": null,
"keywords": "survey, ip, domain, rdap, whois, http",
"author": "deer-hunt",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/aa/53/5543664c7f9475f6e5556c394732905cfdc424b334283c40a2bb94546807/ipsurv-1.0.0.tar.gz",
"platform": null,
"description": "# IpSurv\n\n\"IpSurv\" is a command-line program for surveying IP addresses, host information, and more. Also \"IpSurv\" is extensible program by Python.\n\n<div align=\"center\">\n\n[![CI - Test](https://github.com/deer-hunt/ipsurv/actions/workflows/unit-tests.yml/badge.svg)](https://github.com/deer-hunt/ipsurv/actions/workflows/unit-tests.yml)\n[![Coverage](https://codecov.io/github/deer-hunt/ipsurv/coverage.svg?branch=main)](https://codecov.io/gh/deer-hunt/ipsurv)\n\n</div>\n\n<img src=\"https://raw.githubusercontent.com/deer-hunt/ipsurv/main/docs/images/ipsurv.gif\" alt=\"ipsurv\" width=\"100%\" />\n\n## Installation\n\n```bash\n$ pip install ipsurv\nor\n$ pip3 install ipsurv\n```\n\n## Requirements\n\n- ```python``` and ```pip``` command\n- Python 3.0 or later version.\n\n> If you'd like to use in Python 2.7, you can refactor to Python 2.7 code easily. See \"development_debug.md\".\n\n## Usage\n\n**Specify IP using Argument**\n\n```bash\n$ cat ips.txt|python3 -m ipsurv 192.168.1.10\n$ cat ips.txt|python3 -m ipsurv 192.168.1.10 192.168.1.11\n```\n\n**Specify IP using PIPE**\n\n```bash\n$ cat ips.txt|python3 -m ipsurv\n$ cat apache.log|python3 -m ipsurv\n```\n\n**Example result**\n\n```bash\n8.8.8.8:53,8.8.8.0,US,ICMP_OK,TCP_OK,UDP_OK\n```\n\n## Survey-mode\n\n\"IpSurv\" have two Survey-mode. Those are \"Survey IPs\" and \"Survey Self\". \n\n| Survey-mode | Description |\n|-------------------|------------------------|\n| **Survey IPs** | Primary mode. Surveying IP or Host or URL. |\n| **Survey Self** | Surveying self IP. |\n\n**Survey Self e.g.**\n\n```bash\n$ ipsurv self\nIp: 144.160.*.*\nHostname: \nOrganization: AS797 AT&T Services, Inc.\nCountry: US\nCity: San Jose\nRegion: California\nPostal: 95103\nGeo: 37.3394,-121.8950\nTimezone: America/Los_Angeles\nLocalIp: 10.0.2.5\nLocalDns: ['8.8.8.8', '8.8.4.4']\n```\n\n## Features of \"Survey IPs mode\"\n\n- Grouping by IP or Subnet.\n- Skip duplicate by the group.\n- Autodetect IP in line. Trying to resolve the name automatically.\n- Autodetect delimiter-char.\n- Customize output format. There are many format.\n- Output JSON format.\n- Show headers.\n- Check ICMP, TCP, UDP, HTTP.\n- Set timeout.\n- Load env variable. And changing arguments and internal configures.\n\n## Command options\n\n\"IpSurv\" have many options. Please read [Command Arguments(.md) reference](./docs/command_arguments.md).\n\n**Options**\n\n```\n[-h] [--verbose {0,1,2,3}] [--log LOG] [--disable_env]\n[--resolve RESOLVE] [--autodetect AUTODETECT]\n[--begin BEGIN] [--end END] [--collect COLLECT]\n[--all_collect] [--timeout TIMEOUT] [--group GROUP]\n[--skip_duplicate {0,1,2}] [--format FORMAT]\n[--no_original] [--sequence] [--enclose ENCLOSE]\n[--delimiter DELIMITER] [--alt_delimiter ALT_DELIMITER]\n[--headers {0,1,2,3}] [--json {0,1,2}] [--json_list]\n[--exhaustive] [--icmp ICMP] [--tcp TCP] [--udp UDP]\n[--http {0,1,2}] [--version]\n[target [target ...]]\n```\n\n**Example options**\n\n```bash\n$ cat ips.txt|python3 -m ipsurv --group=24\n$ cat ips.txt|python3 -m ipsurv --group=network\n$ cat ips.txt|python3 -m ipsurv --format=\"{country},{name}\"\n$ cat ips.txt|python3 -m ipsurv --format=\"{country},{ip_int},{handle},{port43}\"\n$ cat /var/log/httpd/access_log|ipsurv --ident --no_original\n\n$ cat ips.txt|python3 -m ipsurv --group=255.255.255.0\n$ cat ips.txt|python3 -m ipsurv --delimiter=\"\\t\"\n$ cat ips.txt|python3 -m ipsurv --format=\"{group}\\t{ip_int}\\t{country}\\t{handle}\\t{port43}\" \n$ cat ips.txt|python3 -m ipsurv --format=\"{country},{ip_int},{handle},{port43},{icmp},{port},{tcp}\" --group=network --icmp=1 --tcp=1 --timeout=2\n```\n\n## Example result\n\n```bash\n$ cat .dev/test/government.txt|ipsurv --headers=1 --format=\"{status},{group},{country},{name},{cidr},{http},{http_h2}\" --group=network --http=2\n\noriginal,status,group,country,name,cidr,http,http_h2\nwww.whitehouse.gov,OK,192.0.64.1,US,AUTOMATTIC,192.0.64.0/18,HTTP_OK,HTTP2\nwww.state.gov,OK,3.165.0.1,US,AMAZON-CF,3.165.0.0/16,HTTP_OK,HTTP2\nwww.treasury.gov,OK,23.32.0.1,US,AKAMAI,23.32.0.0/11,HTTP_OK,HTTP2\nwww.gov.uk,OK,151.101.0.1,US,SKYCA-3,151.101.0.0/16,HTTP_OK,HTTP2\nwww.gouvernement.fr,OK,217.70.184.1,FR,GANDIFR-NET4,217.70.184.0/24,HTTP_OK,HTTP1\nwww.diplomatie.gouv.fr,OK,77.128.0.1,FR,FR-SFR-20100831,77.128.0.0/11,HTTP_OK,HTTP1\nwww.economie.gouv.fr,OK,141.101.88.1,EU,CLOUDFLARE-EU,141.101.88.0/21,HTTP_OK,HTTP2\nwww.bundesregierung.de,OK,185.173.230.1,DE,BABIEL-NET-230,185.173.230.0/24,HTTP_OK,HTTP2\n```\n\n## Path summary\n\n| Directory | Description |\n|-----------------------|-----------------------------------------------------|\n| `.github` | GitHub Actions files (actions, templates) |\n| `docs` | Documentation files |\n| `example_data` | Sample data files for testing |\n| `examples` | Example programs |\n| `ipsurv` | Main package/Sources |\n| `tests` | Test files |\n\n\n## Documents\n\n| Title | Path |\n|-------------------------------|---------------------------------------------|\n| **Command arguments reference** | [command_arguments.md](./docs/command_arguments.md) |\n| **Command examples** | [command_examples.md](./docs/command_examples.md) |\n| **Program architecture and Classes** | [program_architecture_classes.md](./docs/program_architecture_classes.md) |\n| **Customizing and Examples** | [customize_examples.md](./docs/customize_examples.md) |\n| **Development and Debugging** | [development_debug.md](./docs/development_debug.md) |\n\n\n## Debugging\n\nIn verbose mode, outputting internal data and behaviors in detail.\n\n```bash\n$ python -m ipsurv --verbose=2 #INFO\n$ python -m ipsurv --verbose=3 #DEBUG\n```\n\n## Dependencies\n\n```dnspython```, ```ipaddress```\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "\"IpSurv\" is a command-line program for surveying IP addresses, host information, and more. Also \"IpSurv\" is extensible program by Python.",
"version": "1.0.0",
"project_urls": {
"GitHub": "https://github.com/deer-hunt/ipsurv"
},
"split_keywords": [
"survey",
" ip",
" domain",
" rdap",
" whois",
" http"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a78daef66313378df328fd243e6a857aa41241d268a206ca1e0dcd5befa6913e",
"md5": "1a34dd3fc5bfd5f928be38c90bc6cb04",
"sha256": "6185eda82151ec211b7a767f6b6368e9cd09ae373f8e59f8e08d41eaf0f5e397"
},
"downloads": -1,
"filename": "ipsurv-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "1a34dd3fc5bfd5f928be38c90bc6cb04",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.0",
"size": 37896,
"upload_time": "2024-11-22T19:31:42",
"upload_time_iso_8601": "2024-11-22T19:31:42.581200Z",
"url": "https://files.pythonhosted.org/packages/a7/8d/aef66313378df328fd243e6a857aa41241d268a206ca1e0dcd5befa6913e/ipsurv-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "aa535543664c7f9475f6e5556c394732905cfdc424b334283c40a2bb94546807",
"md5": "a242dcdbc28099c1550ca8dbebc7e6be",
"sha256": "ff0075d4bcae38a41510807c6cba34bf083efcb4da576d081c8a1940b25e4ad8"
},
"downloads": -1,
"filename": "ipsurv-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "a242dcdbc28099c1550ca8dbebc7e6be",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.0",
"size": 40113,
"upload_time": "2024-11-22T19:31:44",
"upload_time_iso_8601": "2024-11-22T19:31:44.281470Z",
"url": "https://files.pythonhosted.org/packages/aa/53/5543664c7f9475f6e5556c394732905cfdc424b334283c40a2bb94546807/ipsurv-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-22 19:31:44",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "deer-hunt",
"github_project": "ipsurv",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "dnspython",
"specs": [
[
">=",
"2.0.0"
]
]
},
{
"name": "ipaddress",
"specs": [
[
">=",
"1.0.0"
]
]
},
{
"name": "pytest",
"specs": [
[
">=",
"7.0.1"
]
]
},
{
"name": "pytest-mock",
"specs": [
[
">=",
"3.6.1"
]
]
},
{
"name": "pytest-cov",
"specs": [
[
">=",
"4.0.0"
]
]
},
{
"name": "flake8",
"specs": [
[
">=",
"5.0.4"
]
]
},
{
"name": "setuptools",
"specs": [
[
">=",
"35.0.0"
]
]
}
],
"tox": true,
"lcname": "ipsurv"
}