Skip to main content

Allow a user to unpack IP ranges

Project description

UnPackIps

Description

IpRanges was designed for Network Engineer to quickly unpack IP ranges. The intention is to avoid spreadsheets, and other methods of IP importing.

Dependency


  • Python3

Usage

  • A pipe "|" separator is used to separate subnets within the string, and commas and dashes to expand IP addresses.

Example 1: Unpacking IPs

      >>> ips = get_ips(user_input="10.1.1.130, 131, 133| 192.168.1.22-50, 1|8.8.8.8")
      ['10.1.1.130', '10.1.1.131', '10.1.1.133', '192.168.1.22', '192.168.1.23', '192.168.1.24', '192.168.1.25', '192.168.1.26', '192.168.1.27', '192.168.1.28',
      '192.168.1.29', '192.168.1.30', '192.168.1.31', '192.168.1.32', '192.168.1.33', '192.168.1.34', '192.168.1.35', '192.168.1.36', '192.168.1.37'
      , '192.168.1.38', '192.168.1.39', '192.168.1.40', '192.168.1.41', '192.168.1.42', '192.168.1.43', '192.168.1.44', '192.168.1.45', '192.168.1.46', '192.168.1.47',
      '192.168.1.48', '192.168.1.49', '192.168.1.50', '192.168.1.1', '8.8.8.8']

Example 2: Unpacking w/ Ping

      >>> ping(user_input="10.1.1.130, 131, 133| 192.168.1.22, 1|8.8.8.8")
      10.1.1.130 up | Latency: 314ms Time: Mon, 19 Oct 2020 20:56:01 +0000
      10.1.1.130 up | Latency: 326ms Time: Mon, 19 Oct 2020 20:56:01 +0000
      10.1.1.130 up | Latency: 246ms Time: Mon, 19 Oct 2020 20:56:01 +0000
      10.1.1.130 up | Latency: 269ms Time: Mon, 19 Oct 2020 20:56:01 +0000
      _
      10.1.1.131 up | Latency: 332ms Time: Mon, 19 Oct 2020 20:56:05 +0000
      10.1.1.131 up | Latency: 251ms Time: Mon, 19 Oct 2020 20:56:05 +0000
      10.1.1.131 up | Latency: 274ms Time: Mon, 19 Oct 2020 20:56:05 +0000
      10.1.1.131 up | Latency: 296ms Time: Mon, 19 Oct 2020 20:56:05 +0000
      _
      !!! 10.1.1.133 Request timed out. | Status: Down | Time: Mon, 19 Oct 2020 20:56:24 +0000 !!!
      !!! 10.1.1.133 Request timed out. | Status: Down | Time: Mon, 19 Oct 2020 20:56:24 +0000 !!!
      !!! 10.1.1.133 Rsquest timed out. | Status: Down | Time: Mon, 19 Oct 2020 20:56:24 +0000 !!!
      !!! 10.1.1.133 Rsquest timed out. | Status: Down | Time: Mon, 19 Oct 2020 20:56:24 +0000 !!!
      _
      192.168.1.22 up | Latency: 180ms Time: Mon, 19 Oct 2020 20:56:27 +0000
      192.168.1.22 up | Latency: 203ms Time: Mon, 19 Oct 2020 20:56:27 +0000
      192.168.1.22 up | Latency: 226ms Time: Mon, 19 Oct 2020 20:56:27 +0000
      192.168.1.22 up | Latency: 145ms Time: Mon, 19 Oct 2020 20:56:27 +0000
      _
      192.168.1.1 up | Latency: 142ms Time: Mon, 19 Oct 2020 20:56:30 +0000
      192.168.1.1 up | Latency: 125ms Time: Mon, 19 Oct 2020 20:56:30 +0000
      192.168.1.1 up | Latency: 187ms Time: Mon, 19 Oct 2020 20:56:30 +0000
      192.168.1.1 up | Latency: 214ms Time: Mon, 19 Oct 2020 20:56:30 +0000

All ping output saved to log with latency

      >>> INFO:root:
      192.168.156.22 up | Latency: 180ms Time: Mon, 19 Oct 2020 20:56:27 +0000
      INFO:root:
                192.168.1.22 up | Latency: 203ms Time: Mon, 19 Oct 2020 20:56:27 +0000
      INFO:root:
                192.168.1.22 up | Latency: 226ms Time: Mon, 19 Oct 2020 20:56:27 +0000
      INFO:root:
                192.168.1.22 up | Latency: 145ms Time: Mon, 19 Oct 2020 20:56:27 +0000
      INFO:root:
                192.168.1.1 up | Latency: 142ms Time: Mon, 19 Oct 2020 20:56:30 +0000
      INFO:root:
                192.168.1.1 up | Latency: 125ms Time: Mon, 19 Oct 2020 20:56:30 +0000
      INFO:root:
                192.168.1.1 up | Latency: 187ms Time: Mon, 19 Oct 2020 20:56:30 +0000
      INFO:root:
                192.168.1.1 up | Latency: 214ms Time: Mon, 19 Oct 2020 20:56:30 +0000
      INFO:root:
                8.8.8.8 up | Latency: 35ms Time: Mon, 19 Oct 2020 20:56:33 +0000
      INFO:root:
                8.8.8.8 up | Latency: 39ms Time: Mon, 19 Oct 2020 20:56:33 +0000
      INFO:root:
                8.8.8.8 up | Latency: 37ms Time: Mon, 19 Oct 2020 20:56:33 +0000
      INFO:root:
                8.8.8.8 up | Latency: 43ms Time: Mon, 19 Oct 2020 20:56:33 +0000

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

UnpackIPs-2.0.2.tar.gz (3.8 kB view details)

Uploaded Source

File details

Details for the file UnpackIPs-2.0.2.tar.gz.

File metadata

  • Download URL: UnpackIPs-2.0.2.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.3

File hashes

Hashes for UnpackIPs-2.0.2.tar.gz
Algorithm Hash digest
SHA256 ac19946c7e9ed08f0281e25dffaa283fd5e279bc222a4d1282b07eededc8473e
MD5 c4d7f590f0dfdaf9998de546902e2066
BLAKE2b-256 a0c3b22e042e4972d2f49d3e83992617aac8ad1d28f96f1623b5e7377d11bd69

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