Skip to main content

"IpSurv" is a command-line program for surveying IP addresses, host information, and more. Also "IpSurv" is extensible program by Python.

Project description

IpSurv

"IpSurv" is a command-line program for surveying IP addresses, host information, and more. Also "IpSurv" is extensible program by Python.

CI - Test Coverage

ipsurv

Installation

$ 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

$ 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

$ cat ips.txt|python3 -m ipsurv
$ cat apache.log|python3 -m ipsurv

Example result

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.

$ 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.

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

$ 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

$ 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
Command examples command_examples.md
Program architecture and Classes program_architecture_classes.md
Customizing and Examples customize_examples.md
Development and Debugging development_debug.md

Debugging

In verbose mode, outputting internal data and behaviors in detail.

$ python -m ipsurv --verbose=2 #INFO
$ python -m ipsurv --verbose=3 #DEBUG

Dependencies

dnspython, ipaddress

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ipsurv-1.0.0.tar.gz (40.1 kB view details)

Uploaded Source

Built Distribution

ipsurv-1.0.0-py3-none-any.whl (37.9 kB view details)

Uploaded Python 3

File details

Details for the file ipsurv-1.0.0.tar.gz.

File metadata

  • Download URL: ipsurv-1.0.0.tar.gz
  • Upload date:
  • Size: 40.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for ipsurv-1.0.0.tar.gz
Algorithm Hash digest
SHA256 ff0075d4bcae38a41510807c6cba34bf083efcb4da576d081c8a1940b25e4ad8
MD5 a242dcdbc28099c1550ca8dbebc7e6be
BLAKE2b-256 aa535543664c7f9475f6e5556c394732905cfdc424b334283c40a2bb94546807

See more details on using hashes here.

File details

Details for the file ipsurv-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: ipsurv-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 37.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for ipsurv-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6185eda82151ec211b7a767f6b6368e9cd09ae373f8e59f8e08d41eaf0f5e397
MD5 1a34dd3fc5bfd5f928be38c90bc6cb04
BLAKE2b-256 a78daef66313378df328fd243e6a857aa41241d268a206ca1e0dcd5befa6913e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page