mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-06-23 00:29:59 +02:00
@ -1,5 +1,8 @@
|
||||
jc changelog
|
||||
|
||||
20220102 v1.17.6
|
||||
- Add jar-manifest file parser (for MANIFEST.MF files)
|
||||
|
||||
20211221 v1.17.5
|
||||
- Add zipinfo parser tested on linux and macOS
|
||||
|
||||
|
@ -145,6 +145,7 @@ The JSON output can be compact (default) or pretty formatted with the `-p` optio
|
||||
- `--iostat-s` enables the `iostat` command streaming parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/iostat_s))
|
||||
- `--iptables` enables the `iptables` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/iptables))
|
||||
- `--iw-scan` enables the `iw dev [device] scan` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/iw_scan))
|
||||
- `--jar-manifest` enables the MANIFEST.MF file parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/jar_manifest))
|
||||
- `--jobs` enables the `jobs` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/jobs))
|
||||
- `--kv` enables the Key/Value file parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/kv))
|
||||
- `--last` enables the `last` and `lastb` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/last))
|
||||
@ -1009,4 +1010,4 @@ cat istio.yaml | jc --yaml -p
|
||||
]
|
||||
```
|
||||
|
||||
© 2019-2021 Kelly Brazil
|
||||
© 2019-2022 Kelly Brazil
|
104
docs/parsers/jar_manifest.md
Normal file
104
docs/parsers/jar_manifest.md
Normal file
@ -0,0 +1,104 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
|
||||
# jc.parsers.jar_manifest
|
||||
jc - JSON CLI output utility `MANIFES.MF` file parser
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ cat MANIFEST.MF | jc --jar-manifest
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.jar_manifest
|
||||
result = jc.parsers.jar_manifest.parse(jar_manifest_file_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"key1": string,
|
||||
"key2": string
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
$ cat MANIFEST.MF | jc --jar-manifest -p
|
||||
$ unzip -c apache-log4j-2.16.0-bin/log4j-core-2.16.0.jar META-INF/MANIFEST.MF | jc --jar-manifest -p
|
||||
$ unzip -c 'apache-log4j-2.16.0-bin/*.jar' META-INF/MANIFEST.MF | jc --jar-manifest -p
|
||||
|
||||
$ cat MANIFEST.MF | jc --jar-manifest -p
|
||||
|
||||
[
|
||||
{
|
||||
"Import_Package": "com.conversantmedia.util.concurrent;resolution:=optional,com.fasterxml.jackson.annotation;version="[2.12,3)";resolution:=optional,com.fasterxml.jackson.core;version="[2.12,3)";resolution:=optional,com.fasterxml.jackson.core.type;version="[2.12,3)";resolution:=optional,com.fasterxml.jackson.cor...",
|
||||
"Export_Package": "org.apache.logging.log4j.core;uses:="org.apache.logging.log4j,org.apache.logging.log4j.core.config,org.apache.logging.log4j.core.impl,org.apache.logging.log4j.core.layout,org.apache.logging.log4j.core.time,org.apache.logging.log4j.message,org.apache.logging.log4j.spi,org.apache.logging.log4j.status...",
|
||||
"Manifest_Version": "1.0",
|
||||
"Bundle_License": "https://www.apache.org/licenses/LICENSE-2.0.txt",
|
||||
"Bundle_SymbolicName": "org.apache.logging.log4j.core",
|
||||
"Built_By": "matt",
|
||||
"Bnd_LastModified": "1639373735804",
|
||||
"Implementation_Vendor_Id": "org.apache.logging.log4j",
|
||||
"Specification_Title": "Apache Log4j Core",
|
||||
"Log4jReleaseManager": "Matt Sicker",
|
||||
...
|
||||
}
|
||||
]
|
||||
|
||||
$ unzip -c 'apache-log4j-2.16.0-bin/*.jar' META-INF/MANIFEST.MF | jc --jar-manifest -p
|
||||
|
||||
[
|
||||
...
|
||||
{
|
||||
"Archive": "apache-log4j-2.16.0-bin/log4j-spring-boot-2.16.0-sources.jar",
|
||||
"Manifest_Version": "1.0",
|
||||
"Built_By": "matt",
|
||||
"Created_By": "Apache Maven 3.8.4",
|
||||
"Build_Jdk": "1.8.0_312"
|
||||
},
|
||||
{
|
||||
"Archive": "apache-log4j-2.16.0-bin/log4j-spring-boot-2.16.0-javadoc.jar",
|
||||
"Manifest_Version": "1.0",
|
||||
"Built_By": "matt",
|
||||
"Created_By": "Apache Maven 3.8.4",
|
||||
"Build_Jdk": "1.8.0_312"
|
||||
},
|
||||
{
|
||||
"Bundle_SymbolicName": "org.apache.logging.log4j.spring-cloud-config-client.logging.log4j.core.util;version="[2.16,3)",org.springframework.boot.autoconfigure.condition,org.springframework.cloud.context.environment,org.springframework.context,org.springframework.stereotype",
|
||||
"Export_Package": "org.apache.logging.log4j.spring.cloud.config.controller;version="2.16.0"ient",
|
||||
"Archive": "apache-log4j-2.16.0-bin/log4j-spring-cloud-config-client-2.16.0.jar",
|
||||
"Manifest_Version": "1.0",
|
||||
"Bundle_License": "https://www.apache.org/licenses/LICENSE-2.0.txt",
|
||||
...
|
||||
}
|
||||
...
|
||||
]
|
||||
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) output preprocessed JSON if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
|
||||
|
||||
Version 0.01 by Matt J (https://github.com/listuser)
|
@ -73,4 +73,4 @@ Module Example:
|
||||
"""
|
||||
|
||||
name = 'jc'
|
||||
__version__ = '1.17.5'
|
||||
__version__ = '1.17.6'
|
||||
|
@ -37,7 +37,7 @@ class info():
|
||||
author = 'Kelly Brazil'
|
||||
author_email = 'kellyjonbrazil@gmail.com'
|
||||
website = 'https://github.com/kellyjonbrazil/jc'
|
||||
copyright = '© 2019-2021 Kelly Brazil'
|
||||
copyright = '© 2019-2022 Kelly Brazil'
|
||||
license = 'MIT License'
|
||||
|
||||
|
||||
@ -80,6 +80,7 @@ parsers = [
|
||||
'iostat-s',
|
||||
'iptables',
|
||||
'iw-scan',
|
||||
'jar-manifest',
|
||||
'jobs',
|
||||
'kv',
|
||||
'last',
|
||||
|
215
jc/parsers/jar_manifest.py
Normal file
215
jc/parsers/jar_manifest.py
Normal file
@ -0,0 +1,215 @@
|
||||
"""jc - JSON CLI output utility `MANIFES.MF` file parser
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ cat MANIFEST.MF | jc --jar-manifest
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.jar_manifest
|
||||
result = jc.parsers.jar_manifest.parse(jar_manifest_file_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"key1": string,
|
||||
"key2": string
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
$ cat MANIFEST.MF | jc --jar-manifest -p
|
||||
$ unzip -c apache-log4j-2.16.0-bin/log4j-core-2.16.0.jar META-INF/MANIFEST.MF | jc --jar-manifest -p
|
||||
$ unzip -c 'apache-log4j-2.16.0-bin/*.jar' META-INF/MANIFEST.MF | jc --jar-manifest -p
|
||||
|
||||
$ cat MANIFEST.MF | jc --jar-manifest -p
|
||||
|
||||
[
|
||||
{
|
||||
"Import_Package": "com.conversantmedia.util.concurrent;resolution:=optional,com.fasterxml.jackson.annotation;version=\"[2.12,3)\";resolution:=optional,com.fasterxml.jackson.core;version=\"[2.12,3)\";resolution:=optional,com.fasterxml.jackson.core.type;version=\"[2.12,3)\";resolution:=optional,com.fasterxml.jackson.cor...",
|
||||
"Export_Package": "org.apache.logging.log4j.core;uses:=\"org.apache.logging.log4j,org.apache.logging.log4j.core.config,org.apache.logging.log4j.core.impl,org.apache.logging.log4j.core.layout,org.apache.logging.log4j.core.time,org.apache.logging.log4j.message,org.apache.logging.log4j.spi,org.apache.logging.log4j.status...",
|
||||
"Manifest_Version": "1.0",
|
||||
"Bundle_License": "https://www.apache.org/licenses/LICENSE-2.0.txt",
|
||||
"Bundle_SymbolicName": "org.apache.logging.log4j.core",
|
||||
"Built_By": "matt",
|
||||
"Bnd_LastModified": "1639373735804",
|
||||
"Implementation_Vendor_Id": "org.apache.logging.log4j",
|
||||
"Specification_Title": "Apache Log4j Core",
|
||||
"Log4jReleaseManager": "Matt Sicker",
|
||||
...
|
||||
}
|
||||
]
|
||||
|
||||
$ unzip -c 'apache-log4j-2.16.0-bin/*.jar' META-INF/MANIFEST.MF | jc --jar-manifest -p
|
||||
|
||||
[
|
||||
...
|
||||
{
|
||||
"Archive": "apache-log4j-2.16.0-bin/log4j-spring-boot-2.16.0-sources.jar",
|
||||
"Manifest_Version": "1.0",
|
||||
"Built_By": "matt",
|
||||
"Created_By": "Apache Maven 3.8.4",
|
||||
"Build_Jdk": "1.8.0_312"
|
||||
},
|
||||
{
|
||||
"Archive": "apache-log4j-2.16.0-bin/log4j-spring-boot-2.16.0-javadoc.jar",
|
||||
"Manifest_Version": "1.0",
|
||||
"Built_By": "matt",
|
||||
"Created_By": "Apache Maven 3.8.4",
|
||||
"Build_Jdk": "1.8.0_312"
|
||||
},
|
||||
{
|
||||
"Bundle_SymbolicName": "org.apache.logging.log4j.spring-cloud-config-client.logging.log4j.core.util;version=\"[2.16,3)\",org.springframework.boot.autoconfigure.condition,org.springframework.cloud.context.environment,org.springframework.context,org.springframework.stereotype",
|
||||
"Export_Package": "org.apache.logging.log4j.spring.cloud.config.controller;version=\"2.16.0\"ient",
|
||||
"Archive": "apache-log4j-2.16.0-bin/log4j-spring-cloud-config-client-2.16.0.jar",
|
||||
"Manifest_Version": "1.0",
|
||||
"Bundle_License": "https://www.apache.org/licenses/LICENSE-2.0.txt",
|
||||
...
|
||||
}
|
||||
...
|
||||
]
|
||||
"""
|
||||
import jc.utils
|
||||
import re
|
||||
|
||||
|
||||
class info():
|
||||
"""Provides parser metadata (version, author, etc.)"""
|
||||
version = '0.01'
|
||||
description = 'MANIFEST.MF file parser'
|
||||
author = 'Matt J'
|
||||
author_email = 'https://github.com/listuser'
|
||||
compatible = ['linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd']
|
||||
|
||||
|
||||
__version__ = info.version
|
||||
|
||||
|
||||
def _process(proc_data):
|
||||
"""
|
||||
Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (List of Dictionaries) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of Dictionaries. Structured data to conform to the schema.
|
||||
"""
|
||||
|
||||
return proc_data
|
||||
|
||||
|
||||
def parse(data, raw=False, quiet=False):
|
||||
"""
|
||||
Main text parsing function
|
||||
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) output preprocessed JSON if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
"""
|
||||
jc.utils.compatibility(__name__, info.compatible, quiet)
|
||||
jc.utils.input_type_check(data)
|
||||
|
||||
raw_output = []
|
||||
archives = []
|
||||
|
||||
if jc.utils.has_data(data):
|
||||
datalines = data.splitlines()
|
||||
|
||||
# remove last line of multi-archive output since it is not needed
|
||||
if datalines[-1].endswith('archives were successfully processed.'):
|
||||
datalines.pop(-1)
|
||||
|
||||
# extract each archive into its own list of lines.
|
||||
# archives are separated by a blank line
|
||||
this_archive = []
|
||||
for row in datalines:
|
||||
if row == '':
|
||||
archives.append(this_archive)
|
||||
this_archive = []
|
||||
continue
|
||||
|
||||
this_archive.append(row)
|
||||
|
||||
if this_archive:
|
||||
archives.append(this_archive)
|
||||
|
||||
# iterate through list of archives and parse
|
||||
for archive_item in archives:
|
||||
|
||||
manifests = []
|
||||
this_manifest = {}
|
||||
plines = []
|
||||
|
||||
for i, line in enumerate(archive_item):
|
||||
last = archive_item[-1]
|
||||
|
||||
# remove line since it is not needed and starts with "space"
|
||||
if (re.match(r'^\s+inflating\s*:\s*META-INF/MANIFEST.MF', line, re.IGNORECASE)):
|
||||
archive_item.pop(i)
|
||||
continue
|
||||
|
||||
# if line starts with "space"
|
||||
# begin key multiline value pair concatenation
|
||||
if (re.match(r'\s', line)):
|
||||
|
||||
# expectation is this "if" sets a key once
|
||||
if (not this_manifest):
|
||||
# previous line contains a key
|
||||
k, v = archive_item[i - 1].split(":", maxsplit=1)
|
||||
v = v + line
|
||||
v = re.sub(r'\s', '', v)
|
||||
this_manifest = {k: v}
|
||||
plines.append(i - 1)
|
||||
plines.append(i)
|
||||
|
||||
# continue key multiline value pair concatenation
|
||||
else:
|
||||
plines.append(i)
|
||||
linecmp = line
|
||||
for k, v in this_manifest.items():
|
||||
line = v + line
|
||||
line = re.sub(r'\s', '', line)
|
||||
this_manifest.update({k:line})
|
||||
|
||||
if linecmp is not last:
|
||||
nextline = archive_item[i + 1]
|
||||
# if next line starts with not "space",
|
||||
# end key multiline value pair concatenation
|
||||
if (re.match(r'\S', nextline)):
|
||||
manifests.append(this_manifest)
|
||||
this_manifest = False
|
||||
else:
|
||||
manifests.append(this_manifest)
|
||||
|
||||
# pop key multiline value pair lines
|
||||
if plines:
|
||||
for p in reversed(plines):
|
||||
archive_item.pop(p)
|
||||
|
||||
# all other key value pairs
|
||||
for i, line in enumerate(archive_item):
|
||||
k, v = line.split(":", maxsplit=1)
|
||||
v = v.strip()
|
||||
manifests.append({k: v})
|
||||
|
||||
if manifests:
|
||||
this_manifest = {}
|
||||
for d in manifests:
|
||||
for k, v in d.items():
|
||||
k = re.sub(r'\s', '', k)
|
||||
k = re.sub(r'-', '_', k)
|
||||
this_manifest.update({k: v})
|
||||
raw_output.append(this_manifest)
|
||||
|
||||
return raw_output if raw else _process(raw_output)
|
9
man/jc.1
9
man/jc.1
@ -1,4 +1,4 @@
|
||||
.TH jc 1 2021-12-23 1.17.5 "JSON CLI output utility"
|
||||
.TH jc 1 2022-01-02 1.17.6 "JSON CLI output utility"
|
||||
.SH NAME
|
||||
jc \- JSONifies the output of many CLI tools and file-types
|
||||
.SH SYNOPSIS
|
||||
@ -197,6 +197,11 @@ INI file parser
|
||||
\fB--iw-scan\fP
|
||||
`iw dev [device] scan` command parser
|
||||
|
||||
.TP
|
||||
.B
|
||||
\fB--jar-manifest\fP
|
||||
MANIFEST.MF file parser
|
||||
|
||||
.TP
|
||||
.B
|
||||
\fB--jobs\fP
|
||||
@ -639,6 +644,6 @@ Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
https://github.com/kellyjonbrazil/jc
|
||||
|
||||
.SH COPYRIGHT
|
||||
Copyright (c) 2019-2021 Kelly Brazil
|
||||
Copyright (c) 2019-2022 Kelly Brazil
|
||||
|
||||
License: MIT License
|
2
setup.py
2
setup.py
@ -5,7 +5,7 @@ with open('README.md', 'r') as f:
|
||||
|
||||
setuptools.setup(
|
||||
name='jc',
|
||||
version='1.17.5',
|
||||
version='1.17.6',
|
||||
author='Kelly Brazil',
|
||||
author_email='kellyjonbrazil@gmail.com',
|
||||
description='Converts the output of popular command-line tools and file-types to JSON.',
|
||||
|
1
tests/fixtures/rhel-8/MANIFEST.MF.MULTI.json
vendored
Normal file
1
tests/fixtures/rhel-8/MANIFEST.MF.MULTI.json
vendored
Normal file
File diff suppressed because one or more lines are too long
2210
tests/fixtures/rhel-8/MANIFEST.MF.MULTI.out
vendored
Normal file
2210
tests/fixtures/rhel-8/MANIFEST.MF.MULTI.out
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
tests/fixtures/rhel-8/MANIFEST.MF.json
vendored
Normal file
1
tests/fixtures/rhel-8/MANIFEST.MF.json
vendored
Normal file
File diff suppressed because one or more lines are too long
292
tests/fixtures/rhel-8/MANIFEST.MF.out
vendored
Normal file
292
tests/fixtures/rhel-8/MANIFEST.MF.out
vendored
Normal file
@ -0,0 +1,292 @@
|
||||
Manifest-Version: 1.0
|
||||
Bundle-License: https://www.apache.org/licenses/LICENSE-2.0.txt
|
||||
Bundle-SymbolicName: org.apache.logging.log4j.core
|
||||
Built-By: rgoers
|
||||
Bnd-LastModified: 1639792304782
|
||||
Implementation-Vendor-Id: org.apache.logging.log4j
|
||||
Specification-Title: Apache Log4j Core
|
||||
Log4jReleaseManager: Ralph Goers
|
||||
Bundle-DocURL: https://www.apache.org/
|
||||
Import-Package: com.conversantmedia.util.concurrent;resolution:=option
|
||||
al,com.fasterxml.jackson.annotation;version="[2.12,3)";resolution:=op
|
||||
tional,com.fasterxml.jackson.core;version="[2.12,3)";resolution:=opti
|
||||
onal,com.fasterxml.jackson.core.type;version="[2.12,3)";resolution:=o
|
||||
ptional,com.fasterxml.jackson.core.util;version="[2.12,3)";resolution
|
||||
:=optional,com.fasterxml.jackson.databind;version="[2.12,3)";resoluti
|
||||
on:=optional,com.fasterxml.jackson.databind.annotation;version="[2.12
|
||||
,3)";resolution:=optional,com.fasterxml.jackson.databind.deser.std;ve
|
||||
rsion="[2.12,3)";resolution:=optional,com.fasterxml.jackson.databind.
|
||||
module;version="[2.12,3)";resolution:=optional,com.fasterxml.jackson.
|
||||
databind.node;version="[2.12,3)";resolution:=optional,com.fasterxml.j
|
||||
ackson.databind.ser;version="[2.12,3)";resolution:=optional,com.faste
|
||||
rxml.jackson.databind.ser.impl;version="[2.12,3)";resolution:=optiona
|
||||
l,com.fasterxml.jackson.databind.ser.std;version="[2.12,3)";resolutio
|
||||
n:=optional,com.fasterxml.jackson.dataformat.xml;version="[2.12,3)";r
|
||||
esolution:=optional,com.fasterxml.jackson.dataformat.xml.annotation;v
|
||||
ersion="[2.12,3)";resolution:=optional,com.fasterxml.jackson.dataform
|
||||
at.xml.util;version="[2.12,3)";resolution:=optional,com.fasterxml.jac
|
||||
kson.dataformat.yaml;version="[2.12,3)";resolution:=optional,com.lmax
|
||||
.disruptor;version="[3.4,4)";resolution:=optional,com.lmax.disruptor.
|
||||
dsl;version="[3.4,4)";resolution:=optional,javax.activation;version="
|
||||
[1.2,2)";resolution:=optional,javax.annotation.processing,javax.crypt
|
||||
o,javax.jms;version="[1.1,2)";resolution:=optional,javax.lang.model,j
|
||||
avax.lang.model.element,javax.lang.model.util,javax.mail;version="[1.
|
||||
6,2)";resolution:=optional,javax.mail.internet;version="[1.6,2)";reso
|
||||
lution:=optional,javax.mail.util;version="[1.6,2)";resolution:=option
|
||||
al,javax.management,javax.naming,javax.net,javax.net.ssl,javax.script
|
||||
,javax.sql,javax.tools,javax.xml.parsers,javax.xml.stream,javax.xml.t
|
||||
ransform,javax.xml.transform.stream,javax.xml.validation,org.apache.c
|
||||
ommons.compress.compressors;version="[1.21,2)";resolution:=optional,o
|
||||
rg.apache.commons.compress.utils;version="[1.21,2)";resolution:=optio
|
||||
nal,org.apache.commons.csv;version="[1.9,2)";resolution:=optional,org
|
||||
.apache.kafka.clients.producer;resolution:=optional,org.apache.loggin
|
||||
g.log4j;version="[2.17,3)",org.apache.logging.log4j.core,org.apache.l
|
||||
ogging.log4j.core.appender,org.apache.logging.log4j.core.appender.db,
|
||||
org.apache.logging.log4j.core.appender.rewrite,org.apache.logging.log
|
||||
4j.core.appender.rolling,org.apache.logging.log4j.core.appender.rolli
|
||||
ng.action,org.apache.logging.log4j.core.async,org.apache.logging.log4
|
||||
j.core.config,org.apache.logging.log4j.core.config.arbiters,org.apach
|
||||
e.logging.log4j.core.config.builder.api,org.apache.logging.log4j.core
|
||||
.config.builder.impl,org.apache.logging.log4j.core.config.composite,o
|
||||
rg.apache.logging.log4j.core.config.json,org.apache.logging.log4j.cor
|
||||
e.config.plugins,org.apache.logging.log4j.core.config.plugins.convert
|
||||
,org.apache.logging.log4j.core.config.plugins.processor,org.apache.lo
|
||||
gging.log4j.core.config.plugins.util,org.apache.logging.log4j.core.co
|
||||
nfig.plugins.validation,org.apache.logging.log4j.core.config.plugins.
|
||||
validation.constraints,org.apache.logging.log4j.core.config.plugins.v
|
||||
alidation.validators,org.apache.logging.log4j.core.config.plugins.vis
|
||||
itors,org.apache.logging.log4j.core.config.status,org.apache.logging.
|
||||
log4j.core.filter,org.apache.logging.log4j.core.impl,org.apache.loggi
|
||||
ng.log4j.core.jackson,org.apache.logging.log4j.core.jmx,org.apache.lo
|
||||
gging.log4j.core.layout,org.apache.logging.log4j.core.layout.internal
|
||||
,org.apache.logging.log4j.core.lookup,org.apache.logging.log4j.core.n
|
||||
et,org.apache.logging.log4j.core.net.ssl,org.apache.logging.log4j.cor
|
||||
e.pattern,org.apache.logging.log4j.core.script,org.apache.logging.log
|
||||
4j.core.selector,org.apache.logging.log4j.core.time,org.apache.loggin
|
||||
g.log4j.core.tools.picocli,org.apache.logging.log4j.core.util,org.apa
|
||||
che.logging.log4j.core.util.datetime,org.apache.logging.log4j.message
|
||||
;version="[2.17,3)",org.apache.logging.log4j.spi;version="[2.17,3)",o
|
||||
rg.apache.logging.log4j.status;version="[2.17,3)",org.apache.logging.
|
||||
log4j.util;version="[2.17,3)",org.codehaus.stax2;version="[4.2,5)";re
|
||||
solution:=optional,org.fusesource.jansi;version="[2.3,3)";resolution:
|
||||
=optional,org.jctools.queues;resolution:=optional,org.osgi.framework;
|
||||
version="[1.6,2)",org.osgi.framework.wiring;version="[1.0,2)",org.w3c
|
||||
.dom,org.xml.sax,org.zeromq;version="[0.4,1)";resolution:=optional,su
|
||||
n.reflect;resolution:=optional
|
||||
Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))"
|
||||
Export-Package: org.apache.logging.log4j.core;uses:="org.apache.loggin
|
||||
g.log4j,org.apache.logging.log4j.core.config,org.apache.logging.log4j
|
||||
.core.impl,org.apache.logging.log4j.core.layout,org.apache.logging.lo
|
||||
g4j.core.time,org.apache.logging.log4j.message,org.apache.logging.log
|
||||
4j.spi,org.apache.logging.log4j.status,org.apache.logging.log4j.util"
|
||||
;version="2.17.0",org.apache.logging.log4j.core.appender;uses:="org.a
|
||||
pache.logging.log4j,org.apache.logging.log4j.core,org.apache.logging.
|
||||
log4j.core.appender.rolling,org.apache.logging.log4j.core.async,org.a
|
||||
pache.logging.log4j.core.config,org.apache.logging.log4j.core.config.
|
||||
plugins,org.apache.logging.log4j.core.config.plugins.validation.const
|
||||
raints,org.apache.logging.log4j.core.filter,org.apache.logging.log4j.
|
||||
core.impl,org.apache.logging.log4j.core.layout,org.apache.logging.log
|
||||
4j.core.net,org.apache.logging.log4j.core.net.ssl,org.apache.logging.
|
||||
log4j.core.script,org.apache.logging.log4j.core.util,org.apache.loggi
|
||||
ng.log4j.status";version="2.17.0",org.apache.logging.log4j.core.appen
|
||||
der.db;uses:="org.apache.logging.log4j.core,org.apache.logging.log4j.
|
||||
core.appender,org.apache.logging.log4j.core.config,org.apache.logging
|
||||
.log4j.core.config.plugins,org.apache.logging.log4j.core.util";versio
|
||||
n="2.17.0",org.apache.logging.log4j.core.appender.db.jdbc;uses:="org.
|
||||
apache.logging.log4j,org.apache.logging.log4j.core,org.apache.logging
|
||||
.log4j.core.appender.db,org.apache.logging.log4j.core.config,org.apac
|
||||
he.logging.log4j.core.config.plugins,org.apache.logging.log4j.core.co
|
||||
nfig.plugins.validation.constraints,org.apache.logging.log4j.core.lay
|
||||
out,org.apache.logging.log4j.core.util";version="2.17.0",org.apache.l
|
||||
ogging.log4j.core.appender.mom;uses:="javax.jms,org.apache.logging.lo
|
||||
g4j.core,org.apache.logging.log4j.core.appender,org.apache.logging.lo
|
||||
g4j.core.config,org.apache.logging.log4j.core.config.plugins,org.apac
|
||||
he.logging.log4j.core.net,org.apache.logging.log4j.core.util";version
|
||||
="2.17.0",org.apache.logging.log4j.core.appender.mom.jeromq;uses:="or
|
||||
g.apache.logging.log4j.core,org.apache.logging.log4j.core.appender,or
|
||||
g.apache.logging.log4j.core.config,org.apache.logging.log4j.core.conf
|
||||
ig.plugins,org.apache.logging.log4j.core.config.plugins.validation.co
|
||||
nstraints,org.zeromq";version="2.17.0",org.apache.logging.log4j.core.
|
||||
appender.mom.kafka;uses:="org.apache.kafka.clients.producer,org.apach
|
||||
e.logging.log4j.core,org.apache.logging.log4j.core.appender,org.apach
|
||||
e.logging.log4j.core.config,org.apache.logging.log4j.core.config.plug
|
||||
ins,org.apache.logging.log4j.core.util";version="2.17.0",org.apache.l
|
||||
ogging.log4j.core.appender.nosql;uses:="org.apache.logging.log4j.core
|
||||
,org.apache.logging.log4j.core.appender,org.apache.logging.log4j.core
|
||||
.appender.db,org.apache.logging.log4j.core.config.plugins,org.apache.
|
||||
logging.log4j.core.util";version="2.17.0",org.apache.logging.log4j.co
|
||||
re.appender.rewrite;uses:="org.apache.logging.log4j,org.apache.loggin
|
||||
g.log4j.core,org.apache.logging.log4j.core.appender,org.apache.loggin
|
||||
g.log4j.core.config,org.apache.logging.log4j.core.config.plugins,org.
|
||||
apache.logging.log4j.core.util";version="2.17.0",org.apache.logging.l
|
||||
og4j.core.appender.rolling;uses:="org.apache.logging.log4j,org.apache
|
||||
.logging.log4j.core,org.apache.logging.log4j.core.appender,org.apache
|
||||
.logging.log4j.core.appender.rolling.action,org.apache.logging.log4j.
|
||||
core.config,org.apache.logging.log4j.core.config.plugins,org.apache.l
|
||||
ogging.log4j.core.lookup,org.apache.logging.log4j.core.util";version=
|
||||
"2.17.0",org.apache.logging.log4j.core.appender.rolling.action;uses:=
|
||||
"org.apache.logging.log4j,org.apache.logging.log4j.core.config,org.ap
|
||||
ache.logging.log4j.core.config.plugins,org.apache.logging.log4j.core.
|
||||
lookup,org.apache.logging.log4j.core.script,org.apache.logging.log4j.
|
||||
core.util";version="2.17.0",org.apache.logging.log4j.core.appender.ro
|
||||
uting;uses:="org.apache.logging.log4j.core,org.apache.logging.log4j.c
|
||||
ore.appender,org.apache.logging.log4j.core.appender.rewrite,org.apach
|
||||
e.logging.log4j.core.config,org.apache.logging.log4j.core.config.plug
|
||||
ins,org.apache.logging.log4j.core.script,org.apache.logging.log4j.cor
|
||||
e.util";version="2.17.0",org.apache.logging.log4j.core.async;uses:="c
|
||||
om.conversantmedia.util.concurrent,com.lmax.disruptor,org.apache.logg
|
||||
ing.log4j,org.apache.logging.log4j.core,org.apache.logging.log4j.core
|
||||
.appender,org.apache.logging.log4j.core.config,org.apache.logging.log
|
||||
4j.core.config.plugins,org.apache.logging.log4j.core.config.plugins.v
|
||||
alidation.constraints,org.apache.logging.log4j.core.impl,org.apache.l
|
||||
ogging.log4j.core.jmx,org.apache.logging.log4j.core.selector,org.apac
|
||||
he.logging.log4j.core.time,org.apache.logging.log4j.core.util,org.apa
|
||||
che.logging.log4j.message,org.apache.logging.log4j.util";version="2.1
|
||||
7.0",org.apache.logging.log4j.core.config;uses:="org.apache.logging.l
|
||||
og4j,org.apache.logging.log4j.core,org.apache.logging.log4j.core.asyn
|
||||
c,org.apache.logging.log4j.core.config.builder.api,org.apache.logging
|
||||
.log4j.core.config.plugins,org.apache.logging.log4j.core.config.plugi
|
||||
ns.util,org.apache.logging.log4j.core.config.plugins.validation.const
|
||||
raints,org.apache.logging.log4j.core.filter,org.apache.logging.log4j.
|
||||
core.impl,org.apache.logging.log4j.core.lookup,org.apache.logging.log
|
||||
4j.core.net,org.apache.logging.log4j.core.script,org.apache.logging.l
|
||||
og4j.core.util,org.apache.logging.log4j.message,org.apache.logging.lo
|
||||
g4j.util";version="2.17.0",org.apache.logging.log4j.core.config.arbit
|
||||
ers;uses:="org.apache.logging.log4j.core.config,org.apache.logging.lo
|
||||
g4j.core.config.plugins,org.apache.logging.log4j.core.util";version="
|
||||
2.17.0",org.apache.logging.log4j.core.config.builder.api;uses:="org.a
|
||||
pache.logging.log4j,org.apache.logging.log4j.core,org.apache.logging.
|
||||
log4j.core.config,org.apache.logging.log4j.core.config.builder.impl,o
|
||||
rg.apache.logging.log4j.core.util";version="2.17.0",org.apache.loggin
|
||||
g.log4j.core.config.builder.impl;uses:="javax.xml.transform,org.apach
|
||||
e.logging.log4j,org.apache.logging.log4j.core,org.apache.logging.log4
|
||||
j.core.config,org.apache.logging.log4j.core.config.builder.api,org.ap
|
||||
ache.logging.log4j.core.config.plugins.util,org.apache.logging.log4j.
|
||||
core.config.status";version="2.17.0",org.apache.logging.log4j.core.co
|
||||
nfig.composite;uses:="org.apache.logging.log4j.core.config,org.apache
|
||||
.logging.log4j.core.config.plugins.util";version="2.17.0",org.apache.
|
||||
logging.log4j.core.config.json;uses:="com.fasterxml.jackson.databind,
|
||||
org.apache.logging.log4j.core,org.apache.logging.log4j.core.config,or
|
||||
g.apache.logging.log4j.core.config.plugins";version="2.17.0",org.apac
|
||||
he.logging.log4j.core.config.plugins;uses:="org.apache.logging.log4j.
|
||||
core.config.plugins.visitors";version="2.17.0",org.apache.logging.log
|
||||
4j.core.config.plugins.convert;uses:="org.apache.logging.log4j,org.ap
|
||||
ache.logging.log4j.core.appender.rolling.action,org.apache.logging.lo
|
||||
g4j.core.config.plugins,org.apache.logging.log4j.core.util";version="
|
||||
2.17.0",org.apache.logging.log4j.core.config.plugins.processor;uses:=
|
||||
"javax.annotation.processing,javax.lang.model,javax.lang.model.elemen
|
||||
t";version="2.17.0",org.apache.logging.log4j.core.config.plugins.util
|
||||
;uses:="org.apache.logging.log4j.core,org.apache.logging.log4j.core.c
|
||||
onfig,org.apache.logging.log4j.core.config.plugins.processor,org.apac
|
||||
he.logging.log4j.core.util";version="2.17.0",org.apache.logging.log4j
|
||||
.core.config.plugins.validation;version="2.17.0",org.apache.logging.l
|
||||
og4j.core.config.plugins.validation.constraints;uses:="org.apache.log
|
||||
ging.log4j.core.config.plugins.validation,org.apache.logging.log4j.co
|
||||
re.config.plugins.validation.validators";version="2.17.0",org.apache.
|
||||
logging.log4j.core.config.plugins.validation.validators;uses:="org.ap
|
||||
ache.logging.log4j.core.config.plugins.validation,org.apache.logging.
|
||||
log4j.core.config.plugins.validation.constraints";version="2.17.0",or
|
||||
g.apache.logging.log4j.core.config.plugins.visitors;uses:="org.apache
|
||||
.logging.log4j,org.apache.logging.log4j.core,org.apache.logging.log4j
|
||||
.core.config,org.apache.logging.log4j.core.config.plugins,org.apache.
|
||||
logging.log4j.core.lookup";version="2.17.0",org.apache.logging.log4j.
|
||||
core.config.properties;uses:="org.apache.logging.log4j.core,org.apach
|
||||
e.logging.log4j.core.config,org.apache.logging.log4j.core.config.buil
|
||||
der.api,org.apache.logging.log4j.core.config.builder.impl,org.apache.
|
||||
logging.log4j.core.config.plugins,org.apache.logging.log4j.core.util"
|
||||
;version="2.17.0",org.apache.logging.log4j.core.config.status;uses:="
|
||||
org.apache.logging.log4j";version="2.17.0",org.apache.logging.log4j.c
|
||||
ore.config.xml;uses:="org.apache.logging.log4j.core,org.apache.loggin
|
||||
g.log4j.core.config,org.apache.logging.log4j.core.config.plugins";ver
|
||||
sion="2.17.0",org.apache.logging.log4j.core.config.yaml;uses:="com.fa
|
||||
sterxml.jackson.databind,org.apache.logging.log4j.core,org.apache.log
|
||||
ging.log4j.core.config,org.apache.logging.log4j.core.config.json,org.
|
||||
apache.logging.log4j.core.config.plugins";version="2.17.0",org.apache
|
||||
.logging.log4j.core.filter;uses:="org.apache.logging.log4j,org.apache
|
||||
.logging.log4j.core,org.apache.logging.log4j.core.config,org.apache.l
|
||||
ogging.log4j.core.config.plugins,org.apache.logging.log4j.core.script
|
||||
,org.apache.logging.log4j.core.util,org.apache.logging.log4j.message,
|
||||
org.apache.logging.log4j.util";version="2.17.0",org.apache.logging.lo
|
||||
g4j.core.impl;uses:="org.apache.logging.log4j,org.apache.logging.log4
|
||||
j.core,org.apache.logging.log4j.core.config,org.apache.logging.log4j.
|
||||
core.pattern,org.apache.logging.log4j.core.selector,org.apache.loggin
|
||||
g.log4j.core.time,org.apache.logging.log4j.core.util,org.apache.loggi
|
||||
ng.log4j.message,org.apache.logging.log4j.spi,org.apache.logging.log4
|
||||
j.util";version="2.17.0",org.apache.logging.log4j.core.jackson;uses:=
|
||||
"com.fasterxml.jackson.core,com.fasterxml.jackson.databind,com.faster
|
||||
xml.jackson.databind.deser.std,com.fasterxml.jackson.databind.ser.std
|
||||
,com.fasterxml.jackson.dataformat.xml,com.fasterxml.jackson.dataforma
|
||||
t.yaml,org.apache.logging.log4j.message,org.apache.logging.log4j.util
|
||||
";version="2.17.0",org.apache.logging.log4j.core.jmx;uses:="com.lmax.
|
||||
disruptor,javax.management,org.apache.logging.log4j,org.apache.loggin
|
||||
g.log4j.core,org.apache.logging.log4j.core.appender,org.apache.loggin
|
||||
g.log4j.core.config,org.apache.logging.log4j.core.selector,org.apache
|
||||
.logging.log4j.status";version="2.17.0",org.apache.logging.log4j.core
|
||||
.layout;uses:="com.fasterxml.jackson.annotation,com.fasterxml.jackson
|
||||
.core,com.fasterxml.jackson.databind,com.fasterxml.jackson.dataformat
|
||||
.xml.annotation,org.apache.commons.csv,org.apache.logging.log4j,org.a
|
||||
pache.logging.log4j.core,org.apache.logging.log4j.core.config,org.apa
|
||||
che.logging.log4j.core.config.plugins,org.apache.logging.log4j.core.i
|
||||
mpl,org.apache.logging.log4j.core.net,org.apache.logging.log4j.core.p
|
||||
attern,org.apache.logging.log4j.core.script,org.apache.logging.log4j.
|
||||
core.util,org.apache.logging.log4j.message";version="2.17.0",org.apac
|
||||
he.logging.log4j.core.layout.internal;version="2.17.0",org.apache.log
|
||||
ging.log4j.core.lookup;uses:="org.apache.logging.log4j.core,org.apach
|
||||
e.logging.log4j.core.config,org.apache.logging.log4j.core.config.plug
|
||||
ins";version="2.17.0",org.apache.logging.log4j.core.message;uses:="or
|
||||
g.apache.logging.log4j.message";version="2.17.0",org.apache.logging.l
|
||||
og4j.core.net;uses:="javax.mail,javax.mail.internet,javax.naming,org.
|
||||
apache.logging.log4j,org.apache.logging.log4j.core,org.apache.logging
|
||||
.log4j.core.appender,org.apache.logging.log4j.core.config,org.apache.
|
||||
logging.log4j.core.config.plugins,org.apache.logging.log4j.core.net.s
|
||||
sl,org.apache.logging.log4j.core.util";version="2.17.0",org.apache.lo
|
||||
gging.log4j.core.net.ssl;uses:="javax.net.ssl,org.apache.logging.log4
|
||||
j.core.config.plugins,org.apache.logging.log4j.status";version="2.17.
|
||||
0",org.apache.logging.log4j.core.osgi;uses:="org.apache.logging.log4j
|
||||
.core,org.apache.logging.log4j.core.selector,org.osgi.framework";vers
|
||||
ion="2.17.0",org.apache.logging.log4j.core.parser;uses:="org.apache.l
|
||||
ogging.log4j.core";version="2.17.0",org.apache.logging.log4j.core.pat
|
||||
tern;uses:="org.apache.logging.log4j,org.apache.logging.log4j.core,or
|
||||
g.apache.logging.log4j.core.config,org.apache.logging.log4j.core.conf
|
||||
ig.plugins,org.apache.logging.log4j.core.impl,org.apache.logging.log4
|
||||
j.core.time,org.apache.logging.log4j.message,org.fusesource.jansi";ve
|
||||
rsion="2.17.0",org.apache.logging.log4j.core.script;uses:="javax.scri
|
||||
pt,org.apache.logging.log4j,org.apache.logging.log4j.core.config,org.
|
||||
apache.logging.log4j.core.config.plugins,org.apache.logging.log4j.cor
|
||||
e.util";version="2.17.0",org.apache.logging.log4j.core.selector;uses:
|
||||
="org.apache.logging.log4j.core,org.apache.logging.log4j.spi,org.apac
|
||||
he.logging.log4j.status";version="2.17.0",org.apache.logging.log4j.co
|
||||
re.time;uses:="org.apache.logging.log4j.core.util,org.apache.logging.
|
||||
log4j.util";version="2.17.0",org.apache.logging.log4j.core.time.inter
|
||||
nal;uses:="org.apache.logging.log4j.core.time";version="2.17.0",org.a
|
||||
pache.logging.log4j.core.tools;version="2.17.0",org.apache.logging.lo
|
||||
g4j.core.tools.picocli;version="2.17.0",org.apache.logging.log4j.core
|
||||
.util;uses:="javax.crypto,javax.naming,org.apache.logging.log4j,org.a
|
||||
pache.logging.log4j.core,org.apache.logging.log4j.core.config,org.apa
|
||||
che.logging.log4j.core.config.plugins,org.apache.logging.log4j.util";
|
||||
version="2.17.0",org.apache.logging.log4j.core.util.datetime;uses:="o
|
||||
rg.apache.logging.log4j.core.time";version="2.17.0"
|
||||
Bundle-Name: Apache Log4j Core
|
||||
Log4jReleaseVersionJava6: 2.3
|
||||
Multi-Release: true
|
||||
Bundle-Activator: org.apache.logging.log4j.core.osgi.Activator
|
||||
Log4jReleaseVersionJava7: 2.12.2
|
||||
Log4jReleaseVersion: 2.17.0
|
||||
Implementation-Title: Apache Log4j Core
|
||||
Bundle-Description: The Apache Log4j Implementation
|
||||
Automatic-Module-Name: org.apache.logging.log4j.core
|
||||
Implementation-Version: 2.17.0
|
||||
Specification-Vendor: The Apache Software Foundation
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Vendor: The Apache Software Foundation
|
||||
Tool: Bnd-3.5.0.201709291849
|
||||
Implementation-Vendor: The Apache Software Foundation
|
||||
Bundle-Version: 2.17.0
|
||||
X-Compile-Target-JDK: 1.8
|
||||
X-Compile-Source-JDK: 1.8
|
||||
Created-By: Apache Maven Bundle Plugin
|
||||
Build-Jdk: 1.8.0_144
|
||||
Specification-Version: 2.17.0
|
||||
Implementation-URL: https://logging.apache.org/log4j/2.x/log4j-core/
|
||||
Log4jReleaseKey: B3D8E1BA
|
||||
|
46
tests/test_jar_manifest.py
Normal file
46
tests/test_jar_manifest.py
Normal file
@ -0,0 +1,46 @@
|
||||
import os
|
||||
import unittest
|
||||
import json
|
||||
import jc.parsers.jar_manifest
|
||||
|
||||
THIS_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
|
||||
class MyTests(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
# input
|
||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/rhel-8/MANIFEST.MF.out'), 'r', encoding='utf-8') as f:
|
||||
self.rhel_8_manifest_mf = f.read()
|
||||
|
||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/rhel-8/MANIFEST.MF.MULTI.out'), 'r', encoding='utf-8') as f:
|
||||
self.rhel_8_manifest_mf_multi = f.read()
|
||||
|
||||
# output
|
||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/rhel-8/MANIFEST.MF.json'), 'r', encoding='utf-8') as f:
|
||||
self.rhel_8_manifest_mf_json = json.loads(f.read())
|
||||
|
||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/rhel-8/MANIFEST.MF.MULTI.json'), 'r', encoding='utf-8') as f:
|
||||
self.rhel_8_manifest_mf_multi_json = json.loads(f.read())
|
||||
|
||||
def test_jar_manifest_nodata(self):
|
||||
"""
|
||||
Test 'jar_manifest' parser with no data
|
||||
"""
|
||||
self.assertEqual(jc.parsers.jar_manifest.parse('', quiet=True), [])
|
||||
|
||||
def test_jar_manifest_rhel_8(self):
|
||||
"""
|
||||
Test 'cat MANIFEST.MF | jc --jar_manifest'
|
||||
"""
|
||||
self.assertEqual(jc.parsers.jar_manifest.parse(self.rhel_8_manifest_mf, quiet=True), self.rhel_8_manifest_mf_json)
|
||||
|
||||
def test_jar_manifest_multi_rhel_8(self):
|
||||
"""
|
||||
Test 'unzip -c apache-log4j-2.16.0-bin/log4j-core-2.16.0.jar META-INF/MANIFEST.MF | jc --jar_manifest'
|
||||
"""
|
||||
self.assertEqual(jc.parsers.jar_manifest.parse(self.rhel_8_manifest_mf_multi, quiet=True), self.rhel_8_manifest_mf_multi_json)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
Reference in New Issue
Block a user