ipsurv package

Submodules

ipsurv.configs module

class Config

Bases: object

APP_ARGUMENTS = {'add_ip': {'action': 'store_true', 'default': False, 'help': 'Append "ip" to the output format. For example, use when the target is a hostname, etc.'}, 'all_collect': {'action': 'store_true', 'default': False, 'help': 'All data collectors.'}, 'alt_delimiter': {'action': 'StrAction', 'default': ';', 'help': 'Alternative delimiter character. If you specify "enclose" or "json" option, this option is disabled.', 'type': <class 'str'>}, 'autodetect': {'default': False, 'help': 'Autodetect an IP or hostname that is included in the line. [Experimental]', 'type': <function strtobool>}, 'begin': {'default': -1, 'help': 'Beginning from sequence number.', 'type': <class 'int'>}, 'collect': {'default': 'rdap;dnstxt;dnsreverse;ipinfo;geoip', 'help': 'Data collectors. See reference manual in detail. ex: rdap;dnstxt;dnsreverse;ipinfo;geoip', 'type': <class 'str'>}, 'delimiter': {'action': 'StrAction', 'default': None, 'help': 'Delimiter-char in result line.', 'type': <class 'str'>}, 'enclose': {'default': None, 'help': 'Character of enclose in result line. If you specify "json" option, this option is disabled. ex: \'"\', "\'"', 'type': <class 'str'>}, 'end': {'default': -1, 'help': 'Ending to sequence number.', 'type': <class 'int'>}, 'exhaustive': {'action': 'store_true', 'default': False, 'help': 'Output exhaustive internal values in JSON. Use with "json" option.'}, 'format': {'action': 'StrAction', 'default': 'default', 'help': 'Output format. Specify `Profile` or `Parameter`. See reference manual in detail. ex: simple, default, detail, heavy, geo, hostname etc.', 'type': None}, 'geoip_only': {'action': 'store_true', 'default': False, 'help': '`--geoip_only` is equivalent to `--collect=geoip --format=area`.'}, 'group': {'default': None, 'help': 'Grouping rule. ex: network, 24, 255.255.255.0', 'type': None}, 'headers': {'choices': [0, 1, 2, 3], 'default': 0, 'help': 'Show headers. 1: LowerCase, 2: PascalCase, 3: UpperCase', 'type': <class 'int'>}, 'http': {'choices': [0, 1, 2], 'default': 0, 'help': 'Check HTTP response.', 'type': <class 'int'>}, 'icmp': {'default': False, 'help': 'Check ICMP.', 'type': <function strtobool>}, 'ident': {'action': 'store_true', 'default': False, 'help': 'Append identifier. Default identifier is ip.'}, 'identify_int': {'action': 'store_true', 'default': False, 'help': "Identify IP's int value."}, 'json': {'choices': [0, 1, 2], 'default': 0, 'help': 'Output JSON data. *2: Output formatted JSON.', 'type': <class 'int'>}, 'json_all': {'action': 'store_true', 'default': False, 'help': '`--json_all` is equivalent to `--json=2 --exhaustive`.'}, 'json_list': {'action': 'store_true', 'default': False, 'help': 'Output JSON list. It makes it easier to parse JSON.'}, 'no_original': {'action': 'store_true', 'default': False, 'help': 'Cancel outputting the original line automatically.'}, 'range': {'default': '', 'help': 'Check whether IP is in IP/subnet ranges.  The value is CIDR notation. ex: "1.0.0.1/8;192.168.1.1/24"', 'type': <class 'str'>}, 'resolve': {'default': True, 'help': 'Resolve the name to IP if target value is domain or hostname automatically.', 'type': <function strtobool>}, 'sequence': {'action': 'store_true', 'default': False, 'help': 'Append sequence number.'}, 'skip_duplicate': {'choices': [0, 1, 2], 'default': 0, 'help': 'Skip duplicate group. *2: It also skip checking server reactivity[icmp, tcp, udp].', 'type': <class 'int'>}, 'tcp': {'default': 0, 'help': 'Check TCP port. Specify default port.', 'type': <class 'int'>}, 'timeout': {'default': '8.0', 'help': 'Timeout seconds. Specify single value - ex: 1,3.2. Or specify values of each connection types. "dns,http,reactivity" - "3;5.1;6"', 'type': <class 'str'>}, 'udp': {'default': 0, 'help': 'Check UDP port. Specify default port.', 'type': <class 'int'>}, 'version': {'action': 'store_true', 'default': False, 'help': 'Show version information.'}}
COLLECTORS = ['rdap', 'dnstxt', 'ipinfo', 'dnsreverse', 'geoip']
ENV_CONFS = ['ipinfo_token', 'geoip']
FORMAT_PARAMS = ['success', 'status', 'requests', 'errors', 'identifier', 'identifier_int', 'target.*', 'sequence', 'original', 'ip', 'ip_int', 'ip_hex', 'ip_reversed', 'port', 'ip_type', 'in_range', 'group_int', 'group', 'group_found', 'group_status', 'network_start', 'network_end', 'country', 'cidr', 'rdap_time', 'port43', 'country_updated', 'name', 'handle', 'address', 'org', 'asn', 'timezone', 'description', 'dnstxt_time', 'rir', 'dnsreverse_time', 'hostname', 'ipinfo_time', 'geo', 'postal', 'city_name', 'region_name', 'continent', 'continent_name', 'subdivision', 'subdivision_name', 'icmp', 'icmp_time', 'tcp', 'tcp_time', 'udp', 'udp_time', 'http', 'http_time', 'http_status', 'http_size', 'http_h2']
FORMAT_PROFILES = {'address': ['country', 'address'], 'area': ['continent', 'continent_name', 'country', 'country_name', 'timezone', 'geo'], 'country': ['country'], 'default': ['status', 'group', 'country', 'name', 'network_start', 'network_end'], 'detail': ['status', 'group', 'country', 'name', 'handle', 'asn', 'org', 'cidr', 'geo', 'city_name', 'address', 'description', 'hostname', 'errors'], 'geo': ['country', 'geo'], 'heavy': ['status', 'group', 'country', 'timezone', 'name', 'handle', 'asn', 'org', 'cidr', 'network_start', 'network_end', 'ip_type', 'geo', 'city_name', 'region_name', 'address', 'description', 'hostname', 'errors'], 'hostname': ['hostname'], 'ip': ['ip'], 'network': ['cidr', 'network_start', 'network_end'], 'org': ['asn', 'org'], 'simple': ['status', 'group', 'country'], 'system': ['ip_type', 'ip_int', 'ip_hex', 'ip_reversed'], 'timezone': ['timezone'], 'web': ['http', 'http_status', 'http_h2', 'http_time']}
HEAD_MSG_SELF = 'Self IP status by https://ipinfo.io'
MASTER_DATA = {'errors': [], 'group': '', 'group_found': False, 'group_int': 0, 'group_status': '', 'ip': None, 'ip_int': None, 'ip_type': None, 'original': None, 'port': -1, 'requests': [], 'sequence': None, 'status': '', 'success': False, 'target': None}
PRE_ARGUMENTS = {'debug': {'action': 'store_true', 'default': False, 'help': '`--debug` is equivalent to `--verbose=3`.'}, 'disable_env': {'action': 'store_true', 'default': False, 'help': 'Disable to load env variable for args. Env name: `IPSURV_ARGS`.'}, 'log': {'default': None, 'help': 'Verbose log filename.', 'type': <class 'str'>}, 'verbose': {'choices': [0, 1, 2, 3], 'default': 0, 'help': 'Verbose mode. [Level - 1:TRACE_ERROR, 2:INFO, 3:DEBUG]', 'type': <class 'int'>}}
class Constant

