Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_dig_aaaa_ubuntu_18_4(self):
"""
Test 'dig AAAA' on Ubuntu 18.4
"""
self.assertEqual(jc.parsers.dig.parse(self.ubuntu_18_4_dig_aaaa, quiet=True), self.ubuntu_18_4_dig_aaaa_json)
def test_dig_centos_7_7(self):
"""
Test 'dig' on Centos 7.7
"""
self.assertEqual(jc.parsers.dig.parse(self.centos_7_7_dig, quiet=True), self.centos_7_7_dig_json)
def test_dig_x_centos_7_7(self):
"""
Test 'dig -x' on Centos 7.7
"""
self.assertEqual(jc.parsers.dig.parse(self.centos_7_7_dig_x, quiet=True), self.centos_7_7_dig_x_json)
def test_dig_ubuntu_18_4(self):
"""
Test 'dig' on Ubuntu 18.4
"""
self.assertEqual(jc.parsers.dig.parse(self.ubuntu_18_4_dig, quiet=True), self.ubuntu_18_4_dig_json)
def test_dig_aaaa_centos_7_7(self):
"""
Test 'dig AAAA' on Centos 7.7
"""
self.assertEqual(jc.parsers.dig.parse(self.centos_7_7_dig_aaaa, quiet=True), self.centos_7_7_dig_aaaa_json)
def test_dig_x_ubuntu_18_4(self):
"""
Test 'dig -x' on Ubuntu 18.4
"""
self.assertEqual(jc.parsers.dig.parse(self.ubuntu_18_4_dig_x, quiet=True), self.ubuntu_18_4_dig_x_json)
if '-q' in sys.argv:
quiet = True
if '-r' in sys.argv:
raw = True
# parsers
if '--arp' in sys.argv:
result = jc.parsers.arp.parse(data, raw=raw, quiet=quiet)
elif '--df' in sys.argv:
result = jc.parsers.df.parse(data, raw=raw, quiet=quiet)
elif '--dig' in sys.argv:
result = jc.parsers.dig.parse(data, raw=raw, quiet=quiet)
elif '--env' in sys.argv:
result = jc.parsers.env.parse(data, raw=raw, quiet=quiet)
elif '--free' in sys.argv:
result = jc.parsers.free.parse(data, raw=raw, quiet=quiet)
elif '--history' in sys.argv:
result = jc.parsers.history.parse(data, raw=raw, quiet=quiet)
elif '--ifconfig' in sys.argv:
result = jc.parsers.ifconfig.parse(data, raw=raw, quiet=quiet)
elif '--iptables' in sys.argv:
result = jc.parsers.iptables.parse(data, raw=raw, quiet=quiet)
debug = True
if '-p' in sys.argv:
pretty = True
if '-q' in sys.argv:
quiet = True
if '-r' in sys.argv:
raw = True
# parsers
parser_map = {
'--arp': jc.parsers.arp.parse,
'--df': jc.parsers.df.parse,
'--dig': jc.parsers.dig.parse,
'--env': jc.parsers.env.parse,
'--free': jc.parsers.free.parse,
'--fstab': jc.parsers.fstab.parse,
'--history': jc.parsers.history.parse,
'--hosts': jc.parsers.hosts.parse,
'--ifconfig': jc.parsers.ifconfig.parse,
'--iptables': jc.parsers.iptables.parse,
'--jobs': jc.parsers.jobs.parse,
'--ls': jc.parsers.ls.parse,
'--lsblk': jc.parsers.lsblk.parse,
'--lsmod': jc.parsers.lsmod.parse,
'--lsof': jc.parsers.lsof.parse,
'--mount': jc.parsers.mount.parse,
'--netstat': jc.parsers.netstat.parse,
'--ps': jc.parsers.ps.parse,
'--route': jc.parsers.route.parse,