mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2026-04-03 17:44:07 +02:00
Compare commits
43 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0ee244756b | ||
|
|
6d5ac9abe6 | ||
|
|
44f6d9e132 | ||
|
|
360154559c | ||
|
|
78672bd7ad | ||
|
|
65d96e26b5 | ||
|
|
241d53af9a | ||
|
|
5563829df2 | ||
|
|
3a4a27e1f9 | ||
|
|
9c887a36a8 | ||
|
|
bc7973af36 | ||
|
|
32972d8fdb | ||
|
|
b128d9109c | ||
|
|
929d7273a4 | ||
|
|
2a40f84274 | ||
|
|
9ff6fa818f | ||
|
|
dac73a4bfe | ||
|
|
d7895547f7 | ||
|
|
b7d439cb87 | ||
|
|
7cc903a5f5 | ||
|
|
c495a8291b | ||
|
|
5e1d7d777c | ||
|
|
7edad3f676 | ||
|
|
f7331001d4 | ||
|
|
f8e09ae2ff | ||
|
|
433c7cc0f0 | ||
|
|
d753e71a74 | ||
|
|
2e4f5a508b | ||
|
|
88b960eff6 | ||
|
|
88c77bd89e | ||
|
|
51a7a4251f | ||
|
|
51d2f316f3 | ||
|
|
ff78a46c48 | ||
|
|
ed4a9dc1d4 | ||
|
|
63182dba26 | ||
|
|
9c1eaa9389 | ||
|
|
bc520fcbcd | ||
|
|
46faac1a12 | ||
|
|
3c424c0cb3 | ||
|
|
3ac8d0362b | ||
|
|
d88b998e6c | ||
|
|
a9ed55c006 | ||
|
|
ea61434123 |
2
.github/workflows/pythonapp.yml
vendored
2
.github/workflows/pythonapp.yml
vendored
@@ -14,7 +14,7 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
os: [macos-latest, ubuntu-latest, windows-latest]
|
||||
python-version: [3.7, 3.8, 3.9, 3.10.0]
|
||||
python-version: ["3.7", "3.8", "3.9", "3.10"]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
jc changelog
|
||||
|
||||
20220103 v1.17.6
|
||||
- Add jar-manifest file parser (for MANIFEST.MF files)
|
||||
- Fix CSV parsers for some files that include doublequotes
|
||||
|
||||
20211221 v1.17.5
|
||||
- Add zipinfo parser tested on linux and macOS
|
||||
|
||||
20211207 v1.17.4
|
||||
- Add support for the NO_COLOR environment variable to set mono (http://no-color.org/)
|
||||
- Add -C option to force color output even when using pipes (overrides -m and NO_COLOR)
|
||||
|
||||
31
EXAMPLES.md
31
EXAMPLES.md
@@ -3793,5 +3793,36 @@ cat istio.yaml | jc --yaml -p
|
||||
}
|
||||
]
|
||||
```
|
||||
### zipinfo
|
||||
```bash
|
||||
zipinfo file.zip | jc --zipinfo -p # or: jc -p zipinfo file.zip
|
||||
```
|
||||
```json
|
||||
[
|
||||
{
|
||||
"archive": "file.zip",
|
||||
"size": 4116,
|
||||
"size_unit": "bytes",
|
||||
"number_entries": 1,
|
||||
"number_files": 1,
|
||||
"bytes_uncompressed": 11837,
|
||||
"bytes_compressed": 3966,
|
||||
"percent_compressed": 66.5,
|
||||
"files": [
|
||||
{
|
||||
"flags": "-rw-r--r--",
|
||||
"zipversion": "2.1",
|
||||
"zipunder": "unx",
|
||||
"filesize": 11837,
|
||||
"type": "bX",
|
||||
"method": "defN",
|
||||
"date": "21-Dec-08",
|
||||
"time": "20:50",
|
||||
"filename": "compressed_file"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
© 2019-2021 Kelly Brazil
|
||||
|
||||
@@ -91,7 +91,10 @@ pip3 install jc
|
||||
| FreeBSD | `portsnap fetch update && cd /usr/ports/textproc/py-jc && make install clean` |
|
||||
| Ansible filter plugin | `ansible-galaxy collection install community.general` |
|
||||
|
||||
> For more packages and binaries, see the [jc packaging](https://kellyjonbrazil.github.io/jc-packaging/) site.
|
||||
> For more OS Packages, see https://repology.org/project/jc/versions.
|
||||
|
||||
### Binaries and Packages
|
||||
For precompiled binaries and packages, see [Releases](https://github.com/kellyjonbrazil/jc/releases) on Github.
|
||||
|
||||
## Usage
|
||||
`jc` accepts piped input from `STDIN` and outputs a JSON representation of the previous command's output to `STDOUT`.
|
||||
@@ -142,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))
|
||||
@@ -188,6 +192,7 @@ The JSON output can be compact (default) or pretty formatted with the `-p` optio
|
||||
- `--who` enables the `who` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/who))
|
||||
- `--xml` enables the XML file parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/xml))
|
||||
- `--yaml` enables the YAML file parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/yaml))
|
||||
- `--zipinfo` enables the `zipinfo` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/zipinfo))
|
||||
|
||||
### Options
|
||||
- `-a` about `jc`. Prints information about `jc` and the parsers (in JSON, of course!)
|
||||
@@ -1005,4 +1010,4 @@ cat istio.yaml | jc --yaml -p
|
||||
]
|
||||
```
|
||||
|
||||
© 2019-2021 Kelly Brazil
|
||||
© 2019-2022 Kelly Brazil
|
||||
@@ -22,8 +22,10 @@ Schema:
|
||||
|
||||
{
|
||||
"variables": [
|
||||
"name": string,
|
||||
"value": string
|
||||
{
|
||||
"name": string,
|
||||
"value": string
|
||||
}
|
||||
],
|
||||
"schedule": [
|
||||
{
|
||||
|
||||
@@ -18,8 +18,10 @@ Schema:
|
||||
|
||||
{
|
||||
"variables": [
|
||||
"name": string,
|
||||
"value": string
|
||||
{
|
||||
"name": string,
|
||||
"value": string
|
||||
}
|
||||
],
|
||||
"schedule": [
|
||||
{
|
||||
|
||||
@@ -99,4 +99,4 @@ Returns:
|
||||
## Parser Information
|
||||
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
|
||||
|
||||
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
@@ -27,11 +27,11 @@ Schema:
|
||||
{
|
||||
"column_name1": string,
|
||||
"column_name2": string,
|
||||
"_jc_meta": # This object only exists if using -qq or ignore_exceptions=True
|
||||
"_jc_meta": # This object only exists if using -qq or ignore_exceptions=True
|
||||
{
|
||||
"success": booean, # true if successfully parsed, false if error
|
||||
"error": string, # exists if "success" is false
|
||||
"line": string # exists if "success" is false
|
||||
"success": boolean, # true if successfully parsed, false if error
|
||||
"error": string, # exists if "success" is false
|
||||
"line": string # exists if "success" is false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,4 +82,4 @@ Returns:
|
||||
## Parser Information
|
||||
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)
|
||||
|
||||
@@ -73,7 +73,7 @@ Schema:
|
||||
"percent_wrqm": float,
|
||||
"_jc_meta": # This object only exists if using -qq or ignore_exceptions=True
|
||||
{
|
||||
"success": booean, # true if successfully parsed, false if error
|
||||
"success": boolean, # true if successfully parsed, false if error
|
||||
"error": string, # exists if "success" is false
|
||||
"line": string # exists if "success" is false
|
||||
}
|
||||
|
||||
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 `MANIFEST.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)
|
||||
@@ -39,7 +39,7 @@ Schema:
|
||||
"epoch_utc": integer, # timezone aware timestamp if date field is in UTC and can be converted
|
||||
"_jc_meta": # This object only exists if using -qq or ignore_exceptions=True
|
||||
{
|
||||
"success": booean, # true if successfully parsed, false if error
|
||||
"success": boolean, # true if successfully parsed, false if error
|
||||
"error": string, # exists if "success" is false
|
||||
"line": string # exists if "success" is false
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ Schema:
|
||||
"round_trip_ms_stddev": float,
|
||||
"_jc_meta": # This object only exists if using -qq or ignore_exceptions=True
|
||||
{
|
||||
"success": booean, # true if successfully parsed, false if error
|
||||
"success": boolean, # true if successfully parsed, false if error
|
||||
"error": string, # exists if "success" is false
|
||||
"line": string # exists if "success" is false
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ Schema:
|
||||
"epoch_utc": integer # aware timestamp if -t flag is used and UTC TZ
|
||||
"_jc_meta": # This object only exists if using -qq or ignore_exceptions=True
|
||||
{
|
||||
"success": booean, # true if successfully parsed, false if error
|
||||
"success": boolean, # true if successfully parsed, false if error
|
||||
"error": string, # exists if "success" is false
|
||||
"line": string # exists if "success" is false
|
||||
}
|
||||
|
||||
107
docs/parsers/zipinfo.md
Normal file
107
docs/parsers/zipinfo.md
Normal file
@@ -0,0 +1,107 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
|
||||
# jc.parsers.zipinfo
|
||||
jc - JSON CLI output utility `zipinfo` command output parser
|
||||
|
||||
Options supported:
|
||||
- none
|
||||
|
||||
Note: The default listing format.
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ zipinfo <archive> | jc --zipinfo
|
||||
|
||||
or
|
||||
|
||||
$ jc zipinfo
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.zipinfo
|
||||
result = jc.parsers.zipinfo.parse(zipinfo_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"archive": string,
|
||||
"size": integer,
|
||||
"size_unit": string,
|
||||
"number_entries": integer,
|
||||
"number_files": integer,
|
||||
"bytes_uncompressed": integer,
|
||||
"bytes_compressed": integer,
|
||||
"percent_compressed": float,
|
||||
"files": [
|
||||
{
|
||||
"flags": string,
|
||||
"zipversion": string,
|
||||
"zipunder": string
|
||||
"filesize": integer,
|
||||
"type": string,
|
||||
"method": string,
|
||||
"date": string,
|
||||
"time": string,
|
||||
"filename": string
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
$ zipinfo log4j-core-2.16.0.jar | jc --zipinfo -p
|
||||
|
||||
[
|
||||
{
|
||||
"archive": "log4j-core-2.16.0.jar",
|
||||
"size": 1789565,
|
||||
"size_unit": "bytes",
|
||||
"number_entries": 1218,
|
||||
"number_files": 1218,
|
||||
"bytes_uncompressed": 3974141,
|
||||
"bytes_compressed": 1515455,
|
||||
"percent_compressed": 61.9,
|
||||
"files": [
|
||||
{
|
||||
"flags": "-rw-r--r--",
|
||||
"zipversion": "2.0",
|
||||
"zipunder": "unx",
|
||||
"filesize": 19810,
|
||||
"type": "bl",
|
||||
"method": "defN",
|
||||
"date": "21-Dec-12",
|
||||
"time": "23:35",
|
||||
"filename": "META-INF/MANIFEST.MF"
|
||||
},
|
||||
...
|
||||
|
||||
|
||||
## 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
|
||||
|
||||
Version 0.01 by Matt J (https://github.com/listuser)
|
||||
@@ -73,4 +73,4 @@ Module Example:
|
||||
"""
|
||||
|
||||
name = 'jc'
|
||||
__version__ = '1.17.4'
|
||||
__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',
|
||||
@@ -125,7 +126,8 @@ parsers = [
|
||||
'wc',
|
||||
'who',
|
||||
'xml',
|
||||
'yaml'
|
||||
'yaml',
|
||||
'zipinfo'
|
||||
]
|
||||
|
||||
JC_ERROR_EXIT = 100
|
||||
|
||||
@@ -19,8 +19,10 @@ Schema:
|
||||
|
||||
{
|
||||
"variables": [
|
||||
"name": string,
|
||||
"value": string
|
||||
{
|
||||
"name": string,
|
||||
"value": string
|
||||
}
|
||||
],
|
||||
"schedule": [
|
||||
{
|
||||
|
||||
@@ -15,8 +15,10 @@ Schema:
|
||||
|
||||
{
|
||||
"variables": [
|
||||
"name": string,
|
||||
"value": string
|
||||
{
|
||||
"name": string,
|
||||
"value": string
|
||||
}
|
||||
],
|
||||
"schedule": [
|
||||
{
|
||||
|
||||
@@ -75,7 +75,7 @@ import csv
|
||||
|
||||
class info():
|
||||
"""Provides parser metadata (version, author, etc.)"""
|
||||
version = '1.3'
|
||||
version = '1.4'
|
||||
description = 'CSV file parser'
|
||||
author = 'Kelly Brazil'
|
||||
author_email = 'kellyjonbrazil@gmail.com'
|
||||
@@ -130,9 +130,11 @@ def parse(data, raw=False, quiet=False):
|
||||
|
||||
if jc.utils.has_data(data):
|
||||
|
||||
dialect = None
|
||||
dialect = 'excel' # default in csv module
|
||||
try:
|
||||
dialect = csv.Sniffer().sniff(data[:1024])
|
||||
if '""' in data:
|
||||
dialect.doublequote = True
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
||||
@@ -24,11 +24,11 @@ Schema:
|
||||
{
|
||||
"column_name1": string,
|
||||
"column_name2": string,
|
||||
"_jc_meta": # This object only exists if using -qq or ignore_exceptions=True
|
||||
"_jc_meta": # This object only exists if using -qq or ignore_exceptions=True
|
||||
{
|
||||
"success": booean, # true if successfully parsed, false if error
|
||||
"error": string, # exists if "success" is false
|
||||
"line": string # exists if "success" is false
|
||||
"success": boolean, # true if successfully parsed, false if error
|
||||
"error": string, # exists if "success" is false
|
||||
"line": string # exists if "success" is false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ from jc.exceptions import ParseError
|
||||
|
||||
class info():
|
||||
"""Provides parser metadata (version, author, etc.)"""
|
||||
version = '1.1'
|
||||
version = '1.2'
|
||||
description = 'CSV file streaming parser'
|
||||
author = 'Kelly Brazil'
|
||||
author_email = 'kellyjonbrazil@gmail.com'
|
||||
@@ -113,18 +113,20 @@ def parse(data, raw=False, quiet=False, ignore_exceptions=False):
|
||||
|
||||
# first, load the first 100 lines into a list to detect the CSV dialect
|
||||
for line in itertools.islice(data, 100):
|
||||
temp_list.append(line)
|
||||
temp_list.append(line.rstrip())
|
||||
|
||||
# check for Python bug that does not split on `\r` newlines from sys.stdin correctly
|
||||
# https://bugs.python.org/issue45617
|
||||
if len(temp_list) == 1:
|
||||
raise ParseError('Unable to detect line endings. Please try the non-streaming CSV parser instead.')
|
||||
|
||||
sniffdata = '\n'.join(temp_list)
|
||||
sniffdata = '\n'.join(temp_list)[:1024]
|
||||
dialect = 'excel' # default in csv module
|
||||
|
||||
dialect = None
|
||||
try:
|
||||
dialect = csv.Sniffer().sniff(sniffdata)
|
||||
if '""' in sniffdata:
|
||||
dialect.doublequote = True
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ Schema:
|
||||
"foo": string,
|
||||
"_jc_meta": # This object only exists if using -qq or ignore_exceptions=True
|
||||
{
|
||||
"success": booean, # true if successfully parsed, false if error
|
||||
"success": boolean, # true if successfully parsed, false if error
|
||||
"error": string, # exists if "success" is false
|
||||
"line": string # exists if "success" is false
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ Schema:
|
||||
"percent_wrqm": float,
|
||||
"_jc_meta": # This object only exists if using -qq or ignore_exceptions=True
|
||||
{
|
||||
"success": booean, # true if successfully parsed, false if error
|
||||
"success": boolean, # true if successfully parsed, false if error
|
||||
"error": string, # exists if "success" is false
|
||||
"line": string # exists if "success" is false
|
||||
}
|
||||
|
||||
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 `MANIFEST.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)
|
||||
@@ -36,7 +36,7 @@ Schema:
|
||||
"epoch_utc": integer, # timezone aware timestamp if date field is in UTC and can be converted
|
||||
"_jc_meta": # This object only exists if using -qq or ignore_exceptions=True
|
||||
{
|
||||
"success": booean, # true if successfully parsed, false if error
|
||||
"success": boolean, # true if successfully parsed, false if error
|
||||
"error": string, # exists if "success" is false
|
||||
"line": string # exists if "success" is false
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ Schema:
|
||||
"round_trip_ms_stddev": float,
|
||||
"_jc_meta": # This object only exists if using -qq or ignore_exceptions=True
|
||||
{
|
||||
"success": booean, # true if successfully parsed, false if error
|
||||
"success": boolean, # true if successfully parsed, false if error
|
||||
"error": string, # exists if "success" is false
|
||||
"line": string # exists if "success" is false
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ Schema:
|
||||
"epoch_utc": integer # aware timestamp if -t flag is used and UTC TZ
|
||||
"_jc_meta": # This object only exists if using -qq or ignore_exceptions=True
|
||||
{
|
||||
"success": booean, # true if successfully parsed, false if error
|
||||
"success": boolean, # true if successfully parsed, false if error
|
||||
"error": string, # exists if "success" is false
|
||||
"line": string # exists if "success" is false
|
||||
}
|
||||
|
||||
206
jc/parsers/zipinfo.py
Normal file
206
jc/parsers/zipinfo.py
Normal file
@@ -0,0 +1,206 @@
|
||||
"""jc - JSON CLI output utility `zipinfo` command output parser
|
||||
|
||||
Options supported:
|
||||
- none
|
||||
|
||||
Note: The default listing format.
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ zipinfo <archive> | jc --zipinfo
|
||||
|
||||
or
|
||||
|
||||
$ jc zipinfo
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.zipinfo
|
||||
result = jc.parsers.zipinfo.parse(zipinfo_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"archive": string,
|
||||
"size": integer,
|
||||
"size_unit": string,
|
||||
"number_entries": integer,
|
||||
"number_files": integer,
|
||||
"bytes_uncompressed": integer,
|
||||
"bytes_compressed": integer,
|
||||
"percent_compressed": float,
|
||||
"files": [
|
||||
{
|
||||
"flags": string,
|
||||
"zipversion": string,
|
||||
"zipunder": string
|
||||
"filesize": integer,
|
||||
"type": string,
|
||||
"method": string,
|
||||
"date": string,
|
||||
"time": string,
|
||||
"filename": string
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
$ zipinfo log4j-core-2.16.0.jar | jc --zipinfo -p
|
||||
|
||||
[
|
||||
{
|
||||
"archive": "log4j-core-2.16.0.jar",
|
||||
"size": 1789565,
|
||||
"size_unit": "bytes",
|
||||
"number_entries": 1218,
|
||||
"number_files": 1218,
|
||||
"bytes_uncompressed": 3974141,
|
||||
"bytes_compressed": 1515455,
|
||||
"percent_compressed": 61.9,
|
||||
"files": [
|
||||
{
|
||||
"flags": "-rw-r--r--",
|
||||
"zipversion": "2.0",
|
||||
"zipunder": "unx",
|
||||
"filesize": 19810,
|
||||
"type": "bl",
|
||||
"method": "defN",
|
||||
"date": "21-Dec-12",
|
||||
"time": "23:35",
|
||||
"filename": "META-INF/MANIFEST.MF"
|
||||
},
|
||||
...
|
||||
"""
|
||||
import jc.utils
|
||||
import jc.parsers.universal
|
||||
|
||||
|
||||
class info():
|
||||
"""Provides parser metadata (version, author, etc.)"""
|
||||
version = '0.01'
|
||||
description = '`zipinfo` command parser'
|
||||
author = 'Matt J'
|
||||
author_email = 'https://github.com/listuser'
|
||||
compatible = ['linux', 'darwin']
|
||||
magic_commands = ['zipinfo']
|
||||
|
||||
|
||||
__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.
|
||||
"""
|
||||
|
||||
for entry in proc_data:
|
||||
int_list = ['bytes_compressed', 'bytes_uncompressed', 'number_entries',
|
||||
'number_files', 'size', 'filesize']
|
||||
float_list = ['percent_compressed']
|
||||
for key in entry:
|
||||
if key in int_list:
|
||||
entry[key] = jc.utils.convert_to_int(entry[key])
|
||||
if key in float_list:
|
||||
entry[key] = jc.utils.convert_to_float(entry[key])
|
||||
|
||||
if 'files' in key:
|
||||
for item in entry['files']:
|
||||
for key in item:
|
||||
if key in int_list:
|
||||
item[key] = jc.utils.convert_to_int(item[key])
|
||||
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:
|
||||
archive_info = {}
|
||||
|
||||
# 1st line
|
||||
# Archive: log4j-core-2.16.0.jar
|
||||
line = archive_item.pop(0)
|
||||
_, archive = line.split()
|
||||
|
||||
# 2nd line
|
||||
# Zip file size: 1789565 bytes, number of entries: 1218
|
||||
line = archive_item.pop(0)
|
||||
_, _, _, size, size_unit, *_, number_entries = line.split()
|
||||
size_unit = size_unit.rstrip(',')
|
||||
|
||||
# last line
|
||||
# 1218 files, 3974141 bytes uncompressed, 1515455 bytes compressed: 61.9%
|
||||
line = archive_item.pop(-1)
|
||||
number_files, _, bytes_uncompressed, _, _, bytes_compressed, *_, percent_compressed = line.split()
|
||||
percent_compressed = percent_compressed.rstrip("%")
|
||||
|
||||
# Add header row for parsing
|
||||
archive_item[:0] = ['flags zipversion zipunder filesize type method date time filename']
|
||||
|
||||
file_list = jc.parsers.universal.simple_table_parse(archive_item)
|
||||
|
||||
archive_info = {
|
||||
'archive': archive,
|
||||
'size': size,
|
||||
'size_unit': size_unit,
|
||||
'number_entries': number_entries,
|
||||
'number_files': number_files,
|
||||
'bytes_uncompressed': bytes_uncompressed,
|
||||
'bytes_compressed': bytes_compressed,
|
||||
'percent_compressed': percent_compressed,
|
||||
'files': file_list
|
||||
}
|
||||
|
||||
raw_output.append(archive_info)
|
||||
|
||||
return raw_output if raw else _process(raw_output)
|
||||
14
man/jc.1
14
man/jc.1
@@ -1,4 +1,4 @@
|
||||
.TH jc 1 2021-12-08 1.17.4 "JSON CLI output utility"
|
||||
.TH jc 1 2022-01-03 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
|
||||
@@ -427,6 +432,11 @@ XML file parser
|
||||
\fB--yaml\fP
|
||||
YAML file parser
|
||||
|
||||
.TP
|
||||
.B
|
||||
\fB--zipinfo\fP
|
||||
`zipinfo` command parser
|
||||
|
||||
|
||||
.RE
|
||||
.PP
|
||||
@@ -634,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.4',
|
||||
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.',
|
||||
|
||||
@@ -91,7 +91,10 @@ pip3 install jc
|
||||
| FreeBSD | `portsnap fetch update && cd /usr/ports/textproc/py-jc && make install clean` |
|
||||
| Ansible filter plugin | `ansible-galaxy collection install community.general` |
|
||||
|
||||
> For more packages and binaries, see the [jc packaging](https://kellyjonbrazil.github.io/jc-packaging/) site.
|
||||
> For more OS Packages, see https://repology.org/project/jc/versions.
|
||||
|
||||
### Binaries and Packages
|
||||
For precompiled binaries and packages, see [Releases](https://github.com/kellyjonbrazil/jc/releases) on Github.
|
||||
|
||||
## Usage
|
||||
`jc` accepts piped input from `STDIN` and outputs a JSON representation of the previous command's output to `STDOUT`.
|
||||
|
||||
1
tests/fixtures/generic/csv-doubleqouted-streaming.json
vendored
Normal file
1
tests/fixtures/generic/csv-doubleqouted-streaming.json
vendored
Normal file
@@ -0,0 +1 @@
|
||||
[{"A":"1","B":"this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this"},{"A":"2","B":"this is a field with \" in it\""}]
|
||||
3
tests/fixtures/generic/csv-doubleqouted.csv
vendored
Normal file
3
tests/fixtures/generic/csv-doubleqouted.csv
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
A,B
|
||||
1,"this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this"
|
||||
2,"this is a field with "" in it"
|
||||
|
4
tests/fixtures/generic/csv-doubleqouted.json
vendored
Normal file
4
tests/fixtures/generic/csv-doubleqouted.json
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
[
|
||||
{"A": "1", "B": "this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this is 1024 bytes long field this"},
|
||||
{"A": "2", "B": "this is a field with \" in it"}
|
||||
]
|
||||
1
tests/fixtures/osx-10.14.6/zipinfo-multi.json
vendored
Normal file
1
tests/fixtures/osx-10.14.6/zipinfo-multi.json
vendored
Normal file
@@ -0,0 +1 @@
|
||||
[{"archive":"jc1.zip","size":4116,"size_unit":"bytes","number_entries":1,"number_files":1,"bytes_uncompressed":11837,"bytes_compressed":3966,"percent_compressed":66.5,"files":[{"flags":"-rw-r--r--","zipversion":"2.1","zipunder":"unx","filesize":11837,"type":"bX","method":"defN","date":"21-Dec-08","time":"20:50","filename":"jc.1"}]},{"archive":"testzip.zip","size":8106,"size_unit":"bytes","number_entries":2,"number_files":2,"bytes_uncompressed":8539,"bytes_compressed":7651,"percent_compressed":10.4,"files":[{"flags":"-rw-r--r--","zipversion":"3.0","zipunder":"unx","filesize":197,"type":"tx","method":"defN","date":"21-Aug-03","time":"15:12","filename":"round-table.gv"},{"flags":"-rw-r--r--","zipversion":"3.0","zipunder":"unx","filesize":8342,"type":"bx","method":"defN","date":"21-Aug-03","time":"15:12","filename":"round-table.gv.pdf"}]},{"archive":"micro.zip","size":6144,"size_unit":"bytes","number_entries":8,"number_files":8,"bytes_uncompressed":22839,"bytes_compressed":4908,"percent_compressed":78.5,"files":[{"flags":"-rw-r--r--","zipversion":"2.1","zipunder":"unx","filesize":10688,"type":"bX","method":"defN","date":"19-Sep-30","time":"16:47","filename":"microsimservermac.py"},{"flags":"drwxrwxr-x","zipversion":"2.1","zipunder":"unx","filesize":0,"type":"bx","method":"stor","date":"21-Dec-20","time":"14:33","filename":"__MACOSX/"},{"flags":"-rw-r--r--","zipversion":"2.1","zipunder":"unx","filesize":176,"type":"bX","method":"defN","date":"19-Sep-30","time":"16:47","filename":"__MACOSX/._microsimservermac.py"},{"flags":"-rw-r--r--","zipversion":"2.1","zipunder":"unx","filesize":528,"type":"bX","method":"defN","date":"19-Aug-27","time":"07:46","filename":"Dockerfile"},{"flags":"-rw-r--r--","zipversion":"2.1","zipunder":"unx","filesize":10538,"type":"bX","method":"defN","date":"19-Oct-01","time":"13:22","filename":"microsimserver.py"},{"flags":"-rw-r--r--","zipversion":"2.1","zipunder":"unx","filesize":380,"type":"bX","method":"defN","date":"19-Oct-01","time":"13:22","filename":"changelog.txt"},{"flags":"-rwxr-xr-x","zipversion":"2.1","zipunder":"unx","filesize":263,"type":"bX","method":"defN","date":"19-Oct-01","time":"12:09","filename":"dockerhub.sh"},{"flags":"-rw-r--r--","zipversion":"2.1","zipunder":"unx","filesize":266,"type":"bX","method":"defN","date":"19-Oct-01","time":"12:09","filename":"__MACOSX/._dockerhub.sh"}]}]
|
||||
24
tests/fixtures/osx-10.14.6/zipinfo-multi.out
vendored
Normal file
24
tests/fixtures/osx-10.14.6/zipinfo-multi.out
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
Archive: jc1.zip
|
||||
Zip file size: 4116 bytes, number of entries: 1
|
||||
-rw-r--r-- 2.1 unx 11837 bX defN 21-Dec-08 20:50 jc.1
|
||||
1 file, 11837 bytes uncompressed, 3966 bytes compressed: 66.5%
|
||||
|
||||
Archive: testzip.zip
|
||||
Zip file size: 8106 bytes, number of entries: 2
|
||||
-rw-r--r-- 3.0 unx 197 tx defN 21-Aug-03 15:12 round-table.gv
|
||||
-rw-r--r-- 3.0 unx 8342 bx defN 21-Aug-03 15:12 round-table.gv.pdf
|
||||
2 files, 8539 bytes uncompressed, 7651 bytes compressed: 10.4%
|
||||
|
||||
Archive: micro.zip
|
||||
Zip file size: 6144 bytes, number of entries: 8
|
||||
-rw-r--r-- 2.1 unx 10688 bX defN 19-Sep-30 16:47 microsimservermac.py
|
||||
drwxrwxr-x 2.1 unx 0 bx stor 21-Dec-20 14:33 __MACOSX/
|
||||
-rw-r--r-- 2.1 unx 176 bX defN 19-Sep-30 16:47 __MACOSX/._microsimservermac.py
|
||||
-rw-r--r-- 2.1 unx 528 bX defN 19-Aug-27 07:46 Dockerfile
|
||||
-rw-r--r-- 2.1 unx 10538 bX defN 19-Oct-01 13:22 microsimserver.py
|
||||
-rw-r--r-- 2.1 unx 380 bX defN 19-Oct-01 13:22 changelog.txt
|
||||
-rwxr-xr-x 2.1 unx 263 bX defN 19-Oct-01 12:09 dockerhub.sh
|
||||
-rw-r--r-- 2.1 unx 266 bX defN 19-Oct-01 12:09 __MACOSX/._dockerhub.sh
|
||||
8 files, 22839 bytes uncompressed, 4908 bytes compressed: 78.5%
|
||||
|
||||
3 archives were successfully processed.
|
||||
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
|
||||
|
||||
1
tests/fixtures/rhel-8/zipinfo.json
vendored
Normal file
1
tests/fixtures/rhel-8/zipinfo.json
vendored
Normal file
File diff suppressed because one or more lines are too long
1221
tests/fixtures/rhel-8/zipinfo.out
vendored
Normal file
1221
tests/fixtures/rhel-8/zipinfo.out
vendored
Normal file
File diff suppressed because it is too large
Load Diff
@@ -37,6 +37,9 @@ class MyTests(unittest.TestCase):
|
||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/generic/csv-insurance.csv'), 'r', encoding='utf-8') as f:
|
||||
self.generic_csv_insurance = f.read()
|
||||
|
||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/generic/csv-doubleqouted.csv'), 'r', encoding='utf-8') as f:
|
||||
self.generic_csv_doubleqouted = f.read()
|
||||
|
||||
# output
|
||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/generic/csv-biostats.json'), 'r', encoding='utf-8') as f:
|
||||
self.generic_csv_biostats_json = json.loads(f.read())
|
||||
@@ -65,6 +68,9 @@ class MyTests(unittest.TestCase):
|
||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/generic/csv-insurance.json'), 'r', encoding='utf-8') as f:
|
||||
self.generic_csv_insurance_json = json.loads(f.read())
|
||||
|
||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/generic/csv-doubleqouted.json'), 'r', encoding='utf-8') as f:
|
||||
self.generic_csv_doubleqouted_json = json.loads(f.read())
|
||||
|
||||
def test_csv_nodata(self):
|
||||
"""
|
||||
Test with no data
|
||||
@@ -125,6 +131,12 @@ class MyTests(unittest.TestCase):
|
||||
"""
|
||||
self.assertEqual(jc.parsers.csv.parse(self.generic_csv_insurance, quiet=True), self.generic_csv_insurance_json)
|
||||
|
||||
def test_doubleqouted(self):
|
||||
"""
|
||||
Test 'csv-doubleqouted.csv' file
|
||||
"""
|
||||
self.assertEqual(jc.parsers.csv.parse(self.generic_csv_doubleqouted, quiet=True), self.generic_csv_doubleqouted_json)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
||||
@@ -42,6 +42,9 @@ class MyTests(unittest.TestCase):
|
||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/generic/csv-10k-sales-records.csv'), 'r', encoding='utf-8') as f:
|
||||
self.generic_csv_10k_sales_records = f.read()
|
||||
|
||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/generic/csv-doubleqouted.csv'), 'r', encoding='utf-8') as f:
|
||||
self.generic_csv_doubleqouted = f.read()
|
||||
|
||||
# output
|
||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/generic/csv-biostats-streaming.json'), 'r', encoding='utf-8') as f:
|
||||
self.generic_csv_biostats_streaming_json = json.loads(f.read())
|
||||
@@ -70,6 +73,9 @@ class MyTests(unittest.TestCase):
|
||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/generic/csv-10k-sales-records-streaming.json'), 'r', encoding='utf-8') as f:
|
||||
self.generic_csv_10k_sales_records_streaming_json = json.loads(f.read())
|
||||
|
||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/generic/csv-doubleqouted-streaming.json'), 'r', encoding='utf-8') as f:
|
||||
self.generic_csv_doublequoted_streaming_json = json.loads(f.read())
|
||||
|
||||
def test_csv_s_nodata(self):
|
||||
"""
|
||||
Test CSV parser with no data
|
||||
@@ -141,6 +147,12 @@ class MyTests(unittest.TestCase):
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.csv_s.parse(self.generic_csv_10k_sales_records.splitlines(), quiet=True)), self.generic_csv_10k_sales_records_streaming_json)
|
||||
|
||||
def test_csv_s_doublequoted(self):
|
||||
"""
|
||||
Test 'doublequoted.csv' file
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.csv_s.parse(self.generic_csv_doubleqouted.splitlines(), quiet=True)), self.generic_csv_doublequoted_streaming_json)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
||||
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()
|
||||
46
tests/test_zipinfo.py
Normal file
46
tests/test_zipinfo.py
Normal file
@@ -0,0 +1,46 @@
|
||||
import os
|
||||
import unittest
|
||||
import json
|
||||
import jc.parsers.zipinfo
|
||||
|
||||
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/zipinfo.out'), 'r', encoding='utf-8') as f:
|
||||
self.rhel_8_zipinfo = f.read()
|
||||
|
||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.14.6/zipinfo-multi.out'), 'r', encoding='utf-8') as f:
|
||||
self.osx_10_14_6_zipinfo_multi = f.read()
|
||||
|
||||
# output
|
||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/rhel-8/zipinfo.json'), 'r', encoding='utf-8') as f:
|
||||
self.rhel_8_zipinfo_json = json.loads(f.read())
|
||||
|
||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.14.6/zipinfo-multi.json'), 'r', encoding='utf-8') as f:
|
||||
self.osx_10_14_6_zipinfo_multi_json = json.loads(f.read())
|
||||
|
||||
def test_zipinfo_nodata(self):
|
||||
"""
|
||||
Test 'zipinfo' parser with no data
|
||||
"""
|
||||
self.assertEqual(jc.parsers.zipinfo.parse('', quiet=True), [])
|
||||
|
||||
def test_zipinfo_rhel_8(self):
|
||||
"""
|
||||
Test 'zipinfo' on Red Hat 8
|
||||
"""
|
||||
self.assertEqual(jc.parsers.zipinfo.parse(self.rhel_8_zipinfo, quiet=True), self.rhel_8_zipinfo_json)
|
||||
|
||||
def test_zipinfo_multi_osx_10_14_6(self):
|
||||
"""
|
||||
Test 'zipinfo' with multiple archives on OSX 10.14.6
|
||||
"""
|
||||
self.assertEqual(jc.parsers.zipinfo.parse(self.osx_10_14_6_zipinfo_multi, quiet=True), self.osx_10_14_6_zipinfo_multi_json)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user