Bases: object

APP_BOTTOM_DESC = 'command example:\n  ipsurv 192.168.1.100\n  ipsurv 192.168.1.100 192.168.1.101\n  ipsurv google.com wikipedia.org\n  cat list.txt|ipsurv\n  cat list.txt|ipsurv --format="hostname"\n  cat list.txt|ipsurv --json=2\n  cat /var/log/httpd/access_log|ipsurv --add_ip --no_original\n  ipsurv self\n\ndocuments:\n  https://github.com/deer-hunt/ipsurv/\n  There are several documents, including "Command arguments reference", "Command examples", and more.\n'
APP_DESCRIPTION = '"IpSurv" is a command-line program for surveying IP addresses, host information, and more. Also "IpSurv" is extensible program by Python.'
APP_NAME = 'ipsurv'
DELIMITER_DEFAULT = ','
ENV_ARGS_VAR = 'IPSURV_ARGS'
ENV_CONF_VAR = 'IPSURV_CONF'
IP_TYPE_PRIVATE = 1
IP_TYPE_PUBLIC = 2
MODE_SURVEY_IPS = 1
MODE_SURVEY_SELF = 2
STATUS_EMPTY = 'EMPTY'
STATUS_EXIST = 'EXIST'
STATUS_ILLEGAL_FORMAT = 'ILLEGAL_FORMAT'
STATUS_RESOLVE_FAIL = 'RESOLVE_FAIL'
STR_LOWER = 1
STR_PASCAL = 2
STR_UPPER = 3

ipsurv.ip_surv_cmd module

class IpSurvCmd(factory)

Bases: object

run()

ipsurv.survey_ips module

class SurveyIps(args, config, data_factory, target_parser, collectors, reactivities, pipeline, serializer)

Bases: object

dispatch(rows, args)
initialize(args)

ipsurv.survey_self module

class SurveySelf(args, config, data_factory, collector, pipeline, serializer)

Bases: object

dispatch()
initialize()

Module contents