1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-06-17 00:07:37 +02:00

fix for ipv6 ip-address parser with older python and version bump

This commit is contained in:
Kelly Brazil
2022-08-29 07:51:27 -07:00
parent 0b726f7acc
commit 5968eb697e
6 changed files with 18 additions and 8 deletions

View File

@ -1,8 +1,12 @@
jc changelog jc changelog
20220829 v1.21.2
- Fix IP Address string parser for older python versions that don't cleanly
accept decimal input format - IPv6 fix (e.g. python 3.6)
20220828 v1.21.1 20220828 v1.21.1
- Fix IP Address string parser for older python versions that don't cleanly - Fix IP Address string parser for older python versions that don't cleanly
accept decimal input format (e.g. python 3.6) accept decimal input format - IPv4 fix (e.g. python 3.6)
- Fix `arp -a` parser for cases where incomplete hardware addresses are found - Fix `arp -a` parser for cases where incomplete hardware addresses are found
in the arp table on linux in the arp table on linux

View File

@ -487,4 +487,4 @@ Returns:
### Parser Information ### Parser Information
Compatibility: linux, darwin, cygwin, win32, aix, freebsd Compatibility: linux, darwin, cygwin, win32, aix, freebsd
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com) Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@ -6,7 +6,7 @@ import importlib
from typing import Dict, List, Iterable, Union, Iterator from typing import Dict, List, Iterable, Union, Iterator
from jc import appdirs from jc import appdirs
__version__ = '1.21.1' __version__ = '1.21.2'
parsers = [ parsers = [
'acpi', 'acpi',

View File

@ -468,7 +468,7 @@ import jc.utils
class info(): class info():
"""Provides parser metadata (version, author, etc.)""" """Provides parser metadata (version, author, etc.)"""
version = '1.1' version = '1.2'
description = 'IPv4 and IPv6 Address string parser' description = 'IPv4 and IPv6 Address string parser'
author = 'Kelly Brazil' author = 'Kelly Brazil'
author_email = 'kellyjonbrazil@gmail.com' author_email = 'kellyjonbrazil@gmail.com'
@ -569,7 +569,10 @@ def parse(
try: try:
hostmask_string = str(interface.hostmask) hostmask_string = str(interface.hostmask)
except AttributeError: except AttributeError:
if interface.version == 4:
hostmask_string = '0.0.0.0' hostmask_string = '0.0.0.0'
if interface.version == 6:
hostmask_string = '::'
hostmask_ipobj = ipaddress.ip_address(hostmask_string) hostmask_ipobj = ipaddress.ip_address(hostmask_string)
@ -577,7 +580,10 @@ def parse(
try: try:
netmask_string = str(interface.netmask) netmask_string = str(interface.netmask)
except AttributeError: except AttributeError:
if interface.version == 4:
netmask_string = '255.255.255.255' netmask_string = '255.255.255.255'
if interface.version == 6:
netmask_string = 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff'
netmask_ipobj = ipaddress.ip_address(netmask_string) netmask_ipobj = ipaddress.ip_address(netmask_string)

View File

@ -1,4 +1,4 @@
.TH jc 1 2022-08-28 1.21.1 "JSON Convert" .TH jc 1 2022-08-29 1.21.2 "JSON Convert"
.SH NAME .SH NAME
\fBjc\fP \- JSON Convert JSONifies the output of many CLI tools and file-types \fBjc\fP \- JSON Convert JSONifies the output of many CLI tools and file-types
.SH SYNOPSIS .SH SYNOPSIS

View File

@ -5,7 +5,7 @@ with open('README.md', 'r') as f:
setuptools.setup( setuptools.setup(
name='jc', name='jc',
version='1.21.1', version='1.21.2',
author='Kelly Brazil', author='Kelly Brazil',
author_email='kellyjonbrazil@gmail.com', author_email='kellyjonbrazil@gmail.com',
description='Converts the output of popular command-line tools and file-types to JSON.', description='Converts the output of popular command-line tools and file-types to JSON.',