# IpSurv
<div>
<img width="165" height="165" src="https://raw.githubusercontent.com/deer-hunt/ipsurv/main/docs/images/ipsurv-logo.png" align="left" />
```IpSurv``` is a command-line program for surveying IP addresses, host information, and more. Also ```IpSurv``` is extensible program by Python.
<div>
<a href="https://github.com/deer-hunt/ipsurv/actions/workflows/unit-tests.yml"><img alt="CI - Test" src="https://github.com/deer-hunt/ipsurv/actions/workflows/unit-tests.yml/badge.svg"></a>
<a href="https://github.com/deer-hunt/ipsurv/actions/workflows/unit-tests-windows.yml"><img alt="CI - Test" src="https://github.com/deer-hunt/ipsurv/actions/workflows/unit-tests-windows.yml/badge.svg"></a>
<a href="https://github.com/deer-hunt/ipsurv/actions/workflows/lint.yml"><img alt="GitHub Actions build status (Lint)" src="https://github.com/deer-hunt/ipsurv/workflows/Lint/badge.svg"></a>
<a href="https://codecov.io/gh/deer-hunt/ipsurv"><img alt="Coverage" src="https://codecov.io/github/deer-hunt/ipsurv/coverage.svg?branch=main"></a>
<img alt="PyPI - Status" src="https://img.shields.io/pypi/status/ipsurv">
<a href="https://github.com/deer-hunt/ipsurv/blob/main/LICENSE.md"><img alt="License - MIT" src="https://img.shields.io/pypi/l/ipsurv.svg"></a>
<a href="https://pypi.org/project/ipsurv/"><img alt="Newest PyPI version" src="https://img.shields.io/pypi/v/ipsurv.svg"></a>
<a href="https://pypi.org/project/ipsurv/"><img alt="Number of PyPI downloads" src="https://img.shields.io/pypi/dm/ipsurv.svg"></a>
<img alt="GitHub code size in bytes" src="https://img.shields.io/github/languages/code-size/deer-hunt/ipsurv">
<a href="https://pypi.org/project/ipsurv"><img alt="Supported Versions" src="https://img.shields.io/pypi/pyversions/ipsurv.svg"></a>
<a href="https://deer-hunt.github.io/ipsurv/" alt="IpSurv's documentation site"><img src="https://img.shields.io/badge/stable%20docs-github.io-brightgreen?style=flat&color=%2373DC8C&label=Docs"/></a>
<a href="https://app.fossa.com/projects/git%2Bgithub.com%2Fdeer-hunt%2Fipsurv?ref=badge_shield" alt="FOSSA Status"><img src="https://app.fossa.com/api/projects/git%2Bgithub.com%2Fdeer-hunt%2Fipsurv.svg?type=shield"/></a>
</div>
</div>
<p> </p>
<img src="https://raw.githubusercontent.com/deer-hunt/ipsurv/main/docs/images/ipsurv.gif" alt="ipsurv visual image" width="100%" />
## Installation
```bash
$ pip install ipsurv
or
$ pip3 install ipsurv
```
## Requirements
- ```python``` and ```pip``` command
- Python 3.0 or later version.
> If you use in Python 3.0 - 3.2, please run ```pip install ipaddress```.
> If you'd like to use in Python 2.7, you can refactor to Python 2.7 code easily. See "development_debug.md".
## Documentation site
IpSurv's documentation site is [https://deer-hunt.github.io/ipsurv/](https://deer-hunt.github.io/ipsurv/).
## Usage
**Specify Target using Argument**
```bash
$ ipsurv 192.168.1.10
$ ipsurv 192.168.1.10 192.168.1.11
$ ipsurv test-example-sample-ipsurv.com --add_ip
$ ipsurv x.x.x.x --format=geo
```
**Specify Target using PIPE**
```bash
$ cat ips.txt|ipsurv
$ cat apache.log|ipsurv --add_ip
```
**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.
- Use GeoIP2 via IpSurv optionally.
## Command options
```IpSurv``` have many options. Please read [Command arguments(.md) reference](https://github.com/deer-hunt/ipsurv/blob/main/docs/command_arguments.md).
**Options**
```
[-h] [--verbose {0,1,2,3}] [--debug] [--log {string}]
[--disable_env] [--resolve {0,1}] [--identify_int]
[--autodetect] [--begin {number}] [--end {number}]
[--collect {string}] [--all_collect] [--timeout {string}]
[--group {string}] [--skip_duplicate {0,1,2}]
[--range {string}] [--format {string}] [--no_original]
[--sequence] [--add_ip] [--ident] [--enclose {string}]
[--delimiter {string}] [--alt_delimiter {string}]
[--headers {0,1,2,3}] [--json {0,1,2}] [--json_list]
[--exhaustive] [--icmp {0,1}] [--tcp {number}]
[--udp {number}] [--http {0,1,2}] [--json_all]
[--geoip_only] [--host_only] [--version]
[target [target ...]]
```
**Example options**
```bash
$ cat ips.txt|ipsurv --group=24
$ cat ips.txt|ipsurv --group=network
$ cat ips.txt|ipsurv --format=country
$ cat ips.txt|ipsurv --format=hostname
$ cat ips.txt|ipsurv --format="{country},{name}"
$ cat ips.txt|ipsurv --format="{country},{ip_int},{handle},{port43}"
$ cat /var/log/httpd/access_log|ipsurv --ident --no_original
$ cat ips.txt|ipsurv --group=255.255.255.0
$ cat ips.txt|ipsurv --delimiter="\t"
$ cat ips.txt|ipsurv --format="{group}\t{ip_int}\t{country}\t{handle}\t{port43}"
$ cat ips.txt|ipsurv --format="{country},{ip_int},{handle},{port43},{icmp},{port},{tcp}" --group=network --icmp=1 --tcp=1 --timeout=2
```
## Command examples
**Show headers**
```bash
$ cat ./example_data/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
```
**Add line-number**
```bash
$ cat ./example_data/government.txt|ipsurv --sequence --add_ip
1,www.whitehouse.gov,192.0.66.168,OK,US,AUTOMATTIC,192.0.64.0,192.0.127.255
2,www.state.gov,3.165.39.61,OK,US,AMAZON-CF,3.165.0.0,3.165.255.255
3,www.treasury.gov,23.50.118.187,OK,US,AKAMAI,23.32.0.0,23.67.255.255
4,www.gov.uk,151.101.192.144,OK,US,SKYCA-3,151.101.0.0,151.101.255.255
```
**Output by JSON**
```bash
$ ipsurv wikipedia.org --format=default --json=2 --add_ip
{
"original": "wikipedia.org",
"ip": "103.102.166.224",
"status": "OK",
"group": "",
"country": "US",
"name": "WIKIMEDIA-AP",
"network_start": "103.102.166.0",
"network_end": "103.102.166.255"
}
```
**Output detailed data by JSON**
```bash
$ ipsurv wikipedia.org --json_all # `--json_all` is equivalent to `--json=2 --exhaustive`
$ ipsurv wikipedia.org --format=default --json=2 --exhaustive
{
"success": true,
"status": "OK",
"requests": [
"RDAP"
],
"errors": [],
"sequence": 1,
"original": "wikipedia.org",
"target": "103.102.166.224",
"ip": "103.102.166.224",
"ip_int": 1734780640,
"port": null,
"group_int": 0,
"group": "",
"group_found": false,
"group_status": "-",
"country": "US",
"name": "WIKIMEDIA-AP",
"network_start": "103.102.166.0",
"network_end": "103.102.166.255",
"ip_hex": "67.66.A6.E0",
"ip_reversed": "224.166.102.103",
"ip_type": "PUBLIC",
~~~~~~~~~~~~~
"org": "Wikimedia Foundation, Inc.",
"address": "1 Montgomery Street Suite 1600",
"description": "Wikimedia Foundation, Inc.",
"target.raw": "wikipedia.org",
"target.identifier": "103.102.166.224",
"target.identifier_int": 1734780640,
"target.identified": true,
"target.ip": "103.102.166.224",
"target.url": null,
"target.fqdn": "wikipedia.org",
"target.port": null,
"target.status": "EXIST"
}
```
**Check HTTP response**
```
$ ipsurv https://www.reddit.com --format="{ip},{http},{http_status},{http_size},{http_mime},{http_server},{http_h2}" --http=2
https://www.reddit.com,151.101.193.140,HTTP_OK,200,721210,text/html,snooserv,HTTP2
$ ipsurv https://www.youtube.com/feed/you --format=web --http=2
https://www.youtube.com/feed/you,142.251.42.174,HTTP_OK,200,559230,text/html,ESF,HTTP2
```
**Check Host name or PC name**
```
$ ipsurv 192.168.1.120 --host_only
$ ipsurv 192.168.1.120 --format="hostname"
192.168.1.100,MYPC-016
```
> You can also find the Windows PC name in private network.
More examples are [here](https://deer-hunt.github.io/ipsurv/pages/command_examples.html).
## Output Format
You can customize "Output Format" by ```--format``` option as follows. There are ```parameter - {}``` and ```profile - <>``` in ```--format```.
For more information, please read [--format description](https://deer-hunt.github.io/ipsurv/pages/command_arguments.html#format).
```
$ ipsurv github.io --format=heavy # Profile
$ ipsurv github.io --format=simple # Profile
$ ipsurv 8.8.8.8 --format="{status},{ip},{country},{address}" # Paramaters
$ ipsurv 8.8.8.8 --format="{status}\t{ip}\t{hostname}" # Paramaters, TAB char
$ ipsurv cloudflare.com --format="{ip},<address>,<system>" # Paramaters + Profile
$ ipsurv wikipedia.org --format="<address>,{hostname},{ip_type}" # Profile + Paramaters
```
## Using GeoIP2 optionally
```IpSurv``` support [GeoIP2](https://github.com/maxmind/GeoIP2-python) optionally. If ```GeoIP2``` module is installed and there are ```mmdb``` files, You can use GeoIP2 features via ```IpSurv```.
When using the GeoIP2 module, network communication does not occur, which enables faster processing.
Please refer to the [Using GeoIP2](https://deer-hunt.github.io/ipsurv/pages/using_geoip2.html) documentation in detail.
**Examples**
```
$ ipsurv 8.8.8.8 --geoip_only
8.8.8.8,NA,North America,US,United States,America/Chicago,AS15169,37.751;-97.822
```
```
$ ipsurv www.wikipedia.org --format="{country},{geo}" --collect=geoip --headers=1
original,country,geo
www.wikipedia.org,US,37.751;-97.822
$ ipsurv 8.8.8.8 --format="{continent},{continent_name},{country},{geo}" --collect="geoip" --headers=1
original,continent,continent_name,country,geo
8.8.8.8,NA,North America,US,37.751;-97.822
```
> `IpSuv` support customizing GeoIP2 data path by `IPSURV_CONF` env. Please read [here](https://deer-hunt.github.io/ipsurv/pages/command_arguments.html#environment-variable-ipsurv-conf) about `IPSURV_CONF`.
## Documents
The following documents exist in ```IpSurv```. You can read documents in [Documentation site](https://deer-hunt.github.io/ipsurv/).
| Title | Path |
|-------------------------------|---------------------------------------------|
| **Command arguments** | [command_arguments.md](https://github.com/deer-hunt/ipsurv/blob/main/docs/command_arguments.md) |
| **Command examples** | [command_examples.md](https://github.com/deer-hunt/ipsurv/blob/main/docs/command_examples.md) |
| **Program architecture and Classes** | [program_architecture_classes.md](https://github.com/deer-hunt/ipsurv/blob/main/docs/program_architecture_classes.md) |
| **Customizing and Examples** | [customize_examples.md](https://github.com/deer-hunt/ipsurv/blob/main/docs/customize_examples.md) |
| **Development and Debugging** | [development_debug.md](https://github.com/deer-hunt/ipsurv/blob/main/docs/development_debug.md) |
| **About Using GeoIP2** | [using_geoip2.md](https://github.com/deer-hunt/ipsurv/blob/main/docs/using_geoip2.md) |
| **IpSurv's Major Modules and Classes** | [github.io / Modules and Classes reference](https://deer-hunt.github.io/ipsurv/py-modindex.html) |
## Path summary
| Directory | Description |
|-----------------------|-----------------------------------------------------|
| `.github` | GitHub Actions files |
| `docs` | Documentation files |
| `example_data` | Sample data files for testing |
| `examples` | Example programs |
| `ipsurv` | Main package/Sources |
| `tests` | Test files |
## Debugging
In verbose mode, outputting internal data and behaviors in detail.
```bash
$ ipsurv ***** --verbose=2 #INFO
$ ipsurv ***** --verbose=3 #DEBUG
$ ipsurv ***** --debug #DEBUG This option is equivalent to "--verbose=3"
```
## Customizing IpSurv
```IpSurv``` is implemented as customizable program architecture. ```IpSurv``` provide extending features and several classes.
And you can use IpSurv's internal classes in your program. Please read ```program_architecture_classes.md```.
**Classes for major customization**
| Classes | Description |
|----------------------|----------------------------------------------|
| **Pipeline** | Pipeline class provide catching and customizing the data in each processing. ```./examples/pipeline_customize.py``` |
| **ObjectFactory** | ObjectFactory class provide customizing classes and creating original classes. ```./examples/object_factory.py``` |
| **Serializer, LineSerializer, JsonSerializer** | Serializer class provide displaying data and transforming data for presentation. ```./examples/object_factory_original_headers.py``` |
## Dependencies
- [dnspython](https://github.com/rthalley/dnspython)
- [geoip2](https://github.com/maxmind/GeoIP2-python) [Optional]
Raw data
{
"_id": null,
"home_page": "https://github.com/deer-hunt/ipsurv",
"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/9e/02/86a77247557bf3af2863710eaa2aca97c360bd7ab86a2c1604f63bf0c266/ipsurv-1.1.3.tar.gz",
"platform": null,
"description": "# IpSurv\n\n<div>\n<img width=\"165\" height=\"165\" src=\"https://raw.githubusercontent.com/deer-hunt/ipsurv/main/docs/images/ipsurv-logo.png\" align=\"left\" />\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>\n\n<a href=\"https://github.com/deer-hunt/ipsurv/actions/workflows/unit-tests.yml\"><img alt=\"CI - Test\" src=\"https://github.com/deer-hunt/ipsurv/actions/workflows/unit-tests.yml/badge.svg\"></a>\n<a href=\"https://github.com/deer-hunt/ipsurv/actions/workflows/unit-tests-windows.yml\"><img alt=\"CI - Test\" src=\"https://github.com/deer-hunt/ipsurv/actions/workflows/unit-tests-windows.yml/badge.svg\"></a>\n<a href=\"https://github.com/deer-hunt/ipsurv/actions/workflows/lint.yml\"><img alt=\"GitHub Actions build status (Lint)\" src=\"https://github.com/deer-hunt/ipsurv/workflows/Lint/badge.svg\"></a>\n<a href=\"https://codecov.io/gh/deer-hunt/ipsurv\"><img alt=\"Coverage\" src=\"https://codecov.io/github/deer-hunt/ipsurv/coverage.svg?branch=main\"></a>\n<img alt=\"PyPI - Status\" src=\"https://img.shields.io/pypi/status/ipsurv\">\n<a href=\"https://github.com/deer-hunt/ipsurv/blob/main/LICENSE.md\"><img alt=\"License - MIT\" src=\"https://img.shields.io/pypi/l/ipsurv.svg\"></a>\n<a href=\"https://pypi.org/project/ipsurv/\"><img alt=\"Newest PyPI version\" src=\"https://img.shields.io/pypi/v/ipsurv.svg\"></a>\n<a href=\"https://pypi.org/project/ipsurv/\"><img alt=\"Number of PyPI downloads\" src=\"https://img.shields.io/pypi/dm/ipsurv.svg\"></a>\n<img alt=\"GitHub code size in bytes\" src=\"https://img.shields.io/github/languages/code-size/deer-hunt/ipsurv\">\n<a href=\"https://pypi.org/project/ipsurv\"><img alt=\"Supported Versions\" src=\"https://img.shields.io/pypi/pyversions/ipsurv.svg\"></a>\n<a href=\"https://deer-hunt.github.io/ipsurv/\" alt=\"IpSurv's documentation site\"><img src=\"https://img.shields.io/badge/stable%20docs-github.io-brightgreen?style=flat&color=%2373DC8C&label=Docs\"/></a>\n<a href=\"https://app.fossa.com/projects/git%2Bgithub.com%2Fdeer-hunt%2Fipsurv?ref=badge_shield\" alt=\"FOSSA Status\"><img src=\"https://app.fossa.com/api/projects/git%2Bgithub.com%2Fdeer-hunt%2Fipsurv.svg?type=shield\"/></a>\n\n</div>\n</div>\n\n<p> </p>\n\n<img src=\"https://raw.githubusercontent.com/deer-hunt/ipsurv/main/docs/images/ipsurv.gif\" alt=\"ipsurv visual image\" 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 use in Python 3.0 - 3.2, please run ```pip install ipaddress```.\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## Documentation site\n\nIpSurv's documentation site is [https://deer-hunt.github.io/ipsurv/](https://deer-hunt.github.io/ipsurv/).\n\n\n## Usage\n\n**Specify Target using Argument**\n\n```bash\n$ ipsurv 192.168.1.10\n$ ipsurv 192.168.1.10 192.168.1.11\n$ ipsurv test-example-sample-ipsurv.com --add_ip\n$ ipsurv x.x.x.x --format=geo\n```\n\n**Specify Target using PIPE**\n\n```bash\n$ cat ips.txt|ipsurv\n$ cat apache.log|ipsurv --add_ip\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- Use GeoIP2 via IpSurv optionally.\n\n## Command options\n\n```IpSurv``` have many options. Please read [Command arguments(.md) reference](https://github.com/deer-hunt/ipsurv/blob/main/docs/command_arguments.md).\n\n**Options**\n\n```\n[-h] [--verbose {0,1,2,3}] [--debug] [--log {string}]\n[--disable_env] [--resolve {0,1}] [--identify_int]\n[--autodetect] [--begin {number}] [--end {number}]\n[--collect {string}] [--all_collect] [--timeout {string}]\n[--group {string}] [--skip_duplicate {0,1,2}]\n[--range {string}] [--format {string}] [--no_original]\n[--sequence] [--add_ip] [--ident] [--enclose {string}]\n[--delimiter {string}] [--alt_delimiter {string}]\n[--headers {0,1,2,3}] [--json {0,1,2}] [--json_list]\n[--exhaustive] [--icmp {0,1}] [--tcp {number}]\n[--udp {number}] [--http {0,1,2}] [--json_all]\n[--geoip_only] [--host_only] [--version]\n[target [target ...]]\n```\n\n**Example options**\n\n```bash\n$ cat ips.txt|ipsurv --group=24\n$ cat ips.txt|ipsurv --group=network\n$ cat ips.txt|ipsurv --format=country\n$ cat ips.txt|ipsurv --format=hostname\n$ cat ips.txt|ipsurv --format=\"{country},{name}\"\n$ cat ips.txt|ipsurv --format=\"{country},{ip_int},{handle},{port43}\"\n$ cat /var/log/httpd/access_log|ipsurv --ident --no_original\n\n$ cat ips.txt|ipsurv --group=255.255.255.0\n$ cat ips.txt|ipsurv --delimiter=\"\\t\"\n$ cat ips.txt|ipsurv --format=\"{group}\\t{ip_int}\\t{country}\\t{handle}\\t{port43}\" \n$ cat ips.txt|ipsurv --format=\"{country},{ip_int},{handle},{port43},{icmp},{port},{tcp}\" --group=network --icmp=1 --tcp=1 --timeout=2\n```\n\n## Command examples\n\n**Show headers**\n\n```bash\n$ cat ./example_data/government.txt|ipsurv --headers=1 --format=\"{status},{group},{country},{name},{cidr},{http},{http_h2}\" --group=network --http=2\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**Add line-number**\n\n```bash\n$ cat ./example_data/government.txt|ipsurv --sequence --add_ip\n1,www.whitehouse.gov,192.0.66.168,OK,US,AUTOMATTIC,192.0.64.0,192.0.127.255\n2,www.state.gov,3.165.39.61,OK,US,AMAZON-CF,3.165.0.0,3.165.255.255\n3,www.treasury.gov,23.50.118.187,OK,US,AKAMAI,23.32.0.0,23.67.255.255\n4,www.gov.uk,151.101.192.144,OK,US,SKYCA-3,151.101.0.0,151.101.255.255\n```\n\n**Output by JSON**\n\n```bash\n$ ipsurv wikipedia.org --format=default --json=2 --add_ip\n{\n \"original\": \"wikipedia.org\",\n \"ip\": \"103.102.166.224\",\n \"status\": \"OK\",\n \"group\": \"\",\n \"country\": \"US\",\n \"name\": \"WIKIMEDIA-AP\",\n \"network_start\": \"103.102.166.0\",\n \"network_end\": \"103.102.166.255\"\n}\n```\n\n**Output detailed data by JSON**\n\n```bash\n$ ipsurv wikipedia.org --json_all # `--json_all` is equivalent to `--json=2 --exhaustive`\n$ ipsurv wikipedia.org --format=default --json=2 --exhaustive\n{\n \"success\": true,\n \"status\": \"OK\",\n \"requests\": [\n \"RDAP\"\n ],\n \"errors\": [],\n \"sequence\": 1,\n \"original\": \"wikipedia.org\",\n \"target\": \"103.102.166.224\",\n \"ip\": \"103.102.166.224\",\n \"ip_int\": 1734780640,\n \"port\": null,\n \"group_int\": 0,\n \"group\": \"\",\n \"group_found\": false,\n \"group_status\": \"-\",\n \"country\": \"US\",\n \"name\": \"WIKIMEDIA-AP\",\n \"network_start\": \"103.102.166.0\",\n \"network_end\": \"103.102.166.255\",\n \"ip_hex\": \"67.66.A6.E0\",\n \"ip_reversed\": \"224.166.102.103\",\n \"ip_type\": \"PUBLIC\",\n~~~~~~~~~~~~~\n \"org\": \"Wikimedia Foundation, Inc.\",\n \"address\": \"1 Montgomery Street Suite 1600\",\n \"description\": \"Wikimedia Foundation, Inc.\",\n \"target.raw\": \"wikipedia.org\",\n \"target.identifier\": \"103.102.166.224\",\n \"target.identifier_int\": 1734780640,\n \"target.identified\": true,\n \"target.ip\": \"103.102.166.224\",\n \"target.url\": null,\n \"target.fqdn\": \"wikipedia.org\",\n \"target.port\": null,\n \"target.status\": \"EXIST\"\n}\n```\n\n**Check HTTP response**\n\n```\n$ ipsurv https://www.reddit.com --format=\"{ip},{http},{http_status},{http_size},{http_mime},{http_server},{http_h2}\" --http=2\nhttps://www.reddit.com,151.101.193.140,HTTP_OK,200,721210,text/html,snooserv,HTTP2\n\n$ ipsurv https://www.youtube.com/feed/you --format=web --http=2\nhttps://www.youtube.com/feed/you,142.251.42.174,HTTP_OK,200,559230,text/html,ESF,HTTP2\n```\n\n**Check Host name or PC name**\n\n```\n$ ipsurv 192.168.1.120 --host_only\n$ ipsurv 192.168.1.120 --format=\"hostname\"\n192.168.1.100,MYPC-016\n```\n\n> You can also find the Windows PC name in private network.\n\nMore examples are [here](https://deer-hunt.github.io/ipsurv/pages/command_examples.html).\n\n\n## Output Format\n\nYou can customize \"Output Format\" by ```--format``` option as follows. There are ```parameter - {}``` and ```profile - <>``` in ```--format```.\nFor more information, please read [--format description](https://deer-hunt.github.io/ipsurv/pages/command_arguments.html#format).\n\n```\n$ ipsurv github.io --format=heavy # Profile\n$ ipsurv github.io --format=simple # Profile\n\n$ ipsurv 8.8.8.8 --format=\"{status},{ip},{country},{address}\" # Paramaters\n$ ipsurv 8.8.8.8 --format=\"{status}\\t{ip}\\t{hostname}\" # Paramaters, TAB char\n\n$ ipsurv cloudflare.com --format=\"{ip},<address>,<system>\" # Paramaters + Profile\n$ ipsurv wikipedia.org --format=\"<address>,{hostname},{ip_type}\" # Profile + Paramaters\n```\n\n\n## Using GeoIP2 optionally\n\n```IpSurv``` support [GeoIP2](https://github.com/maxmind/GeoIP2-python) optionally. If ```GeoIP2``` module is installed and there are ```mmdb``` files, You can use GeoIP2 features via ```IpSurv```.\nWhen using the GeoIP2 module, network communication does not occur, which enables faster processing.\n\nPlease refer to the [Using GeoIP2](https://deer-hunt.github.io/ipsurv/pages/using_geoip2.html) documentation in detail.\n\n**Examples**\n\n```\n$ ipsurv 8.8.8.8 --geoip_only\n8.8.8.8,NA,North America,US,United States,America/Chicago,AS15169,37.751;-97.822\n```\n\n```\n$ ipsurv www.wikipedia.org --format=\"{country},{geo}\" --collect=geoip --headers=1\noriginal,country,geo\nwww.wikipedia.org,US,37.751;-97.822\n\n$ ipsurv 8.8.8.8 --format=\"{continent},{continent_name},{country},{geo}\" --collect=\"geoip\" --headers=1\noriginal,continent,continent_name,country,geo\n8.8.8.8,NA,North America,US,37.751;-97.822\n```\n\n> `IpSuv` support customizing GeoIP2 data path by `IPSURV_CONF` env. Please read [here](https://deer-hunt.github.io/ipsurv/pages/command_arguments.html#environment-variable-ipsurv-conf) about `IPSURV_CONF`.\n\n\n## Documents\n\nThe following documents exist in ```IpSurv```. You can read documents in [Documentation site](https://deer-hunt.github.io/ipsurv/).\n\n| Title | Path |\n|-------------------------------|---------------------------------------------|\n| **Command arguments** | [command_arguments.md](https://github.com/deer-hunt/ipsurv/blob/main/docs/command_arguments.md) |\n| **Command examples** | [command_examples.md](https://github.com/deer-hunt/ipsurv/blob/main/docs/command_examples.md) |\n| **Program architecture and Classes** | [program_architecture_classes.md](https://github.com/deer-hunt/ipsurv/blob/main/docs/program_architecture_classes.md) |\n| **Customizing and Examples** | [customize_examples.md](https://github.com/deer-hunt/ipsurv/blob/main/docs/customize_examples.md) |\n| **Development and Debugging** | [development_debug.md](https://github.com/deer-hunt/ipsurv/blob/main/docs/development_debug.md) |\n| **About Using GeoIP2** | [using_geoip2.md](https://github.com/deer-hunt/ipsurv/blob/main/docs/using_geoip2.md) |\n| **IpSurv's Major Modules and Classes** | [github.io / Modules and Classes reference](https://deer-hunt.github.io/ipsurv/py-modindex.html) |\n\n\n## Path summary\n\n| Directory | Description |\n|-----------------------|-----------------------------------------------------|\n| `.github` | GitHub Actions files |\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## Debugging\n\nIn verbose mode, outputting internal data and behaviors in detail.\n\n```bash\n$ ipsurv ***** --verbose=2 #INFO\n$ ipsurv ***** --verbose=3 #DEBUG\n\n$ ipsurv ***** --debug #DEBUG This option is equivalent to \"--verbose=3\"\n```\n\n## Customizing IpSurv\n\n```IpSurv``` is implemented as customizable program architecture. ```IpSurv``` provide extending features and several classes. \nAnd you can use IpSurv's internal classes in your program. Please read ```program_architecture_classes.md```.\n\n**Classes for major customization**\n\n| Classes | Description |\n|----------------------|----------------------------------------------|\n| **Pipeline** | Pipeline class provide catching and customizing the data in each processing. ```./examples/pipeline_customize.py``` |\n| **ObjectFactory** | ObjectFactory class provide customizing classes and creating original classes. ```./examples/object_factory.py``` |\n| **Serializer, LineSerializer, JsonSerializer** | Serializer class provide displaying data and transforming data for presentation. ```./examples/object_factory_original_headers.py``` |\n\n\n## Dependencies\n\n- [dnspython](https://github.com/rthalley/dnspython)\n- [geoip2](https://github.com/maxmind/GeoIP2-python) [Optional]\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.1.3",
"project_urls": {
"Changelog": "https://github.com/deer-hunt/ipsurv/blob/main/CHANGELOG.md",
"Documentation": "https://deer-hunt.github.io/ipsurv/",
"Github": "https://github.com/deer-hunt/ipsurv/",
"Homepage": "https://github.com/deer-hunt/ipsurv"
},
"split_keywords": [
"survey",
" ip",
" domain",
" rdap",
" whois",
" http"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a459ef898515cb0a1b0044dc6eedac69f8eeefeda67e6545cc5e02ce41818804",
"md5": "17e555516dd852d042920f55b101b5e7",
"sha256": "af40caa6488daab9dacc3481ac4409a93d59642202089d81e12f714d467d616c"
},
"downloads": -1,
"filename": "ipsurv-1.1.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "17e555516dd852d042920f55b101b5e7",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.0",
"size": 47509,
"upload_time": "2024-12-17T14:07:07",
"upload_time_iso_8601": "2024-12-17T14:07:07.796235Z",
"url": "https://files.pythonhosted.org/packages/a4/59/ef898515cb0a1b0044dc6eedac69f8eeefeda67e6545cc5e02ce41818804/ipsurv-1.1.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "9e0286a77247557bf3af2863710eaa2aca97c360bd7ab86a2c1604f63bf0c266",
"md5": "eaf502da7597f5f73de3d59d3038cb76",
"sha256": "ae1d7929fa9ade6ae3912b5f693d82de22252dd021c69c6595df1a1921f867a4"
},
"downloads": -1,
"filename": "ipsurv-1.1.3.tar.gz",
"has_sig": false,
"md5_digest": "eaf502da7597f5f73de3d59d3038cb76",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.0",
"size": 51176,
"upload_time": "2024-12-17T14:07:11",
"upload_time_iso_8601": "2024-12-17T14:07:11.380495Z",
"url": "https://files.pythonhosted.org/packages/9e/02/86a77247557bf3af2863710eaa2aca97c360bd7ab86a2c1604f63bf0c266/ipsurv-1.1.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-17 14:07:11",
"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": "geoip2",
"specs": []
}
],
"tox": true,
"lcname": "ipsurv"
}