mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2026-04-03 17:44:07 +02:00
Compare commits
1139 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ac8120e1fe | ||
|
|
a854f1d6b0 | ||
|
|
7c9e92e284 | ||
|
|
4c2775970d | ||
|
|
ba0fc5dad9 | ||
|
|
222d1b7255 | ||
|
|
34fda0905f | ||
|
|
ccbe36e712 | ||
|
|
bb1136c33c | ||
|
|
c6a13aa4d8 | ||
|
|
d04a175d36 | ||
|
|
966df71566 | ||
|
|
c8599253fb | ||
|
|
65d9cc718f | ||
|
|
9b4190f1e6 | ||
|
|
c519657d85 | ||
|
|
d5cceb77e9 | ||
|
|
5cde110afb | ||
|
|
65aa6c1a9a | ||
|
|
5394d7f62d | ||
|
|
ebbd4e9320 | ||
|
|
834acfb2d6 | ||
|
|
1182c9f263 | ||
|
|
ed3046bb1b | ||
|
|
ca73076b56 | ||
|
|
9efc014dce | ||
|
|
dbe1757a48 | ||
|
|
1c09289d95 | ||
|
|
e9ccedf0d7 | ||
|
|
fb4b4eeb58 | ||
|
|
896891ad9e | ||
|
|
7fda79d841 | ||
|
|
8995ac686a | ||
|
|
006047553d | ||
|
|
c56e38c66c | ||
|
|
ee3b873ef4 | ||
|
|
a39cb05228 | ||
|
|
f54ceaa793 | ||
|
|
99cce72244 | ||
|
|
0c40e3a3c9 | ||
|
|
025d00ecd2 | ||
|
|
a2b5d41308 | ||
|
|
366589268e | ||
|
|
53dd28b65e | ||
|
|
0be6528aff | ||
|
|
6ceaa7749e | ||
|
|
6ae2e17ea1 | ||
|
|
ef9ca9322e | ||
|
|
95cba21d73 | ||
|
|
be1dd031f1 | ||
|
|
7fbe1e9f21 | ||
|
|
7d33850d43 | ||
|
|
7887789d0d | ||
|
|
7ddd2a4ce2 | ||
|
|
34ab34cc66 | ||
|
|
a8b231da81 | ||
|
|
2278c7ecab | ||
|
|
4cb88977cc | ||
|
|
0af4a3a5d7 | ||
|
|
c0f9b705c6 | ||
|
|
fa416083f2 | ||
|
|
e858faa746 | ||
|
|
a8f769eea3 | ||
|
|
26133261f9 | ||
|
|
6072ea0ec7 | ||
|
|
95672c23b7 | ||
|
|
a2e0e6d549 | ||
|
|
2df5e79295 | ||
|
|
c5e0642b0b | ||
|
|
78150ded70 | ||
|
|
05f3e4ea8a | ||
|
|
b7cf0ca8d4 | ||
|
|
ba6e1e694e | ||
|
|
aec3e3cd13 | ||
|
|
d9363ae473 | ||
|
|
0f367a435a | ||
|
|
0955598b49 | ||
|
|
f2a8e0087b | ||
|
|
97e9798cef | ||
|
|
413519e02c | ||
|
|
5c855e40c6 | ||
|
|
b66c5dbf55 | ||
|
|
b054b1b782 | ||
|
|
1593d0bf79 | ||
|
|
8a22f8a468 | ||
|
|
c26f0641ff | ||
|
|
40eb2b7ef6 | ||
|
|
71af0c5555 | ||
|
|
9f5532d91f | ||
|
|
c68c919024 | ||
|
|
9eb4df34b1 | ||
|
|
921133f3ac | ||
|
|
0350607359 | ||
|
|
5f8c65cf5b | ||
|
|
ed048c7b2b | ||
|
|
18dabd4b9f | ||
|
|
0005945383 | ||
|
|
e13605a6a9 | ||
|
|
a92e318319 | ||
|
|
7d8166326a | ||
|
|
d21e5f4f28 | ||
|
|
f1bab336ee | ||
|
|
0faacb6d0d | ||
|
|
6af82fb9ae | ||
|
|
517137889c | ||
|
|
8a3997cd0e | ||
|
|
4f66faad0d | ||
|
|
846f4fb691 | ||
|
|
5bec53b3f8 | ||
|
|
dfc942776b | ||
|
|
18a00bc57a | ||
|
|
e2b2406931 | ||
|
|
a9cfb4b13a | ||
|
|
3e57ecf6df | ||
|
|
2ddf67ad0c | ||
|
|
137c59cea1 | ||
|
|
8b2f57e8e7 | ||
|
|
01f5aa05b3 | ||
|
|
6ae626ef9f | ||
|
|
dea7099183 | ||
|
|
9c3e4f349c | ||
|
|
d5398c7089 | ||
|
|
2dcf0e2d1b | ||
|
|
f45295eee4 | ||
|
|
4ef34f7849 | ||
|
|
a69e55cb1c | ||
|
|
6563b9f073 | ||
|
|
6e17ed6f62 | ||
|
|
abda8735be | ||
|
|
79cb156441 | ||
|
|
1da080dc52 | ||
|
|
3ca8e1ef11 | ||
|
|
1d31d3570a | ||
|
|
b84123a09b | ||
|
|
475eedb142 | ||
|
|
ebd0432b82 | ||
|
|
ee1135003b | ||
|
|
aaee394e51 | ||
|
|
ad91a71488 | ||
|
|
c2adc46db4 | ||
|
|
3e9afca803 | ||
|
|
ee2a7ddc2e | ||
|
|
4fc7232d44 | ||
|
|
a0dff721b1 | ||
|
|
37061227d9 | ||
|
|
401b7b31b8 | ||
|
|
86a4bd12b5 | ||
|
|
50638cc11e | ||
|
|
36de08a6f8 | ||
|
|
83fa32f615 | ||
|
|
a3ca2814b3 | ||
|
|
5c06712fba | ||
|
|
fdadba226f | ||
|
|
5ac36befe2 | ||
|
|
527b5ab5c5 | ||
|
|
495c353c5d | ||
|
|
abbd4820fd | ||
|
|
5e88eb0c8b | ||
|
|
b0c98a56ce | ||
|
|
07e9b46535 | ||
|
|
87419750fc | ||
|
|
412a772b42 | ||
|
|
52a816cc45 | ||
|
|
48deacf875 | ||
|
|
7a377f7b8d | ||
|
|
e2f97d7d8e | ||
|
|
f9bf889654 | ||
|
|
026846650a | ||
|
|
850917ada0 | ||
|
|
bce4eb536a | ||
|
|
ef2a2121b5 | ||
|
|
4bed8392b8 | ||
|
|
8e2bcba352 | ||
|
|
588e5c2653 | ||
|
|
25085c3412 | ||
|
|
bfa99d99af | ||
|
|
b8f7ddcfc8 | ||
|
|
413ea4bc68 | ||
|
|
13948fff26 | ||
|
|
6275591ef1 | ||
|
|
2cdbebb7fd | ||
|
|
412f11276a | ||
|
|
f3dd51f517 | ||
|
|
f66f1aadaa | ||
|
|
8ead7e4835 | ||
|
|
f1177a2606 | ||
|
|
44dc2a74c1 | ||
|
|
d50bd96ce6 | ||
|
|
5cde127a04 | ||
|
|
63d1cead90 | ||
|
|
d3e7f09ca3 | ||
|
|
e6bdbb42d3 | ||
|
|
3cfc5e3e3c | ||
|
|
082d4a3f80 | ||
|
|
158c28455b | ||
|
|
efb02493b8 | ||
|
|
a319ec85ca | ||
|
|
e754e88f2d | ||
|
|
cfa7f267fc | ||
|
|
c581e959fa | ||
|
|
9eb56543be | ||
|
|
67643906b1 | ||
|
|
14d257225c | ||
|
|
0411940f75 | ||
|
|
7d60df67f3 | ||
|
|
70a971a2f1 | ||
|
|
3fbdffd028 | ||
|
|
539fe72d16 | ||
|
|
bd6611aaba | ||
|
|
cf77ddc396 | ||
|
|
77bcd616cd | ||
|
|
5ee2eda83e | ||
|
|
5b849b0275 | ||
|
|
3e5d206f0c | ||
|
|
f50f96381d | ||
|
|
962632ac1f | ||
|
|
d209780a9d | ||
|
|
8e5451a7c1 | ||
|
|
86a09c17cf | ||
|
|
4bb85195e2 | ||
|
|
39f43aad63 | ||
|
|
29689f7603 | ||
|
|
78d7ab1308 | ||
|
|
303cd12de3 | ||
|
|
b65f37e075 | ||
|
|
c05fa7e9cd | ||
|
|
264272a8b8 | ||
|
|
7fadb23fea | ||
|
|
c419e460db | ||
|
|
6434ff61bf | ||
|
|
45a1be11e2 | ||
|
|
7659fe470a | ||
|
|
c332c4febf | ||
|
|
2cc212bfab | ||
|
|
b836ffc583 | ||
|
|
29f1a1d425 | ||
|
|
9f78dc6afa | ||
|
|
74c7e11948 | ||
|
|
6ba6dc0374 | ||
|
|
ec0f2569e5 | ||
|
|
65e30c4440 | ||
|
|
8d9ebf5dfa | ||
|
|
c3746454ff | ||
|
|
ea0f6493a2 | ||
|
|
afbc46076e | ||
|
|
2b9b6550a7 | ||
|
|
6fb3c0a409 | ||
|
|
1b8911ad36 | ||
|
|
cc61b57dd1 | ||
|
|
6d679b2895 | ||
|
|
1e1fc08a47 | ||
|
|
b5c3a03d56 | ||
|
|
9e269f070f | ||
|
|
f863cfdef4 | ||
|
|
2cd58d75e7 | ||
|
|
03b70eebb7 | ||
|
|
1e76ce2aea | ||
|
|
d9fc1b4242 | ||
|
|
36a3d2e96d | ||
|
|
bf05de1d63 | ||
|
|
cae41df1d8 | ||
|
|
8e9ff7fa9f | ||
|
|
973c535c72 | ||
|
|
8614d3dde9 | ||
|
|
a73ee47bcf | ||
|
|
d54a81831f | ||
|
|
73ae1396b9 | ||
|
|
3399e8551e | ||
|
|
b9656c2fae | ||
|
|
e08ccb7942 | ||
|
|
9b648e8560 | ||
|
|
c97a8fb48f | ||
|
|
3a95407161 | ||
|
|
7609af28b3 | ||
|
|
c2b2e81a2b | ||
|
|
3b0594a4a6 | ||
|
|
2b0b9dd7ba | ||
|
|
f159dd6b9d | ||
|
|
2d5d87c73d | ||
|
|
a260ceba1c | ||
|
|
6c30b8106c | ||
|
|
a23921c879 | ||
|
|
3999276d17 | ||
|
|
65bd4850f2 | ||
|
|
d71c2d2b20 | ||
|
|
6dd5b29998 | ||
|
|
1868b28f74 | ||
|
|
e8c0bef6ca | ||
|
|
2c09a06b5a | ||
|
|
fc75ce90d1 | ||
|
|
45a6cfc9cf | ||
|
|
69a0922410 | ||
|
|
2bb201a706 | ||
|
|
50d5d3a3ba | ||
|
|
b14a8980b8 | ||
|
|
de6aa1cc92 | ||
|
|
c4dcedb269 | ||
|
|
140a61702b | ||
|
|
4d3fc07e3b | ||
|
|
dcc4d35d55 | ||
|
|
cfb30b32f3 | ||
|
|
26f2738471 | ||
|
|
2bccd14c5d | ||
|
|
0d4823c9de | ||
|
|
2a14f56b72 | ||
|
|
fe49759598 | ||
|
|
ee737a59eb | ||
|
|
517ab10930 | ||
|
|
604fb574be | ||
|
|
a254ee8d88 | ||
|
|
f784a7a76d | ||
|
|
2e33afbe18 | ||
|
|
103bb174fc | ||
|
|
2a76a64fa1 | ||
|
|
c8fb56c601 | ||
|
|
e835227027 | ||
|
|
88ffcaee56 | ||
|
|
a9ba98847c | ||
|
|
2630049ab7 | ||
|
|
47c7e081f3 | ||
|
|
ef7f755614 | ||
|
|
32bd7ffbf6 | ||
|
|
347097a294 | ||
|
|
356857f5d6 | ||
|
|
ee12c52291 | ||
|
|
0e7ebf4dc1 | ||
|
|
f1e0cec9d6 | ||
|
|
d96a2a8623 | ||
|
|
1b1bc46222 | ||
|
|
d5a8b4eed2 | ||
|
|
5ddd4f0e86 | ||
|
|
8b94c326de | ||
|
|
29b012e66d | ||
|
|
572a3207cd | ||
|
|
2a88f2be6b | ||
|
|
3de6eac1ad | ||
|
|
f44260603e | ||
|
|
1c60f5355e | ||
|
|
40fa78a966 | ||
|
|
71db67ef49 | ||
|
|
1cd723b48f | ||
|
|
82ee4d7b30 | ||
|
|
dfd19f38f3 | ||
|
|
2358c883d0 | ||
|
|
79e4f3a761 | ||
|
|
5be45622cc | ||
|
|
5f4136b943 | ||
|
|
941bfe2724 | ||
|
|
3ed44a26d9 | ||
|
|
b7270517bd | ||
|
|
bf63ac93c6 | ||
|
|
1cb80f15c2 | ||
|
|
b5c22c6e53 | ||
|
|
7951366117 | ||
|
|
c78a4bb655 | ||
|
|
8aceda18b9 | ||
|
|
e0c75a9b6b | ||
|
|
fd283f6cf7 | ||
|
|
b881ad4ec0 | ||
|
|
2fcb32e26f | ||
|
|
13a802225b | ||
|
|
88649a4e8d | ||
|
|
5c6fa5bff6 | ||
|
|
b70025d6d6 | ||
|
|
59b89ecbd4 | ||
|
|
8f7502ff0f | ||
|
|
249d93f15c | ||
|
|
b0cf2e2d78 | ||
|
|
264fcd40ad | ||
|
|
54def8ef49 | ||
|
|
63c271b837 | ||
|
|
741b2d1c1d | ||
|
|
47d4335890 | ||
|
|
81f721f1ab | ||
|
|
c4e1068895 | ||
|
|
a77bb4165a | ||
|
|
3cd2dce496 | ||
|
|
46a8978740 | ||
|
|
3161c48939 | ||
|
|
a89a9187f8 | ||
|
|
d9e0aa5b93 | ||
|
|
d298e101e9 | ||
|
|
cea975d7f1 | ||
|
|
1ed69f9e6a | ||
|
|
ab0e05ec82 | ||
|
|
c16cce4bf0 | ||
|
|
d3489536a1 | ||
|
|
041050ce28 | ||
|
|
7de1a8a5d6 | ||
|
|
d4604743d1 | ||
|
|
0b8fb31298 | ||
|
|
dcdd79e28c | ||
|
|
5291baeb8e | ||
|
|
6867102c66 | ||
|
|
36ed2c7e2e | ||
|
|
4ab0aba9d3 | ||
|
|
e643badaf7 | ||
|
|
d96e96219e | ||
|
|
e42af3353e | ||
|
|
4ec2b16f42 | ||
|
|
0a028456bf | ||
|
|
a1f10928e1 | ||
|
|
eae1d4b89a | ||
|
|
d3c7cec333 | ||
|
|
36fa08d711 | ||
|
|
a9958841e4 | ||
|
|
504ad81a01 | ||
|
|
8bf2f4f4d0 | ||
|
|
805397ea18 | ||
|
|
1b3985c2d7 | ||
|
|
f602043642 | ||
|
|
1a1aa8fda3 | ||
|
|
3249a017ae | ||
|
|
84f0246b2d | ||
|
|
1c795982b0 | ||
|
|
c5164b4108 | ||
|
|
dc3716ecb3 | ||
|
|
c5165ccc21 | ||
|
|
5b2035e0e6 | ||
|
|
5205154aaf | ||
|
|
f500de3af6 | ||
|
|
4b028b5080 | ||
|
|
4cd721be85 | ||
|
|
d58ca402a7 | ||
|
|
5386879040 | ||
|
|
f19a1f23a9 | ||
|
|
5023e5be4c | ||
|
|
5527d22459 | ||
|
|
9d567c2e70 | ||
|
|
39c03a15d5 | ||
|
|
5e6d2562f9 | ||
|
|
7009d5a014 | ||
|
|
42f9ddabb9 | ||
|
|
30efb5afc0 | ||
|
|
786dc76c09 | ||
|
|
fc48874a5d | ||
|
|
67164e7b23 | ||
|
|
3db9774ac6 | ||
|
|
03aef93d9a | ||
|
|
9b7e3de3ed | ||
|
|
291b6b061a | ||
|
|
08496533e2 | ||
|
|
f8dceb5046 | ||
|
|
240ed4047f | ||
|
|
0bf6f7cd7c | ||
|
|
313bd86e3e | ||
|
|
56259d5605 | ||
|
|
8a4885c1fe | ||
|
|
5b06f84917 | ||
|
|
37a1428914 | ||
|
|
bff065daf3 | ||
|
|
c60d899f31 | ||
|
|
fb7c390506 | ||
|
|
22afb69573 | ||
|
|
be51304c9c | ||
|
|
44f83d800f | ||
|
|
bf07973d90 | ||
|
|
11e94b686c | ||
|
|
c68bf674a1 | ||
|
|
dbbc310082 | ||
|
|
e861f4a597 | ||
|
|
049e93707c | ||
|
|
164294ecb7 | ||
|
|
22ef489795 | ||
|
|
8f9d650f6c | ||
|
|
7e134a63bd | ||
|
|
9b5c25cb5b | ||
|
|
894946b207 | ||
|
|
92ad2068db | ||
|
|
59662a1500 | ||
|
|
125b88a2ca | ||
|
|
79fce8c769 | ||
|
|
a4a53f8b3b | ||
|
|
743e1ae90f | ||
|
|
dbcff80907 | ||
|
|
6e10965aed | ||
|
|
0c8c4a9c53 | ||
|
|
7632541a1e | ||
|
|
a213ad9a85 | ||
|
|
15ac5a9004 | ||
|
|
0658668eb0 | ||
|
|
ccef69ac37 | ||
|
|
64676fda2e | ||
|
|
6ea2d776ae | ||
|
|
98ced9616c | ||
|
|
ae19183803 | ||
|
|
8536514baf | ||
|
|
81982a9f79 | ||
|
|
1acbb2f096 | ||
|
|
80fb4d40a5 | ||
|
|
c972dd1aac | ||
|
|
9dde65c25c | ||
|
|
7486b0c7cd | ||
|
|
5c7a520a0b | ||
|
|
193ddf71f8 | ||
|
|
c46fe9816c | ||
|
|
aada5f0794 | ||
|
|
5c7bf363a6 | ||
|
|
00b74be540 | ||
|
|
96cb01f57a | ||
|
|
adf5f403ae | ||
|
|
1c09c95c71 | ||
|
|
64f442d743 | ||
|
|
cd8d43446b | ||
|
|
7361eac1a4 | ||
|
|
9d41f0a938 | ||
|
|
00274c15df | ||
|
|
d0b8a91f94 | ||
|
|
098e8dbef6 | ||
|
|
ec29b8bbc6 | ||
|
|
1d8f83b8c6 | ||
|
|
12c4419c6a | ||
|
|
b134c53f33 | ||
|
|
23ff19fdb5 | ||
|
|
7a43ba631b | ||
|
|
2beb26f3e3 | ||
|
|
4b55f49e99 | ||
|
|
c0239a771c | ||
|
|
bc4738e900 | ||
|
|
1c76caf59b | ||
|
|
0679951d4a | ||
|
|
df7aee9e4b | ||
|
|
a8d97a2521 | ||
|
|
9370b336d8 | ||
|
|
118f98222a | ||
|
|
dc997821f4 | ||
|
|
aef0fdb435 | ||
|
|
21ee3c0e78 | ||
|
|
d6c665f74b | ||
|
|
79305a50d0 | ||
|
|
e758aa41ef | ||
|
|
910cb34b09 | ||
|
|
976fea4eb2 | ||
|
|
81447ec9e6 | ||
|
|
61b8e9f7b5 | ||
|
|
8e86a04448 | ||
|
|
f23715a783 | ||
|
|
fa693a8bb1 | ||
|
|
103168c25b | ||
|
|
ae7ed4eec5 | ||
|
|
caa516db72 | ||
|
|
f05c3d6113 | ||
|
|
5d872b1535 | ||
|
|
1559cd9f5c | ||
|
|
a5a87c7da1 | ||
|
|
0e6cec62c1 | ||
|
|
3bb1d89165 | ||
|
|
f5f5f102fb | ||
|
|
0c82fe7e4d | ||
|
|
13ffe8a84d | ||
|
|
4c6eebaa33 | ||
|
|
f8fbb2dce2 | ||
|
|
dbfe682674 | ||
|
|
2a148d44a1 | ||
|
|
0648d2e9e3 | ||
|
|
ac9128fa0c | ||
|
|
4d7a872670 | ||
|
|
07f716b254 | ||
|
|
b0d6a7307c | ||
|
|
53ad793ff8 | ||
|
|
ea4332d8e4 | ||
|
|
5c5ff9324f | ||
|
|
2ab6352fdb | ||
|
|
56dcbaf40c | ||
|
|
029b5abcac | ||
|
|
32521ac91a | ||
|
|
bf88407902 | ||
|
|
63cf47db63 | ||
|
|
9970866b3b | ||
|
|
d61941b276 | ||
|
|
081fdb8026 | ||
|
|
f64dfbf79d | ||
|
|
5fb73f4ad5 | ||
|
|
1c16d32420 | ||
|
|
e367e0d714 | ||
|
|
4046649e32 | ||
|
|
77fcfe439c | ||
|
|
71d1355419 | ||
|
|
d1b270f336 | ||
|
|
9190a08332 | ||
|
|
3fae50e305 | ||
|
|
3582497ed4 | ||
|
|
19a67daabf | ||
|
|
02a7e5fd8a | ||
|
|
df72b16022 | ||
|
|
61bdc13810 | ||
|
|
1350a34316 | ||
|
|
7cfe68b96a | ||
|
|
7a93a61f54 | ||
|
|
362977e598 | ||
|
|
5cac897beb | ||
|
|
cad94cc6b3 | ||
|
|
fe4e429e85 | ||
|
|
d83b10e2d5 | ||
|
|
bd2a757fcd | ||
|
|
358b69a4cb | ||
|
|
08821a1454 | ||
|
|
90277c1d87 | ||
|
|
a51e702f77 | ||
|
|
466e37128b | ||
|
|
f1ea61388f | ||
|
|
72c11fda3a | ||
|
|
d6645983ef | ||
|
|
01e911ecdb | ||
|
|
12c0b3d889 | ||
|
|
c1075e40b7 | ||
|
|
fabe3f01b7 | ||
|
|
3a2ff61899 | ||
|
|
aeff94d272 | ||
|
|
c94f5d83fa | ||
|
|
b0756fa0f9 | ||
|
|
6c85abd57b | ||
|
|
7659ae94bd | ||
|
|
e306e81e43 | ||
|
|
6d5768b26b | ||
|
|
cee9f8bf32 | ||
|
|
b8e2678c01 | ||
|
|
b0fe96ed03 | ||
|
|
bb65ec380b | ||
|
|
ae6248227b | ||
|
|
36ce3c791d | ||
|
|
5d639db5a8 | ||
|
|
63161ffdbb | ||
|
|
cf11c71831 | ||
|
|
048f8c1f4b | ||
|
|
b6b42d9071 | ||
|
|
d43863ee9f | ||
|
|
177d10577f | ||
|
|
47d8e163de | ||
|
|
e49c621e59 | ||
|
|
5e32a6d828 | ||
|
|
b1358a7eca | ||
|
|
ba89092e12 | ||
|
|
f855420a82 | ||
|
|
1589a81945 | ||
|
|
eec2583cb2 | ||
|
|
481c6a8de2 | ||
|
|
68717e8493 | ||
|
|
c524d37136 | ||
|
|
6674f549f2 | ||
|
|
ba371ec730 | ||
|
|
44d1d52426 | ||
|
|
edcca4fb96 | ||
|
|
6fbf9458d1 | ||
|
|
a476e4639b | ||
|
|
5534a1c755 | ||
|
|
c45518db70 | ||
|
|
55480c059a | ||
|
|
04a2af8681 | ||
|
|
71f672a0e0 | ||
|
|
33c40874fa | ||
|
|
b3ced64672 | ||
|
|
a60bf00d54 | ||
|
|
8d9a2744af | ||
|
|
bcd7bac950 | ||
|
|
e996b3a9f6 | ||
|
|
e207cccdc5 | ||
|
|
9776dd1082 | ||
|
|
bcff00799f | ||
|
|
0dc76621bc | ||
|
|
1040c5706f | ||
|
|
265d08e3bd | ||
|
|
491fce7052 | ||
|
|
3404bc4840 | ||
|
|
064e3f6ac0 | ||
|
|
71f0c4f9da | ||
|
|
18143608dc | ||
|
|
83a6d92449 | ||
|
|
ac1f690c54 | ||
|
|
b063f1bfb4 | ||
|
|
4c5caa7b86 | ||
|
|
85edda6e5f | ||
|
|
6e1a4a103c | ||
|
|
2879c084e5 | ||
|
|
4ecc94e531 | ||
|
|
b8ef583b93 | ||
|
|
fd61e19135 | ||
|
|
79011465af | ||
|
|
27acedf8b7 | ||
|
|
532c37140c | ||
|
|
7f4a951065 | ||
|
|
b9fb7fad9c | ||
|
|
be85d78f55 | ||
|
|
23e02090e0 | ||
|
|
50f2a811ad | ||
|
|
28ee448c44 | ||
|
|
688a2099b5 | ||
|
|
6f0a53ed02 | ||
|
|
8a14de663e | ||
|
|
09344e938a | ||
|
|
bf41140322 | ||
|
|
689a85db9b | ||
|
|
5e0d206e7a | ||
|
|
61addd7950 | ||
|
|
60bb9e2aa9 | ||
|
|
842fbbab64 | ||
|
|
bbd227caf4 | ||
|
|
975b4f5e4f | ||
|
|
06840931ba | ||
|
|
9f4327f517 | ||
|
|
3f13c70dfa | ||
|
|
26f8803b23 | ||
|
|
60f1e79b2f | ||
|
|
5ab2ebe45a | ||
|
|
9c8fe80d6d | ||
|
|
1e7e22330f | ||
|
|
7244868fbd | ||
|
|
86ed39ecdd | ||
|
|
94d87b726f | ||
|
|
0984a1ec26 | ||
|
|
de5da060ce | ||
|
|
592435572c | ||
|
|
3172a18a46 | ||
|
|
7f1c57b89c | ||
|
|
39555a48b5 | ||
|
|
e4cdfa13ca | ||
|
|
cb4011bc03 | ||
|
|
299b0faf7c | ||
|
|
2ffd698c03 | ||
|
|
dde54690fc | ||
|
|
8d03055b34 | ||
|
|
8a850be857 | ||
|
|
2a530712cf | ||
|
|
fd22c7dc3a | ||
|
|
b884f6aacc | ||
|
|
ce680d4082 | ||
|
|
644d3f350d | ||
|
|
0144863d33 | ||
|
|
a6b56519a2 | ||
|
|
0a71caf9cd | ||
|
|
35e74328c4 | ||
|
|
e46ac0ff7e | ||
|
|
17fe6c7691 | ||
|
|
01ca7a69c4 | ||
|
|
6d04db6113 | ||
|
|
7c899abb15 | ||
|
|
89d4df2a05 | ||
|
|
71c8364f80 | ||
|
|
214cd6b9e0 | ||
|
|
73c280de3a | ||
|
|
23e1dd3e35 | ||
|
|
2b060aae0d | ||
|
|
186ad73651 | ||
|
|
de7a010f62 | ||
|
|
ac1bcd2918 | ||
|
|
a2e6243282 | ||
|
|
01f92ced81 | ||
|
|
b493bcf4fa | ||
|
|
f6ee30be20 | ||
|
|
50da124ea7 | ||
|
|
5e22f9e2bd | ||
|
|
a384eb4c15 | ||
|
|
dc4620eeb2 | ||
|
|
d7cfa38eee | ||
|
|
a27110ebe5 | ||
|
|
f5988527fb | ||
|
|
c405309742 | ||
|
|
747d12224f | ||
|
|
2b621ab68e | ||
|
|
8689865d31 | ||
|
|
358324533d | ||
|
|
bc5821e69f | ||
|
|
d5b478c968 | ||
|
|
368eba1826 | ||
|
|
6cffb449f4 | ||
|
|
d79d9c7f13 | ||
|
|
179822b994 | ||
|
|
ba369a0b73 | ||
|
|
6a5251f0ef | ||
|
|
004fd74748 | ||
|
|
e8d6d4c080 | ||
|
|
8644f70db4 | ||
|
|
72f233b186 | ||
|
|
fc85950a73 | ||
|
|
fd5cbbb4d5 | ||
|
|
888b6bd6d5 | ||
|
|
81ea83064c | ||
|
|
45859b01e5 | ||
|
|
5b8f166169 | ||
|
|
7e045ba7b0 | ||
|
|
6247975ee6 | ||
|
|
297451230c | ||
|
|
754d555768 | ||
|
|
b61a91f82d | ||
|
|
1ac7a724bd | ||
|
|
2fcf46505c | ||
|
|
fdec4f08c0 | ||
|
|
076c197385 | ||
|
|
3432e830f2 | ||
|
|
14a237749c | ||
|
|
1559c4751e | ||
|
|
af7c4ce8ec | ||
|
|
5763ce6160 | ||
|
|
d7ca6caae8 | ||
|
|
2c4f232aaa | ||
|
|
bddfa71fa6 | ||
|
|
f537ab058b | ||
|
|
1b44b5b05a | ||
|
|
f6e971c652 | ||
|
|
dfa7a71f53 | ||
|
|
3639e02843 | ||
|
|
27b6e79c8a | ||
|
|
f370151b54 | ||
|
|
597a8f468e | ||
|
|
8bd7a00410 | ||
|
|
4867052972 | ||
|
|
688c3a34f6 | ||
|
|
e357b27433 | ||
|
|
dd70bf92f3 | ||
|
|
0a97523928 | ||
|
|
f67bd02283 | ||
|
|
ef1055a9b6 | ||
|
|
cd970b5871 | ||
|
|
11b0863a65 | ||
|
|
5b8cb497de | ||
|
|
38e2addbb6 | ||
|
|
58158ce8b1 | ||
|
|
5ca281f02e | ||
|
|
ac39ce6b98 | ||
|
|
38fb0a6828 | ||
|
|
38c41cfaf4 | ||
|
|
95ba628ac3 | ||
|
|
a53f2ecbaf | ||
|
|
aa1ff55bbe | ||
|
|
097d013447 | ||
|
|
3916623c46 | ||
|
|
42c50c5fa1 | ||
|
|
ea515bbecc | ||
|
|
9f8006060b | ||
|
|
6cd51c4426 | ||
|
|
b1e96bb50c | ||
|
|
50d3bda3b7 | ||
|
|
3dfa4a1bbc | ||
|
|
d1922acfc8 | ||
|
|
3947e424e7 | ||
|
|
25e202a09e | ||
|
|
8eab3c1590 | ||
|
|
4f294aa0ef | ||
|
|
81aa09a2e2 | ||
|
|
10fc8cb48d | ||
|
|
186f0708cc | ||
|
|
622b3ff9ed | ||
|
|
c06963c3d6 | ||
|
|
9009313748 | ||
|
|
d55a8c3079 | ||
|
|
fee6a61f19 | ||
|
|
6f1ef09d2a | ||
|
|
cf6c13e605 | ||
|
|
028f55910a | ||
|
|
d7684d39a8 | ||
|
|
f652ccd4b1 | ||
|
|
6be92498bc | ||
|
|
677e04ab7d | ||
|
|
46fdc457fc | ||
|
|
0306b6b73b | ||
|
|
c881653d55 | ||
|
|
7650d831e3 | ||
|
|
e7a8cc3b8b | ||
|
|
d173b2f237 | ||
|
|
49ba6ed0f2 | ||
|
|
2792d05c7f | ||
|
|
cacda0f3cc | ||
|
|
c420547ff8 | ||
|
|
83d388613f | ||
|
|
094b059aea | ||
|
|
e36a8c627b | ||
|
|
d341e91290 | ||
|
|
557afc95bd | ||
|
|
cb9979ac94 | ||
|
|
5486957141 | ||
|
|
d49155df95 | ||
|
|
0dd4b5f620 | ||
|
|
690603bfda | ||
|
|
b877cc9509 | ||
|
|
32fddce8fb | ||
|
|
03a2b35846 | ||
|
|
086cdc559c | ||
|
|
97eefe28f1 | ||
|
|
32019c99f4 | ||
|
|
f30e15159f | ||
|
|
efd0bae0d6 | ||
|
|
253aa03e07 | ||
|
|
32183118de | ||
|
|
6c8ad1139c | ||
|
|
980c2907ad | ||
|
|
00129f4b40 | ||
|
|
f178bea0d0 | ||
|
|
c583598257 | ||
|
|
1e14425555 | ||
|
|
4a103927cd | ||
|
|
ab3dc41358 | ||
|
|
c9fcd3d203 | ||
|
|
5186347b48 | ||
|
|
e4a40704b5 | ||
|
|
fcfbbc6d84 | ||
|
|
95a38c7712 | ||
|
|
be0f4477bf | ||
|
|
3ebd897601 | ||
|
|
c60e1e8d7f | ||
|
|
eb205562bf | ||
|
|
83a50bb610 | ||
|
|
331171b826 | ||
|
|
1d9965dad6 | ||
|
|
647820c75e | ||
|
|
d9c7dde174 | ||
|
|
ef8c688fa1 | ||
|
|
b0f0d02e75 | ||
|
|
51bc2674bd | ||
|
|
5fc2008517 | ||
|
|
611e5c7ea2 | ||
|
|
74c8b0678a | ||
|
|
00afd79858 | ||
|
|
45fae976f0 | ||
|
|
ae9c1746f1 | ||
|
|
fa1699298b | ||
|
|
c8720b259c | ||
|
|
113a90a5a0 | ||
|
|
7c0e43b2e1 | ||
|
|
d51df73f37 | ||
|
|
8da203648b | ||
|
|
12cc670fa0 | ||
|
|
88222edb7f | ||
|
|
7ca0a511d5 | ||
|
|
02e08403e3 | ||
|
|
e29262b95a | ||
|
|
c449914936 | ||
|
|
9c290b5e11 | ||
|
|
2d9dcde0e3 | ||
|
|
da681a463e | ||
|
|
aeb494703e | ||
|
|
da4e3670b1 | ||
|
|
075e2301e4 | ||
|
|
df3f94b017 | ||
|
|
3df006fb97 | ||
|
|
52d98a1157 | ||
|
|
7c772d3a5a | ||
|
|
a583ecba7b | ||
|
|
76e7347ecf | ||
|
|
e49e6ad179 | ||
|
|
859bece921 | ||
|
|
8ffde41fa4 | ||
|
|
c88bf3e94b | ||
|
|
e623ceacc8 | ||
|
|
92a044ba9b | ||
|
|
906eeefa52 | ||
|
|
e5913cd10d | ||
|
|
52d252f199 | ||
|
|
28425cc493 | ||
|
|
a0ae19a8fd | ||
|
|
0bebb312dd | ||
|
|
0e35e85753 | ||
|
|
bc816bb858 | ||
|
|
e171861629 | ||
|
|
8f539af4ab | ||
|
|
122a4d8f32 | ||
|
|
8bd935791e | ||
|
|
edbae09a17 | ||
|
|
d115d43559 | ||
|
|
bdb218cb0f | ||
|
|
e4e07b76ec | ||
|
|
fd28fea3b6 | ||
|
|
d3c1a73ced | ||
|
|
c4de1c53b9 | ||
|
|
860167b950 | ||
|
|
4ebde3af5f | ||
|
|
ab5e9a46b4 | ||
|
|
c348fa89a9 | ||
|
|
140dc656a2 | ||
|
|
2cad23a7f3 | ||
|
|
9e5c3ae6fb | ||
|
|
ab33836637 | ||
|
|
cb684fa6de | ||
|
|
de6307dc38 | ||
|
|
da51b2b5a0 | ||
|
|
03f0984e1d | ||
|
|
e1f6007dea | ||
|
|
0508256d28 | ||
|
|
993fcd989b | ||
|
|
65d647bc0a | ||
|
|
23d5204634 | ||
|
|
8a239b8f9c | ||
|
|
0a89652ae5 | ||
|
|
6d6054d1dc | ||
|
|
bc9cdadfb0 | ||
|
|
cfe98506a5 | ||
|
|
c4c159f056 | ||
|
|
4d761d7e8a | ||
|
|
c1f36f7455 | ||
|
|
c976c3226d | ||
|
|
cc6287c124 | ||
|
|
966fe97759 | ||
|
|
1f2fe65185 | ||
|
|
b83cd24d57 | ||
|
|
5b4e4fd943 | ||
|
|
61cd9acaa2 | ||
|
|
d2895928bd | ||
|
|
5c354b02ea | ||
|
|
a764642a85 | ||
|
|
a9b0fe6728 | ||
|
|
79ade2c182 | ||
|
|
146dc070ea | ||
|
|
c1b2bae333 | ||
|
|
e771b36a18 | ||
|
|
edcb2280cc | ||
|
|
a249ca1da3 | ||
|
|
f1383b5c66 | ||
|
|
00e497828e | ||
|
|
5968eb697e | ||
|
|
ea78b389c9 | ||
|
|
0b726f7acc | ||
|
|
4d4b95c995 | ||
|
|
fc06d195ec | ||
|
|
c7fc2e3b92 | ||
|
|
980fc77812 | ||
|
|
75dc1722da | ||
|
|
9326f1f0da | ||
|
|
ac831444ce | ||
|
|
4746cb3814 | ||
|
|
6c38a3bbaa | ||
|
|
9699a184d1 | ||
|
|
51eb2c9fa8 | ||
|
|
abf6ea1fec | ||
|
|
37835c1972 | ||
|
|
cd2f139409 | ||
|
|
13bba1f4b8 | ||
|
|
4f21c7b7b4 | ||
|
|
65cf7960bf | ||
|
|
96c5ef5fa2 | ||
|
|
f7c6a82e73 | ||
|
|
23e81bc3fe | ||
|
|
7c35845006 | ||
|
|
7ad0f8a17f | ||
|
|
b6cd123719 | ||
|
|
944ae9f8d9 | ||
|
|
935e114d40 | ||
|
|
7fbfec4e5a | ||
|
|
6d5c72b54b | ||
|
|
23ad501595 | ||
|
|
985d7d28ed | ||
|
|
9ddaddfaa0 | ||
|
|
de11ae20a4 | ||
|
|
89574faef7 | ||
|
|
7bf6f1b870 | ||
|
|
0ee0cb35bc | ||
|
|
780eb05553 | ||
|
|
d71a7fbbed | ||
|
|
5b597b6583 | ||
|
|
42b24d71e9 | ||
|
|
07c65351d5 | ||
|
|
cadf7e732e | ||
|
|
8682a6bd0a | ||
|
|
e20357663d | ||
|
|
e777992b3e | ||
|
|
5f43abc908 | ||
|
|
8cbd92ccb6 | ||
|
|
80b4f7d037 | ||
|
|
d5839e199f | ||
|
|
4b9ed91546 | ||
|
|
2e9b9ab987 | ||
|
|
9a50a0cc2c | ||
|
|
167ea6dfcf | ||
|
|
f17d9ccbd6 | ||
|
|
8a6bbc55d2 | ||
|
|
d42ec58ad1 | ||
|
|
c82c6a88f8 | ||
|
|
e7c8778e30 | ||
|
|
7c4cf66243 | ||
|
|
b4b3a11f01 | ||
|
|
17ce869939 | ||
|
|
05fd3cf787 | ||
|
|
3daf90c5fe | ||
|
|
02db3baf52 | ||
|
|
0bc7311473 | ||
|
|
2fda7af8a7 | ||
|
|
0cd471dfb2 | ||
|
|
20982ab1a6 | ||
|
|
81ed9c0c5c | ||
|
|
23263bd83e | ||
|
|
4d3d608e5c | ||
|
|
850a02b4c0 | ||
|
|
2d4ace68e7 | ||
|
|
9adc66af63 | ||
|
|
c24c5f7985 | ||
|
|
5f280c3e24 | ||
|
|
edff49a44f | ||
|
|
345431bbcc | ||
|
|
b087e712ca | ||
|
|
b7a281c6c4 | ||
|
|
bc1521d937 | ||
|
|
c15f7641f4 | ||
|
|
123de1a3ce | ||
|
|
6d66557b11 | ||
|
|
cb3484e1ab | ||
|
|
3166600ac6 | ||
|
|
ba39f35a01 | ||
|
|
934ef04694 | ||
|
|
bfe41d0391 | ||
|
|
5c9cd4e4cd | ||
|
|
c57d3416b7 | ||
|
|
498a2a314b | ||
|
|
63961d8711 | ||
|
|
02f7d73fca | ||
|
|
0bfb5f8a3c | ||
|
|
f22ac8db2b | ||
|
|
86067f913b | ||
|
|
4744757726 | ||
|
|
108e1b730e | ||
|
|
bf93d60bf1 | ||
|
|
cd5547dfd8 | ||
|
|
ff7f830f65 | ||
|
|
0993fec114 | ||
|
|
ebec5c98b8 | ||
|
|
4075bce26a | ||
|
|
37b830a2fd | ||
|
|
f22dd3aa88 | ||
|
|
c27591e838 | ||
|
|
790cdf2996 | ||
|
|
7f73740fc7 | ||
|
|
babb08c2e0 | ||
|
|
24960cd02b | ||
|
|
1fcf844e8d | ||
|
|
4b245952fe | ||
|
|
4bb4cced90 | ||
|
|
6625ade578 | ||
|
|
3f74571dfc | ||
|
|
c8c3d5dc3d | ||
|
|
6b862dc860 | ||
|
|
92956cb1a7 | ||
|
|
1df662102c | ||
|
|
726bcc83d2 | ||
|
|
b4fb2d102c | ||
|
|
624fba9704 | ||
|
|
fdb629f82b | ||
|
|
11d2eb35be | ||
|
|
d970b435b4 | ||
|
|
82398aef5a | ||
|
|
deaf1860fb | ||
|
|
9fcf1eb9cb | ||
|
|
80de7ed5cb |
69
.github/workflows/pythonapp.yml
vendored
69
.github/workflows/pythonapp.yml
vendored
@@ -9,23 +9,80 @@ on:
|
||||
- "**/*.py"
|
||||
|
||||
jobs:
|
||||
build:
|
||||
very_old_python:
|
||||
if: github.event.pull_request.draft == false
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [macos-latest, ubuntu-latest, windows-latest]
|
||||
python-version: ["3.7", "3.8", "3.9", "3.10"]
|
||||
os: [macos-13, windows-2019]
|
||||
python-version: ["3.6"]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- name: "Set up timezone to America/Los_Angeles"
|
||||
uses: szenius/set-timezone@v1.0
|
||||
uses: szenius/set-timezone@v1.2
|
||||
with:
|
||||
timezoneLinux: "America/Los_Angeles"
|
||||
timezoneMacos: "America/Los_Angeles"
|
||||
timezoneWindows: "Pacific Standard Time"
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v1
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install -r requirements.txt
|
||||
- name: Test with unittest
|
||||
run: |
|
||||
python -m unittest discover tests
|
||||
|
||||
old_python:
|
||||
if: github.event.pull_request.draft == false
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [macos-13, ubuntu-22.04, windows-2019]
|
||||
python-version: ["3.7", "3.8", "3.9", "3.10"]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: "Set up timezone to America/Los_Angeles"
|
||||
uses: szenius/set-timezone@v1.2
|
||||
with:
|
||||
timezoneLinux: "America/Los_Angeles"
|
||||
timezoneMacos: "America/Los_Angeles"
|
||||
timezoneWindows: "Pacific Standard Time"
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install -r requirements.txt
|
||||
- name: Test with unittest
|
||||
run: |
|
||||
python -m unittest discover tests
|
||||
|
||||
latest_python:
|
||||
if: github.event.pull_request.draft == false
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [macos-latest, ubuntu-latest, windows-latest]
|
||||
python-version: ["3.11", "3.12"]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: "Set up timezone to America/Los_Angeles"
|
||||
uses: szenius/set-timezone@v1.2
|
||||
with:
|
||||
timezoneLinux: "America/Los_Angeles"
|
||||
timezoneMacos: "America/Los_Angeles"
|
||||
timezoneWindows: "Pacific Standard Time"
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
- name: Install dependencies
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -6,3 +6,4 @@ build/
|
||||
.github/
|
||||
.vscode/
|
||||
_config.yml
|
||||
.venv
|
||||
|
||||
358
CHANGELOG
358
CHANGELOG
@@ -1,5 +1,361 @@
|
||||
jc changelog
|
||||
|
||||
20250503 v1.25.5
|
||||
- Add `amixer` command parser
|
||||
- Enhance `iptables` command parser to add default policy statistics fields
|
||||
- Fix `bluetoothctl` parser failing to parse controllers with power state prop
|
||||
- Fix `lsblk` command parser to support multiple mountpoints. Also, added
|
||||
byte conversions for size fields.
|
||||
- Fix `nmcli` command parser to support `team.config` JSON field
|
||||
- Fix `time` command parser for output that does not contain centiseconds
|
||||
- Fix `x509-cert` parser to handle IDNA2008 encoded email addresses with a warning
|
||||
- Fix typing for upcoming python v3.14
|
||||
- Fix timezone setting for tests to support minimal chrooted builds
|
||||
|
||||
20241125 v1.25.4
|
||||
- Add `ipconfig` command parser (`ipconfig` for Windows)
|
||||
- Add `pacman` command parser
|
||||
- Add `wg show` command parser
|
||||
- Enhance `ethtool` parser to support `link_partner_advertised_link_modes`
|
||||
- Enhance `ifconfig` parser to support `utun` interfaces with assigned IPv4 addresses on macOS
|
||||
- Enhance `nsd-control` parser with additional state fields
|
||||
- Enhance `ping-s` streaming parser to support error replies
|
||||
- Fix `bluetoothctl` parser when extra attributes like `manufacturer` and `version` exist
|
||||
- Fix `df` parser to correctly output binary vs. decimal size outputs
|
||||
- Fix `ip-address` parser for Python 3.13 changes to IPv4 mapped IPv6 addresses
|
||||
- Fix `iw-scan` parser to output more fields (still beta quality)
|
||||
- Fix `mount` parser for cases where there are spaces in the filesystem name
|
||||
- Fix `netstat` parser for cases where there are spaces in the program name
|
||||
- Fix `pkg-index-deb`, `apt-cache-show`, and `rpm-qi` parsers to correctly convert contiguous packages with the same name
|
||||
- Fix `traceroute` parser to support extreme IPv6 cases
|
||||
- Fix `uptime` parser for data that contains `user` instead of `users`
|
||||
- Fix `yaml` parser to support values that start with an equal sign
|
||||
- Enhance `jc.utils.convert_size_to_int()` to add `posix_mode` and `decimal_bias` parameters
|
||||
- Enhance cli to coerce any non-JSON-serializable objects to a string
|
||||
|
||||
20240609 v1.25.3
|
||||
- Enhance `bluetoothctl` parser with added `battery_percentage` field
|
||||
- Enhance `git-log` standard and streaming parsers with added `lines_changed` field under `file_stats`
|
||||
- Fix `lspci` parser to handle `physlot` fields with a range value
|
||||
- Fix `pci-ids` parser to correctly handle multiple subdevices
|
||||
- Fix `pip-show` parser to handle multi-line fields with a beginning blank line
|
||||
- Fix `ss` parser to correctly handle the `Recv-Q` field being too close to the `Status` field
|
||||
- Fix `top` parsers to quiet uptime info parsing
|
||||
- Fix `traceroute` parser to correctly handle hops with multiple IPs
|
||||
- Fix `zpool-status` parser for config items lacking data values
|
||||
- Optimize some tests by removing timezone settings and using quiet=True
|
||||
- Documentation updates
|
||||
|
||||
20240323 v1.25.2
|
||||
- Add `apt-cache-show` command parser
|
||||
- Add `apt-get-sqq` command parser
|
||||
- Add `ethtool` command parser
|
||||
- Add `needrestart` command parser
|
||||
- Enhance `df` parser to add human readable output support. Note: the `size`
|
||||
field has been changed to an integer and all size values have been normalized
|
||||
to bytes.
|
||||
- Enhance `free` parser to add human readable output support. All size values
|
||||
have been normalizd to bytes.
|
||||
- Enhance `iptables` parser to handle -x output
|
||||
- Enhance `/proc/pid/stat` parser to support "Idle" state
|
||||
- Enhance `rpm_qi` and `pkg_index_deb` parsers to split list fields into arrays
|
||||
- Fix `iwconfig` parser to handle more special characters in the SSID name
|
||||
- Fix `xrandr` parser to ignore extra horizontal and vertical stats lines
|
||||
- Add aarch64 binaries to Releases for macOS and Linux
|
||||
- Documentation and doc build updates
|
||||
|
||||
20240212 v1.25.1
|
||||
- Fix for crash when optional libraries are not installed (e.g. xmltodict)
|
||||
- Fix for `ini` parser crashing with some keys with no values
|
||||
- Fix `xrandr` parser to extract more EDID data
|
||||
- Enhance `uptime` parser to support output with no user information
|
||||
- Enhance `--quiet` CLI option to cover more warning messages
|
||||
- Add tests for missing optional libraries
|
||||
- Documentation updates
|
||||
|
||||
20240204 v1.25.0
|
||||
- Add `--slurp` functionality to wrap output from multiple lines into a single array.
|
||||
Note, this only works with single-line input parsers. (e.g. `date`, `ip-address`, `url`, etc.)
|
||||
Streaming parsers are not supported. Use `jc -hhh` to find parsers compatible with the slurp option.
|
||||
- Enhance `/proc` file magic syntax to allow slurping when multiple files are selected
|
||||
and to include the `_file` metadata field in the data
|
||||
- Enhance `--meta-out` functionality to include a list of the input data when using `--slurp`
|
||||
or `/proc` file magic syntax. For slurpable parsers, this is a list of string inputs in order.
|
||||
For `/proc` file magic syntax, this is a list of `/proc` filenames in order. This can help with
|
||||
identifying which input matches to which output when using `--slurp` or when converting multiple
|
||||
files via `/proc` file magic syntax.
|
||||
- Add `curl-head` command parser for `curl --head` or `curl -I` with verbose support
|
||||
- Add `efibootmgr` command parser
|
||||
- Add `http-headers` parser for plain HTTP header output
|
||||
- Add `kv-dup` parser for Key/Value files with duplicate keys
|
||||
- Add `path` string parser to parse posix path
|
||||
- Add `path-list` string parser to parse path list strings found in env variables
|
||||
- Add source link to online parser documentation
|
||||
- Add snap package build scripts
|
||||
- Add `remove_quotes` function to `utils.py`
|
||||
- Add `normalize_key` function to `utils.py`
|
||||
- Add `line_slice` function to `utils.py`
|
||||
- Add `get_parser` function to `lib.py`
|
||||
- Enhance `nsd-control` parser to support more zone information
|
||||
- Enhance `ping` and `ping-s` parsers to support the `-I` command option
|
||||
- Enhance `proc-net-tcp` parser to add opposite endian support for architectures
|
||||
like the s390x
|
||||
- Enhance `url` parser to add `parent`, `filename`, `stem`, and `extension` fields
|
||||
- Fix `ini` and `ini-dup` parsers to consistently handle null values as empty strings
|
||||
- Fix line slicer to not skip blank lines
|
||||
- Refactor parser aliases for `kv`, `pkg_index_deb`, `lsb_release`, and `os-release`
|
||||
- Update copyright date
|
||||
|
||||
20231216 v1.24.0
|
||||
- Add `debconf-show` command parser
|
||||
- Add `iftop` command parser
|
||||
- Add `pkg-index-apk` parser for Alpine Linux Package Index files
|
||||
- Add `pkg-index-deb` parser for Debian/Ubuntu Package Index files
|
||||
- Add `proc-cmdline` parser for `/proc/cmdline` file
|
||||
- Add `swapon` command parser
|
||||
- Add `tune2fs` command parser
|
||||
- Remove `iso-datetime` parser deprecated since v1.22.1. (use `datetime-iso` instead)
|
||||
- Update timezone change in Github Actions for node v16 requirement
|
||||
- Add Python 3.12 tests to Github Actions
|
||||
- Refactor `acpi` command parser for code cleanup
|
||||
- Refactor vendored libraries to remove Python 2 support
|
||||
- Fix `iptables` parser for cases where the `target` field is blank in a rule
|
||||
- Fix `vmstat` parsers for some cases where wide output is used
|
||||
- Fix `mount` parser for cases with spaces in the mount point name
|
||||
- Fix `xrandr` parser for infinite loop issues
|
||||
|
||||
20231023 v1.23.6
|
||||
- Fix XML parser for xmltodict library versions < 0.13.0
|
||||
- Fix `who` command parser for cases when the from field contains spaces
|
||||
|
||||
20231021 v1.23.5
|
||||
- Add `host` command parser
|
||||
- Add `nsd-control` command parser
|
||||
- Add `lsb_release` command parser
|
||||
- Add `/etc/os-release` file parser
|
||||
- Enhance `env` command parser to support multi-line values
|
||||
- Enhance `ping` and `ping-s` parsers to add error and corrupted support
|
||||
- Enhance `xml` parser to include comments in the JSON output
|
||||
- Fix `pidstat` command parser when using `-T ALL`
|
||||
- Fix `x509-cert` parser to allow negative serial numbers
|
||||
- Fix `x509-cert` parser for cases when bitstrings are larger than standard
|
||||
- Fix `xrandr` command parser for associated device issues
|
||||
- Fix error when pygments library is not installed
|
||||
|
||||
20230730 v1.23.4
|
||||
- Add `/etc/resolve.conf` file parser
|
||||
- Add `/proc/net/tcp` and `/proc/net/tcp6` file parser
|
||||
- Add `find` command parser
|
||||
- Add `ip route` command parser
|
||||
- Fix `certbot` command parser to be more robust with different line endings
|
||||
|
||||
20230621 v1.23.3
|
||||
- Add `lsattr` command parser
|
||||
- Add `srt` file parser
|
||||
- Add `veracrypt` command parser
|
||||
- Add X509 Certificate Request file parser
|
||||
- Enhance X509 Certificate parser to allow non-compliant email addresses with a warning
|
||||
- Enhance `dig` command parser to support the `+nsid` option
|
||||
- Enhance `last` and `lastb` command parser to support the `-x` option
|
||||
- Enhance `route` command parser to add Windows support
|
||||
- Enhnace `netstat` command parser to add Windows support
|
||||
- Enhance `ss` command parser to support extended options
|
||||
- Enhance the compatibility warning message
|
||||
- Fix `bluetoothctl` command parser for some mouse devices
|
||||
- Fix `ping` command parsers for output with missing hostname
|
||||
- Fix `stat` command parser for older versions that may not contain all fields
|
||||
- Fix deprecated option in `setup.cfg`
|
||||
|
||||
20230429 v1.23.2
|
||||
- Add `bluetoothctl` command parser
|
||||
- Add `certbot` command parser for `certificates` and `show_account` options
|
||||
- Fix `acpi` command parser for "Not charging" battery status lines
|
||||
- Fix `iwconfig` command parser for SSIDs with dashes in the name
|
||||
- Fix `crontab` command parsers for incorrect variable parsing in some cases
|
||||
- Fix `git-log` and `git-log-s` command parsers for incorrect insertion/deletion parsing
|
||||
- Fix `ufw-appinfo` command parser for parsing errors on multiline description fields
|
||||
- Fix pytest warnings
|
||||
|
||||
20230323 v1.23.1
|
||||
- Fix `zpool-status` command parser for lines that start with tab
|
||||
- Fix `timedatectl` command parser when RTC set to local
|
||||
- Fix to ensure `py.typed` file is included in the package wheel
|
||||
- Fix `lsusb` command parser to support CDC MBIM and CDC MBIM Extended fields
|
||||
- Add support for the `timesync-status` for the `timedatectl` command parser
|
||||
- Fix to ignore non-parser-plugins in the parser plugin directory
|
||||
|
||||
20230227 v1.23.0
|
||||
- Add input slicing as a `jc` command-line option
|
||||
- Add `ssh` configuration file parser
|
||||
- Add `ver` Version string parser
|
||||
- Add `zpool iostat` command parser
|
||||
- Add `zpool status` command parser
|
||||
- Fix `acpi` command parser for "will never fully discharge" battery state
|
||||
- Fix `crontab` and `crontab-u` command and file parsers for cases where only
|
||||
shortcut schedule items exist
|
||||
- Fix `ifconfig` command parser for older-style linux output
|
||||
- Fix `xrandr` command parser for proper `is_current` output
|
||||
- Fix `xrandr` command parser for infinite loop with some device configurations
|
||||
- Add `reflection` key to `xrandr` parser schema
|
||||
- Add display model info from EDID to `xrandr` parser
|
||||
- Add `MPX-specific VMA` support for VM Flags in `/proc/<pid>/smaps` parser
|
||||
|
||||
20230111 v1.22.5
|
||||
- Add TOML file parser
|
||||
- Add INI with duplicate key support file parser
|
||||
- Add AIX support for the `arp` command parser
|
||||
- Add AIX support for the `mount` command parser
|
||||
- Fix `lsusb` command parser when extra hub port status information is output
|
||||
- Refactor `lsusb` command parser for more code reuse
|
||||
- Fix INI file parser to include top-level values with no section header
|
||||
- Fix INI file parser to not specially handle the [DEFAULT] section
|
||||
- Fix INI file and Key/Value parsers to only remove one quotation mark from the
|
||||
beginning and end of values.
|
||||
- Update copyright dates
|
||||
|
||||
20221230 v1.22.4
|
||||
- Add `iwconfig` command parser
|
||||
- Add NeXTSTEP format support to the PLIST file parser
|
||||
- Fix `proc` parser magic signature detection for `/proc/pid/stat` hacks
|
||||
- Fix `x509-cert` parser for string serial numbers
|
||||
- Add category tags to parser metadata: generic, standard, file, string, binary, command
|
||||
- Add "list parsers by category" view to help
|
||||
- Fix python 3.6-related issues
|
||||
- Add python 3.6 to automated tests
|
||||
|
||||
20221216 v1.22.3
|
||||
- Add Common Log Format and Combined Log Format file parser (standard and streaming)
|
||||
- Add PostgreSQL password file parser
|
||||
- Add openvpn-status.log file parser
|
||||
- Add `cbt` command parser (Google Big Table)
|
||||
- Enhance `ifconfig` parser with interface lane information on BSD
|
||||
- Enhance `ifconfig` parser with additional IPv6 `scope_id` info for BSD
|
||||
- Fix `ifconfig` parser to capture some IPv6 addresses missed on BSD
|
||||
- Fix `git-log` and `git-log-s` parsers for failure on empty author name
|
||||
- Update `os-prober` parser with split EFI partition fields
|
||||
- Add ISO string attribute (`.iso`) to `jc.utils.timestamp()`
|
||||
- Fix several documentation typos
|
||||
|
||||
20221107 v1.22.2
|
||||
- add `sshd_conf` parser for `sshd` configuration files and `sshd -T` output
|
||||
- add `findmnt` command parser
|
||||
- add `git ls-remote` command parser
|
||||
- add `os-prober` command parser
|
||||
- add SemVer string parser
|
||||
- enhance the `ifconfig` parser so it can output multiple IPv4 and IPv6 addresses
|
||||
- enhance the `ifconfig` parser so it can output additional fields common on BSD
|
||||
- enhance `xml` parser with optional `_` prefix for attributes instead of
|
||||
`@` by using the `--raw` option. This can make it easier to filter the
|
||||
JSON output in some tools.
|
||||
- fix the `xml` parser to output a normal Dictionary instead of OrderdDict.
|
||||
This cleans up YAML output. (No `!!omap` comments)
|
||||
- fix `csv` and `csv-s` parsers for UTF-8 encoded CSV files with leading BOM bytes
|
||||
- fix exit code to be non-zero on interrupt
|
||||
- allow parser module objects to be used as arguments to `jc.get_help()` and `jc.parser_info()`
|
||||
- catch unexpected exceptions in the CLI
|
||||
- add error message on interrupt to STDERR
|
||||
- add python 3.11 tests to github actions
|
||||
|
||||
20221024 v1.22.1
|
||||
- add `udevadm` command parser
|
||||
- add `lspci` command parser
|
||||
- add `pci.ids` file parser
|
||||
- fix `proc-pid-stat` parser for command names with spaces and newlines
|
||||
- enhance `ip-address` parser to add `ip_split` field
|
||||
- rename `iso-datetime` parser to `datetime-iso`. A deprecation warning will
|
||||
display until `iso-datetime` is removed in a future version.
|
||||
- refactor cli module
|
||||
- optimize performance of calculated timestamps
|
||||
- add more type annotations
|
||||
- add support for deprecating parsers
|
||||
- move jc-web demo site from heroku to render.com
|
||||
|
||||
20220926 v1.22.0
|
||||
- Add /proc file parsers for linux. Support for the following files:
|
||||
`/proc/buddyinfo`
|
||||
`/proc/consoles`
|
||||
`/proc/cpuinfo`
|
||||
`/proc/crypto`
|
||||
`/proc/devices`
|
||||
`/proc/diskstats`
|
||||
`/proc/filesystems`
|
||||
`/proc/interrupts`
|
||||
`/proc/iomem`
|
||||
`/proc/ioports`
|
||||
`/proc/loadavg`
|
||||
`/proc/locks`
|
||||
`/proc/meminfo`
|
||||
`/proc/modules`
|
||||
`/proc/mtrr`
|
||||
`/proc/pagetypeinfo`
|
||||
`/proc/partitions`
|
||||
`/proc/slabinfo`
|
||||
`/proc/softirqs`
|
||||
`/proc/stat`
|
||||
`/proc/swaps`
|
||||
`/proc/uptime`
|
||||
`/proc/version`
|
||||
`/proc/vmallocinfo`
|
||||
`/proc/vmstat`
|
||||
`/proc/zoneinfo`
|
||||
`/proc/driver/rtc`
|
||||
`/proc/net/arp`
|
||||
`/proc/net/dev`
|
||||
`/proc/net/dev_mcast`
|
||||
`/proc/net/if_inet6`
|
||||
`/proc/net/igmp`
|
||||
`/proc/net/igmp6`
|
||||
`/proc/net/ipv6_route`
|
||||
`/proc/net/netlink`
|
||||
`/proc/net/netstat`
|
||||
`/proc/net/packet`
|
||||
`/proc/net/protocols`
|
||||
`/proc/net/route`
|
||||
`/proc/net/unix`
|
||||
`/proc/<pid>/fdinfo/<fd>`
|
||||
`/proc/<pid>/io`
|
||||
`/proc/<pid>/maps`
|
||||
`/proc/<pid>/mountinfo`
|
||||
`/proc/<pid>/numa_maps`
|
||||
`/proc/<pid>/smaps`
|
||||
`/proc/<pid>/stat`
|
||||
`/proc/<pid>/statm`
|
||||
`/proc/<pid>/status`
|
||||
- Magic syntax support for `/proc` files
|
||||
- Enhance bash and zsh autocompletions for `/proc` files
|
||||
- Enhance `free` parser to support `-w` option integer conversions
|
||||
- Fix `ini` and `kv` parsers so they don't change keynames to lower case
|
||||
NOTE: This can be a breaking change in your scripts
|
||||
- Fix `id` command parser to allow usernames and groupnames with spaces
|
||||
- Enhance metadata output to output metadata even when results are empty
|
||||
- Optimize tests
|
||||
- Optimize documentation build script
|
||||
|
||||
20220829 v1.21.2
|
||||
- Fix IP Address string parser for older python versions that don't cleanly
|
||||
accept decimal input format - IPv6 fix (e.g. python 3.6)
|
||||
|
||||
20220828 v1.21.1
|
||||
- Fix IP Address string parser for older python versions that don't cleanly
|
||||
accept decimal input format - IPv4 fix (e.g. python 3.6)
|
||||
- Fix `arp -a` parser for cases where incomplete hardware addresses are found
|
||||
in the arp table on linux
|
||||
|
||||
20220821 v1.21.0
|
||||
- Add IP Address string parser
|
||||
- Add Syslog standard and streaming string parsers (RFC 3164 and RFC 5424)
|
||||
- Add CEF standard and streaming string parser
|
||||
- Add PLIST file parser (XML and binary support)
|
||||
- Add `-n` support to the `traceroute` parser
|
||||
- Add `mdadm` command parser tested on linux
|
||||
- Add `--meta-out` or `-M` option to add metadata to the JSON output, including
|
||||
a UTC timestamp, parser name, magic command, and magic command exit code
|
||||
- Fix `lsusb` command parser for output containing a `Device Qualifier` and
|
||||
`Binary Object Store Descriptor` sections
|
||||
- Change `LANG=C` to `LC_ALL=C` in locale instructions
|
||||
- Add `__main__.py` to package allowing `python -m jc` usage
|
||||
- Add an enclosing top-level folder inside the windows.zip package
|
||||
|
||||
20220723 v1.20.4
|
||||
- Fix URL string parser path list for URLs ending in a forward slash
|
||||
|
||||
@@ -461,7 +817,7 @@ jc changelog
|
||||
|
||||
20200211 v1.7.3
|
||||
- Add alternative 'magic' syntax: e.g. `jc ls -al`
|
||||
- Options can now be condensed (e.g. -prq is equivalant to -p -r -q)
|
||||
- Options can now be condensed (e.g. -prq is equivalent to -p -r -q)
|
||||
|
||||
20200208 v1.7.2
|
||||
- Include test fixtures in wheel and sdist
|
||||
|
||||
125
CONTRIBUTING.md
125
CONTRIBUTING.md
@@ -1,5 +1,6 @@
|
||||
# Contributing to jc
|
||||
We love your input! We want to make contributing to this project as easy and transparent as possible, whether it's:
|
||||
We love your input! We want to make contributing to this project as easy and
|
||||
transparent as possible, whether it's:
|
||||
|
||||
- Reporting a bug
|
||||
- Discussing the current state of the code
|
||||
@@ -8,26 +9,65 @@ We love your input! We want to make contributing to this project as easy and tra
|
||||
- Proposing a new parser
|
||||
|
||||
## We Develop with Github
|
||||
We use github to host code, to track issues and feature requests, as well as accept pull requests.
|
||||
We use github to host code, to track issues and feature requests, as well as
|
||||
accept pull requests.
|
||||
|
||||
## We Use Github Flow, So All Code Changes Happen Through Pull Requests
|
||||
Pull requests are the best way to propose changes to the codebase (we use [Github Flow](https://guides.github.com/introduction/flow/index.html)). We actively welcome your pull requests:
|
||||
Pull requests are the best way to propose changes to the codebase (we use
|
||||
[Github Flow](https://guides.github.com/introduction/flow/index.html)). We
|
||||
actively welcome your pull requests:
|
||||
|
||||
1. Open an issue to discuss the new feature, bug fix, or parser before opening a pull request. For new parsers, it is important to agree upon a schema before developing the parser.
|
||||
2. Fork the repo and create your branch from `dev`, if available, otherwise `master`.
|
||||
3. For new parsers: Use the [`jc/parsers/foo.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/foo.py) or [`jc/parsers/foo_s.py (streaming)`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/foo_s.py) parsers as a template to get started. You can even place a new parser python module file in the [parser plugin directory](https://github.com/kellyjonbrazil/jc#custom-parsers) to get started right away with just a standard `jc` installation.
|
||||
4. If you've added code that should be tested, add tests. All new parsers should have several sample outputs and tests.
|
||||
5. Documentation is auto-generated from docstrings, so ensure they are clear and accurate.
|
||||
6. Ensure the test suite passes. (Note: "**America/Los_Angeles**" timezone should be configured on the test system)
|
||||
1. Open an issue to discuss the new feature, bug fix, or parser before opening
|
||||
a pull request. For new parsers, it is important to agree upon a schema
|
||||
before developing the parser.
|
||||
2. Fork the repo and create your branch from `dev`, if available, otherwise
|
||||
`master`.
|
||||
3. For new parsers:
|
||||
- Templates: Use the [`jc/parsers/foo.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/foo.py)
|
||||
or [`jc/parsers/foo_s.py (streaming)`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/foo_s.py)
|
||||
parsers as a template to get started.
|
||||
- Local development: You can even place a new parser python module file in
|
||||
the [parser plugin directory](https://github.com/kellyjonbrazil/jc#parser-plugins)
|
||||
to get started right away with just a standard `jc` installation.
|
||||
- Parser registry: Add the parser name to the [jc/lib.py](https://github.com/kellyjonbrazil/jc/blob/master/jc/lib.py)
|
||||
file.
|
||||
4. If you've added code that should be tested, add tests. All new parsers should
|
||||
have several sample outputs and tests.
|
||||
- Templates:
|
||||
- **Recommended:** [tests/templates/_test_foo_simple.py](https://github.com/kellyjonbrazil/jc/tree/master/tests/templates/_test_foo_simple.py) as a template if you only have test with fixtures.
|
||||
Execute these steps for standard tests:
|
||||
- Save this file as `test_{parser_name}.py` since the helper methods extract parser names from the filename. Use underscores instead of dashes for the parser name.
|
||||
- Organize fixtures in `tests/fixtures` for optimal structure.
|
||||
- Format fixtures as follows (using double dashes):
|
||||
- `{parser_name}--{some_test_description}.out` for command output. (no dots in the filename except for the `.out` suffix)
|
||||
- `{parser_name}--{some_test_description}.json` for expected JSON after parsing. (no dots in the filename except for the `.json` suffix)
|
||||
- Custom: [tests/templates/_test_foo.py](https://github.com/kellyjonbrazil/jc/blob/master/tests/templates/_test_foo.py) as a template for tests.
|
||||
- Custom: [tests/templates/_test_foo_s.py](https://github.com/kellyjonbrazil/jc/tree/master/tests/templates/_test_foo_s.py) as a template for **streaming parser** tests.
|
||||
- Fixtures: Tests typically consist of an input file and an expected output
|
||||
JSON file. Add the data files to the appropriate folder under [tests/fixtures](https://github.com/kellyjonbrazil/jc/tree/master/tests/fixtures)
|
||||
5. Documentation is auto-generated from docstrings, so ensure they are clear and
|
||||
accurate.
|
||||
6. Ensure the test suite passes. (Note: "**America/Los_Angeles**" timezone
|
||||
should be configured on the test system)
|
||||
7. Make sure your code lints.
|
||||
8. Issue that pull request!
|
||||
|
||||
## Parser Schema Guidelines
|
||||
- Try to keep the schema as flat as possible - typically a list of flat dictionaries
|
||||
- Keys should be lowercase, contain no special characters, and spaces should be converted to underscores
|
||||
- Keys should be static, if possible. If they have to be dynamic, then they should not contain lists or dictionaries
|
||||
## Documentation And Completions
|
||||
|
||||
This will make it easier to use tools like `jq` without requiring escaping of special characters, encapsulating key names in [""], keeps paths predictable, and makes iterating and searching for values easier.
|
||||
No need to worry about documentation and completions as those are auto generated
|
||||
via the python doc strings.
|
||||
|
||||
## Parser Schema Guidelines
|
||||
- Try to keep the schema as flat as possible - typically a list of flat
|
||||
dictionaries
|
||||
- Keys should be lowercase, contain no special characters, and spaces should be
|
||||
converted to underscores
|
||||
- Keys should be static, if possible. If they have to be dynamic, then they
|
||||
should not contain lists or dictionaries
|
||||
|
||||
This will make it easier to use tools like `jq` without requiring escaping of
|
||||
special characters, encapsulating key names in `[""]`, keeps paths predictable,
|
||||
and makes iterating and searching for values easier.
|
||||
|
||||
**Examples**
|
||||
|
||||
@@ -62,18 +102,61 @@ Good:
|
||||
]
|
||||
```
|
||||
|
||||
## Tests
|
||||
It is essential to have good command output sample coverage and tests to keep the `jc` parser quality high.
|
||||
## Development Environment
|
||||
Use the following steps to set up the development environment.
|
||||
|
||||
Many parsers include calculated timestamp fields using the `jc.utils.timestamp` class. Naive timestamps created with this class should be generated on a system configured with the "**America/Los_Angeles**" timezone on linux/macOS/unix and "**Pacific Standard Time**" timezone on Windows for tests to pass on the Github Actions CI tests. This timezone should be configured on your local system before running the tests locally, as well.
|
||||
### Virtual Environment
|
||||
Set up a Python virtual environment for `jc` development so you won't have to
|
||||
worry about library conflicts. This can be done with something like
|
||||
[pyenv](https://github.com/pyenv/pyenv) and/or
|
||||
[venv](https://docs.python.org/3/library/venv.html)
|
||||
|
||||
### Clone the repo
|
||||
Once the virtual environment is set up, clone the `jc` repository inside:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/kellyjonbrazil/jc.git
|
||||
```
|
||||
|
||||
### Install In Developer Mode
|
||||
Next, use the `./install.sh` script to install `jc` and the requirements in
|
||||
developer mode (code chages take effect immediately). This will install the
|
||||
console-script entry point to `$HOME/.local/bin` so you may need to add this
|
||||
to your path.
|
||||
|
||||
## Tests
|
||||
It is essential to have good command output sample coverage and tests to keep
|
||||
the `jc` parser quality high.
|
||||
|
||||
Many parsers include calculated timestamp fields using the `jc.utils.timestamp`
|
||||
class. Naive timestamps created with this class should be generated on a system
|
||||
configured with the "**America/Los_Angeles**" timezone on linux/macOS/unix and
|
||||
"**Pacific Standard Time**" timezone on Windows for tests to pass on the Github
|
||||
Actions CI tests. This timezone should be configured on your local system before
|
||||
running the tests locally, as well.
|
||||
|
||||
You can run all tests by running the `./runtests.sh` script.
|
||||
|
||||
## Debug Messages
|
||||
|
||||
Use `--debug` or `-d` to see debug error messages (double to see more):
|
||||
|
||||
```shell
|
||||
echo 'abc' | jc --parser-with-error -dd
|
||||
```
|
||||
|
||||
## Any contributions you make will be under the MIT Software License
|
||||
In short, when you submit code changes, your submissions are understood to be under the same [MIT License](http://choosealicense.com/licenses/mit/) that covers the project. Feel free to contact the maintainers if that's a concern.
|
||||
In short, when you submit code changes, your submissions are understood to be
|
||||
under the same [MIT License](http://choosealicense.com/licenses/mit/) that
|
||||
covers the project. Feel free to contact the maintainers if that's a concern.
|
||||
|
||||
## Report bugs using Github's Issues
|
||||
We use GitHub issues to track public bugs. Report a bug by [opening a new issue](https://github.com/kellyjonbrazil/jc/issues); it's that easy!
|
||||
We use GitHub issues to track public bugs. Report a bug by
|
||||
[opening a new issue](https://github.com/kellyjonbrazil/jc/issues); it's that
|
||||
easy!
|
||||
|
||||
## Write bug reports with detail, background, and sample code
|
||||
|
||||
**Great Bug Reports** tend to have:
|
||||
|
||||
- A quick summary and/or background
|
||||
@@ -82,8 +165,10 @@ We use GitHub issues to track public bugs. Report a bug by [opening a new issue]
|
||||
- Give sample code if you can.
|
||||
- What you expected would happen
|
||||
- What actually happens
|
||||
- Notes (possibly including why you think this might be happening, or stuff you tried that didn't work)
|
||||
- Notes (possibly including why you think this might be happening, or stuff you
|
||||
tried that didn't work)
|
||||
|
||||
## Use a Consistent Coding Style
|
||||
|
||||
* 4 spaces for indentation rather than tabs
|
||||
* Use a Python linter that will enforce PEP 8 and other best practices
|
||||
|
||||
245
EXAMPLES.md
245
EXAMPLES.md
@@ -265,6 +265,37 @@ blkid -o udev -ip /dev/sda2 | jc --blkid -p # or: jc -p blkid -o udev
|
||||
}
|
||||
]
|
||||
```
|
||||
### CEF strings
|
||||
```bash
|
||||
cat cef.log | jc --cef -p
|
||||
```
|
||||
```json
|
||||
[
|
||||
{
|
||||
"deviceVendor": "Trend Micro",
|
||||
"deviceProduct": "Deep Security Agent",
|
||||
"deviceVersion": "<DSA version>",
|
||||
"deviceEventClassId": "4000000",
|
||||
"name": "Eicar_test_file",
|
||||
"agentSeverity": 6,
|
||||
"CEFVersion": 0,
|
||||
"dvchost": "hostname",
|
||||
"string": "hello \"world\"!",
|
||||
"start": "Nov 08 2020 12:30:00.111 UTC",
|
||||
"start_epoch": 1604867400,
|
||||
"start_epoch_utc": 1604838600,
|
||||
"Host_ID": 1,
|
||||
"Quarantine": 205,
|
||||
"myDate": "Nov 08 2022 12:30:00.111",
|
||||
"myDate_epoch": 1667939400,
|
||||
"myDate_epoch_utc": null,
|
||||
"myFloat": 3.14,
|
||||
"deviceEventClassIdNum": 4000000,
|
||||
"agentSeverityString": "Medium",
|
||||
"agentSeverityNum": 6
|
||||
}
|
||||
]
|
||||
```
|
||||
### chage --list
|
||||
```bash
|
||||
chage --list joeuser | jc --chage -p # or: jc -p chage --list joeuser
|
||||
@@ -1605,21 +1636,21 @@ cat example.ini | jc --ini -p
|
||||
```
|
||||
```json
|
||||
{
|
||||
"DEFAULT": {
|
||||
"ServerAliveInterval": "45",
|
||||
"Compression": "yes",
|
||||
"CompressionLevel": "9",
|
||||
"ForwardX11": "yes"
|
||||
},
|
||||
"bitbucket.org": {
|
||||
"serveraliveinterval": "45",
|
||||
"compression": "yes",
|
||||
"compressionlevel": "9",
|
||||
"forwardx11": "yes",
|
||||
"user": "hg"
|
||||
"User": "hg"
|
||||
},
|
||||
"topsecret.server.com": {
|
||||
"serveraliveinterval": "45",
|
||||
"compression": "yes",
|
||||
"compressionlevel": "9",
|
||||
"forwardx11": "no",
|
||||
"port": "50022"
|
||||
"Port": "50022",
|
||||
"ForwardX11": "no"
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
### iostat
|
||||
```bash
|
||||
@@ -1665,6 +1696,71 @@ $ iostat | jc --iostat -p # or: jc -p iostat
|
||||
}
|
||||
]
|
||||
```
|
||||
### IP Address strings
|
||||
```bash
|
||||
echo 192.168.2.10/24 | jc --ip-address -p
|
||||
```
|
||||
```json
|
||||
{
|
||||
"version": 4,
|
||||
"max_prefix_length": 32,
|
||||
"ip": "192.168.2.10",
|
||||
"ip_compressed": "192.168.2.10",
|
||||
"ip_exploded": "192.168.2.10",
|
||||
"ip_split": [
|
||||
"192",
|
||||
"168",
|
||||
"2",
|
||||
"10"
|
||||
],
|
||||
"scope_id": null,
|
||||
"ipv4_mapped": null,
|
||||
"six_to_four": null,
|
||||
"teredo_client": null,
|
||||
"teredo_server": null,
|
||||
"dns_ptr": "10.2.168.192.in-addr.arpa",
|
||||
"network": "192.168.2.0",
|
||||
"broadcast": "192.168.2.255",
|
||||
"hostmask": "0.0.0.255",
|
||||
"netmask": "255.255.255.0",
|
||||
"cidr_netmask": 24,
|
||||
"hosts": 254,
|
||||
"first_host": "192.168.2.1",
|
||||
"last_host": "192.168.2.254",
|
||||
"is_multicast": false,
|
||||
"is_private": true,
|
||||
"is_global": false,
|
||||
"is_link_local": false,
|
||||
"is_loopback": false,
|
||||
"is_reserved": false,
|
||||
"is_unspecified": false,
|
||||
"int": {
|
||||
"ip": 3232236042,
|
||||
"network": 3232236032,
|
||||
"broadcast": 3232236287,
|
||||
"first_host": 3232236033,
|
||||
"last_host": 3232236286
|
||||
},
|
||||
"hex": {
|
||||
"ip": "c0:a8:02:0a",
|
||||
"network": "c0:a8:02:00",
|
||||
"broadcast": "c0:a8:02:ff",
|
||||
"hostmask": "00:00:00:ff",
|
||||
"netmask": "ff:ff:ff:00",
|
||||
"first_host": "c0:a8:02:01",
|
||||
"last_host": "c0:a8:02:fe"
|
||||
},
|
||||
"bin": {
|
||||
"ip": "11000000101010000000001000001010",
|
||||
"network": "11000000101010000000001000000000",
|
||||
"broadcast": "11000000101010000000001011111111",
|
||||
"hostmask": "00000000000000000000000011111111",
|
||||
"netmask": "11111111111111111111111100000000",
|
||||
"first_host": "11000000101010000000001000000001",
|
||||
"last_host": "11000000101010000000001011111110"
|
||||
}
|
||||
}
|
||||
```
|
||||
### iptables
|
||||
```bash
|
||||
iptables --line-numbers -v -L -t nat | jc --iptables -p # or: jc -p iptables --line-numbers -v -L -t nat
|
||||
@@ -1729,7 +1825,7 @@ iptables --line-numbers -v -L -t nat | jc --iptables -p # or: jc -p ip
|
||||
```
|
||||
### ISO Datetime string
|
||||
```bash
|
||||
echo "2022-07-20T14:52:45Z" | jc --iso-datetime -p
|
||||
echo "2022-07-20T14:52:45Z" | jc --datetime-iso -p
|
||||
```
|
||||
```json
|
||||
{
|
||||
@@ -2832,6 +2928,31 @@ pip show wrapt wheel | jc --pip-show -p # or: jc -p pip show wrapt whe
|
||||
}
|
||||
]
|
||||
```
|
||||
### PLIST files
|
||||
```bash
|
||||
cat info.plist | jc --plist -p
|
||||
```
|
||||
```json
|
||||
{
|
||||
"NSAppleScriptEnabled": true,
|
||||
"LSMultipleInstancesProhibited": true,
|
||||
"CFBundleInfoDictionaryVersion": "6.0",
|
||||
"DTPlatformVersion": "GM",
|
||||
"CFBundleIconFile": "GarageBand.icns",
|
||||
"CFBundleName": "GarageBand",
|
||||
"DTSDKName": "macosx10.13internal",
|
||||
"NSSupportsAutomaticGraphicsSwitching": true,
|
||||
"RevisionDate": "2018-12-03_14:10:56",
|
||||
"UTImportedTypeDeclarations": [
|
||||
{
|
||||
"UTTypeConformsTo": [
|
||||
"public.data",
|
||||
"public.content"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
### postconf -M
|
||||
```bash
|
||||
postconf -M | jc --postconf -p # or jc -p postconf -M
|
||||
@@ -3382,6 +3503,57 @@ sysctl -a | jc --sysctl -p # or: jc -p sysctl -a
|
||||
"user.expr_nest_max": 32
|
||||
}
|
||||
```
|
||||
### Syslog strings (RFC 5424)
|
||||
```bash
|
||||
cat syslog.txt | jc --syslog -p
|
||||
```
|
||||
```json
|
||||
[
|
||||
{
|
||||
"priority": 35,
|
||||
"version": 1,
|
||||
"timestamp": "2003-10-11T22:14:15.003Z",
|
||||
"hostname": "mymachine.example.com",
|
||||
"appname": "evntslog",
|
||||
"proc_id": null,
|
||||
"msg_id": "ID47",
|
||||
"structured_data": [
|
||||
{
|
||||
"identity": "exampleSDID@32473",
|
||||
"parameters": {
|
||||
"iut": "3",
|
||||
"eventSource": "Application",
|
||||
"eventID": "1011"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity": "examplePriority@32473",
|
||||
"parameters": {
|
||||
"class": "high"
|
||||
}
|
||||
}
|
||||
],
|
||||
"message": "unauthorized attempt",
|
||||
"timestamp_epoch": 1065935655,
|
||||
"timestamp_epoch_utc": 1065910455
|
||||
}
|
||||
]
|
||||
```
|
||||
### Syslog strings (RFC 3164)
|
||||
```bash
|
||||
cat syslog.txt | jc --syslog-bsd -p
|
||||
```
|
||||
```json
|
||||
[
|
||||
{
|
||||
"priority": 34,
|
||||
"date": "Oct 11 22:14:15",
|
||||
"hostname": "mymachine",
|
||||
"tag": "su",
|
||||
"content": "'su root' failed for lonvick on /dev/pts/8"
|
||||
}
|
||||
]
|
||||
```
|
||||
### systemctl
|
||||
```bash
|
||||
systemctl -a | jc --systemctl -p # or: jc -p systemctl -a
|
||||
@@ -4379,6 +4551,57 @@ cat entrust.pem | jc --x509-cert -p
|
||||
}
|
||||
]
|
||||
```
|
||||
### X.509 PEM and DER certificate request files
|
||||
```bash
|
||||
cat myserver.csr | jc --x509-csr -p
|
||||
```
|
||||
```json
|
||||
[
|
||||
{
|
||||
"certification_request_info": {
|
||||
"version": "v1",
|
||||
"subject": {
|
||||
"common_name": "myserver.for.example"
|
||||
},
|
||||
"subject_pk_info": {
|
||||
"algorithm": {
|
||||
"algorithm": "ec",
|
||||
"parameters": "secp256r1"
|
||||
},
|
||||
"public_key": "04:40:33:c0:91:8f:e9:46:ea:d0:dc:d0:f9:63:2c:a4:35:1f:0f:54:c8:a9:9b:e3:9e:d4:f3:64:b8:60:cc:7f:39:75:dd:a7:61:31:02:7c:9e:89:c6:db:45:15:f2:5f:b0:65:29:0b:42:d2:6e:c2:ea:a6:23:bd:fc:65:e5:7d:4e"
|
||||
},
|
||||
"attributes": [
|
||||
{
|
||||
"type": "extension_request",
|
||||
"values": [
|
||||
[
|
||||
{
|
||||
"extn_id": "extended_key_usage",
|
||||
"critical": false,
|
||||
"extn_value": [
|
||||
"server_auth"
|
||||
]
|
||||
},
|
||||
{
|
||||
"extn_id": "subject_alt_name",
|
||||
"critical": false,
|
||||
"extn_value": [
|
||||
"myserver.for.example"
|
||||
]
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"signature_algorithm": {
|
||||
"algorithm": "sha384_ecdsa",
|
||||
"parameters": null
|
||||
},
|
||||
"signature": "30:45:02:20:77:ac:5b:51:bf:c5:f5:43:02:52:ae:66:8a:fe:95:98:98:98:a9:45:34:31:08:ff:2c:cc:92:d9:1c:70:28:74:02:21:00:97:79:7b:e7:45:18:76:cf:d7:3b:79:34:56:d2:69:b5:73:41:9b:8a:b7:ad:ec:80:23:c1:2f:64:da:e5:28:19"
|
||||
}
|
||||
]
|
||||
```
|
||||
### XML files
|
||||
```bash
|
||||
cat cd_catalog.xml
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
include jc/py.typed
|
||||
include man/jc.1
|
||||
include CHANGELOG
|
||||
|
||||
75
README-snap.md
Normal file
75
README-snap.md
Normal file
@@ -0,0 +1,75 @@
|
||||
# How to use `jc` with `snap`
|
||||
|
||||
## How to build `snap` package
|
||||
|
||||
- Install `snapd`. [One](https://snapcraft.io/docs/installing-snapd) or [two](https://github.com/don-rumata/ansible-role-install-snap).
|
||||
|
||||
- Install `snapcraft`:
|
||||
|
||||
```bash
|
||||
$ sudo snap install snapcraft --classic
|
||||
```
|
||||
|
||||
- Update snapd:
|
||||
|
||||
```bash
|
||||
$ sudo snap refresh snapcraft --edge
|
||||
```
|
||||
|
||||
- Clone the repo:
|
||||
|
||||
```bash
|
||||
$ git clone https://github.com/kellyjonbrazil/jc
|
||||
```
|
||||
|
||||
- Change the directory:
|
||||
|
||||
```bash
|
||||
$ cd ./jc
|
||||
```
|
||||
|
||||
- Select branch:
|
||||
|
||||
```bash
|
||||
$ git checkout snap-support
|
||||
```
|
||||
|
||||
- Initialize LXD:
|
||||
|
||||
```bash
|
||||
$ lxd init --auto
|
||||
```
|
||||
|
||||
- Build `.snap` file:
|
||||
|
||||
```bash
|
||||
$ snapcraft
|
||||
```
|
||||
|
||||
## How to install local snap file
|
||||
|
||||
```bash
|
||||
$ snap install --dangerous ./jc_*_amd64.snap
|
||||
```
|
||||
|
||||
## How to use `jc` with plugins
|
||||
|
||||
- Put your plugin in the `"$HOME/.local/share/jc"` directory.
|
||||
|
||||
- To connect the directory, run:
|
||||
|
||||
```bash
|
||||
snap connect jc:dot-jc-plugins snapd
|
||||
```
|
||||
|
||||
## Urls
|
||||
|
||||
- <https://snapcraft.io/docs/supported-interfaces>
|
||||
|
||||
- <https://snapcraft.io/docs/interface-management>
|
||||
|
||||
- <https://snapcraft.io/docs/personal-files-interface>
|
||||
|
||||
- <https://snapcraft.io/docs/python-apps>
|
||||
|
||||
- <https://documentation.ubuntu.com/lxd/en/latest/getting_started/>
|
||||
587
README.md
587
README.md
@@ -3,19 +3,20 @@
|
||||
|
||||
> Check out the `jc` Python [package documentation](https://github.com/kellyjonbrazil/jc/tree/master/docs) for developers
|
||||
|
||||
> Try the `jc` [web demo](https://jc-web-demo.herokuapp.com/)
|
||||
> Try the `jc` [web demo](https://jc-web.onrender.com/) and [REST API](https://github.com/kellyjonbrazil/jc-restapi)
|
||||
|
||||
> JC is [now available](https://galaxy.ansible.com/community/general) as an
|
||||
Ansible filter plugin in the `community.general` collection. See this
|
||||
> `jc` is available as an
|
||||
[Ansible filter plugin](https://docs.ansible.com/ansible/latest/collections/community/general/jc_filter.html#ansible-collections-community-general-jc-filter)
|
||||
in the `community.general` collection. See this
|
||||
[blog post](https://blog.kellybrazil.com/2020/08/30/parsing-command-output-in-ansible-with-jc/)
|
||||
for an example.
|
||||
|
||||
# JC
|
||||
JSON Convert
|
||||
|
||||
`jc` JSONifies the output of many CLI tools and file-types for easier parsing in
|
||||
scripts. See the [**Parsers**](#parsers) section for supported commands and
|
||||
file-types.
|
||||
`jc` JSONifies the output of many CLI tools, file-types, and common strings
|
||||
for easier parsing in scripts. See the [**Parsers**](#parsers) section for
|
||||
supported commands, file-types, and strings.
|
||||
```bash
|
||||
dig example.com | jc --dig
|
||||
```
|
||||
@@ -44,8 +45,8 @@ $ jc dig example.com | jq -r '.[].answer[].data'
|
||||
93.184.216.34
|
||||
```
|
||||
|
||||
`jc` can also be used as a python library. In this case the output will be
|
||||
a python dictionary, a list of dictionaries, or even a
|
||||
`jc` can also be used as a python library. In this case the returned value
|
||||
will be a python dictionary, a list of dictionaries, or even a
|
||||
[lazy iterable of dictionaries](#using-streaming-parsers-as-python-modules)
|
||||
instead of JSON:
|
||||
```python
|
||||
@@ -70,12 +71,12 @@ values are converted, and, in some cases, additional semantic context fields are
|
||||
added.
|
||||
|
||||
To access the raw, pre-processed JSON, use the `-r` cli option or the `raw=True`
|
||||
function parameter in `parse()`.
|
||||
function parameter in `parse()` when using `jc` as a python library.
|
||||
|
||||
Schemas for each parser can be found at the documentation link beside each
|
||||
[**Parser**](#parsers) below.
|
||||
|
||||
Release notes can be found [here](https://blog.kellybrazil.com/category/jc-news/).
|
||||
Release notes can be found in the [Releases section](https://github.com/kellyjonbrazil/jc/releases) on Github.
|
||||
|
||||
## Why Would Anyone Do This!?
|
||||
For more information on the motivations for this project, please see my blog
|
||||
@@ -93,6 +94,7 @@ Use Cases:
|
||||
- [Ansible command output parsing](https://blog.kellybrazil.com/2020/08/30/parsing-command-output-in-ansible-with-jc/)
|
||||
- [Saltstack command output parsing](https://blog.kellybrazil.com/2020/09/15/parsing-command-output-in-saltstack-with-jc/)
|
||||
- [Nornir command output parsing](https://blog.kellybrazil.com/2020/12/09/parsing-command-output-in-nornir-with-jc/)
|
||||
- [FortiSOAR command output parsing](https://docs.fortinet.com/document/fortisoar/1.0.0/jc-parse-command-output/323/jc-parse-command-output-v1-0-0)
|
||||
|
||||
## Installation
|
||||
There are several ways to get `jc`. You can install via `pip`, OS package
|
||||
@@ -113,13 +115,15 @@ pip3 install jc
|
||||
| Debian/Ubuntu linux | `apt-get install jc` |
|
||||
| Fedora linux | `dnf install jc` |
|
||||
| openSUSE linux | `zypper install jc` |
|
||||
| Archlinux Community Repository | `paru -S jc` or `aura -S jc` or `yay -S jc` |
|
||||
| Arch linux | `pacman -S jc` |
|
||||
| NixOS linux | `nix-env -iA nixpkgs.jc` or `nix-env -iA nixos.jc` |
|
||||
| Guix System linux | `guix install jc` |
|
||||
| Gentoo Linux | `emerge dev-python/jc` |
|
||||
| Photon linux | `tdnf install jc` |
|
||||
| macOS | `brew install jc` |
|
||||
| FreeBSD | `portsnap fetch update && cd /usr/ports/textproc/py-jc && make install clean` |
|
||||
| Ansible filter plugin | `ansible-galaxy collection install community.general` |
|
||||
| FortiSOAR connector | Install from FortiSOAR Connector Marketplace |
|
||||
|
||||
> For more OS Packages, see https://repology.org/project/jc/versions.
|
||||
|
||||
@@ -131,14 +135,18 @@ on Github.
|
||||
`jc` accepts piped input from `STDIN` and outputs a JSON representation of the
|
||||
previous command's output to `STDOUT`.
|
||||
```bash
|
||||
COMMAND | jc PARSER [OPTIONS]
|
||||
COMMAND | jc [SLICE] [OPTIONS] PARSER
|
||||
cat FILE | jc [SLICE] [OPTIONS] PARSER
|
||||
echo STRING | jc [SLICE] [OPTIONS] PARSER
|
||||
```
|
||||
|
||||
Alternatively, the "magic" syntax can be used by prepending `jc` to the command
|
||||
to be converted. Options can be passed to `jc` immediately before the command is
|
||||
given. (Note: command aliases and shell builtins are not supported)
|
||||
to be converted or in front of the absolute path for Proc files. Options can be
|
||||
passed to `jc` immediately before the command or Proc file path is given.
|
||||
(Note: command aliases and shell builtins are not supported)
|
||||
```bash
|
||||
jc [OPTIONS] COMMAND
|
||||
jc [SLICE] [OPTIONS] COMMAND
|
||||
jc [SLICE] [OPTIONS] /proc/<path-to-procfile>
|
||||
```
|
||||
|
||||
The JSON output can be compact (default) or pretty formatted with the `-p`
|
||||
@@ -148,139 +156,305 @@ option.
|
||||
|
||||
| Argument | Command or Filetype | Documentation |
|
||||
|-------------------|---------------------------------------------------------|----------------------------------------------------------------------------|
|
||||
| ` --acpi` | `acpi` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/acpi) |
|
||||
| ` --airport` | `airport -I` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/airport) |
|
||||
| ` --airport-s` | `airport -s` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/airport_s) |
|
||||
| ` --arp` | `arp` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/arp) |
|
||||
| ` --asciitable` | ASCII and Unicode table parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/asciitable) |
|
||||
| ` --asciitable-m` | multi-line ASCII and Unicode table parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/asciitable_m) |
|
||||
| ` --blkid` | `blkid` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/blkid) |
|
||||
| ` --chage` | `chage --list` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/chage) |
|
||||
| ` --cksum` | `cksum` and `sum` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/cksum) |
|
||||
| ` --crontab` | `crontab` command and file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/crontab) |
|
||||
| ` --crontab-u` | `crontab` file parser with user support | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/crontab_u) |
|
||||
| ` --csv` | CSV file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/csv) |
|
||||
| ` --csv-s` | CSV file streaming parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/csv_s) |
|
||||
| ` --date` | `date` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/date) |
|
||||
| ` --df` | `df` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/df) |
|
||||
| ` --dig` | `dig` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/dig) |
|
||||
| ` --dir` | `dir` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/dir) |
|
||||
| ` --dmidecode` | `dmidecode` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/dmidecode) |
|
||||
| ` --dpkg-l` | `dpkg -l` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/dpkg_l) |
|
||||
| ` --du` | `du` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/du) |
|
||||
| `--acpi` | `acpi` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/acpi) |
|
||||
| `--airport` | `airport -I` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/airport) |
|
||||
| `--airport-s` | `airport -s` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/airport_s) |
|
||||
| `--amixer` | `amixer` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/amixer) |
|
||||
| `--apt-cache-show` | `apt-cache show` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/apt_cache_show) |
|
||||
| `--apt-get-sqq` | `apt-get -sqq` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/apt_get_sqq) |
|
||||
| `--arp` | `arp` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/arp) |
|
||||
| `--asciitable` | ASCII and Unicode table parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/asciitable) |
|
||||
| `--asciitable-m` | multi-line ASCII and Unicode table parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/asciitable_m) |
|
||||
| `--blkid` | `blkid` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/blkid) |
|
||||
| `--bluetoothctl` | `bluetoothctl` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/bluetoothctl) |
|
||||
| `--cbt` | `cbt` (Google Bigtable) command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/cbt) |
|
||||
| `--cef` | CEF string parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/cef) |
|
||||
| `--cef-s` | CEF string streaming parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/cef_s) |
|
||||
| `--certbot` | `certbot` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/certbot) |
|
||||
| `--chage` | `chage --list` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/chage) |
|
||||
| `--cksum` | `cksum` and `sum` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/cksum) |
|
||||
| `--clf` | Common and Combined Log Format file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/clf) |
|
||||
| `--clf-s` | Common and Combined Log Format file streaming parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/clf_s) |
|
||||
| `--crontab` | `crontab` command and file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/crontab) |
|
||||
| `--crontab-u` | `crontab` file parser with user support | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/crontab_u) |
|
||||
| `--csv` | CSV file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/csv) |
|
||||
| `--csv-s` | CSV file streaming parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/csv_s) |
|
||||
| `--curl-head` | `curl --head` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/curl_head) |
|
||||
| `--date` | `date` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/date) |
|
||||
| `--datetime-iso` | ISO 8601 Datetime string parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/datetime_iso) |
|
||||
| `--debconf-show` | `debconf-show` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/debconf_show) |
|
||||
| `--df` | `df` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/df) |
|
||||
| `--dig` | `dig` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/dig) |
|
||||
| `--dir` | `dir` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/dir) |
|
||||
| `--dmidecode` | `dmidecode` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/dmidecode) |
|
||||
| `--dpkg-l` | `dpkg -l` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/dpkg_l) |
|
||||
| `--du` | `du` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/du) |
|
||||
| `--efibootmgr` | `efibootmgr` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/efibootmgr) |
|
||||
| `--email-address` | Email Address string parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/email_address) |
|
||||
| ` --env` | `env` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/env) |
|
||||
| ` --file` | `file` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/file) |
|
||||
| ` --finger` | `finger` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/finger) |
|
||||
| ` --free` | `free` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/free) |
|
||||
| ` --fstab` | `/etc/fstab` file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/fstab) |
|
||||
| ` --git-log` | `git log` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/git_log) |
|
||||
| ` --git-log-s` | `git log` command streaming parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/git_log_s) |
|
||||
| ` --gpg` | `gpg --with-colons` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/gpg) |
|
||||
| ` --group` | `/etc/group` file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/group) |
|
||||
| ` --gshadow` | `/etc/gshadow` file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/gshadow) |
|
||||
| ` --hash` | `hash` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/hash) |
|
||||
| ` --hashsum` | hashsum command parser (`md5sum`, `shasum`, etc.) | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/hashsum) |
|
||||
| ` --hciconfig` | `hciconfig` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/hciconfig) |
|
||||
| ` --history` | `history` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/history) |
|
||||
| ` --hosts` | `/etc/hosts` file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/hosts) |
|
||||
| ` --id` | `id` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/id) |
|
||||
| ` --ifconfig` | `ifconfig` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/ifconfig) |
|
||||
| ` --ini` | INI file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/ini) |
|
||||
| ` --iostat` | `iostat` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/iostat) |
|
||||
| ` --iostat-s` | `iostat` command streaming parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/iostat_s) |
|
||||
| ` --iptables` | `iptables` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/iptables) |
|
||||
| ` --iso-datetime` | ISO 8601 Datetime string parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/iso_datetime) |
|
||||
| ` --iw-scan` | `iw dev [device] scan` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/iw_scan) |
|
||||
| ` --jar-manifest` | MANIFEST.MF file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/jar_manifest) |
|
||||
| ` --jobs` | `jobs` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/jobs) |
|
||||
| ` --jwt` | JWT string parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/jwt) |
|
||||
| ` --kv` | Key/Value file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/kv) |
|
||||
| ` --last` | `last` and `lastb` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/last) |
|
||||
| ` --ls` | `ls` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/ls) |
|
||||
| ` --ls-s` | `ls` command streaming parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/ls_s) |
|
||||
| ` --lsblk` | `lsblk` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/lsblk) |
|
||||
| ` --lsmod` | `lsmod` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/lsmod) |
|
||||
| ` --lsof` | `lsof` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/lsof) |
|
||||
| ` --lsusb` | `lsusb` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/lsusb) |
|
||||
| ` --m3u` | M3U and M3U8 file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/m3u) |
|
||||
| ` --mount` | `mount` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/mount) |
|
||||
| ` --mpstat` | `mpstat` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/mpstat) |
|
||||
| ` --mpstat-s` | `mpstat` command streaming parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/mpstat_s) |
|
||||
| ` --netstat` | `netstat` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/netstat) |
|
||||
| ` --nmcli` | `nmcli` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/nmcli) |
|
||||
| ` --ntpq` | `ntpq -p` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/ntpq) |
|
||||
| ` --passwd` | `/etc/passwd` file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/passwd) |
|
||||
| ` --pidstat` | `pidstat -h` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/pidstat) |
|
||||
| ` --pidstat-s` | `pidstat -h` command streaming parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/pidstat_s) |
|
||||
| ` --ping` | `ping` and `ping6` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/ping) |
|
||||
| ` --ping-s` | `ping` and `ping6` command streaming parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/ping_s) |
|
||||
| ` --pip-list` | `pip list` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/pip_list) |
|
||||
| ` --pip-show` | `pip show` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/pip_show) |
|
||||
| ` --postconf` | `postconf -M` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/postconf) |
|
||||
| ` --ps` | `ps` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/ps) |
|
||||
| ` --route` | `route` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/route) |
|
||||
| ` --rpm-qi` | `rpm -qi` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/rpm_qi) |
|
||||
| ` --rsync` | `rsync` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/rsync) |
|
||||
| ` --rsync-s` | `rsync` command streaming parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/rsync_s) |
|
||||
| ` --sfdisk` | `sfdisk` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/sfdisk) |
|
||||
| ` --shadow` | `/etc/shadow` file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/shadow) |
|
||||
| ` --ss` | `ss` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/ss) |
|
||||
| ` --stat` | `stat` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/stat) |
|
||||
| ` --stat-s` | `stat` command streaming parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/stat_s) |
|
||||
| ` --sysctl` | `sysctl` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/sysctl) |
|
||||
| ` --systemctl` | `systemctl` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/systemctl) |
|
||||
| ` --systemctl-lj` | `systemctl list-jobs` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/systemctl_lj) |
|
||||
| ` --systemctl-ls` | `systemctl list-sockets` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/systemctl_ls) |
|
||||
| `--env` | `env` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/env) |
|
||||
| `--ethtool` | `ethtool` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/ethtool) |
|
||||
| `--file` | `file` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/file) |
|
||||
| `--find` | `find` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/find) |
|
||||
| `--findmnt` | `findmnt` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/findmnt) |
|
||||
| `--finger` | `finger` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/finger) |
|
||||
| `--free` | `free` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/free) |
|
||||
| `--fstab` | `/etc/fstab` file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/fstab) |
|
||||
| `--git-log` | `git log` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/git_log) |
|
||||
| `--git-log-s` | `git log` command streaming parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/git_log_s) |
|
||||
| `--git-ls-remote` | `git ls-remote` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/git_ls_remote) |
|
||||
| `--gpg` | `gpg --with-colons` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/gpg) |
|
||||
| `--group` | `/etc/group` file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/group) |
|
||||
| `--gshadow` | `/etc/gshadow` file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/gshadow) |
|
||||
| `--hash` | `hash` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/hash) |
|
||||
| `--hashsum` | hashsum command parser (`md5sum`, `shasum`, etc.) | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/hashsum) |
|
||||
| `--hciconfig` | `hciconfig` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/hciconfig) |
|
||||
| `--history` | `history` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/history) |
|
||||
| `--host` | `host` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/host) |
|
||||
| `--hosts` | `/etc/hosts` file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/hosts) |
|
||||
| `--http-headers` | HTTP headers parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/http_headers) |
|
||||
| `--id` | `id` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/id) |
|
||||
| `--ifconfig` | `ifconfig` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/ifconfig) |
|
||||
| `--ini` | INI file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/ini) |
|
||||
| `--ini-dup` | INI with duplicate key file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/ini_dup) |
|
||||
| `--iostat` | `iostat` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/iostat) |
|
||||
| `--iostat-s` | `iostat` command streaming parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/iostat_s) |
|
||||
| `--ip-address` | IPv4 and IPv6 Address string parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/ip_address) |
|
||||
| `--ipconfig` | `ipconfig` Windows command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/ipconfig) |
|
||||
| `--iptables` | `iptables` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/iptables) |
|
||||
| `--ip-route` | `ip route` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/ip_route) |
|
||||
| `--iw-scan` | `iw dev [device] scan` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/iw_scan) |
|
||||
| `--iwconfig` | `iwconfig` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/iwconfig) |
|
||||
| `--jar-manifest` | Java MANIFEST.MF file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/jar_manifest) |
|
||||
| `--jobs` | `jobs` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/jobs) |
|
||||
| `--jwt` | JWT string parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/jwt) |
|
||||
| `--kv` | Key/Value file and string parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/kv) |
|
||||
| `--kv-dup` | Key/Value with duplicate key file and string parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/kv_dup) |
|
||||
| `--last` | `last` and `lastb` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/last) |
|
||||
| `--ls` | `ls` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/ls) |
|
||||
| `--ls-s` | `ls` command streaming parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/ls_s) |
|
||||
| `--lsattr` | `lsattr` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/lsattr) |
|
||||
| `--lsb-release` | `lsb_release` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/lsb_release) |
|
||||
| `--lsblk` | `lsblk` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/lsblk) |
|
||||
| `--lsmod` | `lsmod` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/lsmod) |
|
||||
| `--lsof` | `lsof` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/lsof) |
|
||||
| `--lspci` | `lspci -mmv` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/lspci) |
|
||||
| `--lsusb` | `lsusb` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/lsusb) |
|
||||
| `--m3u` | M3U and M3U8 file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/m3u) |
|
||||
| `--mdadm` | `mdadm` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/mdadm) |
|
||||
| `--mount` | `mount` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/mount) |
|
||||
| `--mpstat` | `mpstat` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/mpstat) |
|
||||
| `--mpstat-s` | `mpstat` command streaming parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/mpstat_s) |
|
||||
| `--needrestart` | `needrestart -b` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/needrestart) |
|
||||
| `--netstat` | `netstat` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/netstat) |
|
||||
| `--nmcli` | `nmcli` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/nmcli) |
|
||||
| `--nsd-control` | `nsd-control` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/nsd_control) |
|
||||
| `--ntpq` | `ntpq -p` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/ntpq) |
|
||||
| `--openvpn` | openvpn-status.log file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/openvpn) |
|
||||
| `--os-prober` | `os-prober` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/os_prober) |
|
||||
| `--os-release` | `/etc/os-release` file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/os_release) |
|
||||
| `--pacman` | `pacman` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/pacman) |
|
||||
| `--passwd` | `/etc/passwd` file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/passwd) |
|
||||
| `--path` | POSIX path string parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/path) |
|
||||
| `--path-list` | POSIX path list string parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/path_list) |
|
||||
| `--pci-ids` | `pci.ids` file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/pci_ids) |
|
||||
| `--pgpass` | PostgreSQL password file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/pgpass) |
|
||||
| `--pidstat` | `pidstat -H` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/pidstat) |
|
||||
| `--pidstat-s` | `pidstat -H` command streaming parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/pidstat_s) |
|
||||
| `--ping` | `ping` and `ping6` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/ping) |
|
||||
| `--ping-s` | `ping` and `ping6` command streaming parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/ping_s) |
|
||||
| `--pip-list` | `pip list` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/pip_list) |
|
||||
| `--pip-show` | `pip show` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/pip_show) |
|
||||
| `--pkg-index-apk` | Alpine Linux Package Index file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/pkg_index_apk) |
|
||||
| `--pkg-index-deb` | Debian Package Index file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/pkg_index_deb) |
|
||||
| `--plist` | PLIST file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/plist) |
|
||||
| `--postconf` | `postconf -M` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/postconf) |
|
||||
| `--proc` | `/proc/` file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/proc) |
|
||||
| `--ps` | `ps` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/ps) |
|
||||
| `--resolve-conf` | `/etc/resolve.conf` file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/resolve_conf) |
|
||||
| `--route` | `route` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/route) |
|
||||
| `--rpm-qi` | `rpm -qi` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/rpm_qi) |
|
||||
| `--rsync` | `rsync` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/rsync) |
|
||||
| `--rsync-s` | `rsync` command streaming parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/rsync_s) |
|
||||
| `--semver` | Semantic Version string parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/semver) |
|
||||
| `--sfdisk` | `sfdisk` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/sfdisk) |
|
||||
| `--shadow` | `/etc/shadow` file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/shadow) |
|
||||
| `--srt` | SRT file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/srt) |
|
||||
| `--ss` | `ss` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/ss) |
|
||||
| `--ssh-conf` | `ssh` config file and `ssh -G` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/ssh_conf) |
|
||||
| `--sshd-conf` | `sshd` config file and `sshd -T` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/sshd_conf) |
|
||||
| `--stat` | `stat` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/stat) |
|
||||
| `--stat-s` | `stat` command streaming parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/stat_s) |
|
||||
| `--swapon` | `swapon` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/swapon) |
|
||||
| `--sysctl` | `sysctl` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/sysctl) |
|
||||
| `--syslog` | Syslog RFC 5424 string parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/syslog) |
|
||||
| `--syslog-s` | Syslog RFC 5424 string streaming parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/syslog_s) |
|
||||
| `--syslog-bsd` | Syslog RFC 3164 string parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/syslog_bsd) |
|
||||
| `--syslog-bsd-s` | Syslog RFC 3164 string streaming parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/syslog_bsd_s) |
|
||||
| `--systemctl` | `systemctl` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/systemctl) |
|
||||
| `--systemctl-lj` | `systemctl list-jobs` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/systemctl_lj) |
|
||||
| `--systemctl-ls` | `systemctl list-sockets` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/systemctl_ls) |
|
||||
| `--systemctl-luf` | `systemctl list-unit-files` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/systemctl_luf) |
|
||||
| ` --systeminfo` | `systeminfo` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/systeminfo) |
|
||||
| ` --time` | `/usr/bin/time` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/time) |
|
||||
| ` --timedatectl` | `timedatectl status` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/timedatectl) |
|
||||
| ` --timestamp` | UNIX Epoch Timestamp string parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/timestamp) |
|
||||
| ` --top` | `top -b` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/top) |
|
||||
| ` --top-s` | `top -b` command streaming parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/top_s) |
|
||||
| ` --tracepath` | `tracepath` and `tracepath6` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/tracepath) |
|
||||
| ` --traceroute` | `traceroute` and `traceroute6` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/traceroute) |
|
||||
| ` --ufw` | `ufw status` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/ufw) |
|
||||
| ` --ufw-appinfo` | `ufw app info [application]` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/ufw_appinfo) |
|
||||
| ` --uname` | `uname -a` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/uname) |
|
||||
| `--systeminfo` | `systeminfo` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/systeminfo) |
|
||||
| `--time` | `/usr/bin/time` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/time) |
|
||||
| `--timedatectl` | `timedatectl status` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/timedatectl) |
|
||||
| `--timestamp` | Unix Epoch Timestamp string parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/timestamp) |
|
||||
| `--toml` | TOML file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/toml) |
|
||||
| `--top` | `top -b` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/top) |
|
||||
| `--top-s` | `top -b` command streaming parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/top_s) |
|
||||
| `--tracepath` | `tracepath` and `tracepath6` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/tracepath) |
|
||||
| `--traceroute` | `traceroute` and `traceroute6` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/traceroute) |
|
||||
| `--tune2fs` | `tune2fs -l` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/tune2fs) |
|
||||
| `--udevadm` | `udevadm info` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/udevadm) |
|
||||
| `--ufw` | `ufw status` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/ufw) |
|
||||
| `--ufw-appinfo` | `ufw app info [application]` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/ufw_appinfo) |
|
||||
| `--uname` | `uname -a` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/uname) |
|
||||
| `--update-alt-gs` | `update-alternatives --get-selections` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/update_alt_gs) |
|
||||
| ` --update-alt-q` | `update-alternatives --query` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/update_alt_q) |
|
||||
| ` --upower` | `upower` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/upower) |
|
||||
| ` --uptime` | `uptime` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/uptime) |
|
||||
| ` --url` | URL string parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/url) |
|
||||
| ` --vmstat` | `vmstat` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/vmstat) |
|
||||
| ` --vmstat-s` | `vmstat` command streaming parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/vmstat_s) |
|
||||
| ` --w` | `w` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/w) |
|
||||
| ` --wc` | `wc` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/wc) |
|
||||
| ` --who` | `who` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/who) |
|
||||
| ` --x509-cert` | X.509 PEM and DER certificate file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/x509_cert) |
|
||||
| ` --xml` | XML file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/xml) |
|
||||
| ` --xrandr` | `xrandr` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/xrandr) |
|
||||
| ` --yaml` | YAML file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/yaml) |
|
||||
| ` --zipinfo` | `zipinfo` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/zipinfo) |
|
||||
| `--update-alt-q` | `update-alternatives --query` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/update_alt_q) |
|
||||
| `--upower` | `upower` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/upower) |
|
||||
| `--uptime` | `uptime` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/uptime) |
|
||||
| `--url` | URL string parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/url) |
|
||||
| `--ver` | Version string parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/ver) |
|
||||
| `--veracrypt` | `veracrypt` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/veracrypt) |
|
||||
| `--vmstat` | `vmstat` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/vmstat) |
|
||||
| `--vmstat-s` | `vmstat` command streaming parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/vmstat_s) |
|
||||
| `--w` | `w` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/w) |
|
||||
| `--wc` | `wc` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/wc) |
|
||||
| `--wg-show` | `wg show` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/wg_show) |
|
||||
| `--who` | `who` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/who) |
|
||||
| `--x509-cert` | X.509 PEM and DER certificate file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/x509_cert) |
|
||||
| `--x509-csr` | X.509 PEM and DER certificate request file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/x509_csr) |
|
||||
| `--xml` | XML file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/xml) |
|
||||
| `--xrandr` | `xrandr` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/xrandr) |
|
||||
| `--yaml` | YAML file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/yaml) |
|
||||
| `--zipinfo` | `zipinfo` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/zipinfo) |
|
||||
| `--zpool-iostat` | `zpool iostat` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/zpool_iostat) |
|
||||
| `--zpool-status` | `zpool status` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/zpool_status) |
|
||||
|
||||
### Options
|
||||
|
||||
| Short | Long | Description |
|
||||
|-------|-----------------|---------------------------------------------------------------------------------------------------------------------|
|
||||
| `-a` | `--about` | About `jc`. Prints information about `jc` and the parsers (in JSON or YAML, of course!) |
|
||||
| `-C` | `--force-color` | Force color output even when using pipes (overrides `-m` and the `NO_COLOR` env variable) |
|
||||
| `-d` | `--debug` | Debug mode. Prints trace messages if parsing issues are encountered (use`-dd` for verbose debugging) |
|
||||
| `-h` | `--help` | Help. Use `jc -h --parser_name` for parser documentation |
|
||||
| `-m` | `--monochrome` | Monochrome output |
|
||||
| `-p` | `--pretty` | Pretty format the JSON output |
|
||||
| `-q` | `--quiet` | Quiet mode. Suppresses parser warning messages (use `-qq` to ignore streaming parser errors) |
|
||||
| `-r` | `--raw` | Raw output. Provides more literal output, typically with string values and no additional semantic processing |
|
||||
| `-u` | `--unbuffer` | Unbuffer output |
|
||||
| `-v` | `--version` | Version information |
|
||||
| `-y` | `--yaml-out` | YAML output |
|
||||
| `-B` | `--bash-comp` | Generate Bash shell completion script ([more info](https://github.com/kellyjonbrazil/jc/wiki/Shell-Completions)) |
|
||||
| `-Z` | `--zsh-comp` | Generate Zsh shell completion script ([more info](https://github.com/kellyjonbrazil/jc/wiki/Shell-Completions)) |
|
||||
| Short | Long | Description |
|
||||
|-------|-----------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `-a` | `--about` | About `jc`. Prints information about `jc` and the parsers (in JSON or YAML, of course!) |
|
||||
| `-C` | `--force-color` | Force color output even when using pipes (overrides `-m` and the `NO_COLOR` env variable) |
|
||||
| `-d` | `--debug` | Debug mode. Prints trace messages if parsing issues are encountered (use`-dd` for verbose debugging) |
|
||||
| `-h` | `--help` | Help. Use `jc -h --parser_name` for parser documentation. Use twice to show hidden parsers (e.g. `-hh`). Use thrice to show parser categories (e.g. `-hhh`). |
|
||||
| `-m` | `--monochrome` | Monochrome output |
|
||||
| `-M` | `--meta-out` | Add metadata to output including timestamp, parser name, magic command, magic command exit code, etc. | |
|
||||
| `-p` | `--pretty` | Pretty format the JSON output |
|
||||
| `-q` | `--quiet` | Quiet mode. Suppresses parser warning messages (use `-qq` to ignore streaming parser errors) |
|
||||
| `-r` | `--raw` | Raw output. Provides more literal output, typically with string values and no additional semantic processing |
|
||||
| `-s` | `--slurp` | Slurp multiple lines into an array. (use `-hhh` to find compatible parsers) |
|
||||
| `-u` | `--unbuffer` | Unbuffer output |
|
||||
| `-v` | `--version` | Version information |
|
||||
| `-y` | `--yaml-out` | YAML output |
|
||||
| `-B` | `--bash-comp` | Generate Bash shell completion script ([more info](https://github.com/kellyjonbrazil/jc/wiki/Shell-Completions)) |
|
||||
| `-Z` | `--zsh-comp` | Generate Zsh shell completion script ([more info](https://github.com/kellyjonbrazil/jc/wiki/Shell-Completions)) |
|
||||
|
||||
### Slice
|
||||
Line slicing is supported using the `START:STOP` syntax similar to Python
|
||||
slicing. This allows you to skip lines at the beginning and/or end of the
|
||||
`STDIN` input you would like `jc` to convert.
|
||||
|
||||
`START` and `STOP` can be positive or negative integers or blank and allow
|
||||
you to specify how many lines to skip and how many lines to process.
|
||||
Positive and blank slices are the most memory efficient. Any negative
|
||||
integers in the slice will use more memory.
|
||||
|
||||
For example, to skip the first and last line of the following text, you
|
||||
could express the slice in a couple ways:
|
||||
|
||||
```bash
|
||||
$ cat table.txt
|
||||
### We want to skip this header ###
|
||||
col1 col2
|
||||
foo 1
|
||||
bar 2
|
||||
### We want to skip this footer ###
|
||||
$ cat table.txt | jc 1:-1 --asciitable
|
||||
[{"col1":"foo","col2":"1"},{"col1":"bar","col2":"2"}]
|
||||
$ cat table.txt | jc 1:4 --asciitable
|
||||
[{"col1":"foo","col2":"1"},{"col1":"bar","col2":"2"}]
|
||||
```
|
||||
In this example `1:-1` and `1:4` line slices provide the same output.
|
||||
|
||||
When using positive integers the index location of `STOP` is non-inclusive.
|
||||
Positive slices count from the first line of the input toward the end
|
||||
starting at `0` as the first line. Negative slices count from the last line
|
||||
toward the beginning starting at `-1` as the last line. This is also the way
|
||||
[Python's slicing](https://stackoverflow.com/questions/509211/understanding-slicing)
|
||||
feature works.
|
||||
|
||||
Here is a breakdown of line slice options:
|
||||
|
||||
| Slice Notation | Input Lines Processed |
|
||||
|----------------|--------------------------------------------------------------|
|
||||
| `START:STOP` | lines `START` through `STOP - 1` |
|
||||
| `START:` | lines `START` through the rest of the output |
|
||||
| `:STOP` | lines from the beginning through `STOP - 1` |
|
||||
| `-START:STOP` | `START` lines from the end through `STOP - 1` |
|
||||
| `START:-STOP` | lines `START` through `STOP` lines from the end |
|
||||
| `-START:-STOP` | `START` lines from the end through `STOP` lines from the end |
|
||||
| `-START:` | `START` lines from the end through the rest of the output |
|
||||
| `:-STOP` | lines from the beginning through `STOP` lines from the end |
|
||||
| `:` | all lines |
|
||||
|
||||
### Slurp
|
||||
Some parsers support multi-item input and can output an array of results in a
|
||||
single pass. Slurping works for string parsers that accept a single line of
|
||||
input. (e.g. `url` and `ip-address`) To see a list of parsers that support
|
||||
the `--slurp` option, use `jc -hhh`.
|
||||
|
||||
For example, you can send a file with multiple IP addresses (one per line) to
|
||||
`jc` with the `--slurp` option and an array of results will output:
|
||||
|
||||
```bash
|
||||
$ cat ip-addresses.txt | jc --slurp --ip-address
|
||||
[<multiple output objects>]
|
||||
```
|
||||
|
||||
The magic syntax for `/proc` files automatically supports slurping of multiple
|
||||
files (no need to use the `--slurp` option). For example, you can convert many
|
||||
PID files at once:
|
||||
|
||||
```bash
|
||||
$ jc /proc/*/status
|
||||
[<multiple output objects>]
|
||||
```
|
||||
|
||||
When the `/proc` magic syntax is used and multiple files are selected, an
|
||||
additional `_file` field is inserted in the output so it is easier to tell what
|
||||
file each output object refers to.
|
||||
|
||||
Finally, the `--meta-out` option can be used in conjunction with slurped output.
|
||||
In this case, the slurped output is wrapped in an object with the following
|
||||
structure:
|
||||
|
||||
```json
|
||||
{
|
||||
"result": [<multiple output objects>],
|
||||
"_jc_meta": {
|
||||
"parser": "url",
|
||||
"timestamp": 1706235558.654576,
|
||||
"slice_start": null,
|
||||
"slice_end": null,
|
||||
"input_list": [
|
||||
"http://www.google.com",
|
||||
"https://www.apple.com",
|
||||
"https://www.microsoft.com"
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
With `--meta-out`, `input_list` contains a list of inputs (actual input strings
|
||||
or `/proc` filenames) so you can identify which output object relates to each
|
||||
input string or `/proc` filename.
|
||||
|
||||
### Exit Codes
|
||||
Any fatal errors within `jc` will generate an exit code of `100`, otherwise the
|
||||
exit code will be `0`. When using the "magic" syntax (e.g. `jc ifconfig eth0`),
|
||||
exit code will be `0`.
|
||||
|
||||
When using the "magic" syntax (e.g. `jc ifconfig eth0`),
|
||||
`jc` will store the exit code of the program being parsed and add it to the `jc`
|
||||
exit code. This way it is easier to determine if an error was from the parsed
|
||||
program or `jc`.
|
||||
@@ -294,6 +468,44 @@ Consider the following examples using `ifconfig`:
|
||||
| `0` | `100` | `100` | Error in `jc` |
|
||||
| `1` | `100` | `101` | Error in both `ifconfig` and `jc` |
|
||||
|
||||
When using the "magic" syntax you can also retrieve the exit code of the called
|
||||
program by using the `--meta-out` or `-M` option. This will append a `_jc_meta`
|
||||
object to the output that will include the magic command information, including
|
||||
the exit code.
|
||||
|
||||
Here is an example with `ping`:
|
||||
```bash
|
||||
$ jc --meta-out -p ping -c2 192.168.1.252
|
||||
{
|
||||
"destination_ip": "192.168.1.252",
|
||||
"data_bytes": 56,
|
||||
"pattern": null,
|
||||
"destination": "192.168.1.252",
|
||||
"packets_transmitted": 2,
|
||||
"packets_received": 0,
|
||||
"packet_loss_percent": 100.0,
|
||||
"duplicates": 0,
|
||||
"responses": [
|
||||
{
|
||||
"type": "timeout",
|
||||
"icmp_seq": 0,
|
||||
"duplicate": false
|
||||
}
|
||||
],
|
||||
"_jc_meta": {
|
||||
"parser": "ping",
|
||||
"timestamp": 1661357115.27949,
|
||||
"magic_command": [
|
||||
"ping",
|
||||
"-c2",
|
||||
"192.168.1.252"
|
||||
],
|
||||
"magic_command_exit": 2
|
||||
}
|
||||
}
|
||||
$ echo $?
|
||||
2
|
||||
```
|
||||
|
||||
### Setting Custom Colors via Environment Variable
|
||||
You can specify custom colors via the `JC_COLORS` environment variable. The
|
||||
@@ -325,7 +537,7 @@ option.
|
||||
### Streaming Parsers
|
||||
Most parsers load all of the data from `STDIN`, parse it, then output the entire
|
||||
JSON document serially. There are some streaming parsers (e.g. `ls-s` and
|
||||
`ping-s`) that immediately start processing and outputing the data line-by-line
|
||||
`ping-s`) that immediately start processing and outputting the data line-by-line
|
||||
as [JSON Lines](https://jsonlines.org/) (aka [NDJSON](http://ndjson.org/)) while
|
||||
it is being received from `STDIN`. This can significantly reduce the amount of
|
||||
memory required to parse large amounts of command output (e.g. `ls -lR /`) and
|
||||
@@ -408,20 +620,22 @@ for item in result:
|
||||
print(item["filename"])
|
||||
```
|
||||
|
||||
### Custom Parsers
|
||||
Custom local parser plugins may be placed in a `jc/jcparsers` folder in your
|
||||
local **"App data directory"**:
|
||||
### Parser Plugins
|
||||
Parser plugins may be placed in a `jc/jcparsers` folder in your local
|
||||
**"App data directory"**:
|
||||
|
||||
- Linux/unix: `$HOME/.local/share/jc/jcparsers`
|
||||
- macOS: `$HOME/Library/Application Support/jc/jcparsers`
|
||||
- Windows: `$LOCALAPPDATA\jc\jc\jcparsers`
|
||||
|
||||
Local parser plugins are standard python module files. Use the
|
||||
Parser plugins are standard python module files. Use the
|
||||
[`jc/parsers/foo.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/foo.py)
|
||||
or [`jc/parsers/foo_s.py (streaming)`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/foo_s.py)
|
||||
parser as a template and simply place a `.py` file in the `jcparsers` subfolder.
|
||||
Any dependencies can be placed in the `jc` folder above `jcparsers` and can
|
||||
be imported in the parser code.
|
||||
|
||||
Local plugin filenames must be valid python module names and therefore must
|
||||
Parser plugin filenames must be valid python module names and therefore must
|
||||
start with a letter and consist entirely of alphanumerics and underscores.
|
||||
Local plugins may override default parsers.
|
||||
|
||||
@@ -432,15 +646,16 @@ Local plugins may override default parsers.
|
||||
|
||||
#### Locale
|
||||
|
||||
For best results set the `LANG` locale environment variable to `C` or
|
||||
`en_US.UTF-8`. For example, either by setting directly on the command-line:
|
||||
For best results set the locale environment variables to `C` or
|
||||
`en_US.UTF-8` by modifying the `LC_ALL` variable:
|
||||
```
|
||||
$ LANG=C date | jc --date
|
||||
$ LC_ALL=C date | jc --date
|
||||
```
|
||||
|
||||
or by exporting to the environment before running commands:
|
||||
You can also set the locale variables individually:
|
||||
```
|
||||
$ export LANG=C
|
||||
$ export LC_NUMERIC=C
|
||||
```
|
||||
|
||||
On some older systems UTF-8 output will be downgraded to ASCII with `\\u`
|
||||
@@ -478,18 +693,18 @@ they are run on an unsupported platform. To see all parser information,
|
||||
including compatibility, run `jc -ap`.
|
||||
|
||||
You may still use a parser on an unsupported platform - for example, you may
|
||||
want to parse a file with linux `lsof` output on an macOS or Windows laptop. In
|
||||
want to parse a file with linux `lsof` output on a macOS or Windows laptop. In
|
||||
that case you can suppress the warning message with the `-q` cli option or the
|
||||
`quiet=True` function parameter in `parse()`:
|
||||
|
||||
macOS:
|
||||
```bash
|
||||
cat lsof.out | jc --lsof -q
|
||||
cat lsof.out | jc -q --lsof
|
||||
```
|
||||
|
||||
or Windows:
|
||||
```bash
|
||||
type lsof.out | jc --lsof -q
|
||||
type lsof.out | jc -q --lsof
|
||||
```
|
||||
|
||||
Tested on:
|
||||
@@ -533,7 +748,7 @@ documentation.
|
||||
|
||||
### arp
|
||||
```bash
|
||||
arp | jc --arp -p # or: jc -p arp
|
||||
arp | jc -p --arp # or: jc -p arp
|
||||
```
|
||||
```json
|
||||
[
|
||||
@@ -572,7 +787,7 @@ cat homes.csv
|
||||
...
|
||||
```
|
||||
```bash
|
||||
cat homes.csv | jc --csv -p
|
||||
cat homes.csv | jc -p --csv
|
||||
```
|
||||
```json
|
||||
[
|
||||
@@ -613,7 +828,7 @@ cat homes.csv | jc --csv -p
|
||||
```
|
||||
### /etc/hosts file
|
||||
```bash
|
||||
cat /etc/hosts | jc --hosts -p
|
||||
cat /etc/hosts | jc -p --hosts
|
||||
```
|
||||
```json
|
||||
[
|
||||
@@ -640,7 +855,7 @@ cat /etc/hosts | jc --hosts -p
|
||||
```
|
||||
### ifconfig
|
||||
```bash
|
||||
ifconfig | jc --ifconfig -p # or: jc -p ifconfig
|
||||
ifconfig | jc -p --ifconfig # or: jc -p ifconfig
|
||||
```
|
||||
```json
|
||||
[
|
||||
@@ -684,43 +899,37 @@ ifconfig | jc --ifconfig -p # or: jc -p ifconfig
|
||||
cat example.ini
|
||||
```
|
||||
```
|
||||
[DEFAULT]
|
||||
ServerAliveInterval = 45
|
||||
Compression = yes
|
||||
CompressionLevel = 9
|
||||
ForwardX11 = yes
|
||||
foo = fiz
|
||||
bar = buz
|
||||
|
||||
[bitbucket.org]
|
||||
User = hg
|
||||
[section1]
|
||||
fruit = apple
|
||||
color = blue
|
||||
|
||||
[topsecret.server.com]
|
||||
Port = 50022
|
||||
ForwardX11 = no
|
||||
[section2]
|
||||
fruit = pear
|
||||
color = green
|
||||
```
|
||||
```bash
|
||||
cat example.ini | jc --ini -p
|
||||
cat example.ini | jc -p --ini
|
||||
```
|
||||
```json
|
||||
{
|
||||
"bitbucket.org": {
|
||||
"serveraliveinterval": "45",
|
||||
"compression": "yes",
|
||||
"compressionlevel": "9",
|
||||
"forwardx11": "yes",
|
||||
"user": "hg"
|
||||
"foo": "fiz",
|
||||
"bar": "buz",
|
||||
"section1": {
|
||||
"fruit": "apple",
|
||||
"color": "blue"
|
||||
},
|
||||
"topsecret.server.com": {
|
||||
"serveraliveinterval": "45",
|
||||
"compression": "yes",
|
||||
"compressionlevel": "9",
|
||||
"forwardx11": "no",
|
||||
"port": "50022"
|
||||
"section2": {
|
||||
"fruit": "pear",
|
||||
"color": "green"
|
||||
}
|
||||
}
|
||||
```
|
||||
### ls
|
||||
```bash
|
||||
$ ls -l /usr/bin | jc --ls -p # or: jc -p ls -l /usr/bin
|
||||
$ ls -l /usr/bin | jc -p --ls # or: jc -p ls -l /usr/bin
|
||||
```
|
||||
```json
|
||||
[
|
||||
@@ -756,7 +965,7 @@ $ ls -l /usr/bin | jc --ls -p # or: jc -p ls -l /usr/bin
|
||||
```
|
||||
### netstat
|
||||
```bash
|
||||
netstat -apee | jc --netstat -p # or: jc -p netstat -apee
|
||||
netstat -apee | jc -p --netstat # or: jc -p netstat -apee
|
||||
```
|
||||
```json
|
||||
[
|
||||
@@ -844,7 +1053,7 @@ netstat -apee | jc --netstat -p # or: jc -p netstat -apee
|
||||
```
|
||||
### /etc/passwd file
|
||||
```bash
|
||||
cat /etc/passwd | jc --passwd -p
|
||||
cat /etc/passwd | jc -p --passwd
|
||||
```
|
||||
```json
|
||||
[
|
||||
@@ -870,7 +1079,7 @@ cat /etc/passwd | jc --passwd -p
|
||||
```
|
||||
### ping
|
||||
```bash
|
||||
ping 8.8.8.8 -c 3 | jc --ping -p # or: jc -p ping 8.8.8.8 -c 3
|
||||
ping 8.8.8.8 -c 3 | jc -p --ping # or: jc -p ping 8.8.8.8 -c 3
|
||||
```
|
||||
```json
|
||||
{
|
||||
@@ -923,7 +1132,7 @@ ping 8.8.8.8 -c 3 | jc --ping -p # or: jc -p ping 8.8.8.8 -c 3
|
||||
```
|
||||
### ps
|
||||
```bash
|
||||
ps axu | jc --ps -p # or: jc -p ps axu
|
||||
ps axu | jc -p --ps # or: jc -p ps axu
|
||||
```
|
||||
```json
|
||||
[
|
||||
@@ -970,7 +1179,7 @@ ps axu | jc --ps -p # or: jc -p ps axu
|
||||
```
|
||||
### traceroute
|
||||
```bash
|
||||
traceroute -m 2 8.8.8.8 | jc --traceroute -p
|
||||
traceroute -m 2 8.8.8.8 | jc -p --traceroute
|
||||
# or: jc -p traceroute -m 2 8.8.8.8
|
||||
```
|
||||
```json
|
||||
@@ -1035,7 +1244,7 @@ traceroute -m 2 8.8.8.8 | jc --traceroute -p
|
||||
```
|
||||
### uptime
|
||||
```bash
|
||||
uptime | jc --uptime -p # or: jc -p uptime
|
||||
uptime | jc -p --uptime # or: jc -p uptime
|
||||
```
|
||||
```json
|
||||
{
|
||||
@@ -1080,7 +1289,7 @@ cat cd_catalog.xml
|
||||
...
|
||||
```
|
||||
```bash
|
||||
cat cd_catalog.xml | jc --xml -p
|
||||
cat cd_catalog.xml | jc -p --xml
|
||||
```
|
||||
```json
|
||||
{
|
||||
@@ -1132,7 +1341,7 @@ spec:
|
||||
mode: ISTIO_MUTUAL
|
||||
```
|
||||
```bash
|
||||
cat istio.yaml | jc --yaml -p
|
||||
cat istio.yaml | jc -p --yaml
|
||||
```
|
||||
```json
|
||||
[
|
||||
@@ -1170,4 +1379,4 @@ cat istio.yaml | jc --yaml -p
|
||||
]
|
||||
```
|
||||
|
||||
© 2019-2022 Kelly Brazil
|
||||
© 2019-2025 Kelly Brazil
|
||||
@@ -3,9 +3,9 @@ _jc()
|
||||
local cur prev words cword jc_commands jc_parsers jc_options \
|
||||
jc_about_options jc_about_mod_options jc_help_options jc_special_options
|
||||
|
||||
jc_commands=(acpi airport arp blkid chage cksum crontab date df dig dmidecode dpkg du env file finger free git gpg hciconfig id ifconfig iostat iptables iw jobs last lastb ls lsblk lsmod lsof lsusb md5 md5sum mount mpstat netstat nmcli ntpq pidstat ping ping6 pip pip3 postconf printenv ps route rpm rsync sfdisk sha1sum sha224sum sha256sum sha384sum sha512sum shasum ss stat sum sysctl systemctl systeminfo timedatectl top tracepath tracepath6 traceroute traceroute6 ufw uname update-alternatives upower uptime vdir vmstat w wc who xrandr zipinfo)
|
||||
jc_parsers=(--acpi --airport --airport-s --arp --asciitable --asciitable-m --blkid --chage --cksum --crontab --crontab-u --csv --csv-s --date --df --dig --dir --dmidecode --dpkg-l --du --email-address --env --file --finger --free --fstab --git-log --git-log-s --gpg --group --gshadow --hash --hashsum --hciconfig --history --hosts --id --ifconfig --ini --iostat --iostat-s --iptables --iso-datetime --iw-scan --jar-manifest --jobs --jwt --kv --last --ls --ls-s --lsblk --lsmod --lsof --lsusb --m3u --mount --mpstat --mpstat-s --netstat --nmcli --ntpq --passwd --pidstat --pidstat-s --ping --ping-s --pip-list --pip-show --postconf --ps --route --rpm-qi --rsync --rsync-s --sfdisk --shadow --ss --stat --stat-s --sysctl --systemctl --systemctl-lj --systemctl-ls --systemctl-luf --systeminfo --time --timedatectl --timestamp --top --top-s --tracepath --traceroute --ufw --ufw-appinfo --uname --update-alt-gs --update-alt-q --upower --uptime --url --vmstat --vmstat-s --w --wc --who --x509-cert --xml --xrandr --yaml --zipinfo)
|
||||
jc_options=(--force-color -C --debug -d --monochrome -m --pretty -p --quiet -q --raw -r --unbuffer -u --yaml-out -y)
|
||||
jc_commands=(acpi airport amixer apt-cache apt-get arp blkid bluetoothctl cbt certbot chage cksum crontab curl date debconf-show df dig dmidecode dpkg du efibootmgr env ethtool file findmnt finger free git gpg hciconfig host id ifconfig iostat ip ipconfig iptables iw iwconfig jobs last lastb ls lsattr lsb_release lsblk lsmod lsof lspci lsusb md5 md5sum mdadm mount mpstat needrestart netstat nmcli nsd-control ntpq os-prober pacman pidstat ping ping6 pip pip3 postconf printenv ps route rpm rsync sfdisk sha1sum sha224sum sha256sum sha384sum sha512sum shasum ss ssh sshd stat sum swapon sysctl systemctl systeminfo timedatectl top tracepath tracepath6 traceroute traceroute6 tune2fs udevadm ufw uname update-alternatives upower uptime vdir veracrypt vmstat w wc wg who xrandr zipinfo zpool)
|
||||
jc_parsers=(--acpi --airport --airport-s --amixer --apt-cache-show --apt-get-sqq --arp --asciitable --asciitable-m --blkid --bluetoothctl --cbt --cef --cef-s --certbot --chage --cksum --clf --clf-s --crontab --crontab-u --csv --csv-s --curl-head --date --datetime-iso --debconf-show --df --dig --dir --dmidecode --dpkg-l --du --efibootmgr --email-address --env --ethtool --file --find --findmnt --finger --free --fstab --git-log --git-log-s --git-ls-remote --gpg --group --gshadow --hash --hashsum --hciconfig --history --host --hosts --http-headers --id --ifconfig --ini --ini-dup --iostat --iostat-s --ip-address --ipconfig --iptables --ip-route --iw-scan --iwconfig --jar-manifest --jobs --jwt --kv --kv-dup --last --ls --ls-s --lsattr --lsb-release --lsblk --lsmod --lsof --lspci --lsusb --m3u --mdadm --mount --mpstat --mpstat-s --needrestart --netstat --nmcli --nsd-control --ntpq --openvpn --os-prober --os-release --pacman --passwd --path --path-list --pci-ids --pgpass --pidstat --pidstat-s --ping --ping-s --pip-list --pip-show --pkg-index-apk --pkg-index-deb --plist --postconf --proc --proc-buddyinfo --proc-cmdline --proc-consoles --proc-cpuinfo --proc-crypto --proc-devices --proc-diskstats --proc-filesystems --proc-interrupts --proc-iomem --proc-ioports --proc-loadavg --proc-locks --proc-meminfo --proc-modules --proc-mtrr --proc-pagetypeinfo --proc-partitions --proc-slabinfo --proc-softirqs --proc-stat --proc-swaps --proc-uptime --proc-version --proc-vmallocinfo --proc-vmstat --proc-zoneinfo --proc-driver-rtc --proc-net-arp --proc-net-dev --proc-net-dev-mcast --proc-net-if-inet6 --proc-net-igmp --proc-net-igmp6 --proc-net-ipv6-route --proc-net-netlink --proc-net-netstat --proc-net-packet --proc-net-protocols --proc-net-route --proc-net-tcp --proc-net-unix --proc-pid-fdinfo --proc-pid-io --proc-pid-maps --proc-pid-mountinfo --proc-pid-numa-maps --proc-pid-smaps --proc-pid-stat --proc-pid-statm --proc-pid-status --ps --resolve-conf --route --rpm-qi --rsync --rsync-s --semver --sfdisk --shadow --srt --ss --ssh-conf --sshd-conf --stat --stat-s --swapon --sysctl --syslog --syslog-s --syslog-bsd --syslog-bsd-s --systemctl --systemctl-lj --systemctl-ls --systemctl-luf --systeminfo --time --timedatectl --timestamp --toml --top --top-s --tracepath --traceroute --tune2fs --udevadm --ufw --ufw-appinfo --uname --update-alt-gs --update-alt-q --upower --uptime --url --ver --veracrypt --vmstat --vmstat-s --w --wc --wg-show --who --x509-cert --x509-csr --xml --xrandr --yaml --zipinfo --zpool-iostat --zpool-status)
|
||||
jc_options=(--force-color -C --debug -d --monochrome -m --meta-out -M --pretty -p --quiet -q --raw -r --slurp -s --unbuffer -u --yaml-out -y)
|
||||
jc_about_options=(--about -a)
|
||||
jc_about_mod_options=(--pretty -p --yaml-out -y --monochrome -m --force-color -C)
|
||||
jc_help_options=(--help -h)
|
||||
@@ -67,6 +67,12 @@ _jc()
|
||||
fi
|
||||
done
|
||||
|
||||
# if "/pr[oc]" (magic for Procfile parsers) is in the current word, complete with files/directories in the path
|
||||
if [[ "${cur}" =~ "/pr" ]]; then
|
||||
_filedir
|
||||
return 0
|
||||
fi
|
||||
|
||||
# if a parser arg is found anywhere in the line, only show options and help options
|
||||
for i in "${words[@]::${#words[@]}-1}"; do
|
||||
if [[ " ${jc_parsers[*]} " =~ " ${i} " ]]; then
|
||||
|
||||
@@ -9,48 +9,71 @@ _jc() {
|
||||
jc_help_options jc_help_options_describe \
|
||||
jc_special_options jc_special_options_describe
|
||||
|
||||
jc_commands=(acpi airport arp blkid chage cksum crontab date df dig dmidecode dpkg du env file finger free git gpg hciconfig id ifconfig iostat iptables iw jobs last lastb ls lsblk lsmod lsof lsusb md5 md5sum mount mpstat netstat nmcli ntpq pidstat ping ping6 pip pip3 postconf printenv ps route rpm rsync sfdisk sha1sum sha224sum sha256sum sha384sum sha512sum shasum ss stat sum sysctl systemctl systeminfo timedatectl top tracepath tracepath6 traceroute traceroute6 ufw uname update-alternatives upower uptime vdir vmstat w wc who xrandr zipinfo)
|
||||
jc_commands=(acpi airport amixer apt-cache apt-get arp blkid bluetoothctl cbt certbot chage cksum crontab curl date debconf-show df dig dmidecode dpkg du efibootmgr env ethtool file findmnt finger free git gpg hciconfig host id ifconfig iostat ip ipconfig iptables iw iwconfig jobs last lastb ls lsattr lsb_release lsblk lsmod lsof lspci lsusb md5 md5sum mdadm mount mpstat needrestart netstat nmcli nsd-control ntpq os-prober pacman pidstat ping ping6 pip pip3 postconf printenv ps route rpm rsync sfdisk sha1sum sha224sum sha256sum sha384sum sha512sum shasum ss ssh sshd stat sum swapon sysctl systemctl systeminfo timedatectl top tracepath tracepath6 traceroute traceroute6 tune2fs udevadm ufw uname update-alternatives upower uptime vdir veracrypt vmstat w wc wg who xrandr zipinfo zpool)
|
||||
jc_commands_describe=(
|
||||
'acpi:run "acpi" command with magic syntax.'
|
||||
'airport:run "airport" command with magic syntax.'
|
||||
'amixer:run "amixer" command with magic syntax.'
|
||||
'apt-cache:run "apt-cache" command with magic syntax.'
|
||||
'apt-get:run "apt-get" command with magic syntax.'
|
||||
'arp:run "arp" command with magic syntax.'
|
||||
'blkid:run "blkid" command with magic syntax.'
|
||||
'bluetoothctl:run "bluetoothctl" command with magic syntax.'
|
||||
'cbt:run "cbt" command with magic syntax.'
|
||||
'certbot:run "certbot" command with magic syntax.'
|
||||
'chage:run "chage" command with magic syntax.'
|
||||
'cksum:run "cksum" command with magic syntax.'
|
||||
'crontab:run "crontab" command with magic syntax.'
|
||||
'curl:run "curl" command with magic syntax.'
|
||||
'date:run "date" command with magic syntax.'
|
||||
'debconf-show:run "debconf-show" command with magic syntax.'
|
||||
'df:run "df" command with magic syntax.'
|
||||
'dig:run "dig" command with magic syntax.'
|
||||
'dmidecode:run "dmidecode" command with magic syntax.'
|
||||
'dpkg:run "dpkg" command with magic syntax.'
|
||||
'du:run "du" command with magic syntax.'
|
||||
'efibootmgr:run "efibootmgr" command with magic syntax.'
|
||||
'env:run "env" command with magic syntax.'
|
||||
'ethtool:run "ethtool" command with magic syntax.'
|
||||
'file:run "file" command with magic syntax.'
|
||||
'findmnt:run "findmnt" command with magic syntax.'
|
||||
'finger:run "finger" command with magic syntax.'
|
||||
'free:run "free" command with magic syntax.'
|
||||
'git:run "git" command with magic syntax.'
|
||||
'gpg:run "gpg" command with magic syntax.'
|
||||
'hciconfig:run "hciconfig" command with magic syntax.'
|
||||
'host:run "host" command with magic syntax.'
|
||||
'id:run "id" command with magic syntax.'
|
||||
'ifconfig:run "ifconfig" command with magic syntax.'
|
||||
'iostat:run "iostat" command with magic syntax.'
|
||||
'ip:run "ip" command with magic syntax.'
|
||||
'ipconfig:run "ipconfig" command with magic syntax.'
|
||||
'iptables:run "iptables" command with magic syntax.'
|
||||
'iw:run "iw" command with magic syntax.'
|
||||
'iwconfig:run "iwconfig" command with magic syntax.'
|
||||
'jobs:run "jobs" command with magic syntax.'
|
||||
'last:run "last" command with magic syntax.'
|
||||
'lastb:run "lastb" command with magic syntax.'
|
||||
'ls:run "ls" command with magic syntax.'
|
||||
'lsattr:run "lsattr" command with magic syntax.'
|
||||
'lsb_release:run "lsb_release" command with magic syntax.'
|
||||
'lsblk:run "lsblk" command with magic syntax.'
|
||||
'lsmod:run "lsmod" command with magic syntax.'
|
||||
'lsof:run "lsof" command with magic syntax.'
|
||||
'lspci:run "lspci" command with magic syntax.'
|
||||
'lsusb:run "lsusb" command with magic syntax.'
|
||||
'md5:run "md5" command with magic syntax.'
|
||||
'md5sum:run "md5sum" command with magic syntax.'
|
||||
'mdadm:run "mdadm" command with magic syntax.'
|
||||
'mount:run "mount" command with magic syntax.'
|
||||
'mpstat:run "mpstat" command with magic syntax.'
|
||||
'needrestart:run "needrestart" command with magic syntax.'
|
||||
'netstat:run "netstat" command with magic syntax.'
|
||||
'nmcli:run "nmcli" command with magic syntax.'
|
||||
'nsd-control:run "nsd-control" command with magic syntax.'
|
||||
'ntpq:run "ntpq" command with magic syntax.'
|
||||
'os-prober:run "os-prober" command with magic syntax.'
|
||||
'pacman:run "pacman" command with magic syntax.'
|
||||
'pidstat:run "pidstat" command with magic syntax.'
|
||||
'ping:run "ping" command with magic syntax.'
|
||||
'ping6:run "ping6" command with magic syntax.'
|
||||
@@ -70,8 +93,11 @@ _jc() {
|
||||
'sha512sum:run "sha512sum" command with magic syntax.'
|
||||
'shasum:run "shasum" command with magic syntax.'
|
||||
'ss:run "ss" command with magic syntax.'
|
||||
'ssh:run "ssh" command with magic syntax.'
|
||||
'sshd:run "sshd" command with magic syntax.'
|
||||
'stat:run "stat" command with magic syntax.'
|
||||
'sum:run "sum" command with magic syntax.'
|
||||
'swapon:run "swapon" command with magic syntax.'
|
||||
'sysctl:run "sysctl" command with magic syntax.'
|
||||
'systemctl:run "systemctl" command with magic syntax.'
|
||||
'systeminfo:run "systeminfo" command with magic syntax.'
|
||||
@@ -81,49 +107,72 @@ _jc() {
|
||||
'tracepath6:run "tracepath6" command with magic syntax.'
|
||||
'traceroute:run "traceroute" command with magic syntax.'
|
||||
'traceroute6:run "traceroute6" command with magic syntax.'
|
||||
'tune2fs:run "tune2fs" command with magic syntax.'
|
||||
'udevadm:run "udevadm" command with magic syntax.'
|
||||
'ufw:run "ufw" command with magic syntax.'
|
||||
'uname:run "uname" command with magic syntax.'
|
||||
'update-alternatives:run "update-alternatives" command with magic syntax.'
|
||||
'upower:run "upower" command with magic syntax.'
|
||||
'uptime:run "uptime" command with magic syntax.'
|
||||
'vdir:run "vdir" command with magic syntax.'
|
||||
'veracrypt:run "veracrypt" command with magic syntax.'
|
||||
'vmstat:run "vmstat" command with magic syntax.'
|
||||
'w:run "w" command with magic syntax.'
|
||||
'wc:run "wc" command with magic syntax.'
|
||||
'wg:run "wg" command with magic syntax.'
|
||||
'who:run "who" command with magic syntax.'
|
||||
'xrandr:run "xrandr" command with magic syntax.'
|
||||
'zipinfo:run "zipinfo" command with magic syntax.'
|
||||
'zpool:run "zpool" command with magic syntax.'
|
||||
)
|
||||
jc_parsers=(--acpi --airport --airport-s --arp --asciitable --asciitable-m --blkid --chage --cksum --crontab --crontab-u --csv --csv-s --date --df --dig --dir --dmidecode --dpkg-l --du --email-address --env --file --finger --free --fstab --git-log --git-log-s --gpg --group --gshadow --hash --hashsum --hciconfig --history --hosts --id --ifconfig --ini --iostat --iostat-s --iptables --iso-datetime --iw-scan --jar-manifest --jobs --jwt --kv --last --ls --ls-s --lsblk --lsmod --lsof --lsusb --m3u --mount --mpstat --mpstat-s --netstat --nmcli --ntpq --passwd --pidstat --pidstat-s --ping --ping-s --pip-list --pip-show --postconf --ps --route --rpm-qi --rsync --rsync-s --sfdisk --shadow --ss --stat --stat-s --sysctl --systemctl --systemctl-lj --systemctl-ls --systemctl-luf --systeminfo --time --timedatectl --timestamp --top --top-s --tracepath --traceroute --ufw --ufw-appinfo --uname --update-alt-gs --update-alt-q --upower --uptime --url --vmstat --vmstat-s --w --wc --who --x509-cert --xml --xrandr --yaml --zipinfo)
|
||||
jc_parsers=(--acpi --airport --airport-s --amixer --apt-cache-show --apt-get-sqq --arp --asciitable --asciitable-m --blkid --bluetoothctl --cbt --cef --cef-s --certbot --chage --cksum --clf --clf-s --crontab --crontab-u --csv --csv-s --curl-head --date --datetime-iso --debconf-show --df --dig --dir --dmidecode --dpkg-l --du --efibootmgr --email-address --env --ethtool --file --find --findmnt --finger --free --fstab --git-log --git-log-s --git-ls-remote --gpg --group --gshadow --hash --hashsum --hciconfig --history --host --hosts --http-headers --id --ifconfig --ini --ini-dup --iostat --iostat-s --ip-address --ipconfig --iptables --ip-route --iw-scan --iwconfig --jar-manifest --jobs --jwt --kv --kv-dup --last --ls --ls-s --lsattr --lsb-release --lsblk --lsmod --lsof --lspci --lsusb --m3u --mdadm --mount --mpstat --mpstat-s --needrestart --netstat --nmcli --nsd-control --ntpq --openvpn --os-prober --os-release --pacman --passwd --path --path-list --pci-ids --pgpass --pidstat --pidstat-s --ping --ping-s --pip-list --pip-show --pkg-index-apk --pkg-index-deb --plist --postconf --proc --proc-buddyinfo --proc-cmdline --proc-consoles --proc-cpuinfo --proc-crypto --proc-devices --proc-diskstats --proc-filesystems --proc-interrupts --proc-iomem --proc-ioports --proc-loadavg --proc-locks --proc-meminfo --proc-modules --proc-mtrr --proc-pagetypeinfo --proc-partitions --proc-slabinfo --proc-softirqs --proc-stat --proc-swaps --proc-uptime --proc-version --proc-vmallocinfo --proc-vmstat --proc-zoneinfo --proc-driver-rtc --proc-net-arp --proc-net-dev --proc-net-dev-mcast --proc-net-if-inet6 --proc-net-igmp --proc-net-igmp6 --proc-net-ipv6-route --proc-net-netlink --proc-net-netstat --proc-net-packet --proc-net-protocols --proc-net-route --proc-net-tcp --proc-net-unix --proc-pid-fdinfo --proc-pid-io --proc-pid-maps --proc-pid-mountinfo --proc-pid-numa-maps --proc-pid-smaps --proc-pid-stat --proc-pid-statm --proc-pid-status --ps --resolve-conf --route --rpm-qi --rsync --rsync-s --semver --sfdisk --shadow --srt --ss --ssh-conf --sshd-conf --stat --stat-s --swapon --sysctl --syslog --syslog-s --syslog-bsd --syslog-bsd-s --systemctl --systemctl-lj --systemctl-ls --systemctl-luf --systeminfo --time --timedatectl --timestamp --toml --top --top-s --tracepath --traceroute --tune2fs --udevadm --ufw --ufw-appinfo --uname --update-alt-gs --update-alt-q --upower --uptime --url --ver --veracrypt --vmstat --vmstat-s --w --wc --wg-show --who --x509-cert --x509-csr --xml --xrandr --yaml --zipinfo --zpool-iostat --zpool-status)
|
||||
jc_parsers_describe=(
|
||||
'--acpi:`acpi` command parser'
|
||||
'--airport:`airport -I` command parser'
|
||||
'--airport-s:`airport -s` command parser'
|
||||
'--amixer:`amixer` command parser'
|
||||
'--apt-cache-show:`apt-cache show` command parser'
|
||||
'--apt-get-sqq:`apt-get -sqq` command parser'
|
||||
'--arp:`arp` command parser'
|
||||
'--asciitable:ASCII and Unicode table parser'
|
||||
'--asciitable-m:multi-line ASCII and Unicode table parser'
|
||||
'--blkid:`blkid` command parser'
|
||||
'--bluetoothctl:`bluetoothctl` command parser'
|
||||
'--cbt:`cbt` (Google Bigtable) command parser'
|
||||
'--cef:CEF string parser'
|
||||
'--cef-s:CEF string streaming parser'
|
||||
'--certbot:`certbot` command parser'
|
||||
'--chage:`chage --list` command parser'
|
||||
'--cksum:`cksum` and `sum` command parser'
|
||||
'--clf:Common and Combined Log Format file parser'
|
||||
'--clf-s:Common and Combined Log Format file streaming parser'
|
||||
'--crontab:`crontab` command and file parser'
|
||||
'--crontab-u:`crontab` file parser with user support'
|
||||
'--csv:CSV file parser'
|
||||
'--csv-s:CSV file streaming parser'
|
||||
'--curl-head:`curl --head` command parser'
|
||||
'--date:`date` command parser'
|
||||
'--datetime-iso:ISO 8601 Datetime string parser'
|
||||
'--debconf-show:`debconf-show` command parser'
|
||||
'--df:`df` command parser'
|
||||
'--dig:`dig` command parser'
|
||||
'--dir:`dir` command parser'
|
||||
'--dmidecode:`dmidecode` command parser'
|
||||
'--dpkg-l:`dpkg -l` command parser'
|
||||
'--du:`du` command parser'
|
||||
'--efibootmgr:`efibootmgr` command parser'
|
||||
'--email-address:Email Address string parser'
|
||||
'--env:`env` command parser'
|
||||
'--ethtool:`ethtool` command parser'
|
||||
'--file:`file` command parser'
|
||||
'--find:`find` command parser'
|
||||
'--findmnt:`findmnt` command parser'
|
||||
'--finger:`finger` command parser'
|
||||
'--free:`free` command parser'
|
||||
'--fstab:`/etc/fstab` file parser'
|
||||
'--git-log:`git log` command parser'
|
||||
'--git-log-s:`git log` command streaming parser'
|
||||
'--git-ls-remote:`git ls-remote` command parser'
|
||||
'--gpg:`gpg --with-colons` command parser'
|
||||
'--group:`/etc/group` file parser'
|
||||
'--gshadow:`/etc/gshadow` file parser'
|
||||
@@ -131,52 +180,138 @@ _jc() {
|
||||
'--hashsum:hashsum command parser (`md5sum`, `shasum`, etc.)'
|
||||
'--hciconfig:`hciconfig` command parser'
|
||||
'--history:`history` command parser'
|
||||
'--host:`host` command parser'
|
||||
'--hosts:`/etc/hosts` file parser'
|
||||
'--http-headers:HTTP headers parser'
|
||||
'--id:`id` command parser'
|
||||
'--ifconfig:`ifconfig` command parser'
|
||||
'--ini:INI file parser'
|
||||
'--ini-dup:INI with duplicate key file parser'
|
||||
'--iostat:`iostat` command parser'
|
||||
'--iostat-s:`iostat` command streaming parser'
|
||||
'--ip-address:IPv4 and IPv6 Address string parser'
|
||||
'--ipconfig:`ipconfig` Windows command parser'
|
||||
'--iptables:`iptables` command parser'
|
||||
'--iso-datetime:ISO 8601 Datetime string parser'
|
||||
'--ip-route:`ip route` command parser'
|
||||
'--iw-scan:`iw dev [device] scan` command parser'
|
||||
'--jar-manifest:MANIFEST.MF file parser'
|
||||
'--iwconfig:`iwconfig` command parser'
|
||||
'--jar-manifest:Java MANIFEST.MF file parser'
|
||||
'--jobs:`jobs` command parser'
|
||||
'--jwt:JWT string parser'
|
||||
'--kv:Key/Value file parser'
|
||||
'--kv:Key/Value file and string parser'
|
||||
'--kv-dup:Key/Value with duplicate key file and string parser'
|
||||
'--last:`last` and `lastb` command parser'
|
||||
'--ls:`ls` command parser'
|
||||
'--ls-s:`ls` command streaming parser'
|
||||
'--lsattr:`lsattr` command parser'
|
||||
'--lsb-release:`lsb_release` command parser'
|
||||
'--lsblk:`lsblk` command parser'
|
||||
'--lsmod:`lsmod` command parser'
|
||||
'--lsof:`lsof` command parser'
|
||||
'--lspci:`lspci -mmv` command parser'
|
||||
'--lsusb:`lsusb` command parser'
|
||||
'--m3u:M3U and M3U8 file parser'
|
||||
'--mdadm:`mdadm` command parser'
|
||||
'--mount:`mount` command parser'
|
||||
'--mpstat:`mpstat` command parser'
|
||||
'--mpstat-s:`mpstat` command streaming parser'
|
||||
'--needrestart:`needrestart -b` command parser'
|
||||
'--netstat:`netstat` command parser'
|
||||
'--nmcli:`nmcli` command parser'
|
||||
'--nsd-control:`nsd-control` command parser'
|
||||
'--ntpq:`ntpq -p` command parser'
|
||||
'--openvpn:openvpn-status.log file parser'
|
||||
'--os-prober:`os-prober` command parser'
|
||||
'--os-release:`/etc/os-release` file parser'
|
||||
'--pacman:`pacman` command parser'
|
||||
'--passwd:`/etc/passwd` file parser'
|
||||
'--pidstat:`pidstat -h` command parser'
|
||||
'--pidstat-s:`pidstat -h` command streaming parser'
|
||||
'--path:POSIX path string parser'
|
||||
'--path-list:POSIX path list string parser'
|
||||
'--pci-ids:`pci.ids` file parser'
|
||||
'--pgpass:PostgreSQL password file parser'
|
||||
'--pidstat:`pidstat -H` command parser'
|
||||
'--pidstat-s:`pidstat -H` command streaming parser'
|
||||
'--ping:`ping` and `ping6` command parser'
|
||||
'--ping-s:`ping` and `ping6` command streaming parser'
|
||||
'--pip-list:`pip list` command parser'
|
||||
'--pip-show:`pip show` command parser'
|
||||
'--pkg-index-apk:Alpine Linux Package Index file parser'
|
||||
'--pkg-index-deb:Debian Package Index file parser'
|
||||
'--plist:PLIST file parser'
|
||||
'--postconf:`postconf -M` command parser'
|
||||
'--proc:`/proc/` file parser'
|
||||
'--proc-buddyinfo:`/proc/buddyinfo` file parser'
|
||||
'--proc-cmdline:`/proc/cmdline` file parser'
|
||||
'--proc-consoles:`/proc/consoles` file parser'
|
||||
'--proc-cpuinfo:`/proc/cpuinfo` file parser'
|
||||
'--proc-crypto:`/proc/crypto` file parser'
|
||||
'--proc-devices:`/proc/devices` file parser'
|
||||
'--proc-diskstats:`/proc/diskstats` file parser'
|
||||
'--proc-filesystems:`/proc/filesystems` file parser'
|
||||
'--proc-interrupts:`/proc/interrupts` file parser'
|
||||
'--proc-iomem:`/proc/iomem` file parser'
|
||||
'--proc-ioports:`/proc/ioports` file parser'
|
||||
'--proc-loadavg:`/proc/loadavg` file parser'
|
||||
'--proc-locks:`/proc/locks` file parser'
|
||||
'--proc-meminfo:`/proc/meminfo` file parser'
|
||||
'--proc-modules:`/proc/modules` file parser'
|
||||
'--proc-mtrr:`/proc/mtrr` file parser'
|
||||
'--proc-pagetypeinfo:`/proc/pagetypeinfo` file parser'
|
||||
'--proc-partitions:`/proc/partitions` file parser'
|
||||
'--proc-slabinfo:`/proc/slabinfo` file parser'
|
||||
'--proc-softirqs:`/proc/softirqs` file parser'
|
||||
'--proc-stat:`/proc/stat` file parser'
|
||||
'--proc-swaps:`/proc/swaps` file parser'
|
||||
'--proc-uptime:`/proc/uptime` file parser'
|
||||
'--proc-version:`/proc/version` file parser'
|
||||
'--proc-vmallocinfo:`/proc/vmallocinfo` file parser'
|
||||
'--proc-vmstat:`/proc/vmstat` file parser'
|
||||
'--proc-zoneinfo:`/proc/zoneinfo` file parser'
|
||||
'--proc-driver-rtc:`/proc/driver/rtc` file parser'
|
||||
'--proc-net-arp:`/proc/net/arp` file parser'
|
||||
'--proc-net-dev:`/proc/net/dev` file parser'
|
||||
'--proc-net-dev-mcast:`/proc/net/dev_mcast` file parser'
|
||||
'--proc-net-if-inet6:`/proc/net/if_inet6` file parser'
|
||||
'--proc-net-igmp:`/proc/net/igmp` file parser'
|
||||
'--proc-net-igmp6:`/proc/net/igmp6` file parser'
|
||||
'--proc-net-ipv6-route:`/proc/net/ipv6_route` file parser'
|
||||
'--proc-net-netlink:`/proc/net/netlink` file parser'
|
||||
'--proc-net-netstat:`/proc/net/netstat` file parser'
|
||||
'--proc-net-packet:`/proc/net/packet` file parser'
|
||||
'--proc-net-protocols:`/proc/net/protocols` file parser'
|
||||
'--proc-net-route:`/proc/net/route` file parser'
|
||||
'--proc-net-tcp:`/proc/net/tcp` and `/proc/net/tcp6` file parser'
|
||||
'--proc-net-unix:`/proc/net/unix` file parser'
|
||||
'--proc-pid-fdinfo:`/proc/<pid>/fdinfo/<fd>` file parser'
|
||||
'--proc-pid-io:`/proc/<pid>/io` file parser'
|
||||
'--proc-pid-maps:`/proc/<pid>/maps` file parser'
|
||||
'--proc-pid-mountinfo:`/proc/<pid>/mountinfo` file parser'
|
||||
'--proc-pid-numa-maps:`/proc/<pid>/numa_maps` file parser'
|
||||
'--proc-pid-smaps:`/proc/<pid>/smaps` file parser'
|
||||
'--proc-pid-stat:`/proc/<pid>/stat` file parser'
|
||||
'--proc-pid-statm:`/proc/<pid>/statm` file parser'
|
||||
'--proc-pid-status:`/proc/<pid>/status` file parser'
|
||||
'--ps:`ps` command parser'
|
||||
'--resolve-conf:`/etc/resolve.conf` file parser'
|
||||
'--route:`route` command parser'
|
||||
'--rpm-qi:`rpm -qi` command parser'
|
||||
'--rsync:`rsync` command parser'
|
||||
'--rsync-s:`rsync` command streaming parser'
|
||||
'--semver:Semantic Version string parser'
|
||||
'--sfdisk:`sfdisk` command parser'
|
||||
'--shadow:`/etc/shadow` file parser'
|
||||
'--srt:SRT file parser'
|
||||
'--ss:`ss` command parser'
|
||||
'--ssh-conf:`ssh` config file and `ssh -G` command parser'
|
||||
'--sshd-conf:`sshd` config file and `sshd -T` command parser'
|
||||
'--stat:`stat` command parser'
|
||||
'--stat-s:`stat` command streaming parser'
|
||||
'--swapon:`swapon` command parser'
|
||||
'--sysctl:`sysctl` command parser'
|
||||
'--syslog:Syslog RFC 5424 string parser'
|
||||
'--syslog-s:Syslog RFC 5424 string streaming parser'
|
||||
'--syslog-bsd:Syslog RFC 3164 string parser'
|
||||
'--syslog-bsd-s:Syslog RFC 3164 string streaming parser'
|
||||
'--systemctl:`systemctl` command parser'
|
||||
'--systemctl-lj:`systemctl list-jobs` command parser'
|
||||
'--systemctl-ls:`systemctl list-sockets` command parser'
|
||||
@@ -184,11 +319,14 @@ _jc() {
|
||||
'--systeminfo:`systeminfo` command parser'
|
||||
'--time:`/usr/bin/time` command parser'
|
||||
'--timedatectl:`timedatectl status` command parser'
|
||||
'--timestamp:UNIX Epoch Timestamp string parser'
|
||||
'--timestamp:Unix Epoch Timestamp string parser'
|
||||
'--toml:TOML file parser'
|
||||
'--top:`top -b` command parser'
|
||||
'--top-s:`top -b` command streaming parser'
|
||||
'--tracepath:`tracepath` and `tracepath6` command parser'
|
||||
'--traceroute:`traceroute` and `traceroute6` command parser'
|
||||
'--tune2fs:`tune2fs -l` command parser'
|
||||
'--udevadm:`udevadm info` command parser'
|
||||
'--ufw:`ufw status` command parser'
|
||||
'--ufw-appinfo:`ufw app info [application]` command parser'
|
||||
'--uname:`uname -a` command parser'
|
||||
@@ -197,31 +335,41 @@ _jc() {
|
||||
'--upower:`upower` command parser'
|
||||
'--uptime:`uptime` command parser'
|
||||
'--url:URL string parser'
|
||||
'--ver:Version string parser'
|
||||
'--veracrypt:`veracrypt` command parser'
|
||||
'--vmstat:`vmstat` command parser'
|
||||
'--vmstat-s:`vmstat` command streaming parser'
|
||||
'--w:`w` command parser'
|
||||
'--wc:`wc` command parser'
|
||||
'--wg-show:`wg show` command parser'
|
||||
'--who:`who` command parser'
|
||||
'--x509-cert:X.509 PEM and DER certificate file parser'
|
||||
'--x509-csr:X.509 PEM and DER certificate request file parser'
|
||||
'--xml:XML file parser'
|
||||
'--xrandr:`xrandr` command parser'
|
||||
'--yaml:YAML file parser'
|
||||
'--zipinfo:`zipinfo` command parser'
|
||||
'--zpool-iostat:`zpool iostat` command parser'
|
||||
'--zpool-status:`zpool status` command parser'
|
||||
)
|
||||
jc_options=(--force-color -C --debug -d --monochrome -m --pretty -p --quiet -q --raw -r --unbuffer -u --yaml-out -y)
|
||||
jc_options=(--force-color -C --debug -d --monochrome -m --meta-out -M --pretty -p --quiet -q --raw -r --slurp -s --unbuffer -u --yaml-out -y)
|
||||
jc_options_describe=(
|
||||
'--force-color:force color output even when using pipes (overrides -m)'
|
||||
'-C:force color output even when using pipes (overrides -m)'
|
||||
'--force-color:force color output (overrides -m)'
|
||||
'-C:force color output (overrides -m)'
|
||||
'--debug:debug (double for verbose debug)'
|
||||
'-d:debug (double for verbose debug)'
|
||||
'--monochrome:monochrome output'
|
||||
'-m:monochrome output'
|
||||
'--meta-out:add metadata to output including timestamp, etc.'
|
||||
'-M:add metadata to output including timestamp, etc.'
|
||||
'--pretty:pretty print output'
|
||||
'-p:pretty print output'
|
||||
'--quiet:suppress warnings (double to ignore streaming errors)'
|
||||
'-q:suppress warnings (double to ignore streaming errors)'
|
||||
'--raw:raw output'
|
||||
'-r:raw output'
|
||||
'--slurp:slurp multiple lines into an array'
|
||||
'-s:slurp multiple lines into an array'
|
||||
'--unbuffer:unbuffer output'
|
||||
'-u:unbuffer output'
|
||||
'--yaml-out:YAML output'
|
||||
@@ -240,8 +388,8 @@ _jc() {
|
||||
'-y:YAML output'
|
||||
'--monochrome:monochrome output'
|
||||
'-m:monochrome output'
|
||||
'--force-color:force color output even when using pipes (overrides -m)'
|
||||
'-C:force color output even when using pipes (overrides -m)'
|
||||
'--force-color:force color output (overrides -m)'
|
||||
'-C:force color output (overrides -m)'
|
||||
)
|
||||
jc_help_options=(--help -h)
|
||||
jc_help_options_describe=(
|
||||
@@ -315,6 +463,13 @@ _jc() {
|
||||
fi
|
||||
done
|
||||
|
||||
# if "/pr[oc]" (magic for Procfile parsers) is in the current word, complete with files/directories in the path
|
||||
if [[ "${words[-1]}" =~ "/pr" ]]; then
|
||||
# run files completion
|
||||
_files
|
||||
return 0
|
||||
fi
|
||||
|
||||
# if a parser arg is found anywhere in the line, only show options and help options
|
||||
for i in ${words:0:-1}; do
|
||||
if (( $jc_parsers[(Ie)${i}] )); then
|
||||
|
||||
86
doc2md.py
Executable file
86
doc2md.py
Executable file
@@ -0,0 +1,86 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
"""
|
||||
Convert parser doc string to markdown
|
||||
"""
|
||||
import sys
|
||||
import importlib
|
||||
from inspect import isfunction, signature, cleandoc
|
||||
import yapf # type: ignore
|
||||
|
||||
ignore_lib_functions = [
|
||||
'cast',
|
||||
'wraps',
|
||||
'lru_cache',
|
||||
'namedtuple'
|
||||
]
|
||||
|
||||
mod_path = sys.argv[1]
|
||||
mod_name = mod_path.split('.')[-1]
|
||||
module = importlib.import_module(f'{mod_path}')
|
||||
|
||||
######## HEADER ########
|
||||
header = f'''[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="{mod_path}"></a>
|
||||
|
||||
# {mod_path}
|
||||
'''
|
||||
|
||||
summary = module.__doc__ or ''
|
||||
|
||||
functions = []
|
||||
for attribute in dir(module):
|
||||
if isfunction(getattr(module, attribute)) \
|
||||
and not getattr(module, attribute).__name__.startswith('_'):
|
||||
|
||||
if 'jc.parsers.' in mod_path and not 'universal' in mod_path:
|
||||
if attribute == 'parse':
|
||||
functions.append(attribute)
|
||||
|
||||
else:
|
||||
if not attribute in ignore_lib_functions:
|
||||
functions.append(attribute)
|
||||
|
||||
######## TABLE OF CONTENTS ########
|
||||
toc = f'## Table of Contents\n\n* [{mod_path}](#{mod_path})\n'
|
||||
for api in functions:
|
||||
toc = f'{toc} * [{api}](#{mod_path}.{api})\n'
|
||||
|
||||
######## API DOCS ########
|
||||
api_docs = ''
|
||||
for api in functions:
|
||||
api_function = getattr(module, api)
|
||||
|
||||
this_header = f'<a id="{mod_path}.{api}"></a>\n\n### {api}\n'
|
||||
this_sig = str(signature(api_function))
|
||||
formatted_sig = yapf.yapf_api.FormatCode(f'def {api_function.__name__}{this_sig}:\n pass' )
|
||||
formatted_sig = formatted_sig[0].split(':\n pass')[0]
|
||||
this_name_and_sig = f'{this_header}\n```python\n{formatted_sig}\n```'
|
||||
|
||||
this_doc = cleandoc(api_function.__doc__)
|
||||
api_docs = api_docs + this_name_and_sig + '\n\n' + this_doc + '\n\n'
|
||||
|
||||
######## FOOTER ########
|
||||
footer = ''
|
||||
if 'jc.parsers.' in mod_path and not 'universal' in mod_path:
|
||||
footer = '### Parser Information\n'
|
||||
comp = ', '.join(module.info.compatible)
|
||||
ver = module.info.version
|
||||
author = module.info.author
|
||||
author_email = module.info.author_email
|
||||
slurpable = 'slurpable' in module.info.tags
|
||||
footer = footer + f'Compatibility: {comp}\n\n'
|
||||
footer = footer + f'Source: [`jc/parsers/{mod_name}.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/{mod_name}.py)\n\n'
|
||||
if slurpable:
|
||||
footer = footer + 'This parser can be used with the `--slurp` command-line option.\n\n'
|
||||
footer = footer + f'Version {ver} by {author} ({author_email})'
|
||||
|
||||
final_doc = ''
|
||||
if 'jc.parsers.' in mod_path and not 'universal' in mod_path:
|
||||
final_doc = header + '\n' + summary + '\n' + api_docs + footer
|
||||
elif mod_path == 'jc':
|
||||
final_doc = header + '\n' + summary
|
||||
else:
|
||||
final_doc = header + '\n' + toc + '\n' + summary + '\n\n' + api_docs
|
||||
|
||||
print(final_doc)
|
||||
111
docgen.sh
111
docgen.sh
@@ -1,104 +1,32 @@
|
||||
#!/bin/bash
|
||||
# Generate docs.md
|
||||
# requires pydoc-markdown 4.6.1
|
||||
readme_config=$(cat <<'EOF'
|
||||
{
|
||||
"processors": [
|
||||
{
|
||||
"type": "filter"
|
||||
},
|
||||
{
|
||||
"type": "pydocmd"
|
||||
}
|
||||
],
|
||||
"renderer": {
|
||||
"type": "markdown",
|
||||
"header_level_by_type": {
|
||||
"Module": 1,
|
||||
"Class": 3,
|
||||
"Method": 3,
|
||||
"Function": 3,
|
||||
"Variable": 3
|
||||
}
|
||||
}
|
||||
}
|
||||
EOF
|
||||
)
|
||||
|
||||
toc_config=$(cat <<'EOF'
|
||||
{
|
||||
"processors": [
|
||||
{
|
||||
"type": "filter"
|
||||
},
|
||||
{
|
||||
"type": "pydocmd"
|
||||
}
|
||||
],
|
||||
"renderer": {
|
||||
"type": "markdown",
|
||||
"render_toc": true,
|
||||
"header_level_by_type": {
|
||||
"Module": 1,
|
||||
"Class": 3,
|
||||
"Method": 3,
|
||||
"Function": 3,
|
||||
"Variable": 3
|
||||
}
|
||||
}
|
||||
}
|
||||
EOF
|
||||
)
|
||||
|
||||
parser_config=$(cat <<'EOF'
|
||||
{
|
||||
"processors": [
|
||||
{
|
||||
"type": "filter",
|
||||
"expression": "not name == \"info\" and not name.startswith(\"_\") and default()"
|
||||
},
|
||||
{
|
||||
"type": "pydocmd"
|
||||
}
|
||||
],
|
||||
"renderer": {
|
||||
"type": "markdown",
|
||||
"header_level_by_type": {
|
||||
"Module": 1,
|
||||
"Class": 3,
|
||||
"Method": 3,
|
||||
"Function": 3,
|
||||
"Variable": 3
|
||||
}
|
||||
}
|
||||
}
|
||||
EOF
|
||||
)
|
||||
# Generate markdown document files (*.md)
|
||||
# Requires the yapf python library
|
||||
# use ./docgen all to generate all docs
|
||||
|
||||
cd jc
|
||||
(
|
||||
echo Building docs for: package
|
||||
pydoc-markdown -m jc "${readme_config}" > ../docs/readme.md; echo "+++ package docs complete"
|
||||
../doc2md.py jc > ../docs/readme.md && echo "+++ package docs complete" || echo "*** PACKAGE DOCS FAILED ***"
|
||||
) &
|
||||
|
||||
(
|
||||
echo Building docs for: lib
|
||||
pydoc-markdown -m jc.lib "${toc_config}" > ../docs/lib.md; echo "+++ lib docs complete"
|
||||
../doc2md.py jc.lib > ../docs/lib.md && echo "+++ lib docs complete" || echo "*** LIB DOCS FAILED ***"
|
||||
) &
|
||||
|
||||
(
|
||||
echo Building docs for: utils
|
||||
pydoc-markdown -m jc.utils "${toc_config}" > ../docs/utils.md; echo "+++ utils docs complete"
|
||||
../doc2md.py jc.utils > ../docs/utils.md && echo "+++ utils docs complete" || echo "*** UTILS DOCS FAILED ***"
|
||||
) &
|
||||
|
||||
(
|
||||
echo Building docs for: streaming
|
||||
pydoc-markdown -m jc.streaming "${toc_config}" > ../docs/streaming.md; echo "+++ streaming docs complete"
|
||||
../doc2md.py jc.streaming > ../docs/streaming.md && echo "+++ streaming docs complete" || echo "*** STREAMING DOCS FAILED ***"
|
||||
) &
|
||||
|
||||
(
|
||||
echo Building docs for: universal parser
|
||||
pydoc-markdown -m jc.parsers.universal "${toc_config}" > ../docs/parsers/universal.md; echo "+++ universal parser docs complete"
|
||||
../doc2md.py jc.parsers.universal > ../docs/parsers/universal.md && echo "+++ universal parser docs complete" || echo "*** UNIVERSAL PARSER DOCS FAILED ***"
|
||||
) &
|
||||
|
||||
# a bit of inception here... jc is being used to help
|
||||
@@ -112,23 +40,14 @@ do
|
||||
parsers+=("$value")
|
||||
done < <(jc -a | jq -c '.parsers[] | select(.plugin != true)')
|
||||
|
||||
for parser in "${parsers[@]}"
|
||||
do (
|
||||
for parser in "${parsers[@]}"; do
|
||||
parser_name=$(jq -r '.name' <<< "$parser")
|
||||
compatible=$(jq -r '.compatible | join(", ")' <<< "$parser")
|
||||
version=$(jq -r '.version' <<< "$parser")
|
||||
author=$(jq -r '.author' <<< "$parser")
|
||||
author_email=$(jq -r '.author_email' <<< "$parser")
|
||||
|
||||
echo "Building docs for: ${parser_name}"
|
||||
echo "[Home](https://kellyjonbrazil.github.io/jc/)" > ../docs/parsers/"${parser_name}".md
|
||||
pydoc-markdown -m jc.parsers."${parser_name}" "${parser_config}" >> ../docs/parsers/"${parser_name}".md
|
||||
echo "### Parser Information" >> ../docs/parsers/"${parser_name}".md
|
||||
echo "Compatibility: ${compatible}" >> ../docs/parsers/"${parser_name}".md
|
||||
echo >> ../docs/parsers/"${parser_name}".md
|
||||
echo "Version ${version} by ${author} (${author_email})" >> ../docs/parsers/"${parser_name}".md
|
||||
echo "+++ ${parser_name} docs complete"
|
||||
) &
|
||||
{
|
||||
if [[ $1 == "all" ]] || ! git diff --quiet --exit-code HEAD~5 -- "parsers/${parser_name}.py"; then
|
||||
echo "Building docs for: ${parser_name}"
|
||||
../doc2md.py jc.parsers."${parser_name}" > ../docs/parsers/"${parser_name}".md && echo "+++ ${parser_name} docs complete" || echo "*** ${parser_name} DOCS FAILED ***"
|
||||
fi
|
||||
} &
|
||||
done
|
||||
wait
|
||||
echo "Document Generation Complete"
|
||||
|
||||
262
docs/lib.md
262
docs/lib.md
@@ -1,51 +1,155 @@
|
||||
# Table of Contents
|
||||
|
||||
* [jc.lib](#jc.lib)
|
||||
* [parse](#jc.lib.parse)
|
||||
* [parser\_mod\_list](#jc.lib.parser_mod_list)
|
||||
* [plugin\_parser\_mod\_list](#jc.lib.plugin_parser_mod_list)
|
||||
* [standard\_parser\_mod\_list](#jc.lib.standard_parser_mod_list)
|
||||
* [streaming\_parser\_mod\_list](#jc.lib.streaming_parser_mod_list)
|
||||
* [parser\_info](#jc.lib.parser_info)
|
||||
* [all\_parser\_info](#jc.lib.all_parser_info)
|
||||
* [get\_help](#jc.lib.get_help)
|
||||
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.lib"></a>
|
||||
|
||||
# jc.lib
|
||||
|
||||
## Table of Contents
|
||||
|
||||
* [jc.lib](#jc.lib)
|
||||
* [all_parser_info](#jc.lib.all_parser_info)
|
||||
* [get_help](#jc.lib.get_help)
|
||||
* [get_parser](#jc.lib.get_parser)
|
||||
* [parse](#jc.lib.parse)
|
||||
* [parser_info](#jc.lib.parser_info)
|
||||
* [parser_mod_list](#jc.lib.parser_mod_list)
|
||||
* [plugin_parser_mod_list](#jc.lib.plugin_parser_mod_list)
|
||||
* [slurpable_parser_mod_list](#jc.lib.slurpable_parser_mod_list)
|
||||
* [standard_parser_mod_list](#jc.lib.standard_parser_mod_list)
|
||||
* [streaming_parser_mod_list](#jc.lib.streaming_parser_mod_list)
|
||||
|
||||
jc - JSON Convert lib module
|
||||
|
||||
<a id="jc.lib.all_parser_info"></a>
|
||||
|
||||
### all_parser_info
|
||||
|
||||
```python
|
||||
def all_parser_info(
|
||||
documentation: bool = False,
|
||||
show_hidden: bool = False,
|
||||
show_deprecated: bool = False) -> List[jc.jc_types.ParserInfoType]
|
||||
```
|
||||
|
||||
Returns a list of dictionaries that includes metadata for all parser
|
||||
modules. By default only non-hidden, non-deprecated parsers are
|
||||
returned.
|
||||
|
||||
Parameters:
|
||||
|
||||
documentation: (boolean) include parser docstrings if True
|
||||
show_hidden: (boolean) also show parsers marked as hidden
|
||||
in their info metadata.
|
||||
show_deprecated: (boolean) also show parsers marked as
|
||||
deprecated in their info metadata.
|
||||
|
||||
<a id="jc.lib.get_help"></a>
|
||||
|
||||
### get_help
|
||||
|
||||
```python
|
||||
def get_help(parser_mod_name: Union[str, module]) -> None
|
||||
```
|
||||
|
||||
Show help screen for the selected parser.
|
||||
|
||||
This function will accept **module_name**, **cli-name**, and
|
||||
**--argument-name** variants of the module name string as well as a
|
||||
parser module object.
|
||||
|
||||
<a id="jc.lib.get_parser"></a>
|
||||
|
||||
### get_parser
|
||||
|
||||
```python
|
||||
def get_parser(parser_mod_name: Union[str, module]) -> module
|
||||
```
|
||||
|
||||
Return the parser module object and check that the module is a valid
|
||||
parser module.
|
||||
|
||||
Parameters:
|
||||
|
||||
parser_mod_name: (string or Name of the parser module. This
|
||||
Module) function will accept module_name,
|
||||
cli-name, and --argument-name
|
||||
variants of the module name.
|
||||
|
||||
If a Module is given and the Module
|
||||
is a valid parser Module, then the
|
||||
same Module is returned.
|
||||
|
||||
Returns:
|
||||
|
||||
Module: the parser Module object
|
||||
|
||||
Raises:
|
||||
|
||||
ModuleNotFoundError: If the Module is not found or is not a valid
|
||||
parser Module, then a ModuleNotFoundError
|
||||
exception is raised.
|
||||
|
||||
<a id="jc.lib.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
def parse(parser_mod_name: str,
|
||||
data: Union[str, bytes, Iterable[str]],
|
||||
quiet: bool = False,
|
||||
raw: bool = False,
|
||||
ignore_exceptions: bool = None,
|
||||
**kwargs) -> Union[Dict, List[Dict], Iterator[Dict]]
|
||||
def parse(
|
||||
parser_mod_name: Union[str, module],
|
||||
data: Union[str, bytes, Iterable[str]],
|
||||
quiet: bool = False,
|
||||
raw: bool = False,
|
||||
ignore_exceptions: Optional[bool] = None,
|
||||
**kwargs
|
||||
) -> Union[Dict[str, Any], List[Dict[str, Any]], Iterator[Dict[str, Any]]]
|
||||
```
|
||||
|
||||
Parse the string data using the supplied parser module.
|
||||
Parse the data (string or bytes) using the supplied parser (string or
|
||||
module object).
|
||||
|
||||
This function provides a high-level API to simplify parser use. This
|
||||
function will call built-in parsers and custom plugin parsers.
|
||||
|
||||
Example:
|
||||
Example (standard parsers):
|
||||
|
||||
>>> import jc
|
||||
>>> jc.parse('date', 'Tue Jan 18 10:23:07 PST 2022')
|
||||
{'year': 2022, 'month': 'Jan', 'month_num': 1, 'day'...}
|
||||
>>> date_obj = jc.parse('date', 'Tue Jan 18 10:23:07 PST 2022')
|
||||
>>> print(f'The year is: {date_obj["year"]}')
|
||||
The year is: 2022
|
||||
|
||||
Example (streaming parsers):
|
||||
|
||||
>>> import jc
|
||||
>>> ping_gen = jc.parse('ping_s', ping_output.splitlines())
|
||||
>>> for item in ping_gen:
|
||||
>>> print(f'Response time: {item["time_ms"]} ms')
|
||||
Response time: 102 ms
|
||||
Response time: 109 ms
|
||||
...
|
||||
|
||||
To get a list of available parser module names, use `parser_mod_list()`.
|
||||
|
||||
You can also use the lower-level parser modules directly:
|
||||
Alternatively, a parser module object can be supplied:
|
||||
|
||||
>>> import jc
|
||||
>>> jc_date = jc.get_parser('date')
|
||||
>>> date_obj = jc.parse(jc_date, 'Tue Jan 18 10:23:07 PST 2022')
|
||||
>>> print(f'The year is: {date_obj["year"]}')
|
||||
The year is: 2022
|
||||
|
||||
You can also use the parser modules directly via `get_parser()`:
|
||||
|
||||
>>> import jc
|
||||
>>> jc_date = jc.get_parser('date')
|
||||
>>> date_obj = jc_date.parse('Tue Jan 18 10:23:07 PST 2022')
|
||||
>>> print(f'The year is: {date_obj["year"]}')
|
||||
The year is: 2022
|
||||
|
||||
Finally, you can access the low-level parser modules manually:
|
||||
|
||||
>>> import jc.parsers.date
|
||||
>>> jc.parsers.date.parse('Tue Jan 18 10:23:07 PST 2022')
|
||||
>>> date_obj = jc.parsers.date.parse('Tue Jan 18 10:23:07 PST 2022')
|
||||
>>> print(f'The year is: {date_obj["year"]}')
|
||||
The year is: 2022
|
||||
|
||||
Though, accessing plugin parsers directly is a bit more cumbersome, so
|
||||
this higher-level API is recommended. Here is how you can access plugin
|
||||
@@ -62,11 +166,14 @@ parsers without this API:
|
||||
|
||||
Parameters:
|
||||
|
||||
parser_mod_name: (string) name of the parser module. This
|
||||
function will accept module_name,
|
||||
parser_mod_name: (string or name of the parser module. This
|
||||
Module) function will accept module_name,
|
||||
cli-name, and --argument-name
|
||||
variants of the module name.
|
||||
|
||||
A Module object can also be passed
|
||||
directly or via get_parser()
|
||||
|
||||
data: (string or data to parse (string or bytes for
|
||||
bytes or standard parsers, iterable of
|
||||
iterable) strings for streaming parsers)
|
||||
@@ -83,33 +190,69 @@ Returns:
|
||||
Standard Parsers: Dictionary or List of Dictionaries
|
||||
Streaming Parsers: Generator Object containing Dictionaries
|
||||
|
||||
<a id="jc.lib.parser_mod_list"></a>
|
||||
<a id="jc.lib.parser_info"></a>
|
||||
|
||||
### parser\_mod\_list
|
||||
### parser_info
|
||||
|
||||
```python
|
||||
def parser_mod_list() -> List[str]
|
||||
def parser_info(parser_mod_name: Union[str, module],
|
||||
documentation: bool = False) -> jc.jc_types.ParserInfoType
|
||||
```
|
||||
|
||||
Returns a dictionary that includes the parser module metadata.
|
||||
|
||||
Parameters:
|
||||
|
||||
parser_mod_name: (string or name of the parser module. This
|
||||
Module) function will accept module_name,
|
||||
cli-name, and --argument-name
|
||||
variants of the module name as well
|
||||
as a parser module object.
|
||||
|
||||
documentation: (boolean) include parser docstring if True
|
||||
|
||||
<a id="jc.lib.parser_mod_list"></a>
|
||||
|
||||
### parser_mod_list
|
||||
|
||||
```python
|
||||
def parser_mod_list(show_hidden: bool = False,
|
||||
show_deprecated: bool = False) -> List[str]
|
||||
```
|
||||
|
||||
Returns a list of all available parser module names.
|
||||
|
||||
<a id="jc.lib.plugin_parser_mod_list"></a>
|
||||
|
||||
### plugin\_parser\_mod\_list
|
||||
### plugin_parser_mod_list
|
||||
|
||||
```python
|
||||
def plugin_parser_mod_list() -> List[str]
|
||||
def plugin_parser_mod_list(show_hidden: bool = False,
|
||||
show_deprecated: bool = False) -> List[str]
|
||||
```
|
||||
|
||||
Returns a list of plugin parser module names. This function is a
|
||||
subset of `parser_mod_list()`.
|
||||
|
||||
<a id="jc.lib.standard_parser_mod_list"></a>
|
||||
<a id="jc.lib.slurpable_parser_mod_list"></a>
|
||||
|
||||
### standard\_parser\_mod\_list
|
||||
### slurpable_parser_mod_list
|
||||
|
||||
```python
|
||||
def standard_parser_mod_list() -> List[str]
|
||||
def slurpable_parser_mod_list(show_hidden: bool = False,
|
||||
show_deprecated: bool = False) -> List[str]
|
||||
```
|
||||
|
||||
Returns a list of slurpable parser module names. This function is a
|
||||
subset of `parser_mod_list()`.
|
||||
|
||||
<a id="jc.lib.standard_parser_mod_list"></a>
|
||||
|
||||
### standard_parser_mod_list
|
||||
|
||||
```python
|
||||
def standard_parser_mod_list(show_hidden: bool = False,
|
||||
show_deprecated: bool = False) -> List[str]
|
||||
```
|
||||
|
||||
Returns a list of standard parser module names. This function is a
|
||||
@@ -118,59 +261,14 @@ parsers.
|
||||
|
||||
<a id="jc.lib.streaming_parser_mod_list"></a>
|
||||
|
||||
### streaming\_parser\_mod\_list
|
||||
### streaming_parser_mod_list
|
||||
|
||||
```python
|
||||
def streaming_parser_mod_list() -> List[str]
|
||||
def streaming_parser_mod_list(show_hidden: bool = False,
|
||||
show_deprecated: bool = False) -> List[str]
|
||||
```
|
||||
|
||||
Returns a list of streaming parser module names. This function is a
|
||||
subset of `parser_mod_list()`.
|
||||
|
||||
<a id="jc.lib.parser_info"></a>
|
||||
|
||||
### parser\_info
|
||||
|
||||
```python
|
||||
def parser_info(parser_mod_name: str, documentation: bool = False) -> Dict
|
||||
```
|
||||
|
||||
Returns a dictionary that includes the parser module metadata.
|
||||
|
||||
Parameters:
|
||||
|
||||
parser_mod_name: (string) name of the parser module. This
|
||||
function will accept module_name,
|
||||
cli-name, and --argument-name
|
||||
variants of the module name.
|
||||
|
||||
documentation: (boolean) include parser docstring if True
|
||||
|
||||
<a id="jc.lib.all_parser_info"></a>
|
||||
|
||||
### all\_parser\_info
|
||||
|
||||
```python
|
||||
def all_parser_info(documentation: bool = False) -> List[Dict]
|
||||
```
|
||||
|
||||
Returns a list of dictionaries that includes metadata for all parser
|
||||
modules.
|
||||
|
||||
Parameters:
|
||||
|
||||
documentation: (boolean) include parser docstrings if True
|
||||
|
||||
<a id="jc.lib.get_help"></a>
|
||||
|
||||
### get\_help
|
||||
|
||||
```python
|
||||
def get_help(parser_mod_name: str) -> None
|
||||
```
|
||||
|
||||
Show help screen for the selected parser.
|
||||
|
||||
This function will accept **module_name**, **cli-name**, and
|
||||
**--argument-name** variants of the module name string.
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ Usage (cli):
|
||||
|
||||
$ acpi -V | jc --acpi
|
||||
|
||||
or
|
||||
or
|
||||
|
||||
$ jc acpi -V
|
||||
|
||||
@@ -250,4 +250,6 @@ Returns:
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
Source: [`jc/parsers/acpi.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/acpi.py)
|
||||
|
||||
Version 1.7 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
@@ -11,7 +11,7 @@ Usage (cli):
|
||||
|
||||
$ airport -I | jc --airport
|
||||
|
||||
or
|
||||
or
|
||||
|
||||
$ jc airport -I
|
||||
|
||||
@@ -103,4 +103,6 @@ Returns:
|
||||
### Parser Information
|
||||
Compatibility: darwin
|
||||
|
||||
Source: [`jc/parsers/airport.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/airport.py)
|
||||
|
||||
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.airport_s"></a>
|
||||
|
||||
# jc.parsers.airport\_s
|
||||
# jc.parsers.airport_s
|
||||
|
||||
jc - JSON Convert `airport -s` command output parser
|
||||
|
||||
@@ -11,7 +11,7 @@ Usage (cli):
|
||||
|
||||
$ airport -s | jc --airport-s
|
||||
|
||||
or
|
||||
or
|
||||
|
||||
$ jc airport -s
|
||||
|
||||
@@ -131,4 +131,6 @@ Returns:
|
||||
### Parser Information
|
||||
Compatibility: darwin
|
||||
|
||||
Source: [`jc/parsers/airport_s.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/airport_s.py)
|
||||
|
||||
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
117
docs/parsers/amixer.md
Normal file
117
docs/parsers/amixer.md
Normal file
@@ -0,0 +1,117 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.amixer"></a>
|
||||
|
||||
# jc.parsers.amixer
|
||||
|
||||
jc - JSON Convert `amixer sget` command output parser
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ amixer sget <control_name> | jc --amixer
|
||||
$ amixer sget Master | jc --amixer
|
||||
$ amixer sget Capture | jc --amixer
|
||||
$ amixer sget Speakers | jc --amixer
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('amixer', <amixer_sget_command_output>)
|
||||
|
||||
Schema:
|
||||
|
||||
{
|
||||
"control_name": string,
|
||||
"capabilities": [
|
||||
string
|
||||
],
|
||||
"playback_channels": [
|
||||
string
|
||||
],
|
||||
"limits": {
|
||||
"playback_min": integer,
|
||||
"playback_max": integer
|
||||
},
|
||||
"mono": {
|
||||
"playback_value": integer,
|
||||
"percentage": integer,
|
||||
"db": float,
|
||||
"status": boolean
|
||||
}
|
||||
}
|
||||
|
||||
Examples:
|
||||
|
||||
$ amixer sget Master | jc --amixer -p
|
||||
{
|
||||
"control_name": "Capture",
|
||||
"capabilities": [
|
||||
"cvolume",
|
||||
"cswitch"
|
||||
],
|
||||
"playback_channels": [],
|
||||
"limits": {
|
||||
"playback_min": 0,
|
||||
"playback_max": 63
|
||||
},
|
||||
"front_left": {
|
||||
"playback_value": 63,
|
||||
"percentage": 100,
|
||||
"db": 30.0,
|
||||
"status": true
|
||||
},
|
||||
"front_right": {
|
||||
"playback_value": 63,
|
||||
"percentage": 100,
|
||||
"db": 30.0,
|
||||
"status": true
|
||||
}
|
||||
}
|
||||
|
||||
$ amixer sget Master | jc --amixer -p -r
|
||||
{
|
||||
"control_name": "Master",
|
||||
"capabilities": [
|
||||
"pvolume",
|
||||
"pvolume-joined",
|
||||
"pswitch",
|
||||
"pswitch-joined"
|
||||
],
|
||||
"playback_channels": [
|
||||
"Mono"
|
||||
],
|
||||
"limits": {
|
||||
"playback_min": "0",
|
||||
"playback_max": "87"
|
||||
},
|
||||
"mono": {
|
||||
"playback_value": "87",
|
||||
"percentage": "100%",
|
||||
"db": "0.00db",
|
||||
"status": "on"
|
||||
}
|
||||
}
|
||||
|
||||
<a id="jc.parsers.amixer.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
def parse(data: str, raw: bool = False, quiet: bool = False) -> Dict
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
|
||||
Parameters:
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
Dictionary. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Source: [`jc/parsers/amixer.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/amixer.py)
|
||||
|
||||
Version 1.0 by Eden Refael (edenraf@hotmail.com)
|
||||
180
docs/parsers/apt_cache_show.md
Normal file
180
docs/parsers/apt_cache_show.md
Normal file
@@ -0,0 +1,180 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.apt_cache_show"></a>
|
||||
|
||||
# jc.parsers.apt_cache_show
|
||||
|
||||
jc - JSON Convert `apt-cache show` command parser
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ apt-cache show | jc --apt-cache-show
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('apt_cache_show', apt_cache_show_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"package": string,
|
||||
"version": string,
|
||||
"installed_size": integer,
|
||||
"maintainer": string,
|
||||
"architecture": string,
|
||||
"depends": [
|
||||
string
|
||||
],
|
||||
"pre_depends": [
|
||||
string
|
||||
],
|
||||
"recommends": [
|
||||
string
|
||||
],
|
||||
"suggests": [
|
||||
string
|
||||
],
|
||||
"conflicts": [
|
||||
string
|
||||
],
|
||||
"breaks": [
|
||||
string
|
||||
],
|
||||
"description_md5": string,
|
||||
"multi_arch": string,
|
||||
"homepage": string,
|
||||
"section": string,
|
||||
"priority": string,
|
||||
"filename": string,
|
||||
"size": integer,
|
||||
"sha256": string,
|
||||
"description": string
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
$ apt-cache show | jc --apt-cache-show -p
|
||||
[
|
||||
{
|
||||
"package": "systemd",
|
||||
"version": "247.3-6~bpo10+1",
|
||||
"installed_size": 16121,
|
||||
"maintainer": "Debian systemd Maintainers <pkg-systemd-maintaine..",
|
||||
"architecture": "amd64",
|
||||
"depends": [
|
||||
"libacl1 (>= 2.2.23)",
|
||||
"libapparmor1 (>= 2.13)",
|
||||
"libaudit1 (>= 1:2.2.1)",
|
||||
"libcap2 (>= 1:2.10)",
|
||||
"libcryptsetup12 (>= 2:2.0.1)",
|
||||
"libgnutls30 (>= 3.6.6)",
|
||||
"libgpg-error0 (>= 1.14)",
|
||||
"libip4tc0 (>= 1.6.0+snapshot20161117)",
|
||||
"libkmod2 (>= 5~)",
|
||||
"liblz4-1 (>= 0.0~r130)",
|
||||
"libmount1 (>= 2.30)",
|
||||
"libpam0g (>= 0.99.7.1)",
|
||||
"libseccomp2 (>= 2.3.1)",
|
||||
"libsystemd0 (= 247.3-6~bpo10+1)",
|
||||
"systemd-timesyncd | time-daemon",
|
||||
"util-linux (>= 2.27.1)",
|
||||
"mount (>= 2.26)",
|
||||
"adduser"
|
||||
],
|
||||
"pre_depends": [
|
||||
"libblkid1 (>= 2.24)",
|
||||
"libc6 (>= 2.28)",
|
||||
"libgcrypt20 (>= 1.8.0)",
|
||||
"liblz4-1 (>= 0.0~r122)",
|
||||
"liblzma5 (>= 5.1.1alpha+20120614)",
|
||||
"libselinux1 (>= 2.1.9)",
|
||||
"libzstd1 (>= 1.4.0)"
|
||||
],
|
||||
"recommends": [
|
||||
"dbus"
|
||||
],
|
||||
"suggests": [
|
||||
"systemd-container",
|
||||
"policykit-1"
|
||||
],
|
||||
"conflicts": [
|
||||
"consolekit",
|
||||
"libpam-ck-connector"
|
||||
],
|
||||
"breaks": [
|
||||
"python-dbusmock (<< 0.18)",
|
||||
"python3-dbusmock (<< 0.18)",
|
||||
"resolvconf (<< 1.83~)",
|
||||
"systemd-shim (<< 10-4~)",
|
||||
"udev (<< 247~)"
|
||||
],
|
||||
"description_md5": "19399579cbc0c47a303288bf15eadcd4",
|
||||
"multi_arch": "foreign",
|
||||
"homepage": "https://www.freedesktop.org/wiki/Software/systemd",
|
||||
"section": "admin",
|
||||
"priority": "important",
|
||||
"filename": "pool/main/s/systemd/systemd_247.3-6~bpo10+1_amd64.deb",
|
||||
"size": 4382056,
|
||||
"sha256": "2035450655ad02faa0f75dc952128b503e51df5795c67273c0f6...",
|
||||
"description": "system and service manager systemd is a system..."
|
||||
},
|
||||
...
|
||||
]
|
||||
|
||||
$ apt-cache show | jc --apt-cache-show -p -r
|
||||
[
|
||||
{
|
||||
"package": "systemd",
|
||||
"version": "247.3-6~bpo10+1",
|
||||
"installed_size": "16121",
|
||||
"maintainer": "Debian systemd Maintainers <pkg-systemd-maintain...",
|
||||
"architecture": "amd64",
|
||||
"depends": "libacl1 (>= 2.2.23), libapparmor1 (>= 2.13), libaud...",
|
||||
"pre_depends": "libblkid1 (>= 2.24), libc6 (>= 2.28), libgcrypt...",
|
||||
"recommends": "dbus",
|
||||
"suggests": "systemd-container, policykit-1",
|
||||
"conflicts": "consolekit, libpam-ck-connector",
|
||||
"breaks": "python-dbusmock (<< 0.18), python3-dbusmock (<< 0.18...",
|
||||
"description_md5": "19399579cbc0c47a303288bf15eadcd4",
|
||||
"multi_arch": "foreign",
|
||||
"homepage": "https://www.freedesktop.org/wiki/Software/systemd",
|
||||
"section": "admin",
|
||||
"priority": "important",
|
||||
"filename": "pool/main/s/systemd/systemd_247.3-6~bpo10+1_amd64.deb",
|
||||
"size": "4382056",
|
||||
"sha256": "2035450655ad02faa0f75dc952128b503e51df5795c67273c0f6...",
|
||||
"description": "system and service manager systemd is a system..."
|
||||
},
|
||||
...
|
||||
]
|
||||
|
||||
<a id="jc.parsers.apt_cache_show.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
def parse(data: str,
|
||||
raw: bool = False,
|
||||
quiet: bool = False) -> List[Dict[str, Any]]
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Source: [`jc/parsers/apt_cache_show.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/apt_cache_show.py)
|
||||
|
||||
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
201
docs/parsers/apt_get_sqq.md
Normal file
201
docs/parsers/apt_get_sqq.md
Normal file
@@ -0,0 +1,201 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.apt_get_sqq"></a>
|
||||
|
||||
# jc.parsers.apt_get_sqq
|
||||
|
||||
jc - JSON Convert `apt-get -sqq` command output parser
|
||||
|
||||
Requires the `-sqq` options in `apt-get`.
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ apt-get -sqq upgrade | jc --apt-get-sqq
|
||||
|
||||
or
|
||||
|
||||
$ jc apt-get -sqq full-upgrade
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('apt_get_sqq', apt_get_sqq_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"operation": string, # configure, remove, or unpack
|
||||
"package": string,
|
||||
"broken": string/null,
|
||||
"proposed_pkg_ver": string,
|
||||
"existing_pkg_ver": string/null,
|
||||
"architecture": string
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
$ apt-get -sqq upgrade | jc --apt-get-sqq -p
|
||||
[
|
||||
{
|
||||
"operation": "unpack",
|
||||
"package": "dpkg",
|
||||
"broken": "1.19.7",
|
||||
"proposed_pkg_ver": "1.19.8 Debian:10.13/oldstable",
|
||||
"existing_pkg_ver": "Debian-Security:10/oldstable",
|
||||
"architecture": "amd64"
|
||||
},
|
||||
{
|
||||
"operation": "unpack",
|
||||
"package": "dpkg",
|
||||
"broken": null,
|
||||
"proposed_pkg_ver": "1.19.8 Debian:10.13/oldstable",
|
||||
"existing_pkg_ver": "Debian-Security:10/oldstable",
|
||||
"architecture": "amd64"
|
||||
},
|
||||
{
|
||||
"operation": "configure",
|
||||
"package": "dpkg",
|
||||
"broken": "1.19.7",
|
||||
"proposed_pkg_ver": "1.19.8 Debian:10.13/oldstable",
|
||||
"existing_pkg_ver": "Debian-Security:10/oldstable",
|
||||
"architecture": "amd64"
|
||||
},
|
||||
{
|
||||
"operation": "remove",
|
||||
"package": "dpkg",
|
||||
"broken": "1.19.7",
|
||||
"proposed_pkg_ver": "1.19.8 Debian:10.13/oldstable",
|
||||
"existing_pkg_ver": "Debian-Security:10/oldstable",
|
||||
"architecture": "amd64"
|
||||
},
|
||||
{
|
||||
"operation": "unpack",
|
||||
"package": "base-files",
|
||||
"broken": "10.3+deb10u4",
|
||||
"proposed_pkg_ver": "10.3+deb10u13 Debian:10.13/oldstable",
|
||||
"existing_pkg_ver": null,
|
||||
"architecture": "amd64"
|
||||
},
|
||||
{
|
||||
"operation": "configure",
|
||||
"package": "base-files",
|
||||
"broken": null,
|
||||
"proposed_pkg_ver": "10.3+deb10u13 Debian:10.13/oldstable",
|
||||
"existing_pkg_ver": null,
|
||||
"architecture": "amd64"
|
||||
},
|
||||
{
|
||||
"operation": "unpack",
|
||||
"package": "dpkg",
|
||||
"broken": "1.19.7",
|
||||
"proposed_pkg_ver": "1.19.8 Debian:10.13/oldstable",
|
||||
"existing_pkg_ver": "Debian-Security:10/oldstable",
|
||||
"architecture": "amd64"
|
||||
},
|
||||
{
|
||||
"operation": "configure",
|
||||
"package": "dpkg",
|
||||
"broken": null,
|
||||
"proposed_pkg_ver": "1.19.8 Debian:10.13/oldstable",
|
||||
"existing_pkg_ver": "Debian-Security:10/oldstable",
|
||||
"architecture": "amd64"
|
||||
}
|
||||
]
|
||||
|
||||
$ apt-get -sqq upgrade | jc --apt-get-sqq -p -r
|
||||
[
|
||||
{
|
||||
"operation": "Inst",
|
||||
"package": "dpkg",
|
||||
"broken": "1.19.7",
|
||||
"proposed_pkg_ver": "1.19.8 Debian:10.13/oldstable",
|
||||
"existing_pkg_ver": "Debian-Security:10/oldstable",
|
||||
"architecture": "amd64"
|
||||
},
|
||||
{
|
||||
"operation": "Inst",
|
||||
"package": "dpkg",
|
||||
"broken": null,
|
||||
"proposed_pkg_ver": "1.19.8 Debian:10.13/oldstable",
|
||||
"existing_pkg_ver": "Debian-Security:10/oldstable",
|
||||
"architecture": "amd64"
|
||||
},
|
||||
{
|
||||
"operation": "Conf",
|
||||
"package": "dpkg",
|
||||
"broken": "1.19.7",
|
||||
"proposed_pkg_ver": "1.19.8 Debian:10.13/oldstable",
|
||||
"existing_pkg_ver": "Debian-Security:10/oldstable",
|
||||
"architecture": "amd64"
|
||||
},
|
||||
{
|
||||
"operation": "Remv",
|
||||
"package": "dpkg",
|
||||
"broken": "1.19.7",
|
||||
"proposed_pkg_ver": "1.19.8 Debian:10.13/oldstable",
|
||||
"existing_pkg_ver": "Debian-Security:10/oldstable",
|
||||
"architecture": "amd64"
|
||||
},
|
||||
{
|
||||
"operation": "Inst",
|
||||
"package": "base-files",
|
||||
"broken": "10.3+deb10u4",
|
||||
"proposed_pkg_ver": "10.3+deb10u13 Debian:10.13/oldstable",
|
||||
"existing_pkg_ver": null,
|
||||
"architecture": "amd64"
|
||||
},
|
||||
{
|
||||
"operation": "Conf",
|
||||
"package": "base-files",
|
||||
"broken": null,
|
||||
"proposed_pkg_ver": "10.3+deb10u13 Debian:10.13/oldstable",
|
||||
"existing_pkg_ver": null,
|
||||
"architecture": "amd64"
|
||||
},
|
||||
{
|
||||
"operation": "Inst",
|
||||
"package": "dpkg",
|
||||
"broken": "1.19.7",
|
||||
"proposed_pkg_ver": "1.19.8 Debian:10.13/oldstable",
|
||||
"existing_pkg_ver": "Debian-Security:10/oldstable",
|
||||
"architecture": "amd64"
|
||||
},
|
||||
{
|
||||
"operation": "Conf",
|
||||
"package": "dpkg",
|
||||
"broken": null,
|
||||
"proposed_pkg_ver": "1.19.8 Debian:10.13/oldstable",
|
||||
"existing_pkg_ver": "Debian-Security:10/oldstable",
|
||||
"architecture": "amd64"
|
||||
}
|
||||
]
|
||||
|
||||
<a id="jc.parsers.apt_get_sqq.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
def parse(data: str,
|
||||
raw: bool = False,
|
||||
quiet: bool = False) -> List[Dict[str, Any]]
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Source: [`jc/parsers/apt_get_sqq.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/apt_get_sqq.py)
|
||||
|
||||
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
@@ -11,7 +11,7 @@ Usage (cli):
|
||||
|
||||
$ arp | jc --arp
|
||||
|
||||
or
|
||||
or
|
||||
|
||||
$ jc arp
|
||||
|
||||
@@ -140,4 +140,6 @@ Returns:
|
||||
### Parser Information
|
||||
Compatibility: linux, aix, freebsd, darwin
|
||||
|
||||
Version 1.10 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
Source: [`jc/parsers/arp.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/arp.py)
|
||||
|
||||
Version 1.12 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
@@ -144,4 +144,6 @@ Returns:
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
|
||||
|
||||
Source: [`jc/parsers/asciitable.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/asciitable.py)
|
||||
|
||||
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.asciitable_m"></a>
|
||||
|
||||
# jc.parsers.asciitable\_m
|
||||
# jc.parsers.asciitable_m
|
||||
|
||||
jc - JSON Convert `asciitable-m` parser
|
||||
|
||||
@@ -129,4 +129,6 @@ Returns:
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
|
||||
|
||||
Source: [`jc/parsers/asciitable_m.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/asciitable_m.py)
|
||||
|
||||
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
@@ -9,7 +9,7 @@ Usage (cli):
|
||||
|
||||
$ blkid | jc --blkid
|
||||
|
||||
or
|
||||
or
|
||||
|
||||
$ jc blkid
|
||||
|
||||
@@ -143,4 +143,6 @@ Returns:
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Source: [`jc/parsers/blkid.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/blkid.py)
|
||||
|
||||
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
139
docs/parsers/bluetoothctl.md
Normal file
139
docs/parsers/bluetoothctl.md
Normal file
@@ -0,0 +1,139 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.bluetoothctl"></a>
|
||||
|
||||
# jc.parsers.bluetoothctl
|
||||
|
||||
jc - JSON Convert `bluetoothctl` command output parser
|
||||
|
||||
Supports the following `bluetoothctl` subcommands:
|
||||
- `bluetoothctl list`
|
||||
- `bluetoothctl show`
|
||||
- `bluetoothctl show <ctrl>`
|
||||
- `bluetoothctl devices`
|
||||
- `bluetoothctl info <dev>`
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ bluetoothctl info <dev> | jc --bluetoothctl
|
||||
or
|
||||
|
||||
$ jc bluetoothctl info <dev>
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('bluetoothctl', bluetoothctl_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
Because bluetoothctl is handling two main entities, controllers and devices,
|
||||
the schema is shared between them. Most of the fields are common between
|
||||
a controller and a device but there might be fields corresponding to one entity.
|
||||
|
||||
Controller:
|
||||
[
|
||||
{
|
||||
"manufacturer": string,
|
||||
"version": string,
|
||||
"name": string,
|
||||
"is_default": boolean,
|
||||
"is_public": boolean,
|
||||
"is_random": boolean,
|
||||
"address": string,
|
||||
"alias": string,
|
||||
"class": string,
|
||||
"powered": string,
|
||||
"discoverable": string,
|
||||
"discoverable_timeout": string,
|
||||
"pairable": string,
|
||||
"modalias": string,
|
||||
"discovering": string,
|
||||
"uuids": array
|
||||
}
|
||||
]
|
||||
|
||||
Device:
|
||||
[
|
||||
{
|
||||
"name": string,
|
||||
"is_public": boolean,
|
||||
"is_random": boolean,
|
||||
"address": string,
|
||||
"alias": string,
|
||||
"appearance": string,
|
||||
"class": string,
|
||||
"icon": string,
|
||||
"paired": string,
|
||||
"bonded": string,
|
||||
"trusted": string,
|
||||
"blocked": string,
|
||||
"connected": string,
|
||||
"legacy_pairing": string,
|
||||
"rssi": int,
|
||||
"txpower": int,
|
||||
"uuids": array,
|
||||
"modalias": string,
|
||||
"battery_percentage": int
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
$ bluetoothctl info EB:06:EF:62:B3:19 | jc --bluetoothctl -p
|
||||
[
|
||||
{
|
||||
"address": "22:06:33:62:B3:19",
|
||||
"is_public": true,
|
||||
"name": "TaoTronics TT-BH336",
|
||||
"alias": "TaoTronics TT-BH336",
|
||||
"class": "0x00240455",
|
||||
"icon": "audio-headset",
|
||||
"paired": "no",
|
||||
"bonded": "no",
|
||||
"trusted": "no",
|
||||
"blocked": "no",
|
||||
"connected": "no",
|
||||
"legacy_pairing": "no",
|
||||
"uuids": [
|
||||
"Advanced Audio Distribu.. (0000120d-0000-1000-8000-00805f9b34fb)",
|
||||
"Audio Sink (0000130b-0000-1000-8000-00805f9b34fb)",
|
||||
"A/V Remote Control (0000140e-0000-1000-8000-00805f9b34fb)",
|
||||
"A/V Remote Control Cont.. (0000150f-0000-1000-8000-00805f9b34fb)",
|
||||
"Handsfree (0000161e-0000-1000-8000-00805f9b34fb)",
|
||||
"Headset (00001708-0000-1000-8000-00805f9b34fb)",
|
||||
"Headset HS (00001831-0000-1000-8000-00805f9b34fb)"
|
||||
],
|
||||
"rssi": -52,
|
||||
"txpower": 4,
|
||||
"battery_percentage": 70
|
||||
}
|
||||
]
|
||||
|
||||
<a id="jc.parsers.bluetoothctl.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
def parse(data: str,
|
||||
raw: bool = False,
|
||||
quiet: bool = False) -> List[Dict[str, Any]]
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Source: [`jc/parsers/bluetoothctl.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/bluetoothctl.py)
|
||||
|
||||
Version 1.4 by Jake Ob (iakopap at gmail.com)
|
||||
127
docs/parsers/cbt.md
Normal file
127
docs/parsers/cbt.md
Normal file
@@ -0,0 +1,127 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.cbt"></a>
|
||||
|
||||
# jc.parsers.cbt
|
||||
|
||||
jc - JSON Convert `cbt` command output parser (Google Bigtable)
|
||||
|
||||
Parses the human-, but not machine-, friendly output of the cbt command (for
|
||||
Google's Bigtable).
|
||||
|
||||
No effort is made to convert the data types of the values in the cells.
|
||||
|
||||
The `timestamp_epoch` calculated timestamp field is naive. (i.e. based on
|
||||
the local time of the system the parser is run on)
|
||||
|
||||
The `timestamp_epoch_utc` calculated timestamp field is timezone-aware and
|
||||
is only available if the timestamp has a UTC timezone.
|
||||
|
||||
The `timestamp_iso` calculated timestamp field will only include UTC
|
||||
timezone information if the timestamp has a UTC timezone.
|
||||
|
||||
Raw output contains all cells for each column (including timestamps), while
|
||||
the normal output contains only the latest value for each column.
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ cbt | jc --cbt
|
||||
|
||||
or
|
||||
|
||||
$ jc cbt
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('cbt', cbt_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"key": string,
|
||||
"cells": {
|
||||
<string>: { # column family
|
||||
<string>: string # column: value
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
Schema (raw):
|
||||
|
||||
[
|
||||
{
|
||||
"key": string,
|
||||
"cells": [
|
||||
{
|
||||
"column_family": string,
|
||||
"column": string,
|
||||
"value": string,
|
||||
"timestamp_iso": string,
|
||||
"timestamp_epoch": integer,
|
||||
"timestamp_epoch_utc": integer
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
$ cbt -project=$PROJECT -instance=$INSTANCE lookup $TABLE foo | jc --cbt -p
|
||||
[
|
||||
{
|
||||
"key": "foo",
|
||||
"cells": {
|
||||
"foo": {
|
||||
"bar": "baz"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
$ cbt -project=$PROJECT -instance=$INSTANCE lookup $TABLE foo | jc --cbt -p -r
|
||||
[
|
||||
{
|
||||
"key": "foo",
|
||||
"cells": [
|
||||
{
|
||||
"column_family": "foo",
|
||||
"column": "bar",
|
||||
"value": "baz1",
|
||||
"timestamp_iso": "1970-01-01T01:00:00",
|
||||
"timestamp_epoch": 32400,
|
||||
"timestamp_epoch_utc": null
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
<a id="jc.parsers.cbt.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
def parse(data: str,
|
||||
raw: bool = False,
|
||||
quiet: bool = False) -> List[Dict[str, Any]]
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) unprocessed output 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
|
||||
|
||||
Source: [`jc/parsers/cbt.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/cbt.py)
|
||||
|
||||
Version 1.0 by Andreas Weiden (andreas.weiden@gmail.com)
|
||||
148
docs/parsers/cef.md
Normal file
148
docs/parsers/cef.md
Normal file
@@ -0,0 +1,148 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.cef"></a>
|
||||
|
||||
# jc.parsers.cef
|
||||
|
||||
jc - JSON Convert CEF string parser
|
||||
|
||||
This parser conforms to the Microfocus Arcsight CEF specification.
|
||||
|
||||
This parser will accept a single CEF string or multiple CEF string lines.
|
||||
Any text before "CEF" will be ignored. Syslog and CEF escaped characters
|
||||
(`\\`, `\\"`, `\\]`, `\\|`, `\\=`, `\\%`, `\\#`, `\\n`, and `\\r`) are
|
||||
unescaped.
|
||||
|
||||
Extended fields, as defined in the CEF specification, are relabeled
|
||||
and the values are converted to their respective types. Extra naive and
|
||||
UTC epoch timestamps are added where appropriate per the CEF specification.
|
||||
|
||||
A warning message to `STDERR` will be printed if an unparsable line is found
|
||||
unless `--quiet` or `quiet=True` is used.
|
||||
|
||||
To preserve escaping and original keynames and to prevent type conversions
|
||||
use the `--raw` CLI option or `raw=True` param in the `parse()` function.
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ echo 'CEF:0|Vendor|Product|3.2.0|1|SYSTEM|1|... | jc --cef
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('cef', cef_string_output)
|
||||
|
||||
Schema:
|
||||
|
||||
See: https://www.microfocus.com/documentation/arcsight/arcsight-smartconnectors-8.3/cef-implementation-standard/Content/CEF/Chapter%201%20What%20is%20CEF.htm
|
||||
|
||||
> Note: Special characters in key names will be converted to underscores.
|
||||
|
||||
[
|
||||
{
|
||||
"deviceVendor": string,
|
||||
"deviceProduct": string,
|
||||
"deviceVersion": string,
|
||||
"deviceEventClassId": string,
|
||||
"deviceEventClassIdNum": integer/null,
|
||||
"name": string,
|
||||
"agentSeverity": string/integer,
|
||||
"agentSeverityString": string,
|
||||
"agentSeverityNum": integer/null,
|
||||
"CEFVersion": integer,
|
||||
<extended fields> string/integer/float, # [0]
|
||||
<extended fields>"_epoch": integer/null, # [1]
|
||||
<extended fields>"_epoch_utc": integer/null, # [2]
|
||||
<custom fields> string,
|
||||
"unparsable": string # [3]
|
||||
}
|
||||
]
|
||||
|
||||
[0] Will attempt to convert extended fields to the type specified in the
|
||||
CEF specification. If conversion fails, then the field will remain
|
||||
a string.
|
||||
[1] Naive calculated epoch timestamp
|
||||
[2] Timezone-aware calculated epoch timestamp. (UTC only) This value
|
||||
will be null if a UTC timezone cannot be extracted from the original
|
||||
timestamp string value.
|
||||
[3] This field exists if the CEF line is not parsable. The value
|
||||
is the original syslog line.
|
||||
|
||||
Examples:
|
||||
|
||||
$ cat cef.log | jc --cef -p
|
||||
[
|
||||
{
|
||||
"deviceVendor": "Trend Micro",
|
||||
"deviceProduct": "Deep Security Agent",
|
||||
"deviceVersion": "<DSA version>",
|
||||
"deviceEventClassId": "4000000",
|
||||
"name": "Eicar_test_file",
|
||||
"agentSeverity": 6,
|
||||
"CEFVersion": 0,
|
||||
"dvchost": "hostname",
|
||||
"string": "hello \"world\"!",
|
||||
"start": "Nov 08 2020 12:30:00.111 UTC",
|
||||
"start_epoch": 1604867400,
|
||||
"start_epoch_utc": 1604838600,
|
||||
"Host_ID": 1,
|
||||
"Quarantine": 205,
|
||||
"myDate": "Nov 08 2022 12:30:00.111",
|
||||
"myDate_epoch": 1667939400,
|
||||
"myDate_epoch_utc": null,
|
||||
"myFloat": 3.14,
|
||||
"deviceEventClassIdNum": 4000000,
|
||||
"agentSeverityString": "Medium",
|
||||
"agentSeverityNum": 6
|
||||
}
|
||||
]
|
||||
|
||||
$ cat cef.log | jc --cef -p -r
|
||||
[
|
||||
{
|
||||
"deviceVendor": "Trend Micro",
|
||||
"deviceProduct": "Deep Security Agent",
|
||||
"deviceVersion": "<DSA version>",
|
||||
"deviceEventClassId": "4000000",
|
||||
"name": "Eicar_test_file",
|
||||
"agentSeverity": "6",
|
||||
"CEFVersion": "0",
|
||||
"cn1": "1",
|
||||
"cn1Label": "Host ID",
|
||||
"dvchost": "hostname",
|
||||
"cn2": "205",
|
||||
"cn2Label": "Quarantine",
|
||||
"string": "hello \\\"world\\\"!",
|
||||
"start": "Nov 08 2020 12:30:00.111 UTC",
|
||||
"deviceCustomDate1": "Nov 08 2022 12:30:00.111",
|
||||
"deviceCustomDate1Label": "myDate",
|
||||
"cfp1": "3.14",
|
||||
"cfp1Label": "myFloat"
|
||||
}
|
||||
]
|
||||
|
||||
<a id="jc.parsers.cef.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
def parse(data: str, raw: bool = False, quiet: bool = False) -> List[Dict]
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) unprocessed output 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
|
||||
|
||||
Source: [`jc/parsers/cef.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/cef.py)
|
||||
|
||||
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
125
docs/parsers/cef_s.md
Normal file
125
docs/parsers/cef_s.md
Normal file
@@ -0,0 +1,125 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.cef_s"></a>
|
||||
|
||||
# jc.parsers.cef_s
|
||||
|
||||
jc - JSON Convert CEF string output streaming parser
|
||||
|
||||
> This streaming parser outputs JSON Lines (cli) or returns an Iterable of
|
||||
> Dictionaries (module)
|
||||
|
||||
This parser conforms to the Microfocus Arcsight CEF specification.
|
||||
|
||||
This parser will accept a single CEF string or multiple CEF string lines.
|
||||
Any text before "CEF" will be ignored. Syslog and CEF escaped characters
|
||||
(`\\`, `\\"`, `\\]`, `\\|`, `\\=`, `\\%`, `\\#`, `\\n`, and `\\r`) are
|
||||
unescaped.
|
||||
|
||||
Extended fields, as defined in the CEF specification, are relabeled
|
||||
and the values are converted to their respective types. Extra naive and
|
||||
UTC epoch timestamps are added where appropriate per the CEF specification.
|
||||
|
||||
A warning message to `STDERR` will be printed if an unparsable line is found
|
||||
unless `--quiet` or `quiet=True` is used.
|
||||
|
||||
To preserve escaping and original keynames and to prevent type conversions
|
||||
use the `--raw` CLI option or `raw=True` param in the `parse()` function.
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ echo 'CEF:0|Vendor|Product|3.2.0|1|SYSTEM|1|... | jc --cef-s
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
|
||||
result = jc.parse('cef_s', cef_command_output.splitlines())
|
||||
for item in result:
|
||||
# do something
|
||||
|
||||
Schema:
|
||||
|
||||
See: https://www.microfocus.com/documentation/arcsight/arcsight-smartconnectors-8.3/cef-implementation-standard/Content/CEF/Chapter%201%20What%20is%20CEF.htm
|
||||
|
||||
> Note: Special characters in key names will be converted to underscores.
|
||||
|
||||
{
|
||||
"deviceVendor": string,
|
||||
"deviceProduct": string,
|
||||
"deviceVersion": string,
|
||||
"deviceEventClassId": string,
|
||||
"deviceEventClassIdNum": integer/null,
|
||||
"name": string,
|
||||
"agentSeverity": string/integer,
|
||||
"agentSeverityString": string,
|
||||
"agentSeverityNum": integer/null,
|
||||
"CEFVersion": integer,
|
||||
<extended fields> string/integer/float, # [0]
|
||||
<extended fields>"_epoch": integer/null, # [1]
|
||||
<extended fields>"_epoch_utc": integer/null, # [2]
|
||||
<custom fields> string,
|
||||
"unparsable": string # [3]
|
||||
|
||||
# below object only exists if using -qq or ignore_exceptions=True
|
||||
"_jc_meta": {
|
||||
"success": boolean, # false if error parsing
|
||||
"error": string, # exists if "success" is false
|
||||
"line": string # exists if "success" is false
|
||||
}
|
||||
}
|
||||
|
||||
[0] Will attempt to convert extended fields to the type specified in the
|
||||
CEF specification. If conversion fails, then the field will remain
|
||||
a string.
|
||||
[1] Naive calculated epoch timestamp
|
||||
[2] Timezone-aware calculated epoch timestamp. (UTC only) This value
|
||||
will be null if a UTC timezone cannot be extracted from the original
|
||||
timestamp string value.
|
||||
[3] This field exists if the CEF line is not parsable. The value
|
||||
is the original syslog line.
|
||||
|
||||
Examples:
|
||||
|
||||
$ cat cef.log | jc --cef-s
|
||||
{"deviceVendor":"Fortinet","deviceProduct":"FortiDeceptor","deviceV...}
|
||||
{"deviceVendor":"Trend Micro","deviceProduct":"Deep Security Agent"...}
|
||||
...
|
||||
|
||||
$ cat cef.log | jc --cef-s -r
|
||||
{"deviceVendor":"Fortinet","deviceProduct":"FortiDeceptor","deviceV...}
|
||||
{"deviceVendor":"Trend Micro","deviceProduct":"Deep Security Agent"...}
|
||||
...
|
||||
|
||||
<a id="jc.parsers.cef_s.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
def parse(data: Iterable[str],
|
||||
raw: bool = False,
|
||||
quiet: bool = False,
|
||||
ignore_exceptions: bool = False) -> Union[Iterable[Dict], tuple]
|
||||
```
|
||||
|
||||
Main text parsing generator function. Returns an iterable object.
|
||||
|
||||
Parameters:
|
||||
|
||||
data: (iterable) line-based text data to parse
|
||||
(e.g. sys.stdin or str.splitlines())
|
||||
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
ignore_exceptions: (boolean) ignore parsing exceptions if True
|
||||
|
||||
|
||||
Returns:
|
||||
|
||||
Iterable of Dictionaries
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
|
||||
|
||||
Source: [`jc/parsers/cef_s.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/cef_s.py)
|
||||
|
||||
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
163
docs/parsers/certbot.md
Normal file
163
docs/parsers/certbot.md
Normal file
@@ -0,0 +1,163 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.certbot"></a>
|
||||
|
||||
# jc.parsers.certbot
|
||||
|
||||
jc - JSON Convert `certbot` command output parser
|
||||
|
||||
Supports the following `certbot` commands:
|
||||
|
||||
- `certbot show_account`
|
||||
- `certbot certificates`
|
||||
|
||||
Verbose options are not supported.
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ certbot show_account | jc --certbot
|
||||
$ certbot certificates | jc --certbot
|
||||
|
||||
or
|
||||
|
||||
$ jc certbot show_account
|
||||
$ jc certbot certificates
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('certbot', certbot_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
{
|
||||
"certificates": [
|
||||
{
|
||||
"name": string,
|
||||
"serial_number": string,
|
||||
"key_type": string,
|
||||
"domains": [
|
||||
string
|
||||
],
|
||||
"expiration_date": string,
|
||||
"expiration_date_epoch": integer,
|
||||
"expiration_date_epoch_utc": integer,
|
||||
"expiration_date_iso": string,
|
||||
"validity": string,
|
||||
"certificate_path": string,
|
||||
"private_key_path": string
|
||||
}
|
||||
],
|
||||
"account": {
|
||||
"server": string,
|
||||
"url": string,
|
||||
"email": string
|
||||
}
|
||||
}
|
||||
|
||||
Examples:
|
||||
|
||||
$ certbot certificates | jc --certbot -p
|
||||
{
|
||||
"certificates": [
|
||||
{
|
||||
"name": "example.com",
|
||||
"serial_number": "3f7axxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
||||
"key_type": "RSA",
|
||||
"domains": [
|
||||
"example.com",
|
||||
"www.example.com"
|
||||
],
|
||||
"expiration_date": "2023-05-11 01:33:10+00:00",
|
||||
"validity": "63 days",
|
||||
"certificate_path": "/etc/letsencrypt/live/example.com/chain.pem",
|
||||
"private_key_path": "/etc/letsencrypt/live/example.com/priv.pem",
|
||||
"expiration_date_epoch": 1683793990,
|
||||
"expiration_date_epoch_utc": 1683768790,
|
||||
"expiration_date_iso": "2023-05-11T01:33:10+00:00"
|
||||
},
|
||||
{
|
||||
"name": "example.org",
|
||||
"serial_number": "3bcyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy",
|
||||
"key_type": "RSA",
|
||||
"domains": [
|
||||
"example.org",
|
||||
"www.example.org"
|
||||
],
|
||||
"expiration_date": "2023-06-12 01:35:30+00:00",
|
||||
"validity": "63 days",
|
||||
"certificate_path": "/etc/letsencrypt/live/example.org/chain.pem",
|
||||
"private_key_path": "/etc/letsencrypt/live/example.org/key.pem",
|
||||
"expiration_date_epoch": 1686558930,
|
||||
"expiration_date_epoch_utc": 1686533730,
|
||||
"expiration_date_iso": "2023-06-12T01:35:30+00:00"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
$ certbot certificates | jc --certbot -p -r
|
||||
{
|
||||
"certificates": [
|
||||
{
|
||||
"name": "example.com",
|
||||
"serial_number": "3f7axxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
||||
"key_type": "RSA",
|
||||
"domains": [
|
||||
"example.com",
|
||||
"www.example.com"
|
||||
],
|
||||
"expiration_date": "2023-05-11 01:33:10+00:00",
|
||||
"validity": "63 days",
|
||||
"certificate_path": "/etc/letsencrypt/live/example.com/chain.pem",
|
||||
"private_key_path": "/etc/letsencrypt/live/example.com/priv.pem"
|
||||
},
|
||||
{
|
||||
"name": "example.org",
|
||||
"serial_number": "3bcyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy",
|
||||
"key_type": "RSA",
|
||||
"domains": [
|
||||
"example.org",
|
||||
"www.example.org"
|
||||
],
|
||||
"expiration_date": "2023-06-12 01:35:30+00:00",
|
||||
"validity": "63 days",
|
||||
"certificate_path": "/etc/letsencrypt/live/example.org/chain.pem",
|
||||
"private_key_path": "/etc/letsencrypt/live/example.org/key.pem"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
$ certbot show_account | jc --certbot -p
|
||||
{
|
||||
"account": {
|
||||
"server": "https://acme-staging-v02.api.letsencrypt.org/directory",
|
||||
"url": "https://acme-staging-v02.api.letsencrypt.org/acme/acct/123",
|
||||
"email": "some@example.com"
|
||||
}
|
||||
}
|
||||
|
||||
<a id="jc.parsers.certbot.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
def parse(data: str, raw: bool = False, quiet: bool = False) -> Dict[str, Any]
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
Dictionary. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
|
||||
|
||||
Source: [`jc/parsers/certbot.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/certbot.py)
|
||||
|
||||
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
@@ -11,7 +11,7 @@ Usage (cli):
|
||||
|
||||
$ chage -l johndoe | jc --chage
|
||||
|
||||
or
|
||||
or
|
||||
|
||||
$ jc chage -l johndoe
|
||||
|
||||
@@ -79,4 +79,6 @@ Returns:
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Source: [`jc/parsers/chage.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/chage.py)
|
||||
|
||||
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
@@ -13,7 +13,7 @@ Usage (cli):
|
||||
|
||||
$ cksum file.txt | jc --cksum
|
||||
|
||||
or
|
||||
or
|
||||
|
||||
$ jc cksum file.txt
|
||||
|
||||
@@ -77,4 +77,6 @@ Returns:
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, aix, freebsd
|
||||
|
||||
Source: [`jc/parsers/cksum.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/cksum.py)
|
||||
|
||||
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
201
docs/parsers/clf.md
Normal file
201
docs/parsers/clf.md
Normal file
@@ -0,0 +1,201 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.clf"></a>
|
||||
|
||||
# jc.parsers.clf
|
||||
|
||||
jc - JSON Convert Common Log Format file parser
|
||||
|
||||
This parser will handle the Common Log Format standard as specified at
|
||||
https://www.w3.org/Daemon/User/Config/Logging.html#common-logfile-format.
|
||||
|
||||
Combined Log Format is also supported. (Referer and User Agent fields added)
|
||||
|
||||
Extra fields may be present and will be enclosed in the `extra` field as
|
||||
a single string.
|
||||
|
||||
If a log line cannot be parsed, an object with an `unparsable` field will
|
||||
be present with a value of the original line.
|
||||
|
||||
The `epoch` calculated timestamp field is naive. (i.e. based on the
|
||||
local time of the system the parser is run on)
|
||||
|
||||
The `epoch_utc` calculated timestamp field is timezone-aware and is
|
||||
only available if the timezone field is UTC.
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ cat file.log | jc --clf
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('clf', common_log_file_output)
|
||||
|
||||
Schema:
|
||||
|
||||
Empty strings and `-` values are converted to `null`/`None`.
|
||||
|
||||
[
|
||||
{
|
||||
"host": string,
|
||||
"ident": string,
|
||||
"authuser": string,
|
||||
"date": string,
|
||||
"day": integer,
|
||||
"month": string,
|
||||
"year": integer,
|
||||
"hour": integer,
|
||||
"minute": integer,
|
||||
"second": integer,
|
||||
"tz": string,
|
||||
"request": string,
|
||||
"request_method": string,
|
||||
"request_url": string,
|
||||
"request_version": string,
|
||||
"status": integer,
|
||||
"bytes": integer,
|
||||
"referer": string,
|
||||
"user_agent": string,
|
||||
"extra": string,
|
||||
"epoch": integer, # [0]
|
||||
"epoch_utc": integer, # [1]
|
||||
"unparsable": string # [2]
|
||||
}
|
||||
]
|
||||
|
||||
[0] naive timestamp
|
||||
[1] timezone-aware timestamp. Only available if timezone field is UTC
|
||||
[2] exists if the line was not able to be parsed
|
||||
|
||||
Examples:
|
||||
|
||||
$ cat file.log | jc --clf -p
|
||||
[
|
||||
{
|
||||
"host": "127.0.0.1",
|
||||
"ident": "user-identifier",
|
||||
"authuser": "frank",
|
||||
"date": "10/Oct/2000:13:55:36 -0700",
|
||||
"day": 10,
|
||||
"month": "Oct",
|
||||
"year": 2000,
|
||||
"hour": 13,
|
||||
"minute": 55,
|
||||
"second": 36,
|
||||
"tz": "-0700",
|
||||
"request": "GET /apache_pb.gif HTTPS/1.0",
|
||||
"status": 200,
|
||||
"bytes": 2326,
|
||||
"referer": null,
|
||||
"user_agent": null,
|
||||
"extra": null,
|
||||
"request_method": "GET",
|
||||
"request_url": "/apache_pb.gif",
|
||||
"request_version": "HTTPS/1.0",
|
||||
"epoch": 971211336,
|
||||
"epoch_utc": null
|
||||
},
|
||||
{
|
||||
"host": "1.1.1.2",
|
||||
"ident": null,
|
||||
"authuser": null,
|
||||
"date": "11/Nov/2016:03:04:55 +0100",
|
||||
"day": 11,
|
||||
"month": "Nov",
|
||||
"year": 2016,
|
||||
"hour": 3,
|
||||
"minute": 4,
|
||||
"second": 55,
|
||||
"tz": "+0100",
|
||||
"request": "GET /",
|
||||
"status": 200,
|
||||
"bytes": 83,
|
||||
"referer": null,
|
||||
"user_agent": null,
|
||||
"extra": "- 9221 1.1.1.1",
|
||||
"request_method": "GET",
|
||||
"request_url": "/",
|
||||
"request_version": null,
|
||||
"epoch": 1478862295,
|
||||
"epoch_utc": null
|
||||
},
|
||||
...
|
||||
]
|
||||
|
||||
$ cat file.log | jc --clf -p -r
|
||||
[
|
||||
{
|
||||
"host": "127.0.0.1",
|
||||
"ident": "user-identifier",
|
||||
"authuser": "frank",
|
||||
"date": "10/Oct/2000:13:55:36 -0700",
|
||||
"day": "10",
|
||||
"month": "Oct",
|
||||
"year": "2000",
|
||||
"hour": "13",
|
||||
"minute": "55",
|
||||
"second": "36",
|
||||
"tz": "-0700",
|
||||
"request": "GET /apache_pb.gif HTTPS/1.0",
|
||||
"status": "200",
|
||||
"bytes": "2326",
|
||||
"referer": null,
|
||||
"user_agent": null,
|
||||
"extra": "",
|
||||
"request_method": "GET",
|
||||
"request_url": "/apache_pb.gif",
|
||||
"request_version": "HTTPS/1.0"
|
||||
},
|
||||
{
|
||||
"host": "1.1.1.2",
|
||||
"ident": "-",
|
||||
"authuser": "-",
|
||||
"date": "11/Nov/2016:03:04:55 +0100",
|
||||
"day": "11",
|
||||
"month": "Nov",
|
||||
"year": "2016",
|
||||
"hour": "03",
|
||||
"minute": "04",
|
||||
"second": "55",
|
||||
"tz": "+0100",
|
||||
"request": "GET /",
|
||||
"status": "200",
|
||||
"bytes": "83",
|
||||
"referer": "-",
|
||||
"user_agent": "-",
|
||||
"extra": "- 9221 1.1.1.1",
|
||||
"request_method": "GET",
|
||||
"request_url": "/",
|
||||
"request_version": null
|
||||
},
|
||||
...
|
||||
]
|
||||
|
||||
<a id="jc.parsers.clf.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
def parse(data: str,
|
||||
raw: bool = False,
|
||||
quiet: bool = False) -> List[Dict[str, Any]]
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) unprocessed output 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
|
||||
|
||||
Source: [`jc/parsers/clf.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/clf.py)
|
||||
|
||||
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
120
docs/parsers/clf_s.md
Normal file
120
docs/parsers/clf_s.md
Normal file
@@ -0,0 +1,120 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.clf_s"></a>
|
||||
|
||||
# jc.parsers.clf_s
|
||||
|
||||
jc - JSON Convert Common Log Format file streaming parser
|
||||
|
||||
> This streaming parser outputs JSON Lines (cli) or returns an Iterable of
|
||||
> Dictionaries (module)
|
||||
|
||||
This parser will handle the Common Log Format standard as specified at
|
||||
https://www.w3.org/Daemon/User/Config/Logging.html#common-logfile-format.
|
||||
|
||||
Combined Log Format is also supported. (Referer and User Agent fields added)
|
||||
|
||||
Extra fields may be present and will be enclosed in the `extra` field as
|
||||
a single string.
|
||||
|
||||
If a log line cannot be parsed, an object with an `unparsable` field will
|
||||
be present with a value of the original line.
|
||||
|
||||
The `epoch` calculated timestamp field is naive. (i.e. based on the
|
||||
local time of the system the parser is run on)
|
||||
|
||||
The `epoch_utc` calculated timestamp field is timezone-aware and is
|
||||
only available if the timezone field is UTC.
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ cat file.log | jc --clf-s
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
|
||||
result = jc.parse('clf_s', common_log_file_output.splitlines())
|
||||
for item in result:
|
||||
# do something
|
||||
|
||||
Schema:
|
||||
|
||||
Empty strings and `-` values are converted to `null`/`None`.
|
||||
|
||||
{
|
||||
"host": string,
|
||||
"ident": string,
|
||||
"authuser": string,
|
||||
"date": string,
|
||||
"day": integer,
|
||||
"month": string,
|
||||
"year": integer,
|
||||
"hour": integer,
|
||||
"minute": integer,
|
||||
"second": integer,
|
||||
"tz": string,
|
||||
"request": string,
|
||||
"request_method": string,
|
||||
"request_url": string,
|
||||
"request_version": string,
|
||||
"status": integer,
|
||||
"bytes": integer,
|
||||
"referer": string,
|
||||
"user_agent": string,
|
||||
"extra": string,
|
||||
"epoch": integer, # [0]
|
||||
"epoch_utc": integer, # [1]
|
||||
"unparsable": string # [2]
|
||||
}
|
||||
|
||||
[0] naive timestamp
|
||||
[1] timezone-aware timestamp. Only available if timezone field is UTC
|
||||
[2] exists if the line was not able to be parsed
|
||||
|
||||
Examples:
|
||||
|
||||
$ cat file.log | jc --clf-s
|
||||
{"host":"127.0.0.1","ident":"user-identifier","authuser":"frank","...}
|
||||
{"host":"1.1.1.2","ident":null,"authuser":null,"date":"11/Nov/2016...}
|
||||
...
|
||||
|
||||
$ cat file.log | jc --clf-s -r
|
||||
{"host":"127.0.0.1","ident":"user-identifier","authuser":"frank","...}
|
||||
{"host":"1.1.1.2","ident":"-","authuser":"-","date":"11/Nov/2016:0...}
|
||||
...
|
||||
|
||||
<a id="jc.parsers.clf_s.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
def parse(
|
||||
data: Iterable[str],
|
||||
raw: bool = False,
|
||||
quiet: bool = False,
|
||||
ignore_exceptions: bool = False
|
||||
) -> Iterator[Union[Dict[str, Any], Tuple[BaseException, str]]]
|
||||
```
|
||||
|
||||
Main text parsing generator function. Returns an iterable object.
|
||||
|
||||
Parameters:
|
||||
|
||||
data: (iterable) line-based text data to parse
|
||||
(e.g. sys.stdin or str.splitlines())
|
||||
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
ignore_exceptions: (boolean) ignore parsing exceptions if True
|
||||
|
||||
|
||||
Returns:
|
||||
|
||||
Iterable of Dictionaries
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
|
||||
|
||||
Source: [`jc/parsers/clf_s.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/clf_s.py)
|
||||
|
||||
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
@@ -12,7 +12,7 @@ Usage (cli):
|
||||
|
||||
$ crontab -l | jc --crontab
|
||||
|
||||
or
|
||||
or
|
||||
|
||||
$ jc crontab -l
|
||||
|
||||
@@ -32,7 +32,6 @@ Schema:
|
||||
],
|
||||
"schedule": [
|
||||
{
|
||||
"occurrence" string,
|
||||
"minute": [
|
||||
string
|
||||
],
|
||||
@@ -196,4 +195,6 @@ Returns:
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, aix, freebsd
|
||||
|
||||
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
Source: [`jc/parsers/crontab.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/crontab.py)
|
||||
|
||||
Version 1.9 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.crontab_u"></a>
|
||||
|
||||
# jc.parsers.crontab\_u
|
||||
# jc.parsers.crontab_u
|
||||
|
||||
jc - JSON Convert `crontab -l` command output and crontab
|
||||
file parser
|
||||
@@ -29,7 +29,6 @@ Schema:
|
||||
],
|
||||
"schedule": [
|
||||
{
|
||||
"occurrence" string,
|
||||
"minute": [
|
||||
string
|
||||
],
|
||||
@@ -193,4 +192,6 @@ Returns:
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, aix, freebsd
|
||||
|
||||
Version 1.7 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
Source: [`jc/parsers/crontab_u.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/crontab_u.py)
|
||||
|
||||
Version 1.10 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
@@ -82,7 +82,9 @@ Examples:
|
||||
### parse
|
||||
|
||||
```python
|
||||
def parse(data, raw=False, quiet=False)
|
||||
def parse(data: Union[str, bytes],
|
||||
raw: bool = False,
|
||||
quiet: bool = False) -> List[Dict[str, Any]]
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@@ -100,4 +102,6 @@ Returns:
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
|
||||
|
||||
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
Source: [`jc/parsers/csv.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/csv.py)
|
||||
|
||||
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.csv_s"></a>
|
||||
|
||||
# jc.parsers.csv\_s
|
||||
# jc.parsers.csv_s
|
||||
|
||||
jc - JSON Convert `csv` file streaming parser
|
||||
|
||||
@@ -64,7 +64,6 @@ Examples:
|
||||
### parse
|
||||
|
||||
```python
|
||||
@add_jc_meta
|
||||
def parse(data, raw=False, quiet=False, ignore_exceptions=False)
|
||||
```
|
||||
|
||||
@@ -86,4 +85,6 @@ Returns:
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
|
||||
|
||||
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
Source: [`jc/parsers/csv_s.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/csv_s.py)
|
||||
|
||||
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
309
docs/parsers/curl_head.md
Normal file
309
docs/parsers/curl_head.md
Normal file
@@ -0,0 +1,309 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.curl_head"></a>
|
||||
|
||||
# jc.parsers.curl_head
|
||||
|
||||
jc - JSON Convert `curl --head` command output parser
|
||||
|
||||
This parser converts standard and verbose `curl --head` output.
|
||||
|
||||
When converting verbose output from `curl` (to gather request headers, for
|
||||
example) you will need to redirect STDERR to STDOUT with `2>&1`. The magic
|
||||
syntax will not work in this case.
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ curl --head www.example.com | jc --curl-head
|
||||
$ curl -Ivs www.example.com 2>&1 | jc --curl-head
|
||||
|
||||
or
|
||||
|
||||
$ jc curl --head www.example.com
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('curl_head', curl_head_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"_type": string, # request or response
|
||||
"_request_method": string,
|
||||
"_request_uri": string,
|
||||
"_request_version": string,
|
||||
"_response_version": string,
|
||||
"_response_status": integer,
|
||||
"_response_reason": string or null,
|
||||
"<header>": string,
|
||||
|
||||
# well-known headers:
|
||||
|
||||
"accept": [
|
||||
string
|
||||
],
|
||||
"accept-ch": [
|
||||
string
|
||||
],
|
||||
"accept-ch-lifetime": integer,
|
||||
"accept-encoding": [
|
||||
string
|
||||
],
|
||||
"accept-language": [
|
||||
string
|
||||
],
|
||||
"accept-patch": [
|
||||
string
|
||||
],
|
||||
"accept-post": [
|
||||
string
|
||||
],
|
||||
"accept-ranges": [
|
||||
string
|
||||
],
|
||||
"access-control-allow-headers": [
|
||||
string
|
||||
],
|
||||
"access-control-allow-methods": [
|
||||
string
|
||||
],
|
||||
"access-control-expose-headers": [
|
||||
string
|
||||
],
|
||||
"access-control-max-age": integer,
|
||||
"access-control-request-headers": [
|
||||
string
|
||||
],
|
||||
"age": integer,
|
||||
"allow": [
|
||||
string
|
||||
],
|
||||
"alt-svc": [
|
||||
string
|
||||
],
|
||||
"cache-control": [
|
||||
string
|
||||
],
|
||||
"clear-site-data": [
|
||||
string
|
||||
],
|
||||
"connection": [
|
||||
string
|
||||
],
|
||||
"content-encoding": [
|
||||
string
|
||||
],
|
||||
"content-dpr": integer,
|
||||
"content-language": [
|
||||
string
|
||||
],
|
||||
"content-length": integer,
|
||||
"content-security-policy": [
|
||||
string
|
||||
],
|
||||
"content-security-policy-report-only": [
|
||||
string
|
||||
],
|
||||
"cookie": [
|
||||
string
|
||||
],
|
||||
"critical-ch": [
|
||||
string
|
||||
],
|
||||
"date": string,
|
||||
"date_epoch_utc": integer,
|
||||
"expect-ct": [
|
||||
string
|
||||
],
|
||||
"expires": string,
|
||||
"expires_epoch_utc": integer,
|
||||
"device-memory": integer,
|
||||
"downlink": integer,
|
||||
"dpr": integer,
|
||||
"forwarded": [
|
||||
string
|
||||
],
|
||||
"if-match": [
|
||||
string
|
||||
],
|
||||
"if-modified-since": string,
|
||||
"if-modified-since_epoch_utc": integer,
|
||||
"if-none-match": [
|
||||
string
|
||||
],
|
||||
"if-range": string,
|
||||
"if-range_epoch_utc": integer,
|
||||
"if-unmodified-since": string,
|
||||
"if-unmodified-since_epoch_utc": integer,
|
||||
"im": [
|
||||
string
|
||||
],
|
||||
"keep-alive": [
|
||||
string
|
||||
],
|
||||
"large-allocation": integer,
|
||||
"last-modified": string,
|
||||
"last-modified_epoch_utc": integer,
|
||||
"link": [
|
||||
string
|
||||
],
|
||||
"max-forwards": integer,
|
||||
"memento-datetime": string,
|
||||
"memento-datetime_epoch_utc": integer,
|
||||
"permissions-policy": [
|
||||
string
|
||||
],
|
||||
"permissions-policy-report-only": [
|
||||
string
|
||||
],
|
||||
"pragma": [
|
||||
string
|
||||
],
|
||||
"proxy-authenticate": [
|
||||
string
|
||||
],
|
||||
"reporting-endpoints": [
|
||||
string
|
||||
],
|
||||
"retry-after": string,
|
||||
"retry-after_epoch_utc": integer,
|
||||
"rtt": integer,
|
||||
"sec-ch-ua": [
|
||||
string
|
||||
],
|
||||
"sec-ch-ua-full-version-list": [
|
||||
string
|
||||
],
|
||||
"server": [
|
||||
string
|
||||
],
|
||||
"server-timing": [
|
||||
string
|
||||
],
|
||||
"set-cookie": [
|
||||
string
|
||||
],
|
||||
"timing-allow-origin": [
|
||||
string
|
||||
],
|
||||
"trailer": [
|
||||
string
|
||||
],
|
||||
"transfer-encoding": [
|
||||
string
|
||||
],
|
||||
"upgrade": [
|
||||
string
|
||||
],
|
||||
"upgrade-insecure-requests": integer,
|
||||
"vary": [
|
||||
string
|
||||
],
|
||||
"via": [
|
||||
string
|
||||
],
|
||||
"warning": [
|
||||
string
|
||||
],
|
||||
"www-authenticate": [
|
||||
string
|
||||
],
|
||||
"x-cache-hits": [
|
||||
integer
|
||||
],
|
||||
"x-content-duration": float
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
$ curl --head www.example.com | jc --curl-head -p
|
||||
[
|
||||
{
|
||||
"_type": "response",
|
||||
"_response_version": "HTTP/1.1",
|
||||
"_response_status": 200,
|
||||
"_response_reason": [
|
||||
"OK"
|
||||
],
|
||||
"accept-ranges": [
|
||||
"bytes"
|
||||
],
|
||||
"age": 241144,
|
||||
"cache-control": [
|
||||
"max-age=604800"
|
||||
],
|
||||
"content-type": "text/html; charset=UTF-8",
|
||||
"date": "Sun, 04 Feb 2024 23:26:29 GMT",
|
||||
"etag": "\"3147526947\"",
|
||||
"expires": "Sun, 11 Feb 2024 23:26:29 GMT",
|
||||
"last-modified": "Thu, 17 Oct 2019 07:18:26 GMT",
|
||||
"server": [
|
||||
"ECS (sac/2508)"
|
||||
],
|
||||
"x-cache": "HIT",
|
||||
"content-length": 1256,
|
||||
"date_epoch_utc": 1707089189,
|
||||
"expires_epoch_utc": 1707693989,
|
||||
"last-modified_epoch_utc": 1571296706
|
||||
}
|
||||
]
|
||||
|
||||
$ curl --head www.example.com | jc --curl-head -p -r
|
||||
[
|
||||
{
|
||||
"_type": "response",
|
||||
"_response_version": "HTTP/1.1",
|
||||
"_response_status": 200,
|
||||
"_response_reason": [
|
||||
"OK"
|
||||
],
|
||||
"accept-ranges": [
|
||||
"bytes"
|
||||
],
|
||||
"age": "225102",
|
||||
"cache-control": [
|
||||
"max-age=604800"
|
||||
],
|
||||
"content-type": "text/html; charset=UTF-8",
|
||||
"date": "Sun, 04 Feb 2024 23:28:17 GMT",
|
||||
"etag": "\"3147526947\"",
|
||||
"expires": "Sun, 11 Feb 2024 23:28:17 GMT",
|
||||
"last-modified": "Thu, 17 Oct 2019 07:18:26 GMT",
|
||||
"server": [
|
||||
"ECS (sac/2575)"
|
||||
],
|
||||
"x-cache": "HIT",
|
||||
"content-length": "1256"
|
||||
}
|
||||
]
|
||||
|
||||
<a id="jc.parsers.curl_head.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
def parse(data: str,
|
||||
raw: bool = False,
|
||||
quiet: bool = False) -> List[Dict[str, Any]]
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) unprocessed output 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
|
||||
|
||||
Source: [`jc/parsers/curl_head.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/curl_head.py)
|
||||
|
||||
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
@@ -15,7 +15,7 @@ Usage (cli):
|
||||
|
||||
$ date | jc --date
|
||||
|
||||
or
|
||||
or
|
||||
|
||||
$ jc date
|
||||
|
||||
@@ -100,4 +100,8 @@ Returns:
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, freebsd
|
||||
|
||||
Version 2.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
Source: [`jc/parsers/date.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/date.py)
|
||||
|
||||
This parser can be used with the `--slurp` command-line option.
|
||||
|
||||
Version 2.6 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.iso_datetime"></a>
|
||||
<a id="jc.parsers.datetime_iso"></a>
|
||||
|
||||
# jc.parsers.iso\_datetime
|
||||
# jc.parsers.datetime_iso
|
||||
|
||||
jc - JSON Convert ISO 8601 Datetime string parser
|
||||
|
||||
This parser supports standard ISO 8601 strings that include both date and
|
||||
time. If no timezone or offset information is available in the sring, then
|
||||
time. If no timezone or offset information is available in the string, then
|
||||
UTC timezone is used.
|
||||
|
||||
Usage (cli):
|
||||
@@ -65,7 +65,7 @@ Examples:
|
||||
"timestamp": 1658328765
|
||||
}
|
||||
|
||||
<a id="jc.parsers.iso_datetime.parse"></a>
|
||||
<a id="jc.parsers.datetime_iso.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
@@ -88,4 +88,8 @@ Returns:
|
||||
### Parser Information
|
||||
Compatibility: linux, aix, freebsd, darwin, win32, cygwin
|
||||
|
||||
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
Source: [`jc/parsers/datetime_iso.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/datetime_iso.py)
|
||||
|
||||
This parser can be used with the `--slurp` command-line option.
|
||||
|
||||
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
107
docs/parsers/debconf_show.md
Normal file
107
docs/parsers/debconf_show.md
Normal file
@@ -0,0 +1,107 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.debconf_show"></a>
|
||||
|
||||
# jc.parsers.debconf_show
|
||||
|
||||
jc - JSON Convert `debconf-show` command output parser
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ debconf-show onlyoffice-documentserver | jc --debconf-show
|
||||
|
||||
or
|
||||
|
||||
$ jc debconf-show onlyoffice-documentserver
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('debconf_show', debconf_show_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"asked": boolean,
|
||||
"packagename": string,
|
||||
"name": string,
|
||||
"value": string
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
$ debconf-show onlyoffice-documentserver | jc --debconf-show -p
|
||||
[
|
||||
{
|
||||
"asked": true,
|
||||
"packagename": "onlyoffice",
|
||||
"name": "jwt_secret",
|
||||
"value": "aL8ei2iereuzee7cuJ6Cahjah1ixee2ah"
|
||||
},
|
||||
{
|
||||
"asked": false,
|
||||
"packagename": "onlyoffice",
|
||||
"name": "db_pwd",
|
||||
"value": "(password omitted)"
|
||||
},
|
||||
{
|
||||
"asked": true,
|
||||
"packagename": "onlyoffice",
|
||||
"name": "rabbitmq_pwd",
|
||||
"value": "(password omitted)"
|
||||
},
|
||||
{
|
||||
"asked": true,
|
||||
"packagename": "onlyoffice",
|
||||
"name": "db_port",
|
||||
"value": "5432"
|
||||
},
|
||||
{
|
||||
"asked": true,
|
||||
"packagename": "onlyoffice",
|
||||
"name": "db_user",
|
||||
"value": "onlyoffice"
|
||||
},
|
||||
{
|
||||
"asked": true,
|
||||
"packagename": "onlyoffice",
|
||||
"name": "rabbitmq_proto",
|
||||
"value": "amqp"
|
||||
},
|
||||
{
|
||||
"asked": true,
|
||||
"packagename": "onlyoffice",
|
||||
"name": "cluster_mode",
|
||||
"value": "false"
|
||||
}
|
||||
]
|
||||
|
||||
<a id="jc.parsers.debconf_show.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
def parse(data: str,
|
||||
raw: bool = False,
|
||||
quiet: bool = False) -> List[Dict[str, Any]]
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Source: [`jc/parsers/debconf_show.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/debconf_show.py)
|
||||
|
||||
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
@@ -5,11 +5,13 @@
|
||||
|
||||
jc - JSON Convert `df` command output parser
|
||||
|
||||
Values are normalized to bytes when using `df -h`.
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ df | jc --df
|
||||
|
||||
or
|
||||
or
|
||||
|
||||
$ jc df
|
||||
|
||||
@@ -23,7 +25,7 @@ Schema:
|
||||
[
|
||||
{
|
||||
"filesystem": string,
|
||||
"size": string,
|
||||
"size": integer,
|
||||
"1k_blocks": integer,
|
||||
"512_blocks": integer,
|
||||
"used": integer,
|
||||
@@ -120,4 +122,6 @@ Returns:
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, freebsd
|
||||
|
||||
Version 1.11 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
Source: [`jc/parsers/df.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/df.py)
|
||||
|
||||
Version 2.1 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
@@ -9,6 +9,7 @@ Options supported:
|
||||
- `+noall +answer` options are supported in cases where only the answer
|
||||
information is desired.
|
||||
- `+axfr` option is supported on its own
|
||||
- `+nsid` option is supported
|
||||
|
||||
The `when_epoch` calculated timestamp field is naive. (i.e. based on the
|
||||
local time of the system the parser is run on)
|
||||
@@ -20,7 +21,7 @@ Usage (cli):
|
||||
|
||||
$ dig example.com | jc --dig
|
||||
|
||||
or
|
||||
or
|
||||
|
||||
$ jc dig example.com
|
||||
|
||||
@@ -106,7 +107,7 @@ Schema:
|
||||
]
|
||||
|
||||
[0] naive timestamp if "when" field is parsable, else null
|
||||
[1] timezone aware timestamp availabe for UTC, else null
|
||||
[1] timezone aware timestamp available for UTC, else null
|
||||
|
||||
Examples:
|
||||
|
||||
@@ -345,4 +346,6 @@ Returns:
|
||||
### Parser Information
|
||||
Compatibility: linux, aix, freebsd, darwin, win32, cygwin
|
||||
|
||||
Version 2.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
Source: [`jc/parsers/dig.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/dig.py)
|
||||
|
||||
Version 2.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
@@ -143,4 +143,6 @@ Returns:
|
||||
### Parser Information
|
||||
Compatibility: win32
|
||||
|
||||
Source: [`jc/parsers/dir.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/dir.py)
|
||||
|
||||
Version 1.6 by Rasheed Elsaleh (rasheed@rebelliondefense.com)
|
||||
|
||||
@@ -9,7 +9,7 @@ Usage (cli):
|
||||
|
||||
$ dmidecode | jc --dmidecode
|
||||
|
||||
or
|
||||
or
|
||||
|
||||
$ jc dmidecode
|
||||
|
||||
@@ -148,4 +148,6 @@ Returns:
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Source: [`jc/parsers/dmidecode.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/dmidecode.py)
|
||||
|
||||
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.dpkg_l"></a>
|
||||
|
||||
# jc.parsers.dpkg\_l
|
||||
# jc.parsers.dpkg_l
|
||||
|
||||
jc - JSON Convert `dpkg -l` command output parser
|
||||
|
||||
@@ -14,7 +14,7 @@ Usage (cli):
|
||||
|
||||
$ dpkg -l | jc --dpkg-l
|
||||
|
||||
or
|
||||
or
|
||||
|
||||
$ jc dpkg -l
|
||||
|
||||
@@ -154,4 +154,6 @@ Returns:
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Source: [`jc/parsers/dpkg_l.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/dpkg_l.py)
|
||||
|
||||
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
@@ -5,11 +5,15 @@
|
||||
|
||||
jc - JSON Convert `du` command output parser
|
||||
|
||||
The `du -h` option is not supported with the default output. If you
|
||||
would like to use `du -h` or other options that change the output, be sure
|
||||
to use `jc --raw` (cli) or `raw=True` (module).
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ du | jc --du
|
||||
|
||||
or
|
||||
or
|
||||
|
||||
$ jc du
|
||||
|
||||
@@ -110,4 +114,6 @@ Returns:
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, aix, freebsd
|
||||
|
||||
Source: [`jc/parsers/du.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/du.py)
|
||||
|
||||
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
104
docs/parsers/efibootmgr.md
Normal file
104
docs/parsers/efibootmgr.md
Normal file
@@ -0,0 +1,104 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.efibootmgr"></a>
|
||||
|
||||
# jc.parsers.efibootmgr
|
||||
|
||||
jc - JSON Convert `efibootmgr` command output parser
|
||||
|
||||
The `-v` option is also supported.
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ sudo efibootmgr | jc --efibootmgr
|
||||
$ sudo efibootmgr -v | jc --efibootmgr
|
||||
|
||||
or
|
||||
|
||||
$ sudo jc efibootmgr
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('efibootmgr', efibootmgr_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
{
|
||||
"boot_current": string,
|
||||
"timeout_seconds": integer,
|
||||
"boot_order": [
|
||||
string
|
||||
],
|
||||
mirrored_percentage_above_4g: float,
|
||||
mirror_memory_below_4gb: boolean,
|
||||
"boot_options": [
|
||||
{
|
||||
"boot_option_reference": string,
|
||||
"display_name": string,
|
||||
"uefi_device_path": string,
|
||||
"boot_option_enabled": boolean
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Examples:
|
||||
|
||||
$ sudo efibootmgr -v | jc --efibootmgr --p
|
||||
{
|
||||
"boot_current": "0002",
|
||||
"timeout_seconds": 0,
|
||||
"boot_order": [
|
||||
"0002",
|
||||
"0000",
|
||||
"0001"
|
||||
],
|
||||
"mirrored_percentage_above_4g": 0.0,
|
||||
"mirror_memory_below_4gb": false,
|
||||
"boot_options": [
|
||||
{
|
||||
"boot_option_reference": "Boot0000",
|
||||
"display_name": "WARNADO",
|
||||
"uefi_device_path": "HD(1,GPT,05b9944c-1c60-492b-a510-7bbedccdc...",
|
||||
"boot_option_enabled": true
|
||||
},
|
||||
{
|
||||
"boot_option_reference": "Boot0001",
|
||||
"display_name": "Embedded NIC 1 Port 1 Partition 1",
|
||||
"uefi_device_path": "VenHw(3a191845-5f86-4e78-8fce-c4cff59f9daa)",
|
||||
"boot_option_enabled": true
|
||||
},
|
||||
{
|
||||
"boot_option_reference": "Boot0002",
|
||||
"display_name": "opensuse-secureboot",
|
||||
"uefi_device_path": "HD(1,GPT,c5d4f69d-6fc2-48c7-acee-af3f30336...",
|
||||
"boot_option_enabled": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
<a id="jc.parsers.efibootmgr.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
def parse(data: str, raw: bool = False, quiet: bool = False) -> Dict[str, Any]
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
Dictionary. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Source: [`jc/parsers/efibootmgr.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/efibootmgr.py)
|
||||
|
||||
Version 1.0 by Yaofei Zheng (zyf26256@gmail.com, Yaofei.Zheng@dell.com)
|
||||
@@ -1,7 +1,7 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.email_address"></a>
|
||||
|
||||
# jc.parsers.email\_address
|
||||
# jc.parsers.email_address
|
||||
|
||||
jc - JSON Convert Email Address string parser
|
||||
|
||||
@@ -64,4 +64,8 @@ Returns:
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
|
||||
|
||||
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
Source: [`jc/parsers/email_address.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/email_address.py)
|
||||
|
||||
This parser can be used with the `--slurp` command-line option.
|
||||
|
||||
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
@@ -14,7 +14,7 @@ Usage (cli):
|
||||
|
||||
$ env | jc --env
|
||||
|
||||
or
|
||||
or
|
||||
|
||||
$ jc env
|
||||
|
||||
@@ -90,10 +90,12 @@ Parameters:
|
||||
|
||||
Returns:
|
||||
|
||||
Dictionary of raw structured data or
|
||||
List of Dictionaries of processed structured data
|
||||
Dictionary of raw structured data or (default)
|
||||
List of Dictionaries of processed structured data (raw)
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
|
||||
|
||||
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
Source: [`jc/parsers/env.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/env.py)
|
||||
|
||||
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
197
docs/parsers/ethtool.md
Normal file
197
docs/parsers/ethtool.md
Normal file
@@ -0,0 +1,197 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.ethtool"></a>
|
||||
|
||||
# jc.parsers.ethtool
|
||||
|
||||
jc - JSON Convert `ethtool` command output parser
|
||||
|
||||
Supports standard `ethtool` output and the `--module-info` option.
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ ethtool <interface> | jc --ethtool
|
||||
$ ethtool --module-info <interface> | jc --ethtool
|
||||
|
||||
or
|
||||
|
||||
$ jc ethtool <interface>
|
||||
$ jc ethtool --module-info <interface>
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('ethtool', ethtool_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
Note: many units fields are converted to integers and floats
|
||||
when detected. Use raw output for the original string values.
|
||||
|
||||
{
|
||||
"name": string,
|
||||
"supported_ports": [
|
||||
string
|
||||
],
|
||||
"supported_link_modes": [
|
||||
string
|
||||
],
|
||||
"supported_pause_frame_use": string,
|
||||
"supports_auto_negotiation": boolean,
|
||||
"supported_fec_modes": [
|
||||
string
|
||||
],
|
||||
"advertised_link_modes": [
|
||||
string
|
||||
],
|
||||
"advertised_pause_frame_use": boolean,
|
||||
"advertised_auto_negotiation": boolean,
|
||||
"advertised_fec_modes": [
|
||||
string
|
||||
],
|
||||
"speed": string,
|
||||
"speed_bps": integer,
|
||||
"duplex": string,
|
||||
"auto_negotiation": boolean,
|
||||
"port": string,
|
||||
"phyad": string,
|
||||
"mdi_x": string,
|
||||
"transceiver": string,
|
||||
"supports_wake_on": string,
|
||||
"wake_on": string,
|
||||
"current_message_level": [
|
||||
string
|
||||
],
|
||||
"link_detected": boolean,
|
||||
"identifier": string,
|
||||
"extended_identifier": string,
|
||||
"connector": string,
|
||||
"transceiver_codes": string,
|
||||
"transceiver_type": [
|
||||
string
|
||||
],
|
||||
"encoding": string,
|
||||
"br_nominal": string,
|
||||
"rate_identifier": string,
|
||||
"length_smf_km": string,
|
||||
"length_smf": string,
|
||||
"length_50um": string,
|
||||
"length_62_5um": string,
|
||||
"length_copper": string,
|
||||
"length_om3": string,
|
||||
"passive_cu_cmplnce": string,
|
||||
"vendor_name": string,
|
||||
"vendor_oui": string,
|
||||
"vendor_pn": string,
|
||||
"vendor_rev": string,
|
||||
"option_values": string,
|
||||
"br_margin_max": string,
|
||||
"br_margin_min": string
|
||||
}
|
||||
|
||||
Examples:
|
||||
|
||||
$ ethtool enp0s3 | jc --ethtool -p
|
||||
{
|
||||
"name": "enp0s3",
|
||||
"supported_pause_frame_use": "No",
|
||||
"supports_auto_negotiation": true,
|
||||
"supported_fec_modes": "Not reported",
|
||||
"advertised_pause_frame_use": false,
|
||||
"advertised_auto_negotiation": true,
|
||||
"advertised_fec_modes": "Not reported",
|
||||
"speed": "1000Mb/s",
|
||||
"duplex": "Full",
|
||||
"port": "Twisted Pair",
|
||||
"phyad": "0",
|
||||
"transceiver": "internal",
|
||||
"auto_negotiation": false,
|
||||
"mdi_x": "off (auto)",
|
||||
"supports_wake_on": "umbg",
|
||||
"wake_on": "d",
|
||||
"link_detected": true,
|
||||
"supported_ports": [
|
||||
"TP"
|
||||
],
|
||||
"supported_link_modes": [
|
||||
"10baseT/Half",
|
||||
"10baseT/Full",
|
||||
"100baseT/Half",
|
||||
"100baseT/Full",
|
||||
"1000baseT/Full"
|
||||
],
|
||||
"advertised_link_modes": [
|
||||
"10baseT/Half",
|
||||
"10baseT/Full",
|
||||
"100baseT/Half",
|
||||
"100baseT/Full",
|
||||
"1000baseT/Full"
|
||||
],
|
||||
"current_message_level": [
|
||||
"0x00000007 (7)",
|
||||
"drv probe link"
|
||||
],
|
||||
"speed_bps": 1000000000
|
||||
}
|
||||
|
||||
$ ethtool --module-info enp0s3 | jc --ethtool -p
|
||||
{
|
||||
"identifier": "0x03 (SFP)",
|
||||
"extended_identifier": "0x04 (GBIC/SFP defined by 2-wire interface ID)",
|
||||
"connector": "0x21 (Copper pigtail)",
|
||||
"transceiver_codes": "0x01 0x00 0x00 0x04 0x00 0x04 0x80 0xd5 0x00",
|
||||
"transceiver_type": [
|
||||
"Infiniband: 1X Copper Passive",
|
||||
"Ethernet: 1000BASE-CX",
|
||||
"Passive Cable",
|
||||
"FC: Twin Axial Pair (TW)",
|
||||
"FC: 1200 MBytes/sec",
|
||||
"FC: 800 MBytes/sec",
|
||||
"FC: 400 MBytes/sec",
|
||||
"FC: 200 MBytes/sec",
|
||||
"FC: 100 MBytes/sec"
|
||||
],
|
||||
"encoding": "0x00 (unspecified)",
|
||||
"br_nominal": "10300MBd",
|
||||
"rate_identifier": "0x00 (unspecified)",
|
||||
"length_smf_km": "0km",
|
||||
"length_smf": "0m",
|
||||
"length_50um": "0m",
|
||||
"length_62_5um": "0m",
|
||||
"length_copper": "2m",
|
||||
"length_om3": "0m",
|
||||
"passive_cu_cmplnce": "0x01 (SFF-8431 appendix E) [SFF-8472 rev10.4 only]",
|
||||
"vendor_name": "UbiquitiNetworks",
|
||||
"vendor_oui": "00:40:20",
|
||||
"vendor_pn": "UDC-2",
|
||||
"vendor_rev": "",
|
||||
"option_values": "0x00 0x00",
|
||||
"br_margin_max": "0%",
|
||||
"br_margin_min": "0%"
|
||||
}
|
||||
|
||||
<a id="jc.parsers.ethtool.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
def parse(data: str, raw: bool = False, quiet: bool = False) -> Dict[str, Any]
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Source: [`jc/parsers/ethtool.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/ethtool.py)
|
||||
|
||||
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
@@ -9,7 +9,7 @@ Usage (cli):
|
||||
|
||||
$ file * | jc --file
|
||||
|
||||
or
|
||||
or
|
||||
|
||||
$ jc file *
|
||||
|
||||
@@ -85,4 +85,6 @@ Returns:
|
||||
### Parser Information
|
||||
Compatibility: linux, aix, freebsd, darwin
|
||||
|
||||
Source: [`jc/parsers/file.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/file.py)
|
||||
|
||||
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
84
docs/parsers/find.md
Normal file
84
docs/parsers/find.md
Normal file
@@ -0,0 +1,84 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.find"></a>
|
||||
|
||||
# jc.parsers.find
|
||||
|
||||
jc - JSON Convert `find` command output parser
|
||||
|
||||
This parser returns a list of objects by default and a list of strings if
|
||||
the `--raw` option is used.
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ find | jc --find
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('find', find_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"path": string,
|
||||
"node": string,
|
||||
"error": string
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
$ find | jc --find -p
|
||||
[
|
||||
{
|
||||
"path": "./directory"
|
||||
"node": "filename"
|
||||
},
|
||||
{
|
||||
"path": "./anotherdirectory"
|
||||
"node": "anotherfile"
|
||||
},
|
||||
{
|
||||
"path": null
|
||||
"node": null
|
||||
"error": "find: './inaccessible': Permission denied"
|
||||
}
|
||||
...
|
||||
]
|
||||
|
||||
$ find | jc --find -p -r
|
||||
[
|
||||
"./templates/readme_template",
|
||||
"./templates/manpage_template",
|
||||
"./.github/workflows/pythonapp.yml",
|
||||
...
|
||||
]
|
||||
|
||||
<a id="jc.parsers.find.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
List of raw strings or
|
||||
List of Dictionaries of processed structured data
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Source: [`jc/parsers/find.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/find.py)
|
||||
|
||||
Version 1.0 by Solomon Leang (solomonleang@gmail.com)
|
||||
119
docs/parsers/findmnt.md
Normal file
119
docs/parsers/findmnt.md
Normal file
@@ -0,0 +1,119 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.findmnt"></a>
|
||||
|
||||
# jc.parsers.findmnt
|
||||
|
||||
jc - JSON Convert `findmnt` command output parser
|
||||
|
||||
Supports `-a`, `-l`, or no `findmnt` options.
|
||||
|
||||
> Note: Newer versions of `findmnt` have a JSON output option.
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ findmnt | jc --findmnt
|
||||
|
||||
or
|
||||
|
||||
$ jc findmnt
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('findmnt', findmnt_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"target": string,
|
||||
"source": string,
|
||||
"fstype": string,
|
||||
"options": [
|
||||
string
|
||||
],
|
||||
"kv_options": {
|
||||
"<key_name>": string
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
$ findmnt | jc --findmnt -p
|
||||
[
|
||||
{
|
||||
"target": "/",
|
||||
"source": "/dev/mapper/centos-root",
|
||||
"fstype": "xfs",
|
||||
"options": [
|
||||
"rw",
|
||||
"relatime",
|
||||
"seclabel",
|
||||
"attr2",
|
||||
"inode64",
|
||||
"noquota"
|
||||
]
|
||||
},
|
||||
{
|
||||
"target": "/sys/fs/cgroup",
|
||||
"source": "tmpfs",
|
||||
"fstype": "tmpfs",
|
||||
"options": [
|
||||
"ro",
|
||||
"nosuid",
|
||||
"nodev",
|
||||
"noexec",
|
||||
"seclabel"
|
||||
],
|
||||
"kv_options": {
|
||||
"mode": "755"
|
||||
}
|
||||
},
|
||||
...
|
||||
]
|
||||
|
||||
$ findmnt | jc --findmnt -p -r
|
||||
[
|
||||
{
|
||||
"target": "/",
|
||||
"source": "/dev/mapper/centos-root",
|
||||
"fstype": "xfs",
|
||||
"options": "rw,relatime,seclabel,attr2,inode64,noquota"
|
||||
},
|
||||
{
|
||||
"target": "/sys/fs/cgroup",
|
||||
"source": "tmpfs",
|
||||
"fstype": "tmpfs",
|
||||
"options": "ro,nosuid,nodev,noexec,seclabel,mode=755"
|
||||
},
|
||||
...
|
||||
]
|
||||
|
||||
<a id="jc.parsers.findmnt.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
def parse(data: str,
|
||||
raw: bool = False,
|
||||
quiet: bool = False) -> List[Dict[str, Any]]
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Source: [`jc/parsers/findmnt.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/findmnt.py)
|
||||
|
||||
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
@@ -11,7 +11,7 @@ Usage (cli):
|
||||
|
||||
$ finger | jc --finger
|
||||
|
||||
or
|
||||
or
|
||||
|
||||
$ jc finger
|
||||
|
||||
@@ -113,4 +113,6 @@ Returns:
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, freebsd
|
||||
|
||||
Source: [`jc/parsers/finger.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/finger.py)
|
||||
|
||||
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
@@ -5,11 +5,13 @@
|
||||
|
||||
jc - JSON Convert `free` command output parser
|
||||
|
||||
Values are normalized to bytes when using `free -h`.
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ free | jc --free
|
||||
|
||||
or
|
||||
or
|
||||
|
||||
$ jc free
|
||||
|
||||
@@ -22,13 +24,13 @@ Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"type": string,
|
||||
"total": integer,
|
||||
"used": integer,
|
||||
"free": integer,
|
||||
"shared": integer,
|
||||
"buff_cache": integer,
|
||||
"available": integer
|
||||
"type": string,
|
||||
"total": integer,
|
||||
"used": integer,
|
||||
"free": integer,
|
||||
"shared": integer,
|
||||
"buff_cache": integer,
|
||||
"available": integer
|
||||
}
|
||||
]
|
||||
|
||||
@@ -95,4 +97,6 @@ Returns:
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
Source: [`jc/parsers/free.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/free.py)
|
||||
|
||||
Version 1.8 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
@@ -108,4 +108,6 @@ Returns:
|
||||
### Parser Information
|
||||
Compatibility: linux, freebsd
|
||||
|
||||
Source: [`jc/parsers/fstab.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/fstab.py)
|
||||
|
||||
Version 1.7 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.git_log"></a>
|
||||
|
||||
# jc.parsers.git\_log
|
||||
# jc.parsers.git_log
|
||||
|
||||
jc - JSON Convert `git log` command output parser
|
||||
|
||||
@@ -26,7 +26,7 @@ Usage (cli):
|
||||
|
||||
$ git log | jc --git-log
|
||||
|
||||
or
|
||||
or
|
||||
|
||||
$ jc git log
|
||||
|
||||
@@ -40,13 +40,13 @@ Schema:
|
||||
[
|
||||
{
|
||||
"commit": string,
|
||||
"author": string,
|
||||
"author_email": string,
|
||||
"author": string/null,
|
||||
"author_email": string/null,
|
||||
"date": string,
|
||||
"epoch": integer, # [0]
|
||||
"epoch_utc": integer, # [1]
|
||||
"commit_by": string,
|
||||
"commit_by_email": string,
|
||||
"commit_by": string/null,
|
||||
"commit_by_email": string/null,
|
||||
"commit_by_date": string,
|
||||
"message": string,
|
||||
"stats" : {
|
||||
@@ -55,13 +55,19 @@ Schema:
|
||||
"deletions": integer,
|
||||
"files": [
|
||||
string
|
||||
],
|
||||
"file_stats": [
|
||||
{
|
||||
"name": string,
|
||||
"lines_changed": integer
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
[0] naive timestamp if "date" field is parsable, else null
|
||||
[1] timezone aware timestamp availabe for UTC, else null
|
||||
[1] timezone aware timestamp available for UTC, else null
|
||||
|
||||
Examples:
|
||||
|
||||
@@ -79,6 +85,16 @@ Examples:
|
||||
"files": [
|
||||
"docs/parsers/git_log.md",
|
||||
"jc/parsers/git_log.py"
|
||||
],
|
||||
"file_stats": [
|
||||
{
|
||||
"name": "docs/parsers/git_log.md",
|
||||
"lines_changed": 3
|
||||
},
|
||||
{
|
||||
"name": "jc/parsers/git_log.py",
|
||||
"lines_changed": 7
|
||||
}
|
||||
]
|
||||
},
|
||||
"message": "add timestamp docs and examples",
|
||||
@@ -100,6 +116,28 @@ Examples:
|
||||
"jc/parsers/git_log.py",
|
||||
"jc/utils.py",
|
||||
"man/jc.1"
|
||||
],
|
||||
"file_stats": [
|
||||
{
|
||||
"name": "docs/parsers/git_log.md",
|
||||
"lines_changed": 3
|
||||
},
|
||||
{
|
||||
"name": "docs/utils.md",
|
||||
"lines_changed": 7
|
||||
},
|
||||
{
|
||||
"name": "jc/parsers/git_log.py",
|
||||
"lines_changed": 1
|
||||
},
|
||||
{
|
||||
"name": "jc/utils.py",
|
||||
"lines_changed": 12
|
||||
},
|
||||
{
|
||||
"name": "man/jc.1",
|
||||
"lines_changed": 14
|
||||
}
|
||||
]
|
||||
},
|
||||
"message": "add calculated timestamp",
|
||||
@@ -123,6 +161,16 @@ Examples:
|
||||
"files": [
|
||||
"docs/parsers/git_log.md",
|
||||
"jc/parsers/git_log.py"
|
||||
],
|
||||
"file_stats": [
|
||||
{
|
||||
"name": "docs/parsers/git_log.md",
|
||||
"lines_changed": "3"
|
||||
},
|
||||
{
|
||||
"name": "jc/parsers/git_log.py",
|
||||
"lines_changed": "7"
|
||||
}
|
||||
]
|
||||
},
|
||||
"message": "add timestamp docs and examples"
|
||||
@@ -142,6 +190,28 @@ Examples:
|
||||
"jc/parsers/git_log.py",
|
||||
"jc/utils.py",
|
||||
"man/jc.1"
|
||||
],
|
||||
"file_stats": [
|
||||
{
|
||||
"name": "docs/parsers/git_log.md",
|
||||
"lines_changed": "3"
|
||||
},
|
||||
{
|
||||
"name": "docs/utils.md",
|
||||
"lines_changed": "7"
|
||||
},
|
||||
{
|
||||
"name": "jc/parsers/git_log.py",
|
||||
"lines_changed": "1"
|
||||
},
|
||||
{
|
||||
"name": "jc/utils.py",
|
||||
"lines_changed": "12"
|
||||
},
|
||||
{
|
||||
"name": "man/jc.1",
|
||||
"lines_changed": "14"
|
||||
}
|
||||
]
|
||||
},
|
||||
"message": "add calculated timestamp"
|
||||
@@ -172,4 +242,6 @@ Returns:
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
|
||||
|
||||
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
Source: [`jc/parsers/git_log.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/git_log.py)
|
||||
|
||||
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.git_log_s"></a>
|
||||
|
||||
# jc.parsers.git\_log\_s
|
||||
# jc.parsers.git_log_s
|
||||
|
||||
jc - JSON Convert `git log` command output streaming parser
|
||||
|
||||
@@ -41,13 +41,13 @@ Schema:
|
||||
|
||||
{
|
||||
"commit": string,
|
||||
"author": string,
|
||||
"author_email": string,
|
||||
"author": string/null,
|
||||
"author_email": string/null,
|
||||
"date": string,
|
||||
"epoch": integer, # [0]
|
||||
"epoch_utc": integer, # [1]
|
||||
"commit_by": string,
|
||||
"commit_by_email": string,
|
||||
"commit_by": string/null,
|
||||
"commit_by_email": string/null,
|
||||
"commit_by_date": string,
|
||||
"message": string,
|
||||
"stats" : {
|
||||
@@ -56,6 +56,12 @@ Schema:
|
||||
"deletions": integer,
|
||||
"files": [
|
||||
string
|
||||
],
|
||||
"file_stats": [
|
||||
{
|
||||
"name": string,
|
||||
"lines_changed": integer
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -68,7 +74,7 @@ Schema:
|
||||
}
|
||||
|
||||
[0] naive timestamp if "date" field is parsable, else null
|
||||
[1] timezone aware timestamp availabe for UTC, else null
|
||||
[1] timezone aware timestamp available for UTC, else null
|
||||
|
||||
Examples:
|
||||
|
||||
@@ -82,7 +88,6 @@ Examples:
|
||||
### parse
|
||||
|
||||
```python
|
||||
@add_jc_meta
|
||||
def parse(data: Iterable[str],
|
||||
raw: bool = False,
|
||||
quiet: bool = False,
|
||||
@@ -108,4 +113,6 @@ Returns:
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
|
||||
|
||||
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
Source: [`jc/parsers/git_log_s.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/git_log_s.py)
|
||||
|
||||
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
94
docs/parsers/git_ls_remote.md
Normal file
94
docs/parsers/git_ls_remote.md
Normal file
@@ -0,0 +1,94 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.git_ls_remote"></a>
|
||||
|
||||
# jc.parsers.git_ls_remote
|
||||
|
||||
jc - JSON Convert `git ls-remote` command output parser
|
||||
|
||||
This parser outputs two schemas:
|
||||
|
||||
- Default: A single object with key/value pairs
|
||||
- Raw: An array of objects (`--raw` (cli) or `raw=True (module))
|
||||
|
||||
See the Schema section for more details
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ git ls-remote | jc --git-ls-remote
|
||||
|
||||
or
|
||||
|
||||
$ jc git ls-remote
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('git_ls_remote', git_ls_remote_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
Default:
|
||||
{
|
||||
<reference>: string
|
||||
}
|
||||
|
||||
Raw:
|
||||
[
|
||||
{
|
||||
"reference": string,
|
||||
"commit": string
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
$ git ls-remote | jc --git-ls-remote -p
|
||||
{
|
||||
"HEAD": "214cd6b9e09603b3c4fa02203b24fb2bc3d4e338",
|
||||
"refs/heads/dev": "b884f6aacca39e05994596d8fdfa7e7c4f1e0389",
|
||||
"refs/heads/master": "214cd6b9e09603b3c4fa02203b24fb2bc3d4e338",
|
||||
"refs/pull/1/head": "e416c77bed1267254da972b0f95b7ff1d43fccef",
|
||||
...
|
||||
}
|
||||
|
||||
$ git ls-remote | jc --git-ls-remote -p -r
|
||||
[
|
||||
{
|
||||
"reference": "HEAD",
|
||||
"commit": "214cd6b9e09603b3c4fa02203b24fb2bc3d4e338"
|
||||
},
|
||||
{
|
||||
"reference": "refs/heads/dev",
|
||||
"commit": "b884f6aacca39e05994596d8fdfa7e7c4f1e0389"
|
||||
},
|
||||
...
|
||||
]
|
||||
|
||||
<a id="jc.parsers.git_ls_remote.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
def parse(data: str,
|
||||
raw: bool = False,
|
||||
quiet: bool = False) -> Union[Dict[str, Any], List[Dict[str, Any]]]
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
Dictionary (default) or List of Dictionaries (raw)
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
|
||||
|
||||
Source: [`jc/parsers/git_ls_remote.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/git_ls_remote.py)
|
||||
|
||||
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
@@ -9,7 +9,7 @@ Usage (cli):
|
||||
|
||||
$ gpg --with-colons --show-keys file.gpg | jc --gpg
|
||||
|
||||
or
|
||||
or
|
||||
|
||||
$ jc gpg --with-colons --show-keys file.gpg
|
||||
|
||||
@@ -142,4 +142,6 @@ Returns:
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Source: [`jc/parsers/gpg.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/gpg.py)
|
||||
|
||||
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
@@ -132,4 +132,6 @@ Returns:
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, aix, freebsd
|
||||
|
||||
Source: [`jc/parsers/group.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/group.py)
|
||||
|
||||
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
@@ -100,4 +100,6 @@ Returns:
|
||||
### Parser Information
|
||||
Compatibility: linux, aix, freebsd
|
||||
|
||||
Source: [`jc/parsers/gshadow.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/gshadow.py)
|
||||
|
||||
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
@@ -60,4 +60,6 @@ Returns:
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, aix, freebsd
|
||||
|
||||
Source: [`jc/parsers/hash.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/hash.py)
|
||||
|
||||
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
@@ -19,7 +19,7 @@ Usage (cli):
|
||||
|
||||
$ md5sum file.txt | jc --hashsum
|
||||
|
||||
or
|
||||
or
|
||||
|
||||
$ jc md5sum file.txt
|
||||
|
||||
@@ -91,4 +91,6 @@ Returns:
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, aix, freebsd
|
||||
|
||||
Source: [`jc/parsers/hashsum.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/hashsum.py)
|
||||
|
||||
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
@@ -9,7 +9,7 @@ Usage (cli):
|
||||
|
||||
$ hciconfig | jc --hciconfig
|
||||
|
||||
or
|
||||
or
|
||||
|
||||
$ jc hciconfig
|
||||
|
||||
@@ -340,4 +340,6 @@ Returns:
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Source: [`jc/parsers/hciconfig.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/hciconfig.py)
|
||||
|
||||
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
@@ -87,4 +87,6 @@ Returns:
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, aix, freebsd
|
||||
|
||||
Source: [`jc/parsers/history.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/history.py)
|
||||
|
||||
Version 1.7 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
115
docs/parsers/host.md
Normal file
115
docs/parsers/host.md
Normal file
@@ -0,0 +1,115 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.host"></a>
|
||||
|
||||
# jc.parsers.host
|
||||
|
||||
jc - JSON Convert `host` command output parser
|
||||
|
||||
Supports parsing of the most commonly used RR types (A, AAAA, MX, TXT)
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ host google.com | jc --host
|
||||
|
||||
or
|
||||
|
||||
$ jc host google.com
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('host', host_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"hostname": string,
|
||||
"address": [
|
||||
string
|
||||
],
|
||||
"v6-address": [
|
||||
string
|
||||
],
|
||||
"mail": [
|
||||
string
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
[
|
||||
{
|
||||
"nameserver": string,
|
||||
"zone": string,
|
||||
"mname": string,
|
||||
"rname": string,
|
||||
"serial": integer,
|
||||
"refresh": integer,
|
||||
"retry": integer,
|
||||
"expire": integer,
|
||||
"minimum": integer
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
$ host google.com | jc --host
|
||||
[
|
||||
{
|
||||
"hostname": "google.com",
|
||||
"address": [
|
||||
"142.251.39.110"
|
||||
],
|
||||
"v6-address": [
|
||||
"2a00:1450:400e:811::200e"
|
||||
],
|
||||
"mail": [
|
||||
"smtp.google.com."
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
$ jc host -C sunet.se
|
||||
[
|
||||
{
|
||||
"nameserver": "2001:6b0:7::2",
|
||||
"zone": "sunet.se",
|
||||
"mname": "sunic.sunet.se.",
|
||||
"rname": "hostmaster.sunet.se.",
|
||||
"serial": "2023090401",
|
||||
"refresh": "28800",
|
||||
"retry": "7200",
|
||||
"expire": "604800",
|
||||
"minimum": "300"
|
||||
},
|
||||
{
|
||||
...
|
||||
}
|
||||
]
|
||||
|
||||
<a id="jc.parsers.host.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
def parse(data: str, raw: bool = False, quiet: bool = False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) unprocessed output 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
|
||||
|
||||
Source: [`jc/parsers/host.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/host.py)
|
||||
|
||||
Version 1.0 by Pettai (pettai@sunet.se)
|
||||
@@ -97,4 +97,6 @@ Returns:
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
|
||||
|
||||
Source: [`jc/parsers/hosts.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/hosts.py)
|
||||
|
||||
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
336
docs/parsers/http_headers.md
Normal file
336
docs/parsers/http_headers.md
Normal file
@@ -0,0 +1,336 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.http_headers"></a>
|
||||
|
||||
# jc.parsers.http_headers
|
||||
|
||||
jc - JSON Convert HTTP headers parser
|
||||
|
||||
Converts HTTP request and response headers into a list of dictionaries.
|
||||
Well-known headers are processed to allow multiple instances which are
|
||||
aggregated into an array along with any comma-separated values. Integer,
|
||||
float, and datetimes are converted where defined in the specifications.
|
||||
|
||||
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers
|
||||
https://datatracker.ietf.org/doc/html/rfc2616
|
||||
https://datatracker.ietf.org/doc/html/rfc3229
|
||||
https://datatracker.ietf.org/doc/html/rfc7089
|
||||
https://datatracker.ietf.org/doc/html/rfc7231
|
||||
https://datatracker.ietf.org/doc/html/rfc5789
|
||||
|
||||
If you are converting HTTP headers from `curl` verbose output, use the
|
||||
`curl-head` parser which will strip the `>` and `<` characters and remove
|
||||
non-header lines that begin with `*`.
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ cat headers.txt | jc --http-headers
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('http_headers', http_headers_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"_type": string, # request or response
|
||||
"_request_method": string,
|
||||
"_request_uri": string,
|
||||
"_request_version": string,
|
||||
"_response_version": string,
|
||||
"_response_status": integer,
|
||||
"_response_reason": string or null,
|
||||
"<header>": string,
|
||||
|
||||
# well-known headers:
|
||||
|
||||
"accept": [
|
||||
string
|
||||
],
|
||||
"accept-ch": [
|
||||
string
|
||||
],
|
||||
"accept-ch-lifetime": integer,
|
||||
"accept-encoding": [
|
||||
string
|
||||
],
|
||||
"accept-language": [
|
||||
string
|
||||
],
|
||||
"accept-patch": [
|
||||
string
|
||||
],
|
||||
"accept-post": [
|
||||
string
|
||||
],
|
||||
"accept-ranges": [
|
||||
string
|
||||
],
|
||||
"access-control-allow-headers": [
|
||||
string
|
||||
],
|
||||
"access-control-allow-methods": [
|
||||
string
|
||||
],
|
||||
"access-control-expose-headers": [
|
||||
string
|
||||
],
|
||||
"access-control-max-age": integer,
|
||||
"access-control-request-headers": [
|
||||
string
|
||||
],
|
||||
"age": integer,
|
||||
"allow": [
|
||||
string
|
||||
],
|
||||
"alt-svc": [
|
||||
string
|
||||
],
|
||||
"cache-control": [
|
||||
string
|
||||
],
|
||||
"clear-site-data": [
|
||||
string
|
||||
],
|
||||
"connection": [
|
||||
string
|
||||
],
|
||||
"content-encoding": [
|
||||
string
|
||||
],
|
||||
"content-dpr": integer,
|
||||
"content-language": [
|
||||
string
|
||||
],
|
||||
"content-length": integer,
|
||||
"content-security-policy": [
|
||||
string
|
||||
],
|
||||
"content-security-policy-report-only": [
|
||||
string
|
||||
],
|
||||
"cookie": [
|
||||
string
|
||||
],
|
||||
"critical-ch": [
|
||||
string
|
||||
],
|
||||
"date": string,
|
||||
"date_epoch_utc": integer,
|
||||
"expect-ct": [
|
||||
string
|
||||
],
|
||||
"expires": string,
|
||||
"expires_epoch_utc": integer,
|
||||
"device-memory": integer,
|
||||
"downlink": integer,
|
||||
"dpr": integer,
|
||||
"forwarded": [
|
||||
string
|
||||
],
|
||||
"if-match": [
|
||||
string
|
||||
],
|
||||
"if-modified-since": string,
|
||||
"if-modified-since_epoch_utc": integer,
|
||||
"if-none-match": [
|
||||
string
|
||||
],
|
||||
"if-range": string,
|
||||
"if-range_epoch_utc": integer,
|
||||
"if-unmodified-since": string,
|
||||
"if-unmodified-since_epoch_utc": integer,
|
||||
"im": [
|
||||
string
|
||||
],
|
||||
"keep-alive": [
|
||||
string
|
||||
],
|
||||
"large-allocation": integer,
|
||||
"last-modified": string,
|
||||
"last-modified_epoch_utc": integer,
|
||||
"link": [
|
||||
string
|
||||
],
|
||||
"max-forwards": integer,
|
||||
"memento-datetime": string,
|
||||
"memento-datetime_epoch_utc": integer,
|
||||
"permissions-policy": [
|
||||
string
|
||||
],
|
||||
"permissions-policy-report-only": [
|
||||
string
|
||||
],
|
||||
"pragma": [
|
||||
string
|
||||
],
|
||||
"proxy-authenticate": [
|
||||
string
|
||||
],
|
||||
"reporting-endpoints": [
|
||||
string
|
||||
],
|
||||
"retry-after": string,
|
||||
"retry-after_epoch_utc": integer,
|
||||
"rtt": integer,
|
||||
"sec-ch-ua": [
|
||||
string
|
||||
],
|
||||
"sec-ch-ua-full-version-list": [
|
||||
string
|
||||
],
|
||||
"server": [
|
||||
string
|
||||
],
|
||||
"server-timing": [
|
||||
string
|
||||
],
|
||||
"set-cookie": [
|
||||
string
|
||||
],
|
||||
"timing-allow-origin": [
|
||||
string
|
||||
],
|
||||
"trailer": [
|
||||
string
|
||||
],
|
||||
"transfer-encoding": [
|
||||
string
|
||||
],
|
||||
"upgrade": [
|
||||
string
|
||||
],
|
||||
"upgrade-insecure-requests": integer,
|
||||
"vary": [
|
||||
string
|
||||
],
|
||||
"via": [
|
||||
string
|
||||
],
|
||||
"warning": [
|
||||
string
|
||||
],
|
||||
"www-authenticate": [
|
||||
string
|
||||
],
|
||||
"x-cache-hits": [
|
||||
integer
|
||||
],
|
||||
"x-content-duration": float
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
$ cat headers.txt | jc --http-headers -p
|
||||
[
|
||||
{
|
||||
"_type": "request",
|
||||
"_request_method": "HEAD",
|
||||
"_request_uri": "/",
|
||||
"_request_version": "HTTP/1.1",
|
||||
"host": "example.com",
|
||||
"user-agent": "curl/8.1.2",
|
||||
"accept": [
|
||||
"*/*"
|
||||
]
|
||||
},
|
||||
{
|
||||
"_type": "response",
|
||||
"_response_version": "HTTP/1.1",
|
||||
"_response_status": 200,
|
||||
"_response_reason": [
|
||||
"OK"
|
||||
],
|
||||
"accept-ranges": [
|
||||
"bytes"
|
||||
],
|
||||
"age": 140203,
|
||||
"cache-control": [
|
||||
"max-age=604800"
|
||||
],
|
||||
"content-type": "text/html; charset=UTF-8",
|
||||
"date": "Sun, 04 Feb 2024 02:25:07 GMT",
|
||||
"etag": "\"3147526947\"",
|
||||
"expires": "Sun, 11 Feb 2024 02:25:07 GMT",
|
||||
"last-modified": "Thu, 17 Oct 2019 07:18:26 GMT",
|
||||
"server": [
|
||||
"ECS (sac/252F)"
|
||||
],
|
||||
"x-cache": "HIT",
|
||||
"content-length": 1256,
|
||||
"date_epoch_utc": 1707013507,
|
||||
"expires_epoch_utc": 1707618307,
|
||||
"last-modified_epoch_utc": 1571296706
|
||||
}
|
||||
]
|
||||
|
||||
$ cat headers.txt | jc --http-headers -p -r
|
||||
[
|
||||
{
|
||||
"_type": "request",
|
||||
"_request_method": "HEAD",
|
||||
"_request_uri": "/",
|
||||
"_request_version": "HTTP/1.1",
|
||||
"host": "example.com",
|
||||
"user-agent": "curl/8.1.2",
|
||||
"accept": [
|
||||
"*/*"
|
||||
]
|
||||
},
|
||||
{
|
||||
"_type": "response",
|
||||
"_response_version": "HTTP/1.1",
|
||||
"_response_status": 200,
|
||||
"_response_reason": [
|
||||
"OK"
|
||||
],
|
||||
"accept-ranges": [
|
||||
"bytes"
|
||||
],
|
||||
"age": "140203",
|
||||
"cache-control": [
|
||||
"max-age=604800"
|
||||
],
|
||||
"content-type": "text/html; charset=UTF-8",
|
||||
"date": "Sun, 04 Feb 2024 02:25:07 GMT",
|
||||
"etag": "\"3147526947\"",
|
||||
"expires": "Sun, 11 Feb 2024 02:25:07 GMT",
|
||||
"last-modified": "Thu, 17 Oct 2019 07:18:26 GMT",
|
||||
"server": [
|
||||
"ECS (sac/252F)"
|
||||
],
|
||||
"x-cache": "HIT",
|
||||
"content-length": "1256"
|
||||
}
|
||||
]
|
||||
|
||||
<a id="jc.parsers.http_headers.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
def parse(data: str,
|
||||
raw: bool = False,
|
||||
quiet: bool = False) -> List[Dict[str, Any]]
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) unprocessed output 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
|
||||
|
||||
Source: [`jc/parsers/http_headers.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/http_headers.py)
|
||||
|
||||
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
@@ -9,7 +9,7 @@ Usage (cli):
|
||||
|
||||
$ id | jc --id
|
||||
|
||||
or
|
||||
or
|
||||
|
||||
$ jc id
|
||||
|
||||
@@ -128,4 +128,8 @@ Returns:
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, aix, freebsd
|
||||
|
||||
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
Source: [`jc/parsers/id.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/id.py)
|
||||
|
||||
This parser can be used with the `--slurp` command-line option.
|
||||
|
||||
Version 1.7 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
@@ -5,13 +5,16 @@
|
||||
|
||||
jc - JSON Convert `ifconfig` command output parser
|
||||
|
||||
> Note: No `ifconfig` options are supported.
|
||||
No `ifconfig` options are supported.
|
||||
|
||||
Consider using the `ip` command instead of `ifconfig` as it supports native
|
||||
JSON output.
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ ifconfig | jc --ifconfig
|
||||
|
||||
or
|
||||
or
|
||||
|
||||
$ jc ifconfig
|
||||
|
||||
@@ -24,40 +27,92 @@ Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"name": string,
|
||||
"flags": integer,
|
||||
"name": string,
|
||||
"type": string,
|
||||
"metric": integer
|
||||
"flags": integer,
|
||||
"state": [
|
||||
string
|
||||
string
|
||||
],
|
||||
"mtu": integer,
|
||||
"ipv4_addr": string,
|
||||
"ipv4_mask": string,
|
||||
"ipv4_bcast": string,
|
||||
"ipv6_addr": string,
|
||||
"ipv6_mask": integer,
|
||||
"ipv6_scope": string,
|
||||
"mac_addr": string,
|
||||
"type": string,
|
||||
"rx_packets": integer,
|
||||
"rx_bytes": integer,
|
||||
"rx_errors": integer,
|
||||
"rx_dropped": integer,
|
||||
"rx_overruns": integer,
|
||||
"rx_frame": integer,
|
||||
"tx_packets": integer,
|
||||
"tx_bytes": integer,
|
||||
"tx_errors": integer,
|
||||
"tx_dropped": integer,
|
||||
"tx_overruns": integer,
|
||||
"tx_carrier": integer,
|
||||
"tx_collisions": integer,
|
||||
"metric": integer
|
||||
"mtu": integer,
|
||||
"mac_addr": string,
|
||||
"ipv4_addr": string, # [0]
|
||||
"ipv4_mask": string, # [0]
|
||||
"ipv4_bcast": string, # [0]
|
||||
"ipv6_addr": string, # [0]
|
||||
"ipv6_mask": integer, # [0]
|
||||
"ipv6_scope": string, # [0]
|
||||
"ipv6_scope_id": string, # [0]
|
||||
"ipv6_type": string, # [0]
|
||||
"rx_packets": integer,
|
||||
"rx_bytes": integer,
|
||||
"rx_errors": integer,
|
||||
"rx_dropped": integer,
|
||||
"rx_overruns": integer,
|
||||
"rx_frame": integer,
|
||||
"tx_packets": integer,
|
||||
"tx_bytes": integer,
|
||||
"tx_errors": integer,
|
||||
"tx_dropped": integer,
|
||||
"tx_overruns": integer,
|
||||
"tx_carrier": integer,
|
||||
"tx_collisions": integer,
|
||||
"options": string,
|
||||
"options_flags": [
|
||||
string
|
||||
],
|
||||
"status": string,
|
||||
"hw_address": string,
|
||||
"media": string,
|
||||
"media_flags": [
|
||||
string
|
||||
],
|
||||
"nd6_options": integer,
|
||||
"nd6_flags": [
|
||||
string
|
||||
],
|
||||
"plugged": string,
|
||||
"vendor": string,
|
||||
"vendor_pn": string,
|
||||
"vendor_sn": string,
|
||||
"vendor_date": string,
|
||||
"module_temperature": string,
|
||||
"module_voltage": string
|
||||
"ipv4": [
|
||||
{
|
||||
"address": string,
|
||||
"mask": string,
|
||||
"broadcast": string
|
||||
}
|
||||
],
|
||||
"ipv6: [
|
||||
{
|
||||
"address": string,
|
||||
"scope_id": string,
|
||||
"mask": integer,
|
||||
"scope": string,
|
||||
"type": string
|
||||
}
|
||||
],
|
||||
"lanes": [
|
||||
{
|
||||
"lane": integer,
|
||||
"rx_power_mw": float,
|
||||
"rx_power_dbm": float,
|
||||
"tx_bias_ma": float
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
[0] these fields only pick up the last IP address in the interface
|
||||
output and are here for backwards compatibility. For information on
|
||||
all IP addresses, use the `ipv4` and `ipv6` objects which contain an
|
||||
array of IP address objects.
|
||||
|
||||
Examples:
|
||||
|
||||
$ ifconfig | jc --ifconfig -p
|
||||
$ ifconfig ens33 | jc --ifconfig -p
|
||||
[
|
||||
{
|
||||
"name": "ens33",
|
||||
@@ -69,120 +124,94 @@ Examples:
|
||||
"MULTICAST"
|
||||
],
|
||||
"mtu": 1500,
|
||||
"type": "Ethernet",
|
||||
"mac_addr": "00:0c:29:3b:58:0e",
|
||||
"ipv4_addr": "192.168.71.137",
|
||||
"ipv4_mask": "255.255.255.0",
|
||||
"ipv4_bcast": "192.168.71.255",
|
||||
"ipv6_addr": "fe80::c1cb:715d:bc3e:b8a0",
|
||||
"ipv6_mask": 64,
|
||||
"ipv6_scope": "0x20",
|
||||
"mac_addr": "00:0c:29:3b:58:0e",
|
||||
"type": "Ethernet",
|
||||
"ipv6_type": "link",
|
||||
"metric": null,
|
||||
"rx_packets": 8061,
|
||||
"rx_bytes": 1514413,
|
||||
"rx_errors": 0,
|
||||
"rx_dropped": 0,
|
||||
"rx_overruns": 0,
|
||||
"rx_frame": 0,
|
||||
"tx_packets": 4502,
|
||||
"tx_errors": 0,
|
||||
"tx_dropped": 0,
|
||||
"tx_overruns": 0,
|
||||
"tx_carrier": 0,
|
||||
"tx_collisions": 0,
|
||||
"rx_bytes": 1514413,
|
||||
"tx_bytes": 866622,
|
||||
"tx_errors": 0,
|
||||
"tx_dropped": 0,
|
||||
"tx_overruns": 0,
|
||||
"tx_carrier": 0,
|
||||
"tx_collisions": 0,
|
||||
"metric": null
|
||||
},
|
||||
{
|
||||
"name": "lo",
|
||||
"flags": 73,
|
||||
"state": [
|
||||
"UP",
|
||||
"LOOPBACK",
|
||||
"RUNNING"
|
||||
"ipv4": [
|
||||
{
|
||||
"address": "192.168.71.137",
|
||||
"mask": "255.255.255.0",
|
||||
"broadcast": "192.168.71.255"
|
||||
}
|
||||
],
|
||||
"mtu": 65536,
|
||||
"ipv4_addr": "127.0.0.1",
|
||||
"ipv4_mask": "255.0.0.0",
|
||||
"ipv4_bcast": null,
|
||||
"ipv6_addr": "::1",
|
||||
"ipv6_mask": 128,
|
||||
"ipv6_scope": "0x10",
|
||||
"mac_addr": null,
|
||||
"type": "Local Loopback",
|
||||
"rx_packets": 73,
|
||||
"rx_bytes": 6009,
|
||||
"rx_errors": 0,
|
||||
"rx_dropped": 0,
|
||||
"rx_overruns": 0,
|
||||
"rx_frame": 0,
|
||||
"tx_packets": 73,
|
||||
"tx_bytes": 6009,
|
||||
"tx_errors": 0,
|
||||
"tx_dropped": 0,
|
||||
"tx_overruns": 0,
|
||||
"tx_carrier": 0,
|
||||
"tx_collisions": 0,
|
||||
"metric": null
|
||||
"ipv6": [
|
||||
{
|
||||
"address": "fe80::c1cb:715d:bc3e:b8a0",
|
||||
"scope_id": null,
|
||||
"mask": 64,
|
||||
"scope": "0x20",
|
||||
"type": "link"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
$ ifconfig | jc --ifconfig -p -r
|
||||
$ ifconfig ens33 | jc --ifconfig -p -r
|
||||
[
|
||||
{
|
||||
"name": "ens33",
|
||||
"flags": "4163",
|
||||
"state": "UP,BROADCAST,RUNNING,MULTICAST",
|
||||
"mtu": "1500",
|
||||
"type": "Ethernet",
|
||||
"mac_addr": "00:0c:29:3b:58:0e",
|
||||
"ipv4_addr": "192.168.71.137",
|
||||
"ipv4_mask": "255.255.255.0",
|
||||
"ipv4_bcast": "192.168.71.255",
|
||||
"ipv6_addr": "fe80::c1cb:715d:bc3e:b8a0",
|
||||
"ipv6_mask": "64",
|
||||
"ipv6_scope": "0x20",
|
||||
"mac_addr": "00:0c:29:3b:58:0e",
|
||||
"type": "Ethernet",
|
||||
"ipv6_type": "link",
|
||||
"metric": null,
|
||||
"rx_packets": "8061",
|
||||
"rx_bytes": "1514413",
|
||||
"rx_errors": "0",
|
||||
"rx_dropped": "0",
|
||||
"rx_overruns": "0",
|
||||
"rx_frame": "0",
|
||||
"tx_packets": "4502",
|
||||
"tx_errors": "0",
|
||||
"tx_dropped": "0",
|
||||
"tx_overruns": "0",
|
||||
"tx_carrier": "0",
|
||||
"tx_collisions": "0",
|
||||
"rx_bytes": "1514413",
|
||||
"tx_bytes": "866622",
|
||||
"tx_errors": "0",
|
||||
"tx_dropped": "0",
|
||||
"tx_overruns": "0",
|
||||
"tx_carrier": "0",
|
||||
"tx_collisions": "0",
|
||||
"metric": null
|
||||
},
|
||||
{
|
||||
"name": "lo",
|
||||
"flags": "73",
|
||||
"state": "UP,LOOPBACK,RUNNING",
|
||||
"mtu": "65536",
|
||||
"ipv4_addr": "127.0.0.1",
|
||||
"ipv4_mask": "255.0.0.0",
|
||||
"ipv4_bcast": null,
|
||||
"ipv6_addr": "::1",
|
||||
"ipv6_mask": "128",
|
||||
"ipv6_scope": "0x10",
|
||||
"mac_addr": null,
|
||||
"type": "Local Loopback",
|
||||
"rx_packets": "73",
|
||||
"rx_bytes": "6009",
|
||||
"rx_errors": "0",
|
||||
"rx_dropped": "0",
|
||||
"rx_overruns": "0",
|
||||
"rx_frame": "0",
|
||||
"tx_packets": "73",
|
||||
"tx_bytes": "6009",
|
||||
"tx_errors": "0",
|
||||
"tx_dropped": "0",
|
||||
"tx_overruns": "0",
|
||||
"tx_carrier": "0",
|
||||
"tx_collisions": "0",
|
||||
"metric": null
|
||||
"ipv4": [
|
||||
{
|
||||
"address": "192.168.71.137",
|
||||
"mask": "255.255.255.0",
|
||||
"broadcast": "192.168.71.255"
|
||||
}
|
||||
],
|
||||
"ipv6": [
|
||||
{
|
||||
"address": "fe80::c1cb:715d:bc3e:b8a0",
|
||||
"scope_id": null,
|
||||
"mask": "64",
|
||||
"scope": "0x20",
|
||||
"type": "link"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
@@ -191,7 +220,9 @@ Examples:
|
||||
### parse
|
||||
|
||||
```python
|
||||
def parse(data, raw=False, quiet=False)
|
||||
def parse(data: str,
|
||||
raw: bool = False,
|
||||
quiet: bool = False) -> List[Dict[str, Any]]
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@@ -209,4 +240,6 @@ Returns:
|
||||
### Parser Information
|
||||
Compatibility: linux, aix, freebsd, darwin
|
||||
|
||||
Version 1.12 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
Source: [`jc/parsers/ifconfig.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/ifconfig.py)
|
||||
|
||||
Version 2.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
@@ -3,13 +3,15 @@
|
||||
|
||||
# jc.parsers.ini
|
||||
|
||||
jc - JSON Convert `INI` file parser
|
||||
jc - JSON Convert INI file parser
|
||||
|
||||
Parses standard `INI` files and files containing simple key/value pairs.
|
||||
Parses standard INI files.
|
||||
|
||||
- Delimiter can be `=` or `:`. Missing values are supported.
|
||||
- Comment prefix can be `#` or `;`. Comments must be on their own line.
|
||||
- If duplicate keys are found, only the last value will be used.
|
||||
- If any section names have the same name as a top-level key, the top-level
|
||||
key will be overwritten by the section data.
|
||||
|
||||
> Note: Values starting and ending with double or single quotation marks
|
||||
> will have the marks removed. If you would like to keep the quotation
|
||||
@@ -27,45 +29,47 @@ Usage (module):
|
||||
|
||||
Schema:
|
||||
|
||||
ini or key/value document converted to a dictionary - see the configparser
|
||||
INI document converted to a dictionary - see the python configparser
|
||||
standard library documentation for more details.
|
||||
|
||||
{
|
||||
"key1": string,
|
||||
"key2": string
|
||||
"<key1>": string,
|
||||
"<key2>": string,
|
||||
"<section1>": {
|
||||
"<key1>": string,
|
||||
"<key2>": string
|
||||
},
|
||||
"<section2>": {
|
||||
"<key1>": string,
|
||||
"<key2>": string
|
||||
}
|
||||
}
|
||||
|
||||
Examples:
|
||||
|
||||
$ cat example.ini
|
||||
[DEFAULT]
|
||||
ServerAliveInterval = 45
|
||||
Compression = yes
|
||||
CompressionLevel = 9
|
||||
ForwardX11 = yes
|
||||
foo = fiz
|
||||
bar = buz
|
||||
|
||||
[bitbucket.org]
|
||||
User = hg
|
||||
[section1]
|
||||
fruit = apple
|
||||
color = blue
|
||||
|
||||
[topsecret.server.com]
|
||||
Port = 50022
|
||||
ForwardX11 = no
|
||||
[section2]
|
||||
fruit = pear
|
||||
color = green
|
||||
|
||||
$ cat example.ini | jc --ini -p
|
||||
{
|
||||
"bitbucket.org": {
|
||||
"serveraliveinterval": "45",
|
||||
"compression": "yes",
|
||||
"compressionlevel": "9",
|
||||
"forwardx11": "yes",
|
||||
"user": "hg"
|
||||
"foo": "fiz",
|
||||
"bar": "buz",
|
||||
"section1": {
|
||||
"fruit": "apple",
|
||||
"color": "blue"
|
||||
},
|
||||
"topsecret.server.com": {
|
||||
"serveraliveinterval": "45",
|
||||
"compression": "yes",
|
||||
"compressionlevel": "9",
|
||||
"forwardx11": "no",
|
||||
"port": "50022"
|
||||
"section2": {
|
||||
"fruit": "pear",
|
||||
"color": "green"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,9 +91,11 @@ Parameters:
|
||||
|
||||
Returns:
|
||||
|
||||
Dictionary representing the ini file
|
||||
Dictionary representing the INI file.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
|
||||
|
||||
Version 1.7 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
Source: [`jc/parsers/ini.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/ini.py)
|
||||
|
||||
Version 2.2 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
123
docs/parsers/ini_dup.md
Normal file
123
docs/parsers/ini_dup.md
Normal file
@@ -0,0 +1,123 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.ini_dup"></a>
|
||||
|
||||
# jc.parsers.ini_dup
|
||||
|
||||
jc - JSON Convert INI with duplicate key file parser
|
||||
|
||||
Parses standard INI files and preserves duplicate values. All values are
|
||||
contained in lists/arrays.
|
||||
|
||||
- Delimiter can be `=` or `:`. Missing values are supported.
|
||||
- Comment prefix can be `#` or `;`. Comments must be on their own line.
|
||||
- If any section names have the same name as a top-level key, the top-level
|
||||
key will be overwritten by the section data.
|
||||
- If multi-line values are used, each line will be a separate item in the
|
||||
value list. Blank lines in multi-line values are not supported.
|
||||
|
||||
> Note: Values starting and ending with double or single quotation marks
|
||||
> will have the marks removed. If you would like to keep the quotation
|
||||
> marks, use the `-r` command-line argument or the `raw=True` argument in
|
||||
> `parse()`.
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ cat foo.ini | jc --ini-dup
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('ini_dup', ini_file_output)
|
||||
|
||||
Schema:
|
||||
|
||||
INI document converted to a dictionary - see the python configparser
|
||||
standard library documentation for more details.
|
||||
|
||||
{
|
||||
"<key1>": [
|
||||
string
|
||||
],
|
||||
"<key2>": [
|
||||
string
|
||||
],
|
||||
"<section1>": {
|
||||
"<key1>": [
|
||||
string
|
||||
],
|
||||
"<key2>": [
|
||||
string
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Examples:
|
||||
|
||||
$ cat example.ini
|
||||
foo = fiz
|
||||
bar = buz
|
||||
|
||||
[section1]
|
||||
fruit = apple
|
||||
color = blue
|
||||
color = red
|
||||
|
||||
[section2]
|
||||
fruit = pear
|
||||
fruit = peach
|
||||
color = green
|
||||
|
||||
$ cat example.ini | jc --ini-dup -p
|
||||
{
|
||||
"foo": [
|
||||
"fiz"
|
||||
],
|
||||
"bar": [
|
||||
"buz"
|
||||
],
|
||||
"section1": {
|
||||
"fruit": [
|
||||
"apple"
|
||||
],
|
||||
"color": [
|
||||
"blue",
|
||||
"red"
|
||||
]
|
||||
},
|
||||
"section2": {
|
||||
"fruit": [
|
||||
"pear",
|
||||
"peach"
|
||||
],
|
||||
"color": [
|
||||
"green"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
<a id="jc.parsers.ini_dup.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
Dictionary representing the INI file.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
|
||||
|
||||
Source: [`jc/parsers/ini_dup.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/ini_dup.py)
|
||||
|
||||
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
@@ -11,7 +11,7 @@ Usage (cli):
|
||||
|
||||
$ iostat | jc --iostat
|
||||
|
||||
or
|
||||
or
|
||||
|
||||
$ jc iostat
|
||||
|
||||
@@ -182,4 +182,6 @@ Returns:
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Source: [`jc/parsers/iostat.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/iostat.py)
|
||||
|
||||
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.iostat_s"></a>
|
||||
|
||||
# jc.parsers.iostat\_s
|
||||
# jc.parsers.iostat_s
|
||||
|
||||
jc - JSON Convert `iostat` command output streaming parser
|
||||
|
||||
@@ -108,7 +108,6 @@ Examples:
|
||||
### parse
|
||||
|
||||
```python
|
||||
@add_jc_meta
|
||||
def parse(data, raw=False, quiet=False, ignore_exceptions=False)
|
||||
```
|
||||
|
||||
@@ -130,4 +129,6 @@ Returns:
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
Source: [`jc/parsers/iostat_s.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/iostat_s.py)
|
||||
|
||||
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
559
docs/parsers/ip_address.md
Normal file
559
docs/parsers/ip_address.md
Normal file
@@ -0,0 +1,559 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.ip_address"></a>
|
||||
|
||||
# jc.parsers.ip_address
|
||||
|
||||
jc - JSON Convert IP Address string parser
|
||||
|
||||
Accepts standard and integer IP address notation for both IPv4 and IPv6
|
||||
addresses. CIDR subnet mask and Scope ID is also allowed for standard
|
||||
notation. See examples below.
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ echo '192.168.1.1' | jc --ip-address
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('ip_address', ip_address_string)
|
||||
|
||||
Schema:
|
||||
|
||||
{
|
||||
"version": integer,
|
||||
"max_prefix_length": integer,
|
||||
"ip": string,
|
||||
"ip_compressed": string,
|
||||
"ip_exploded": string,
|
||||
"ip_split": [
|
||||
string
|
||||
],
|
||||
"scope_id": string/null,
|
||||
"ipv4_mapped": string/null,
|
||||
"six_to_four": string/null,
|
||||
"teredo_client": string/null,
|
||||
"teredo_server": string/null,
|
||||
"dns_ptr": string,
|
||||
"network": string,
|
||||
"broadcast": string,
|
||||
"hostmask": string,
|
||||
"netmask": string,
|
||||
"cidr_netmask": integer,
|
||||
"hosts": integer,
|
||||
"first_host": string,
|
||||
"last_host": string,
|
||||
"is_multicast": boolean,
|
||||
"is_private": boolean,
|
||||
"is_global": boolean,
|
||||
"is_link_local": boolean,
|
||||
"is_loopback": boolean,
|
||||
"is_reserved": boolean,
|
||||
"is_unspecified": boolean,
|
||||
"int": {
|
||||
"ip": integer,
|
||||
"network": integer,
|
||||
"broadcast": integer,
|
||||
"first_host": integer,
|
||||
"last_host": integer
|
||||
},
|
||||
"hex": {
|
||||
"ip": string,
|
||||
"network": string,
|
||||
"broadcast": string,
|
||||
"hostmask": string,
|
||||
"netmask": string,
|
||||
"first_host": string,
|
||||
"last_host": string
|
||||
},
|
||||
"bin": {
|
||||
"ip": string,
|
||||
"network": string,
|
||||
"broadcast": string,
|
||||
"hostmask": string,
|
||||
"netmask": string,
|
||||
"first_host": string,
|
||||
"last_host": string
|
||||
}
|
||||
}
|
||||
|
||||
Examples:
|
||||
|
||||
$ echo 192.168.2.10/24 | jc --ip-address -p
|
||||
{
|
||||
"version": 4,
|
||||
"max_prefix_length": 32,
|
||||
"ip": "192.168.2.10",
|
||||
"ip_compressed": "192.168.2.10",
|
||||
"ip_exploded": "192.168.2.10",
|
||||
"ip_split": [
|
||||
"192",
|
||||
"168",
|
||||
"2",
|
||||
"10"
|
||||
],
|
||||
"scope_id": null,
|
||||
"ipv4_mapped": null,
|
||||
"six_to_four": null,
|
||||
"teredo_client": null,
|
||||
"teredo_server": null,
|
||||
"dns_ptr": "10.2.168.192.in-addr.arpa",
|
||||
"network": "192.168.2.0",
|
||||
"broadcast": "192.168.2.255",
|
||||
"hostmask": "0.0.0.255",
|
||||
"netmask": "255.255.255.0",
|
||||
"cidr_netmask": 24,
|
||||
"hosts": 254,
|
||||
"first_host": "192.168.2.1",
|
||||
"last_host": "192.168.2.254",
|
||||
"is_multicast": false,
|
||||
"is_private": true,
|
||||
"is_global": false,
|
||||
"is_link_local": false,
|
||||
"is_loopback": false,
|
||||
"is_reserved": false,
|
||||
"is_unspecified": false,
|
||||
"int": {
|
||||
"ip": 3232236042,
|
||||
"network": 3232236032,
|
||||
"broadcast": 3232236287,
|
||||
"first_host": 3232236033,
|
||||
"last_host": 3232236286
|
||||
},
|
||||
"hex": {
|
||||
"ip": "c0:a8:02:0a",
|
||||
"network": "c0:a8:02:00",
|
||||
"broadcast": "c0:a8:02:ff",
|
||||
"hostmask": "00:00:00:ff",
|
||||
"netmask": "ff:ff:ff:00",
|
||||
"first_host": "c0:a8:02:01",
|
||||
"last_host": "c0:a8:02:fe"
|
||||
},
|
||||
"bin": {
|
||||
"ip": "11000000101010000000001000001010",
|
||||
"network": "11000000101010000000001000000000",
|
||||
"broadcast": "11000000101010000000001011111111",
|
||||
"hostmask": "00000000000000000000000011111111",
|
||||
"netmask": "11111111111111111111111100000000",
|
||||
"first_host": "11000000101010000000001000000001",
|
||||
"last_host": "11000000101010000000001011111110"
|
||||
}
|
||||
}
|
||||
|
||||
$ echo 3232236042 | jc --ip-address -p
|
||||
{
|
||||
"version": 4,
|
||||
"max_prefix_length": 32,
|
||||
"ip": "192.168.2.10",
|
||||
"ip_compressed": "192.168.2.10",
|
||||
"ip_exploded": "192.168.2.10",
|
||||
"ip_split": [
|
||||
"192",
|
||||
"168",
|
||||
"2",
|
||||
"10"
|
||||
],
|
||||
"scope_id": null,
|
||||
"ipv4_mapped": null,
|
||||
"six_to_four": null,
|
||||
"teredo_client": null,
|
||||
"teredo_server": null,
|
||||
"dns_ptr": "10.2.168.192.in-addr.arpa",
|
||||
"network": "192.168.2.10",
|
||||
"broadcast": "192.168.2.10",
|
||||
"hostmask": "0.0.0.0",
|
||||
"netmask": "255.255.255.255",
|
||||
"cidr_netmask": 32,
|
||||
"hosts": 1,
|
||||
"first_host": "192.168.2.10",
|
||||
"last_host": "192.168.2.10",
|
||||
"is_multicast": false,
|
||||
"is_private": true,
|
||||
"is_global": false,
|
||||
"is_link_local": false,
|
||||
"is_loopback": false,
|
||||
"is_reserved": false,
|
||||
"is_unspecified": false,
|
||||
"int": {
|
||||
"ip": 3232236042,
|
||||
"network": 3232236042,
|
||||
"broadcast": 3232236042,
|
||||
"first_host": 3232236042,
|
||||
"last_host": 3232236042
|
||||
},
|
||||
"hex": {
|
||||
"ip": "c0:a8:02:0a",
|
||||
"network": "c0:a8:02:0a",
|
||||
"broadcast": "c0:a8:02:0a",
|
||||
"hostmask": "00:00:00:00",
|
||||
"netmask": "ff:ff:ff:ff",
|
||||
"first_host": "c0:a8:02:0a",
|
||||
"last_host": "c0:a8:02:0a"
|
||||
},
|
||||
"bin": {
|
||||
"ip": "11000000101010000000001000001010",
|
||||
"network": "11000000101010000000001000001010",
|
||||
"broadcast": "11000000101010000000001000001010",
|
||||
"hostmask": "00000000000000000000000000000000",
|
||||
"netmask": "11111111111111111111111111111111",
|
||||
"first_host": "11000000101010000000001000001010",
|
||||
"last_host": "11000000101010000000001000001010"
|
||||
}
|
||||
}
|
||||
|
||||
$ echo 127:0:de::1%128/96 | jc --ip-address -p
|
||||
{
|
||||
"version": 6,
|
||||
"max_prefix_length": 128,
|
||||
"ip": "127:0:de::1",
|
||||
"ip_compressed": "127:0:de::1",
|
||||
"ip_exploded": "0127:0000:00de:0000:0000:0000:0000:0001",
|
||||
"ip_split": [
|
||||
"0127",
|
||||
"0000",
|
||||
"00de",
|
||||
"0000",
|
||||
"0000",
|
||||
"0000",
|
||||
"0000",
|
||||
"0001"
|
||||
],
|
||||
"scope_id": "128",
|
||||
"ipv4_mapped": null,
|
||||
"six_to_four": null,
|
||||
"teredo_client": null,
|
||||
"teredo_server": null,
|
||||
"dns_ptr": "1.0.0.0.0.0...0.0.0.e.d.0.0.0.0.0.0.7.2.1.0.ip6.arpa",
|
||||
"network": "127:0:de::",
|
||||
"broadcast": "127:0:de::ffff:ffff",
|
||||
"hostmask": "::ffff:ffff",
|
||||
"netmask": "ffff:ffff:ffff:ffff:ffff:ffff::",
|
||||
"cidr_netmask": 96,
|
||||
"hosts": 4294967294,
|
||||
"first_host": "127:0:de::1",
|
||||
"last_host": "127:0:de::ffff:fffe",
|
||||
"is_multicast": false,
|
||||
"is_private": false,
|
||||
"is_global": true,
|
||||
"is_link_local": false,
|
||||
"is_loopback": false,
|
||||
"is_reserved": true,
|
||||
"is_unspecified": false,
|
||||
"int": {
|
||||
"ip": 1531727573536155682370944093904699393,
|
||||
"network": 1531727573536155682370944093904699392,
|
||||
"broadcast": 1531727573536155682370944098199666687,
|
||||
"first_host": 1531727573536155682370944093904699393,
|
||||
"last_host": 1531727573536155682370944098199666686
|
||||
},
|
||||
"hex": {
|
||||
"ip": "01:27:00:00:00:de:00:00:00:00:00:00:00:00:00:01",
|
||||
"network": "01:27:00:00:00:de:00:00:00:00:00:00:00:00:00:00",
|
||||
"broadcast": "01:27:00:00:00:de:00:00:00:00:00:00:ff:ff:ff:ff",
|
||||
"hostmask": "00:00:00:00:00:00:00:00:00:00:00:00:ff:ff:ff:ff",
|
||||
"netmask": "ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:00:00:00:00",
|
||||
"first_host": "01:27:00:00:00:de:00:00:00:00:00:00:00:00:00:01",
|
||||
"last_host": "01:27:00:00:00:de:00:00:00:00:00:00:ff:ff:ff:fe"
|
||||
},
|
||||
"bin": {
|
||||
"ip": "0000000100100111000000000000000000000000110...000000000001",
|
||||
"network": "00000001001001110000000000000000000000...000000000000",
|
||||
"broadcast": "000000010010011100000000000000000000...111111111111",
|
||||
"hostmask": "0000000000000000000000000000000000000...111111111111",
|
||||
"netmask": "11111111111111111111111111111111111111...000000000000",
|
||||
"first_host": "00000001001001110000000000000000000...000000000001",
|
||||
"last_host": "000000010010011100000000000000000000...1111111111110"
|
||||
}
|
||||
}
|
||||
|
||||
$ echo 1531727573536155682370944093904699393 | jc --ip-address -p
|
||||
{
|
||||
"version": 6,
|
||||
"max_prefix_length": 128,
|
||||
"ip": "127:0:de::1",
|
||||
"ip_compressed": "127:0:de::1",
|
||||
"ip_exploded": "0127:0000:00de:0000:0000:0000:0000:0001",
|
||||
"ip_split": [
|
||||
"0127",
|
||||
"0000",
|
||||
"00de",
|
||||
"0000",
|
||||
"0000",
|
||||
"0000",
|
||||
"0000",
|
||||
"0001"
|
||||
],
|
||||
"scope_id": null,
|
||||
"ipv4_mapped": null,
|
||||
"six_to_four": null,
|
||||
"teredo_client": null,
|
||||
"teredo_server": null,
|
||||
"dns_ptr": "1.0.0.0.0.0....0.0.0.0.e.d.0.0.0.0.0.0.7.2.1.0.ip6.arpa",
|
||||
"network": "127:0:de::1",
|
||||
"broadcast": "127:0:de::1",
|
||||
"hostmask": "::",
|
||||
"netmask": "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff",
|
||||
"cidr_netmask": 128,
|
||||
"hosts": 1,
|
||||
"first_host": "127:0:de::1",
|
||||
"last_host": "127:0:de::1",
|
||||
"is_multicast": false,
|
||||
"is_private": false,
|
||||
"is_global": true,
|
||||
"is_link_local": false,
|
||||
"is_loopback": false,
|
||||
"is_reserved": true,
|
||||
"is_unspecified": false,
|
||||
"int": {
|
||||
"ip": 1531727573536155682370944093904699393,
|
||||
"network": 1531727573536155682370944093904699393,
|
||||
"broadcast": 1531727573536155682370944093904699393,
|
||||
"first_host": 1531727573536155682370944093904699393,
|
||||
"last_host": 1531727573536155682370944093904699393
|
||||
},
|
||||
"hex": {
|
||||
"ip": "01:27:00:00:00:de:00:00:00:00:00:00:00:00:00:01",
|
||||
"network": "01:27:00:00:00:de:00:00:00:00:00:00:00:00:00:01",
|
||||
"broadcast": "01:27:00:00:00:de:00:00:00:00:00:00:00:00:00:01",
|
||||
"hostmask": "00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00",
|
||||
"netmask": "ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff",
|
||||
"first_host": "01:27:00:00:00:de:00:00:00:00:00:00:00:00:00:01",
|
||||
"last_host": "01:27:00:00:00:de:00:00:00:00:00:00:00:00:00:01"
|
||||
},
|
||||
"bin": {
|
||||
"ip": "0000000100100111000000000000000000000000110111100...000001",
|
||||
"network": "00000001001001110000000000000000000000001101...000001",
|
||||
"broadcast": "000000010010011100000000000000000000000011...000001",
|
||||
"hostmask": "0000000000000000000000000000000000000000000...000000",
|
||||
"netmask": "11111111111111111111111111111111111111111111...111111",
|
||||
"first_host": "00000001001001110000000000000000000000001...000001",
|
||||
"last_host": "000000010010011100000000000000000000000011...0000001"
|
||||
}
|
||||
}
|
||||
|
||||
# IPv4 Mapped Address
|
||||
$ echo ::FFFF:192.168.1.35 | jc --ip-address -p
|
||||
{
|
||||
"version": 6,
|
||||
"max_prefix_length": 128,
|
||||
"ip": "::ffff:c0a8:123",
|
||||
"ip_compressed": "::ffff:c0a8:123",
|
||||
"ip_exploded": "0000:0000:0000:0000:0000:ffff:c0a8:0123",
|
||||
"ip_split": [
|
||||
"0000",
|
||||
"0000",
|
||||
"0000",
|
||||
"0000",
|
||||
"0000",
|
||||
"ffff",
|
||||
"c0a8",
|
||||
"0123"
|
||||
],
|
||||
"scope_id": null,
|
||||
"ipv4_mapped": "192.168.1.35",
|
||||
"six_to_four": null,
|
||||
"teredo_client": null,
|
||||
"teredo_server": null,
|
||||
"dns_ptr": "3.2.1.0.8.a.0.c.f.f.f.f.0.0....0.0.0.0.0.0.ip6.arpa",
|
||||
"network": "::ffff:c0a8:123",
|
||||
"broadcast": "::ffff:c0a8:123",
|
||||
"hostmask": "::",
|
||||
"netmask": "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff",
|
||||
"cidr_netmask": 128,
|
||||
"hosts": 1,
|
||||
"first_host": "::ffff:c0a8:123",
|
||||
"last_host": "::ffff:c0a8:123",
|
||||
"is_multicast": false,
|
||||
"is_private": true,
|
||||
"is_global": false,
|
||||
"is_link_local": false,
|
||||
"is_loopback": false,
|
||||
"is_reserved": true,
|
||||
"is_unspecified": false,
|
||||
"int": {
|
||||
"ip": 281473913979171,
|
||||
"network": 281473913979171,
|
||||
"broadcast": 281473913979171,
|
||||
"first_host": 281473913979171,
|
||||
"last_host": 281473913979171
|
||||
},
|
||||
"hex": {
|
||||
"ip": "00:00:00:00:00:00:00:00:00:00:ff:ff:c0:a8:01:23",
|
||||
"network": "00:00:00:00:00:00:00:00:00:00:ff:ff:c0:a8:01:23",
|
||||
"broadcast": "00:00:00:00:00:00:00:00:00:00:ff:ff:c0:a8:01:23",
|
||||
"hostmask": "00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00",
|
||||
"netmask": "ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff",
|
||||
"first_host": "00:00:00:00:00:00:00:00:00:00:ff:ff:c0:a8:01:23",
|
||||
"last_host": "00:00:00:00:00:00:00:00:00:00:ff:ff:c0:a8:01:23"
|
||||
},
|
||||
"bin": {
|
||||
"ip": "000000000000000000000000000000000000000000000...100100011",
|
||||
"network": "0000000000000000000000000000000000000000...000100011",
|
||||
"broadcast": "00000000000000000000000000000000000000...000100011",
|
||||
"hostmask": "000000000000000000000000000000000000000...000000000",
|
||||
"netmask": "1111111111111111111111111111111111111111...111111111",
|
||||
"first_host": "0000000000000000000000000000000000000...100100011",
|
||||
"last_host": "00000000000000000000000000000000000000...0100100011"
|
||||
}
|
||||
}
|
||||
|
||||
# 6to4 Address
|
||||
$ echo 2002:c000:204::/48 | jc --ip-address -p
|
||||
{
|
||||
"version": 6,
|
||||
"max_prefix_length": 128,
|
||||
"ip": "2002:c000:204::",
|
||||
"ip_compressed": "2002:c000:204::",
|
||||
"ip_exploded": "2002:c000:0204:0000:0000:0000:0000:0000",
|
||||
"ip_split": [
|
||||
"2002",
|
||||
"c000",
|
||||
"0204",
|
||||
"0000",
|
||||
"0000",
|
||||
"0000",
|
||||
"0000",
|
||||
"0000"
|
||||
],
|
||||
"scope_id": null,
|
||||
"ipv4_mapped": null,
|
||||
"six_to_four": "192.0.2.4",
|
||||
"teredo_client": null,
|
||||
"teredo_server": null,
|
||||
"dns_ptr": "0.0.0.0.0.0.0...0.0.0.4.0.2.0.0.0.0.c.2.0.0.2.ip6.arpa",
|
||||
"network": "2002:c000:204::",
|
||||
"broadcast": "2002:c000:204:ffff:ffff:ffff:ffff:ffff",
|
||||
"hostmask": "::ffff:ffff:ffff:ffff:ffff",
|
||||
"netmask": "ffff:ffff:ffff::",
|
||||
"cidr_netmask": 48,
|
||||
"hosts": 1208925819614629174706174,
|
||||
"first_host": "2002:c000:204::1",
|
||||
"last_host": "2002:c000:204:ffff:ffff:ffff:ffff:fffe",
|
||||
"is_multicast": false,
|
||||
"is_private": false,
|
||||
"is_global": true,
|
||||
"is_link_local": false,
|
||||
"is_loopback": false,
|
||||
"is_reserved": false,
|
||||
"is_unspecified": false,
|
||||
"int": {
|
||||
"ip": 42549574682102084431821433448024768512,
|
||||
"network": 42549574682102084431821433448024768512,
|
||||
"broadcast": 42549574682103293357641048077199474687,
|
||||
"first_host": 42549574682102084431821433448024768513,
|
||||
"last_host": 42549574682103293357641048077199474686
|
||||
},
|
||||
"hex": {
|
||||
"ip": "20:02:c0:00:02:04:00:00:00:00:00:00:00:00:00:00",
|
||||
"network": "20:02:c0:00:02:04:00:00:00:00:00:00:00:00:00:00",
|
||||
"broadcast": "20:02:c0:00:02:04:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff",
|
||||
"hostmask": "00:00:00:00:00:00:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff",
|
||||
"netmask": "ff:ff:ff:ff:ff:ff:00:00:00:00:00:00:00:00:00:00",
|
||||
"first_host": "20:02:c0:00:02:04:00:00:00:00:00:00:00:00:00:01",
|
||||
"last_host": "20:02:c0:00:02:04:ff:ff:ff:ff:ff:ff:ff:ff:ff:fe"
|
||||
},
|
||||
"bin": {
|
||||
"ip": "00100000000000101100000000000000000000100000010...00000000",
|
||||
"network": "001000000000001011000000000000000000001000...00000000",
|
||||
"broadcast": "0010000000000010110000000000000000000010...11111111",
|
||||
"hostmask": "00000000000000000000000000000000000000000...11111111",
|
||||
"netmask": "111111111111111111111111111111111111111111...00000000",
|
||||
"first_host": "001000000000001011000000000000000000001...00000001",
|
||||
"last_host": "0010000000000010110000000000000000000010...111111110"
|
||||
}
|
||||
}
|
||||
|
||||
# Teredo Address
|
||||
$ echo 2001:0000:4136:e378:8000:63bf:3fff:fdd2 | jc --ip-address -p
|
||||
{
|
||||
"version": 6,
|
||||
"max_prefix_length": 128,
|
||||
"ip": "2001:0:4136:e378:8000:63bf:3fff:fdd2",
|
||||
"ip_compressed": "2001:0:4136:e378:8000:63bf:3fff:fdd2",
|
||||
"ip_exploded": "2001:0000:4136:e378:8000:63bf:3fff:fdd2",
|
||||
"ip_split": [
|
||||
"2001",
|
||||
"0000",
|
||||
"4136",
|
||||
"e378",
|
||||
"8000",
|
||||
"63bf",
|
||||
"3fff",
|
||||
"fdd2"
|
||||
],
|
||||
"scope_id": null,
|
||||
"ipv4_mapped": null,
|
||||
"six_to_four": null,
|
||||
"teredo_client": "192.0.2.45",
|
||||
"teredo_server": "65.54.227.120",
|
||||
"dns_ptr": "2.d.d.f.f.f.f.3.f.b.3.6.0.0.0.8.8....0.1.0.0.2.ip6.arpa",
|
||||
"network": "2001:0:4136:e378:8000:63bf:3fff:fdd2",
|
||||
"broadcast": "2001:0:4136:e378:8000:63bf:3fff:fdd2",
|
||||
"hostmask": "::",
|
||||
"netmask": "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff",
|
||||
"cidr_netmask": 128,
|
||||
"hosts": 1,
|
||||
"first_host": "2001:0:4136:e378:8000:63bf:3fff:fdd2",
|
||||
"last_host": "2001:0:4136:e378:8000:63bf:3fff:fdd2",
|
||||
"is_multicast": false,
|
||||
"is_private": true,
|
||||
"is_global": false,
|
||||
"is_link_local": false,
|
||||
"is_loopback": false,
|
||||
"is_reserved": false,
|
||||
"is_unspecified": false,
|
||||
"int": {
|
||||
"ip": 42540488182158724593221357832373272018,
|
||||
"network": 42540488182158724593221357832373272018,
|
||||
"broadcast": 42540488182158724593221357832373272018,
|
||||
"first_host": 42540488182158724593221357832373272018,
|
||||
"last_host": 42540488182158724593221357832373272018
|
||||
},
|
||||
"hex": {
|
||||
"ip": "20:01:00:00:41:36:e3:78:80:00:63:bf:3f:ff:fd:d2",
|
||||
"network": "20:01:00:00:41:36:e3:78:80:00:63:bf:3f:ff:fd:d2",
|
||||
"broadcast": "20:01:00:00:41:36:e3:78:80:00:63:bf:3f:ff:fd:d2",
|
||||
"hostmask": "00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00",
|
||||
"netmask": "ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff",
|
||||
"first_host": "20:01:00:00:41:36:e3:78:80:00:63:bf:3f:ff:fd:d2",
|
||||
"last_host": "20:01:00:00:41:36:e3:78:80:00:63:bf:3f:ff:fd:d2"
|
||||
},
|
||||
"bin": {
|
||||
"ip": "0010000000000001000000000000000001000001001...110111010010",
|
||||
"network": "00100000000000010000000000000000010000...110111010010",
|
||||
"broadcast": "001000000000000100000000000000000100...110111010010",
|
||||
"hostmask": "0000000000000000000000000000000000000...000000000000",
|
||||
"netmask": "11111111111111111111111111111111111111...111111111111",
|
||||
"first_host": "00100000000000010000000000000000010...110111010010",
|
||||
"last_host": "001000000000000100000000000000000100...110111010010"
|
||||
}
|
||||
}
|
||||
|
||||
<a id="jc.parsers.ip_address.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
def parse(data: str, raw: bool = False, quiet: bool = False) -> Dict
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
Dictionary. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
|
||||
|
||||
Source: [`jc/parsers/ip_address.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/ip_address.py)
|
||||
|
||||
This parser can be used with the `--slurp` command-line option.
|
||||
|
||||
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
76
docs/parsers/ip_route.md
Normal file
76
docs/parsers/ip_route.md
Normal file
@@ -0,0 +1,76 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.ip_route"></a>
|
||||
|
||||
# jc.parsers.ip_route
|
||||
|
||||
jc - JSON Convert `ip route` command output parser
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ ip route | jc --ip-route
|
||||
|
||||
or
|
||||
|
||||
$ jc ip-route
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('ip_route', ip_route_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"ip": string,
|
||||
"via": string,
|
||||
"dev": string,
|
||||
"metric": integer,
|
||||
"proto": string,
|
||||
"scope": string,
|
||||
"src": string,
|
||||
"via": string,
|
||||
"status": string
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
$ ip route | jc --ip-route -p
|
||||
[
|
||||
{
|
||||
"ip": "10.0.2.0/24",
|
||||
"dev": "enp0s3",
|
||||
"proto": "kernel",
|
||||
"scope": "link",
|
||||
"src": "10.0.2.15",
|
||||
"metric": 100
|
||||
}
|
||||
]
|
||||
|
||||
<a id="jc.parsers.ip_route.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
List of Json objects if data is processed and Raw data if raw = true.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Source: [`jc/parsers/ip_route.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/ip_route.py)
|
||||
|
||||
Version 1.0 by Julian Jackson (jackson.julian55@yahoo.com)
|
||||
461
docs/parsers/ipconfig.md
Normal file
461
docs/parsers/ipconfig.md
Normal file
@@ -0,0 +1,461 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.ipconfig"></a>
|
||||
|
||||
# jc.parsers.ipconfig
|
||||
|
||||
jc - JSON Convert `ipconfig` Windows command output parser
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ ipconfig /all | jc --ipconfig
|
||||
$ ipconfig | jc --ipconfig
|
||||
$ jc ipconfig /all
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('ipconfig', ipconfig_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
{
|
||||
"host_name": string,
|
||||
"primary_dns_suffix": string,
|
||||
"node_type": string,
|
||||
"ip_routing_enabled": boolean,
|
||||
"wins_proxy_enabled": boolean,
|
||||
"dns_suffix_search_list": [
|
||||
string
|
||||
],
|
||||
"adapters": [
|
||||
{
|
||||
"name_long": string,
|
||||
"name": string,
|
||||
"type": string,
|
||||
"connection_specific_dns_suffix": string,
|
||||
"connection_specific_dns_suffix_search_list": [
|
||||
string
|
||||
]
|
||||
"description": string,
|
||||
"physical_address": string,
|
||||
"dhcp_enabled": boolean,
|
||||
"autoconfiguration_enabled": boolean,
|
||||
"ipv6_addresses": [
|
||||
{
|
||||
"address": string,
|
||||
"status": string,
|
||||
},
|
||||
],
|
||||
"temporary_ipv6_addresses": [
|
||||
{
|
||||
"address": string,
|
||||
"status": string,
|
||||
},
|
||||
],
|
||||
"link_local_ipv6_addresses": [
|
||||
{
|
||||
"address": string,
|
||||
"status": string,
|
||||
"prefix_length": integer,
|
||||
}
|
||||
],
|
||||
"ipv4_addresses": [
|
||||
{
|
||||
"address": string, # [2]
|
||||
"subnet_mask": string,
|
||||
"status": string,
|
||||
"autoconfigured": boolean # [1]
|
||||
}
|
||||
],
|
||||
"default_gateways": [
|
||||
string
|
||||
],
|
||||
"dhcp_server": null,
|
||||
"dhcpv6_iaid": string,
|
||||
"dhcpv6_client_duid": string,
|
||||
"dns_servers": [
|
||||
string
|
||||
],
|
||||
"primary_wins_server": string,
|
||||
"lease_expires": string,
|
||||
"lease_expires_epoch": integer, # [0]
|
||||
"lease_expires_iso": string,
|
||||
"lease_obtained": string,
|
||||
"lease_obtained_epoch": integer, # [0]
|
||||
"lease_obtained_iso": string,
|
||||
"netbios_over_tcpip": boolean,
|
||||
"media_state": string,
|
||||
"extras": [
|
||||
<string>: string
|
||||
]
|
||||
}
|
||||
],
|
||||
"extras": []
|
||||
}
|
||||
|
||||
Notes:
|
||||
[0] - The epoch calculated timestamp field is naive. (i.e. based on
|
||||
the local time of the system the parser is run on)
|
||||
[1] - 'autoconfigured' under 'ipv4_address' is only providing
|
||||
indication if the ipv4 address was labeled as "Autoconfiguration
|
||||
IPv4 Address" vs "IPv4 Address". It does not infer any
|
||||
information from other fields
|
||||
[2] - Windows XP uses 'IP Address' instead of 'IPv4 Address'. Both
|
||||
values are parsed to the 'ipv4_address' object for consistency
|
||||
|
||||
Examples:
|
||||
|
||||
$ ipconfig /all | jc --ipconfig -p
|
||||
{
|
||||
"host_name": "DESKTOP-WIN11-HOME",
|
||||
"primary_dns_suffix": null,
|
||||
"node_type": "Hybrid",
|
||||
"ip_routing_enabled": false,
|
||||
"wins_proxy_enabled": false,
|
||||
"dns_suffix_search_list": [
|
||||
"localdomain"
|
||||
],
|
||||
"adapters": [
|
||||
{
|
||||
"name_long": "Ethernet adapter Ethernet",
|
||||
"name": "Ethernet",
|
||||
"type": "Ethernet",
|
||||
"connection_specific_dns_suffix": null,
|
||||
"connection_specific_dns_suffix_search_list": [],
|
||||
"description": "Intel(R) I211 Gigabit Network Connection",
|
||||
"physical_address": "24-4B-FE-AB-43-C3",
|
||||
"dhcp_enabled": true,
|
||||
"autoconfiguration_enabled": true,
|
||||
"ipv6_addresses": [],
|
||||
"temporary_ipv6_addresses": [],
|
||||
"link_local_ipv6_addresses": [],
|
||||
"ipv4_addresses": [],
|
||||
"default_gateways": [],
|
||||
"dhcp_server": null,
|
||||
"dhcpv6_iaid": null,
|
||||
"dhcpv6_client_duid": null,
|
||||
"dns_servers": [],
|
||||
"primary_wins_server": null,
|
||||
"lease_expires": null,
|
||||
"lease_obtained": null,
|
||||
"netbios_over_tcpip": null,
|
||||
"media_state": "Media disconnected",
|
||||
"extras": []
|
||||
},
|
||||
{
|
||||
"name_long": "Ethernet adapter Ethernet 2",
|
||||
"name": "Ethernet 2",
|
||||
"type": "Ethernet",
|
||||
"connection_specific_dns_suffix": null,
|
||||
"connection_specific_dns_suffix_search_list": [],
|
||||
"description": "Realtek PCIe 2.5GbE Family Controller",
|
||||
"physical_address": "24-4B-FE-57-3D-F2",
|
||||
"dhcp_enabled": true,
|
||||
"autoconfiguration_enabled": true,
|
||||
"ipv6_addresses": [],
|
||||
"temporary_ipv6_addresses": [],
|
||||
"link_local_ipv6_addresses": [],
|
||||
"ipv4_addresses": [],
|
||||
"default_gateways": [],
|
||||
"dhcp_server": null,
|
||||
"dhcpv6_iaid": null,
|
||||
"dhcpv6_client_duid": null,
|
||||
"dns_servers": [],
|
||||
"primary_wins_server": null,
|
||||
"lease_expires": null,
|
||||
"lease_obtained": null,
|
||||
"netbios_over_tcpip": null,
|
||||
"media_state": "Media disconnected",
|
||||
"extras": []
|
||||
},
|
||||
{
|
||||
"name_long": "Unknown adapter OpenVPN Data Channel Offload for NordVPN",
|
||||
"name": "OpenVPN Data Channel Offload for NordVPN",
|
||||
"type": "Unknown",
|
||||
"connection_specific_dns_suffix": null,
|
||||
"connection_specific_dns_suffix_search_list": [],
|
||||
"description": "OpenVPN Data Channel Offload",
|
||||
"physical_address": null,
|
||||
"dhcp_enabled": true,
|
||||
"autoconfiguration_enabled": true,
|
||||
"ipv6_addresses": [],
|
||||
"temporary_ipv6_addresses": [],
|
||||
"link_local_ipv6_addresses": [],
|
||||
"ipv4_addresses": [],
|
||||
"default_gateways": [],
|
||||
"dhcp_server": null,
|
||||
"dhcpv6_iaid": null,
|
||||
"dhcpv6_client_duid": null,
|
||||
"dns_servers": [],
|
||||
"primary_wins_server": null,
|
||||
"lease_expires": null,
|
||||
"lease_obtained": null,
|
||||
"netbios_over_tcpip": null,
|
||||
"media_state": "Media disconnected",
|
||||
"extras": []
|
||||
},
|
||||
{
|
||||
"name_long": "Unknown adapter Local Area Connection",
|
||||
"name": "Local Area Connection",
|
||||
"type": "Unknown",
|
||||
"connection_specific_dns_suffix": null,
|
||||
"connection_specific_dns_suffix_search_list": [],
|
||||
"description": "TAP-NordVPN Windows Adapter V9",
|
||||
"physical_address": "00-FF-4C-F4-5E-49",
|
||||
"dhcp_enabled": true,
|
||||
"autoconfiguration_enabled": true,
|
||||
"ipv6_addresses": [],
|
||||
"temporary_ipv6_addresses": [],
|
||||
"link_local_ipv6_addresses": [],
|
||||
"ipv4_addresses": [],
|
||||
"default_gateways": [],
|
||||
"dhcp_server": null,
|
||||
"dhcpv6_iaid": null,
|
||||
"dhcpv6_client_duid": null,
|
||||
"dns_servers": [],
|
||||
"primary_wins_server": null,
|
||||
"lease_expires": null,
|
||||
"lease_obtained": null,
|
||||
"netbios_over_tcpip": null,
|
||||
"media_state": "Media disconnected",
|
||||
"extras": []
|
||||
},
|
||||
{
|
||||
"name_long": "Wireless LAN adapter Local Area Connection* 1",
|
||||
"name": "Local Area Connection* 1",
|
||||
"type": "Wireless LAN",
|
||||
"connection_specific_dns_suffix": null,
|
||||
"connection_specific_dns_suffix_search_list": [],
|
||||
"description": "Microsoft Wi-Fi Direct Virtual Adapter",
|
||||
"physical_address": "A8-7E-EA-5A-7F-DE",
|
||||
"dhcp_enabled": true,
|
||||
"autoconfiguration_enabled": true,
|
||||
"ipv6_addresses": [],
|
||||
"temporary_ipv6_addresses": [],
|
||||
"link_local_ipv6_addresses": [],
|
||||
"ipv4_addresses": [],
|
||||
"default_gateways": [],
|
||||
"dhcp_server": null,
|
||||
"dhcpv6_iaid": null,
|
||||
"dhcpv6_client_duid": null,
|
||||
"dns_servers": [],
|
||||
"primary_wins_server": null,
|
||||
"lease_expires": null,
|
||||
"lease_obtained": null,
|
||||
"netbios_over_tcpip": null,
|
||||
"media_state": "Media disconnected",
|
||||
"extras": []
|
||||
},
|
||||
{
|
||||
"name_long": "Wireless LAN adapter Local Area Connection* 2",
|
||||
"name": "Local Area Connection* 2",
|
||||
"type": "Wireless LAN",
|
||||
"connection_specific_dns_suffix": null,
|
||||
"connection_specific_dns_suffix_search_list": [],
|
||||
"description": "Microsoft Wi-Fi Direct Virtual Adapter #2",
|
||||
"physical_address": "AA-7E-EA-F3-64-C3",
|
||||
"dhcp_enabled": true,
|
||||
"autoconfiguration_enabled": true,
|
||||
"ipv6_addresses": [],
|
||||
"temporary_ipv6_addresses": [],
|
||||
"link_local_ipv6_addresses": [],
|
||||
"ipv4_addresses": [],
|
||||
"default_gateways": [],
|
||||
"dhcp_server": null,
|
||||
"dhcpv6_iaid": null,
|
||||
"dhcpv6_client_duid": null,
|
||||
"dns_servers": [],
|
||||
"primary_wins_server": null,
|
||||
"lease_expires": null,
|
||||
"lease_obtained": null,
|
||||
"netbios_over_tcpip": null,
|
||||
"media_state": "Media disconnected",
|
||||
"extras": []
|
||||
},
|
||||
{
|
||||
"name_long": "Ethernet adapter VMware Network Adapter VMnet1",
|
||||
"name": "VMware Network Adapter VMnet1",
|
||||
"type": "Ethernet",
|
||||
"connection_specific_dns_suffix": null,
|
||||
"connection_specific_dns_suffix_search_list": [],
|
||||
"description": "VMware Virtual Ethernet Adapter for VMnet1",
|
||||
"physical_address": "00-50-56-CC-27-73",
|
||||
"dhcp_enabled": true,
|
||||
"autoconfiguration_enabled": true,
|
||||
"ipv6_addresses": [],
|
||||
"temporary_ipv6_addresses": [],
|
||||
"link_local_ipv6_addresses": [
|
||||
{
|
||||
"address": "fe80::f47d:9c7f:69dc:591e",
|
||||
"prefix_length": 8,
|
||||
"status": "Preferred"
|
||||
}
|
||||
],
|
||||
"ipv4_addresses": [
|
||||
{
|
||||
"address": "192.168.181.1",
|
||||
"subnet_mask": "255.255.255.0",
|
||||
"status": "Preferred",
|
||||
"autoconfigured": false
|
||||
}
|
||||
],
|
||||
"default_gateways": [],
|
||||
"dhcp_server": "192.168.181.254",
|
||||
"dhcpv6_iaid": "771772502",
|
||||
"dhcpv6_client_duid": "00-01-00-01-2C-CF-19-EB-24-4B-FE-5B-9B-E6",
|
||||
"dns_servers": [],
|
||||
"primary_wins_server": null,
|
||||
"lease_expires": "2024-09-19T18:01:29",
|
||||
"lease_obtained": "2024-09-19T08:31:29",
|
||||
"netbios_over_tcpip": true,
|
||||
"media_state": null,
|
||||
"extras": []
|
||||
},
|
||||
{
|
||||
"name_long": "Ethernet adapter VMware Network Adapter VMnet8",
|
||||
"name": "VMware Network Adapter VMnet8",
|
||||
"type": "Ethernet",
|
||||
"connection_specific_dns_suffix": null,
|
||||
"connection_specific_dns_suffix_search_list": [],
|
||||
"description": "VMware Virtual Ethernet Adapter for VMnet8",
|
||||
"physical_address": "00-50-56-C9-A3-78",
|
||||
"dhcp_enabled": true,
|
||||
"autoconfiguration_enabled": true,
|
||||
"ipv6_addresses": [],
|
||||
"temporary_ipv6_addresses": [],
|
||||
"link_local_ipv6_addresses": [
|
||||
{
|
||||
"address": "fe80::4551:bf0d:59dd:a4f0",
|
||||
"prefix_length": 10,
|
||||
"status": "Preferred"
|
||||
}
|
||||
],
|
||||
"ipv4_addresses": [
|
||||
{
|
||||
"address": "192.168.213.1",
|
||||
"subnet_mask": "255.255.255.0",
|
||||
"status": "Preferred",
|
||||
"autoconfigured": false
|
||||
}
|
||||
],
|
||||
"default_gateways": [],
|
||||
"dhcp_server": "192.168.213.254",
|
||||
"dhcpv6_iaid": "788549718",
|
||||
"dhcpv6_client_duid": "00-01-00-01-2C-CF-19-EB-24-4B-FE-5B-9B-E6",
|
||||
"dns_servers": [],
|
||||
"primary_wins_server": "192.168.213.2",
|
||||
"lease_expires": "2024-09-19T18:01:29",
|
||||
"lease_obtained": "2024-09-19T08:31:29",
|
||||
"netbios_over_tcpip": true,
|
||||
"media_state": null,
|
||||
"extras": []
|
||||
},
|
||||
{
|
||||
"name_long": "Wireless LAN adapter Wi-Fi",
|
||||
"name": "Wi-Fi",
|
||||
"type": "Wireless LAN",
|
||||
"connection_specific_dns_suffix": "localdomain",
|
||||
"connection_specific_dns_suffix_search_list": [],
|
||||
"description": "Intel(R) Wi-Fi 6 AX200 160MHz",
|
||||
"physical_address": "A8-7E-EA-55-26-B0",
|
||||
"dhcp_enabled": true,
|
||||
"autoconfiguration_enabled": true,
|
||||
"ipv6_addresses": [
|
||||
{
|
||||
"address": "fd63:cc9c:65eb:3f95:57c2:aa:10d8:db08",
|
||||
"status": "Preferred"
|
||||
}
|
||||
],
|
||||
"temporary_ipv6_addresses": [
|
||||
{
|
||||
"address": "fd63:cc9c:65eb:3f95:8928:348e:d692:b7ef",
|
||||
"status": "Preferred"
|
||||
}
|
||||
],
|
||||
"link_local_ipv6_addresses": [
|
||||
{
|
||||
"address": "fe80::4fae:1380:5a1b:8b6b",
|
||||
"prefix_length": 11,
|
||||
"status": "Preferred"
|
||||
}
|
||||
],
|
||||
"ipv4_addresses": [
|
||||
{
|
||||
"address": "192.168.1.169",
|
||||
"subnet_mask": "255.255.255.0",
|
||||
"status": "Preferred",
|
||||
"autoconfigured": false
|
||||
}
|
||||
],
|
||||
"default_gateways": [
|
||||
"192.168.1.1"
|
||||
],
|
||||
"dhcp_server": "192.168.1.1",
|
||||
"dhcpv6_iaid": "162037482",
|
||||
"dhcpv6_client_duid": "00-01-00-01-2C-CF-19-EB-24-4B-FE-5B-9B-E6",
|
||||
"dns_servers": [
|
||||
"192.168.1.1"
|
||||
],
|
||||
"primary_wins_server": null,
|
||||
"lease_expires": "2024-09-20T08:31:30",
|
||||
"lease_obtained": "2024-09-19T08:31:30",
|
||||
"netbios_over_tcpip": true,
|
||||
"media_state": null,
|
||||
"extras": []
|
||||
},
|
||||
{
|
||||
"name_long": "Ethernet adapter Bluetooth Network Connection",
|
||||
"name": "Bluetooth Network Connection",
|
||||
"type": "Ethernet",
|
||||
"connection_specific_dns_suffix": null,
|
||||
"connection_specific_dns_suffix_search_list": [],
|
||||
"description": "Bluetooth Device (Personal Area Network)",
|
||||
"physical_address": "A8-7E-EA-43-23-14",
|
||||
"dhcp_enabled": true,
|
||||
"autoconfiguration_enabled": true,
|
||||
"ipv6_addresses": [],
|
||||
"temporary_ipv6_addresses": [],
|
||||
"link_local_ipv6_addresses": [],
|
||||
"ipv4_addresses": [],
|
||||
"default_gateways": [],
|
||||
"dhcp_server": null,
|
||||
"dhcpv6_iaid": null,
|
||||
"dhcpv6_client_duid": null,
|
||||
"dns_servers": [],
|
||||
"primary_wins_server": null,
|
||||
"lease_expires": null,
|
||||
"lease_obtained": null,
|
||||
"netbios_over_tcpip": null,
|
||||
"media_state": "Media disconnected",
|
||||
"extras": []
|
||||
}
|
||||
],
|
||||
"extras": []
|
||||
}
|
||||
|
||||
<a id="jc.parsers.ipconfig.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
Parsed dictionary. The raw and processed data structures are the same.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: windows
|
||||
|
||||
Source: [`jc/parsers/ipconfig.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/ipconfig.py)
|
||||
|
||||
Version 1.0 by joehacksalot (joehacksalot@gmail.com)
|
||||
@@ -5,13 +5,13 @@
|
||||
|
||||
jc - JSON Convert `iptables` command output parser
|
||||
|
||||
Supports `-vLn` and `--line-numbers` for all tables.
|
||||
Supports `-vLnx` and `--line-numbers` for all tables.
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ sudo iptables -L -t nat | jc --iptables
|
||||
|
||||
or
|
||||
or
|
||||
|
||||
$ jc iptables -L -t nat
|
||||
|
||||
@@ -25,12 +25,15 @@ Schema:
|
||||
[
|
||||
{
|
||||
"chain": string,
|
||||
"default_policy": string,
|
||||
"default_packets": integer,
|
||||
"default_bytes": integer,
|
||||
"rules": [
|
||||
{
|
||||
"num" integer,
|
||||
"pkts": integer,
|
||||
"bytes": integer, # converted based on suffix
|
||||
"target": string,
|
||||
"target": string, # Null if blank
|
||||
"prot": string,
|
||||
"opt": string, # "--" = Null
|
||||
"in": string,
|
||||
@@ -49,6 +52,9 @@ Examples:
|
||||
[
|
||||
{
|
||||
"chain": "PREROUTING",
|
||||
"default_policy": "DROP",
|
||||
"default_packets": 0,
|
||||
"default_bytes": 0,
|
||||
"rules": [
|
||||
{
|
||||
"num": 1,
|
||||
@@ -108,6 +114,9 @@ Examples:
|
||||
[
|
||||
{
|
||||
"chain": "PREROUTING",
|
||||
"default_policy": "DROP",
|
||||
"default_packets": "0",
|
||||
"default_bytes": "0",
|
||||
"rules": [
|
||||
{
|
||||
"num": "1",
|
||||
@@ -186,4 +195,6 @@ Returns:
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Version 1.8 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
Source: [`jc/parsers/iptables.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/iptables.py)
|
||||
|
||||
Version 1.12 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.iw_scan"></a>
|
||||
|
||||
# jc.parsers.iw\_scan
|
||||
# jc.parsers.iw_scan
|
||||
|
||||
jc - JSON Convert `iw dev <device> scan` command output parser
|
||||
|
||||
@@ -12,7 +12,7 @@ Usage (cli):
|
||||
|
||||
$ iw dev wlan0 scan | jc --iw-scan
|
||||
|
||||
or
|
||||
or
|
||||
|
||||
$ jc iw dev wlan0 scan
|
||||
|
||||
@@ -144,4 +144,6 @@ Returns:
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Version 0.7 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
Source: [`jc/parsers/iw_scan.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/iw_scan.py)
|
||||
|
||||
Version 0.75 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
113
docs/parsers/iwconfig.md
Normal file
113
docs/parsers/iwconfig.md
Normal file
@@ -0,0 +1,113 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.iwconfig"></a>
|
||||
|
||||
# jc.parsers.iwconfig
|
||||
|
||||
jc - JSON Convert `iwconfig` command output parser
|
||||
|
||||
No `iwconfig` options are supported.
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ iwconfig | jc --iwconfig
|
||||
|
||||
or
|
||||
|
||||
$ jc iwconfig
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('iwconfig', iwconfig_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"name": string,
|
||||
"protocol": string,
|
||||
"essid": string,
|
||||
"mode": string,
|
||||
"frequency": float,
|
||||
"frequency_unit": string,
|
||||
"access_point": string,
|
||||
"bit_rate": float,
|
||||
"bit_rate_unit": string,
|
||||
"tx_power": integer,
|
||||
"tx_power_unit": string,
|
||||
"retry_short_limit": integer,
|
||||
"rts_threshold": boolean,
|
||||
"fragment_threshold": boolean,
|
||||
"power_management": boolean,
|
||||
"link_quality": string,
|
||||
"signal_level": integer,
|
||||
"signal_level_unit": string,
|
||||
"rx_invalid_nwid": integer,
|
||||
"rx_invalid_crypt": integer,
|
||||
"rx_invalid_frag": integer,
|
||||
"tx_excessive_retries": integer,
|
||||
"invalid_misc": integer,
|
||||
"missed_beacon": integer
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
$ iwconfig | jc --iwconfig -p
|
||||
[
|
||||
{
|
||||
"name": "wlp5s0",
|
||||
"protocol": "IEEE 802.11",
|
||||
"essid": "BLABLABLA",
|
||||
"mode": "Managed",
|
||||
"frequency": 5.18,
|
||||
"frequency_unit": "GHz",
|
||||
"access_point": "E6:64:DA:16:51:BF",
|
||||
"bit_rate": 6.0,
|
||||
"bit_rate_unit": "Mb/s",
|
||||
"tx_power": 30,
|
||||
"tx_power_unit": "dBm",
|
||||
"retry_short_limit": 7,
|
||||
"rts_threshold": false,
|
||||
"fragment_threshold": false,
|
||||
"power_management": true,
|
||||
"link_quality": "61/70",
|
||||
"signal_level": -49,
|
||||
"signal_level_unit": "dBm",
|
||||
"rx_invalid_nwid": 0,
|
||||
"rx_invalid_crypt": 0,
|
||||
"rx_invalid_frag": 0,
|
||||
"tx_excessive_retries": 0,
|
||||
"invalid_misc": 2095,
|
||||
"missed_beacon": 0
|
||||
}
|
||||
]
|
||||
|
||||
<a id="jc.parsers.iwconfig.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
def parse(data: str,
|
||||
raw: bool = False,
|
||||
quiet: bool = False) -> List[Dict[str, Any]]
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Source: [`jc/parsers/iwconfig.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/iwconfig.py)
|
||||
|
||||
Version 1.2 by Thomas Vincent (vrince@gmail.com)
|
||||
@@ -1,9 +1,9 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.jar_manifest"></a>
|
||||
|
||||
# jc.parsers.jar\_manifest
|
||||
# jc.parsers.jar_manifest
|
||||
|
||||
jc - JSON Convert `MANIFEST.MF` file parser
|
||||
jc - JSON Convert Java `MANIFEST.MF` file parser
|
||||
|
||||
Usage (cli):
|
||||
|
||||
@@ -100,4 +100,6 @@ Returns:
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
|
||||
|
||||
Source: [`jc/parsers/jar_manifest.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/jar_manifest.py)
|
||||
|
||||
Version 0.01 by Matt J (https://github.com/listuser)
|
||||
|
||||
@@ -116,4 +116,6 @@ Returns:
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, aix, freebsd
|
||||
|
||||
Source: [`jc/parsers/jobs.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/jobs.py)
|
||||
|
||||
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
@@ -70,4 +70,8 @@ Returns:
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
|
||||
|
||||
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
Source: [`jc/parsers/jwt.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/jwt.py)
|
||||
|
||||
This parser can be used with the `--slurp` command-line option.
|
||||
|
||||
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
# jc.parsers.kv
|
||||
|
||||
jc - JSON Convert `Key/Value` file parser
|
||||
jc - JSON Convert `Key/Value` file and string parser
|
||||
|
||||
Supports files containing simple key/value pairs.
|
||||
|
||||
@@ -26,8 +26,8 @@ Usage (module):
|
||||
|
||||
Schema:
|
||||
|
||||
key/value document converted to a dictionary - see the configparser standard
|
||||
library documentation for more details.
|
||||
Key/Value document converted to a dictionary - see the python configparser
|
||||
standard library documentation for more details.
|
||||
|
||||
{
|
||||
"key1": string,
|
||||
@@ -41,6 +41,7 @@ Examples:
|
||||
name = John Doe
|
||||
address=555 California Drive
|
||||
age: 34
|
||||
|
||||
; comments can include # or ;
|
||||
# delimiter can be = or :
|
||||
# quoted values have quotation marks stripped by default
|
||||
@@ -65,8 +66,6 @@ def parse(data, raw=False, quiet=False)
|
||||
|
||||
Main text parsing function
|
||||
|
||||
Note: this is just a wrapper for jc.parsers.ini
|
||||
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
@@ -75,9 +74,11 @@ Parameters:
|
||||
|
||||
Returns:
|
||||
|
||||
Dictionary representing the key/value file
|
||||
Dictionary representing a Key/Value pair document.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
|
||||
|
||||
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
Source: [`jc/parsers/kv.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/kv.py)
|
||||
|
||||
Version 2.2 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
91
docs/parsers/kv_dup.md
Normal file
91
docs/parsers/kv_dup.md
Normal file
@@ -0,0 +1,91 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.kv_dup"></a>
|
||||
|
||||
# jc.parsers.kv_dup
|
||||
|
||||
jc - JSON Convert `Key/Value` with duplicate key file and string parser
|
||||
|
||||
Supports files containing simple key/value pairs and preserves duplicate
|
||||
values. All values are contained in lists/arrays.
|
||||
|
||||
- Delimiter can be `=` or `:`. Missing values are supported.
|
||||
- Comment prefix can be `#` or `;`. Comments must be on their own line.
|
||||
- If multi-line values are used, each line will be a separate item in the
|
||||
value list. Blank lines in multi-line values are not supported.
|
||||
|
||||
> Note: Values starting and ending with quotation marks will have the marks
|
||||
> removed. If you would like to keep the quotation marks, use the `-r`
|
||||
> command-line argument or the `raw=True` argument in `parse()`.
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ cat foo.txt | jc --kv-dup
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('kv_dup', kv_file_output)
|
||||
|
||||
Schema:
|
||||
|
||||
Key/Value document converted to a dictionary - see the python configparser
|
||||
standard library documentation for more details.
|
||||
|
||||
{
|
||||
"<key1>": [
|
||||
string
|
||||
],
|
||||
"<key2>": [
|
||||
string
|
||||
]
|
||||
}
|
||||
|
||||
Examples:
|
||||
|
||||
$ cat keyvalue.txt
|
||||
# this file contains key/value pairs
|
||||
name = John Doe
|
||||
address=555 California Drive
|
||||
age: 34
|
||||
|
||||
; comments can include # or ;
|
||||
# delimiter can be = or :
|
||||
# quoted values have quotation marks stripped by default
|
||||
# but can be preserved with the -r argument
|
||||
occupation:"Engineer"
|
||||
occupation = "Pilot"
|
||||
|
||||
$ cat keyvalue.txt | jc --kv-dup -p
|
||||
{
|
||||
"name": ["John Doe"],
|
||||
"address": ["555 California Drive"],
|
||||
"age": ["34"],
|
||||
"occupation": ["Engineer", "Pilot"]
|
||||
}
|
||||
|
||||
<a id="jc.parsers.kv_dup.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
Dictionary representing a Key/Value pair document.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
|
||||
|
||||
Source: [`jc/parsers/kv_dup.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/kv_dup.py)
|
||||
|
||||
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
jc - JSON Convert `last` and `lastb` command output parser
|
||||
|
||||
Supports `-w` and `-F` options.
|
||||
Supports `-w`, `-F`, and `-x` options.
|
||||
|
||||
Calculated epoch time fields are naive (i.e. based on the local time of the
|
||||
system the parser is run on) since there is no timezone information in the
|
||||
@@ -15,7 +15,7 @@ Usage (cli):
|
||||
|
||||
$ last | jc --last
|
||||
|
||||
or
|
||||
or
|
||||
|
||||
$ jc last
|
||||
|
||||
@@ -127,4 +127,6 @@ Returns:
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, aix, freebsd
|
||||
|
||||
Version 1.8 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
Source: [`jc/parsers/last.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/last.py)
|
||||
|
||||
Version 1.9 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
@@ -26,7 +26,7 @@ Usage (cli):
|
||||
|
||||
$ ls | jc --ls
|
||||
|
||||
or
|
||||
or
|
||||
|
||||
$ jc ls
|
||||
|
||||
@@ -140,4 +140,6 @@ Returns:
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, aix, freebsd
|
||||
|
||||
Source: [`jc/parsers/ls.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/ls.py)
|
||||
|
||||
Version 1.12 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.ls_s"></a>
|
||||
|
||||
# jc.parsers.ls\_s
|
||||
# jc.parsers.ls_s
|
||||
|
||||
jc - JSON Convert `ls` and `vdir` command output streaming parser
|
||||
|
||||
@@ -77,7 +77,6 @@ Examples:
|
||||
### parse
|
||||
|
||||
```python
|
||||
@add_jc_meta
|
||||
def parse(data, raw=False, quiet=False, ignore_exceptions=False)
|
||||
```
|
||||
|
||||
@@ -99,4 +98,6 @@ Returns:
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, aix, freebsd
|
||||
|
||||
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
Source: [`jc/parsers/ls_s.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/ls_s.py)
|
||||
|
||||
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
91
docs/parsers/lsattr.md
Normal file
91
docs/parsers/lsattr.md
Normal file
@@ -0,0 +1,91 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.lsattr"></a>
|
||||
|
||||
# jc.parsers.lsattr
|
||||
|
||||
jc - JSON Convert `lsattr` command output parser
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ lsattr | jc --lsattr
|
||||
|
||||
or
|
||||
|
||||
$ jc lsattr
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('lsattr', lsattr_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
Information from https://github.com/mirror/busybox/blob/2d4a3d9e6c1493a9520b907e07a41aca90cdfd94/e2fsprogs/e2fs_lib.c#L40
|
||||
used to define field names
|
||||
|
||||
[
|
||||
{
|
||||
"file": string,
|
||||
"compressed_file": Optional[boolean],
|
||||
"compressed_dirty_file": Optional[boolean],
|
||||
"compression_raw_access": Optional[boolean],
|
||||
"secure_deletion": Optional[boolean],
|
||||
"undelete": Optional[boolean],
|
||||
"synchronous_updates": Optional[boolean],
|
||||
"synchronous_directory_updates": Optional[boolean],
|
||||
"immutable": Optional[boolean],
|
||||
"append_only": Optional[boolean],
|
||||
"no_dump": Optional[boolean],
|
||||
"no_atime": Optional[boolean],
|
||||
"compression_requested": Optional[boolean],
|
||||
"encrypted": Optional[boolean],
|
||||
"journaled_data": Optional[boolean],
|
||||
"indexed_directory": Optional[boolean],
|
||||
"no_tailmerging": Optional[boolean],
|
||||
"top_of_directory_hierarchies": Optional[boolean],
|
||||
"extents": Optional[boolean],
|
||||
"no_cow": Optional[boolean],
|
||||
"casefold": Optional[boolean],
|
||||
"inline_data": Optional[boolean],
|
||||
"project_hierarchy": Optional[boolean],
|
||||
"verity": Optional[boolean],
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
$ sudo lsattr /etc/passwd | jc --lsattr
|
||||
[
|
||||
{
|
||||
"file": "/etc/passwd",
|
||||
"extents": true
|
||||
}
|
||||
]
|
||||
|
||||
<a id="jc.parsers.lsattr.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
def parse(data: str,
|
||||
raw: bool = False,
|
||||
quiet: bool = False) -> List[Dict[str, Any]]
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Source: [`jc/parsers/lsattr.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/lsattr.py)
|
||||
|
||||
Version 1.0 by Mark Rotner (rotner.mr@gmail.com)
|
||||
63
docs/parsers/lsb_release.md
Normal file
63
docs/parsers/lsb_release.md
Normal file
@@ -0,0 +1,63 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.lsb_release"></a>
|
||||
|
||||
# jc.parsers.lsb_release
|
||||
|
||||
jc - JSON Convert `lsb_release` command parser
|
||||
|
||||
This parser is an alias to the Key/Value parser (`--kv`).
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ lsb_release -a | jc --lsb-release
|
||||
|
||||
or
|
||||
$ jc lsb_release -a
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('lsb_release', lsb_release_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
{
|
||||
"<key>": string
|
||||
}
|
||||
|
||||
Examples:
|
||||
|
||||
$ lsb_release -a | jc --lsb-release -p
|
||||
{
|
||||
"Distributor ID": "Ubuntu",
|
||||
"Description": "Ubuntu 16.04.6 LTS",
|
||||
"Release": "16.04",
|
||||
"Codename": "xenial"
|
||||
}
|
||||
|
||||
<a id="jc.parsers.lsb_release.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
def parse(data: str, raw: bool = False, quiet: bool = False) -> Dict[str, Any]
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
Dictionary. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
|
||||
|
||||
Source: [`jc/parsers/lsb_release.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/lsb_release.py)
|
||||
|
||||
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
@@ -9,7 +9,7 @@ Usage (cli):
|
||||
|
||||
$ lsblk | jc --lsblk
|
||||
|
||||
or
|
||||
or
|
||||
|
||||
$ jc lsblk
|
||||
|
||||
@@ -22,46 +22,53 @@ Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"name": string,
|
||||
"maj_min": string,
|
||||
"rm": boolean,
|
||||
"size": string,
|
||||
"ro": boolean,
|
||||
"type": string,
|
||||
"mountpoint": string,
|
||||
"kname": string,
|
||||
"fstype": string,
|
||||
"label": string,
|
||||
"uuid": string,
|
||||
"partlabel": string,
|
||||
"partuuid": string,
|
||||
"ra": integer,
|
||||
"model": string,
|
||||
"serial": string,
|
||||
"state": string,
|
||||
"owner": string,
|
||||
"group": string,
|
||||
"mode": string,
|
||||
"alignment": integer,
|
||||
"min_io": integer,
|
||||
"opt_io": integer,
|
||||
"phy_sec": integer,
|
||||
"log_sec": integer,
|
||||
"rota": boolean,
|
||||
"sched": string,
|
||||
"rq_size": integer,
|
||||
"disc_aln": integer,
|
||||
"disc_gran": string,
|
||||
"disc_max": string,
|
||||
"disc_zero": boolean,
|
||||
"wsame": string,
|
||||
"wwn": string,
|
||||
"rand": boolean,
|
||||
"pkname": string,
|
||||
"hctl": string,
|
||||
"tran": string,
|
||||
"rev": string,
|
||||
"vendor": string
|
||||
"name": string,
|
||||
"maj_min": string,
|
||||
"rm": boolean,
|
||||
"size": string,
|
||||
"size_bytes": integer
|
||||
"ro": boolean,
|
||||
"type": string,
|
||||
"mountpoint": string,
|
||||
"mountpoints": [
|
||||
string
|
||||
],
|
||||
"kname": string,
|
||||
"fstype": string,
|
||||
"label": string,
|
||||
"uuid": string,
|
||||
"partlabel": string,
|
||||
"partuuid": string,
|
||||
"ra": integer,
|
||||
"model": string,
|
||||
"serial": string,
|
||||
"state": string,
|
||||
"owner": string,
|
||||
"group": string,
|
||||
"mode": string,
|
||||
"alignment": integer,
|
||||
"min_io": integer,
|
||||
"opt_io": integer,
|
||||
"phy_sec": integer,
|
||||
"log_sec": integer,
|
||||
"rota": boolean,
|
||||
"sched": string,
|
||||
"rq_size": integer,
|
||||
"disc_aln": integer,
|
||||
"disc_gran": string,
|
||||
"disc_gran_bytes": integer,
|
||||
"disc_max": string,
|
||||
"disc_max_bytes": integer,
|
||||
"disc_zero": boolean,
|
||||
"wsame": string,
|
||||
"wsame_bytes": integer,
|
||||
"wwn": string,
|
||||
"rand": boolean,
|
||||
"pkname": string,
|
||||
"hctl": string,
|
||||
"tran": string,
|
||||
"rev": string,
|
||||
"vendor": string
|
||||
}
|
||||
]
|
||||
|
||||
@@ -74,6 +81,7 @@ Examples:
|
||||
"maj_min": "8:0",
|
||||
"rm": false,
|
||||
"size": "20G",
|
||||
"size_bytes": 20000000000,
|
||||
"ro": false,
|
||||
"type": "disk",
|
||||
"mountpoint": null
|
||||
@@ -83,6 +91,7 @@ Examples:
|
||||
"maj_min": "8:1",
|
||||
"rm": false,
|
||||
"size": "1G",
|
||||
"size_bytes": 1000000000
|
||||
"ro": false,
|
||||
"type": "part",
|
||||
"mountpoint": "/boot"
|
||||
@@ -100,6 +109,7 @@ Examples:
|
||||
"maj_min": "8:0",
|
||||
"rm": false,
|
||||
"size": "20G",
|
||||
"size_bytes": 20000000000,
|
||||
"ro": false,
|
||||
"type": "disk",
|
||||
"mountpoint": null,
|
||||
@@ -126,9 +136,12 @@ Examples:
|
||||
"rq_size": 128,
|
||||
"disc_aln": 0,
|
||||
"disc_gran": "0B",
|
||||
"disc_gran_bytes": 0,
|
||||
"disc_max": "0B",
|
||||
"disc_max_bytes": 0,
|
||||
"disc_zero": false,
|
||||
"wsame": "32M",
|
||||
"wsame_bytes": 32000000,
|
||||
"wwn": null,
|
||||
"rand": true,
|
||||
"pkname": null,
|
||||
@@ -142,6 +155,7 @@ Examples:
|
||||
"maj_min": "8:1",
|
||||
"rm": false,
|
||||
"size": "1G",
|
||||
"size_bytes": 1000000000
|
||||
"ro": false,
|
||||
"type": "part",
|
||||
"mountpoint": "/boot",
|
||||
@@ -168,9 +182,12 @@ Examples:
|
||||
"rq_size": 128,
|
||||
"disc_aln": 0,
|
||||
"disc_gran": "0B",
|
||||
"disc_gran_bytes": 0,
|
||||
"disc_max": "0B",
|
||||
"disc_max_bytes": 0,
|
||||
"disc_zero": false,
|
||||
"wsame": "32M",
|
||||
"wsame_bytes": 32000000,
|
||||
"wwn": null,
|
||||
"rand": true,
|
||||
"pkname": "sda",
|
||||
@@ -192,6 +209,7 @@ Examples:
|
||||
"maj_min": "8:0",
|
||||
"rm": "0",
|
||||
"size": "20G",
|
||||
"size_bytes": 20000000000,
|
||||
"ro": "0",
|
||||
"type": "disk",
|
||||
"mountpoint": null,
|
||||
@@ -218,9 +236,12 @@ Examples:
|
||||
"rq_size": "128",
|
||||
"disc_aln": "0",
|
||||
"disc_gran": "0B",
|
||||
"disc_gran_bytes": 0,
|
||||
"disc_max": "0B",
|
||||
"disc_max_bytes": 0,
|
||||
"disc_zero": "0",
|
||||
"wsame": "32M",
|
||||
"wsame_bytes": 32000000,
|
||||
"wwn": null,
|
||||
"rand": "1",
|
||||
"pkname": null,
|
||||
@@ -234,6 +255,7 @@ Examples:
|
||||
"maj_min": "8:1",
|
||||
"rm": "0",
|
||||
"size": "1G",
|
||||
"size_bytes": 1000000000
|
||||
"ro": "0",
|
||||
"type": "part",
|
||||
"mountpoint": "/boot",
|
||||
@@ -260,9 +282,12 @@ Examples:
|
||||
"rq_size": "128",
|
||||
"disc_aln": "0",
|
||||
"disc_gran": "0B",
|
||||
"disc_gran_bytes": 0,
|
||||
"disc_max": "0B",
|
||||
"disc_max_bytes": 0,
|
||||
"disc_zero": "0",
|
||||
"wsame": "32M",
|
||||
"wsame_bytes": 32000000,
|
||||
"wwn": null,
|
||||
"rand": "1",
|
||||
"pkname": "sda",
|
||||
@@ -297,4 +322,6 @@ Returns:
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Version 1.9 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
Source: [`jc/parsers/lsblk.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/lsblk.py)
|
||||
|
||||
Version 1.10 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
@@ -9,7 +9,7 @@ Usage (cli):
|
||||
|
||||
$ lsmod | jc --lsmod
|
||||
|
||||
or
|
||||
or
|
||||
|
||||
$ jc lsmod
|
||||
|
||||
@@ -148,4 +148,6 @@ Returns:
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Source: [`jc/parsers/lsmod.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/lsmod.py)
|
||||
|
||||
Version 1.7 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
@@ -9,7 +9,7 @@ Usage (cli):
|
||||
|
||||
$ lsof | jc --lsof
|
||||
|
||||
or
|
||||
or
|
||||
|
||||
$ jc lsof
|
||||
|
||||
@@ -140,6 +140,8 @@ Returns:
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
Compatibility: linux, darwin, aix, freebsd
|
||||
|
||||
Source: [`jc/parsers/lsof.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/lsof.py)
|
||||
|
||||
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
148
docs/parsers/lspci.md
Normal file
148
docs/parsers/lspci.md
Normal file
@@ -0,0 +1,148 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.lspci"></a>
|
||||
|
||||
# jc.parsers.lspci
|
||||
|
||||
jc - JSON Convert `lspci -mmv` command output parser
|
||||
|
||||
This parser supports the following `lspci` options:
|
||||
- `-mmv`
|
||||
- `-nmmv`
|
||||
- `-nnmmv`
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ lspci -nnmmv | jc --lspci
|
||||
|
||||
or
|
||||
|
||||
$ jc lspci -nnmmv
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('lspci', lspci_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"slot": string,
|
||||
"domain": string,
|
||||
"domain_int": integer,
|
||||
"bus": string,
|
||||
"bus_int": integer,
|
||||
"dev": string,
|
||||
"dev_int": integer,
|
||||
"function": string,
|
||||
"function_int": integer,
|
||||
"class": string,
|
||||
"class_id": string,
|
||||
"class_id_int": integer,
|
||||
"vendor": string,
|
||||
"vendor_id": string,
|
||||
"vendor_id_int": integer,
|
||||
"device": string,
|
||||
"device_id": string,
|
||||
"device_id_int": integer,
|
||||
"svendor": string,
|
||||
"svendor_id": string,
|
||||
"svendor_id_int": integer,
|
||||
"sdevice": string,
|
||||
"sdevice_id": string,
|
||||
"sdevice_id_int": integer,
|
||||
"rev": string,
|
||||
"physlot": string,
|
||||
"progif": string,
|
||||
"progif_int": integer
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
$ lspci -nnmmv | jc --lspci -p
|
||||
[
|
||||
{
|
||||
"slot": "ff:02:05.0",
|
||||
"domain": "ff",
|
||||
"domain_int": 255,
|
||||
"bus": "02",
|
||||
"bus_int": 2,
|
||||
"dev": "05",
|
||||
"dev_int": 5,
|
||||
"function": "0",
|
||||
"function_int": 0,
|
||||
"class": "SATA controller",
|
||||
"class_id": "0106",
|
||||
"class_id_int": 262,
|
||||
"vendor": "VMware",
|
||||
"vendor_id": "15ad",
|
||||
"vendor_id_int": 5549,
|
||||
"device": "SATA AHCI controller",
|
||||
"device_id": "07e0",
|
||||
"device_id_int": 2016,
|
||||
"svendor": "VMware",
|
||||
"svendor_id": "15ad",
|
||||
"svendor_id_int": 5549,
|
||||
"sdevice": "SATA AHCI controller",
|
||||
"sdevice_id": "07e0",
|
||||
"sdevice_id_int": 2016,
|
||||
"physlot": "37",
|
||||
"progif": "01",
|
||||
"progif_int": 1
|
||||
},
|
||||
...
|
||||
]
|
||||
|
||||
$ lspci -nnmmv | jc --lspci -p -r
|
||||
[
|
||||
{
|
||||
"slot": "ff:02:05.0",
|
||||
"domain": "ff",
|
||||
"bus": "02",
|
||||
"dev": "05",
|
||||
"function": "0",
|
||||
"class": "SATA controller",
|
||||
"class_id": "0106",
|
||||
"vendor": "VMware",
|
||||
"vendor_id": "15ad",
|
||||
"device": "SATA AHCI controller",
|
||||
"device_id": "07e0",
|
||||
"svendor": "VMware",
|
||||
"svendor_id": "15ad",
|
||||
"sdevice": "SATA AHCI controller",
|
||||
"sdevice_id": "07e0",
|
||||
"physlot": "37",
|
||||
"progif": "01"
|
||||
},
|
||||
...
|
||||
]
|
||||
|
||||
<a id="jc.parsers.lspci.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
def parse(data: str,
|
||||
raw: bool = False,
|
||||
quiet: bool = False) -> List[Dict[str, Any]]
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Source: [`jc/parsers/lspci.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/lspci.py)
|
||||
|
||||
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
@@ -11,7 +11,7 @@ Usage (cli):
|
||||
|
||||
$ lsusb -v | jc --lsusb
|
||||
|
||||
or
|
||||
or
|
||||
|
||||
$ jc lsusb -v
|
||||
|
||||
@@ -102,6 +102,46 @@ Schema:
|
||||
]
|
||||
}
|
||||
},
|
||||
"cdc_mbim": {
|
||||
"<item>": {
|
||||
"value": string,
|
||||
"description": string,
|
||||
"attributes": [
|
||||
string
|
||||
]
|
||||
}
|
||||
},
|
||||
"cdc_mbim_extended": {
|
||||
"<item>": {
|
||||
"value": string,
|
||||
"description": string,
|
||||
"attributes": [
|
||||
string
|
||||
]
|
||||
}
|
||||
},
|
||||
"videocontrol_descriptors": [
|
||||
{
|
||||
"<item>": {
|
||||
"value": string,
|
||||
"description": string,
|
||||
"attributes": [
|
||||
string
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"videostreaming_descriptors": [
|
||||
{
|
||||
"<item>": {
|
||||
"value": string,
|
||||
"description": string,
|
||||
"attributes": [
|
||||
string
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"endpoint_descriptors": [
|
||||
{
|
||||
"<item>": {
|
||||
@@ -134,6 +174,12 @@ Schema:
|
||||
}
|
||||
}
|
||||
},
|
||||
"device_qualifier": {
|
||||
"<item>": {
|
||||
"value": string,
|
||||
"description": string
|
||||
}
|
||||
},
|
||||
"device_status": {
|
||||
"value": string,
|
||||
"description": string
|
||||
@@ -284,4 +330,6 @@ Returns:
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
Source: [`jc/parsers/lsusb.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/lsusb.py)
|
||||
|
||||
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
@@ -87,4 +87,6 @@ Returns:
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
|
||||
|
||||
Source: [`jc/parsers/m3u.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/m3u.py)
|
||||
|
||||
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
254
docs/parsers/mdadm.md
Normal file
254
docs/parsers/mdadm.md
Normal file
@@ -0,0 +1,254 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.mdadm"></a>
|
||||
|
||||
# jc.parsers.mdadm
|
||||
|
||||
jc - JSON Convert `mdadm` command output parser
|
||||
|
||||
Supports the `--query` and `--examine` options in `mdadm`.
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ mdadm --query --detail /dev/md0 | jc --mdadm
|
||||
|
||||
or
|
||||
|
||||
$ mdadm --examine -E /dev/sdb1 | jc --mdadm
|
||||
|
||||
or
|
||||
|
||||
$ jc mdadm --query --detail /dev/md0
|
||||
|
||||
or
|
||||
|
||||
$ jc mdadm --examine -E /dev/sdb1
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('mdadm', mdadm_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
{
|
||||
"device": string,
|
||||
"magic": string,
|
||||
"version": string,
|
||||
"feature_map": string,
|
||||
"array_uuid": string,
|
||||
"name": string,
|
||||
"name_val": string,
|
||||
"uuid": string,
|
||||
"uuid_val": string,
|
||||
"homehost": string,
|
||||
"container": string,
|
||||
"container_dev": string,
|
||||
"container_member": integer,
|
||||
"controller_guid": string,
|
||||
"container_guid": string,
|
||||
"seq": string,
|
||||
"redundant_hdr": string,
|
||||
"virtual_disks": integer,
|
||||
"creation_time": string,
|
||||
"creation_time_epoch": integer, # naive timestamp
|
||||
"raid_level": string,
|
||||
"array_size": string,
|
||||
"array_size_num": integer,
|
||||
"used_dev_size": string,
|
||||
"used_dev_size_num": integer,
|
||||
"raid_devices": integer,
|
||||
"avail_dev_size": string,
|
||||
"avail_dev_size_num": integer,
|
||||
"data_offset": integer,
|
||||
"super_offset": integer,
|
||||
"unused_space": string,
|
||||
"unused_space_before": integer,
|
||||
"unused_space_after": integer,
|
||||
"state": string,
|
||||
"state_list": [
|
||||
string
|
||||
],
|
||||
"device_uuid": string,
|
||||
"flags": string,
|
||||
"flag_list": [
|
||||
string
|
||||
],
|
||||
"update_time": string,
|
||||
"update_time_epoch": integer, # naive timestamp
|
||||
"bad_block_log": string,
|
||||
"checksum": string,
|
||||
"checksum_val": string,
|
||||
"checksum_state": string,
|
||||
"events": string,
|
||||
"events_num": integer,
|
||||
"events_maj": integer,
|
||||
"events_min": integer,
|
||||
"chunk_size": string,
|
||||
"chunk_size_num": integer,
|
||||
"device_role": string,
|
||||
"array_state": string,
|
||||
"array_state_list": [
|
||||
string
|
||||
],
|
||||
"member_arrays": string,
|
||||
"member_arrays_list": [
|
||||
string
|
||||
],
|
||||
"consistency_policy": string,
|
||||
"rebuild_status": string,
|
||||
"rebuild_status_percent": integer,
|
||||
"resync_status": string,
|
||||
"resync_status_percent": integer,
|
||||
"check_status": string,
|
||||
"check_status_percent": integer,
|
||||
"total_devices": integer,
|
||||
"preferred_minor": integer,
|
||||
"persistence": string,
|
||||
"active_devices": integer,
|
||||
"working_devices": integer,
|
||||
"failed_devices": integer,
|
||||
"spare_devices": integer,
|
||||
"physical_disks": integer,
|
||||
"device_table": [
|
||||
{
|
||||
"number": integer/null,
|
||||
"major": integer/null,
|
||||
"minor": integer/null,
|
||||
"state": [
|
||||
string
|
||||
],
|
||||
"device": string,
|
||||
"raid_device": integer/null
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Any fields unspecified above will be string type.
|
||||
|
||||
Examples:
|
||||
|
||||
$ mdadm --query --detail /dev/md0 | jc --mdadm -p
|
||||
{
|
||||
"device": "/dev/md0",
|
||||
"version": "1.1",
|
||||
"creation_time": "Tue Apr 13 23:22:16 2010",
|
||||
"raid_level": "raid1",
|
||||
"array_size": "5860520828 (5.46 TiB 6.00 TB)",
|
||||
"used_dev_size": "5860520828 (5.46 TiB 6.00 TB)",
|
||||
"raid_devices": 2,
|
||||
"total_devices": 2,
|
||||
"persistence": "Superblock is persistent",
|
||||
"intent_bitmap": "Internal",
|
||||
"update_time": "Tue Jul 26 20:16:31 2022",
|
||||
"state": "clean",
|
||||
"active_devices": 2,
|
||||
"working_devices": 2,
|
||||
"failed_devices": 0,
|
||||
"spare_devices": 0,
|
||||
"consistency_policy": "bitmap",
|
||||
"name": "virttest:0",
|
||||
"uuid": "85c5b164:d58a5ada:14f5fe07:d642e843",
|
||||
"events": 2193679,
|
||||
"device_table": [
|
||||
{
|
||||
"number": 3,
|
||||
"major": 8,
|
||||
"minor": 17,
|
||||
"state": [
|
||||
"active",
|
||||
"sync"
|
||||
],
|
||||
"device": "/dev/sdb1",
|
||||
"raid_device": 0
|
||||
},
|
||||
{
|
||||
"number": 2,
|
||||
"major": 8,
|
||||
"minor": 33,
|
||||
"state": [
|
||||
"active",
|
||||
"sync"
|
||||
],
|
||||
"device": "/dev/sdc1",
|
||||
"raid_device": 1
|
||||
}
|
||||
],
|
||||
"array_size_num": 5860520828,
|
||||
"used_dev_size_num": 5860520828,
|
||||
"name_val": "virttest:0",
|
||||
"uuid_val": "85c5b164:d58a5ada:14f5fe07:d642e843",
|
||||
"state_list": [
|
||||
"clean"
|
||||
],
|
||||
"creation_time_epoch": 1271226136,
|
||||
"update_time_epoch": 1658891791
|
||||
}
|
||||
|
||||
$ mdadm --query --detail /dev/md0 | jc --mdadm -p -r
|
||||
{
|
||||
"device": "/dev/md0",
|
||||
"version": "1.1",
|
||||
"creation_time": "Tue Apr 13 23:22:16 2010",
|
||||
"raid_level": "raid1",
|
||||
"array_size": "5860520828 (5.46 TiB 6.00 TB)",
|
||||
"used_dev_size": "5860520828 (5.46 TiB 6.00 TB)",
|
||||
"raid_devices": "2",
|
||||
"total_devices": "2",
|
||||
"persistence": "Superblock is persistent",
|
||||
"intent_bitmap": "Internal",
|
||||
"update_time": "Tue Jul 26 20:16:31 2022",
|
||||
"state": "clean",
|
||||
"active_devices": "2",
|
||||
"working_devices": "2",
|
||||
"failed_devices": "0",
|
||||
"spare_devices": "0",
|
||||
"consistency_policy": "bitmap",
|
||||
"name": "virttest:0",
|
||||
"uuid": "85c5b164:d58a5ada:14f5fe07:d642e843",
|
||||
"events": "2193679",
|
||||
"device_table": [
|
||||
{
|
||||
"number": "3",
|
||||
"major": "8",
|
||||
"minor": "17",
|
||||
"state": "active sync",
|
||||
"device": "/dev/sdb1",
|
||||
"raid_device": "0"
|
||||
},
|
||||
{
|
||||
"number": "2",
|
||||
"major": "8",
|
||||
"minor": "33",
|
||||
"state": "active sync",
|
||||
"device": "/dev/sdc1",
|
||||
"raid_device": "1"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
<a id="jc.parsers.mdadm.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
def parse(data: str, raw: bool = False, quiet: bool = False) -> Dict
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
Dictionary. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Source: [`jc/parsers/mdadm.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/mdadm.py)
|
||||
|
||||
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
@@ -9,7 +9,7 @@ Usage (cli):
|
||||
|
||||
$ mount | jc --mount
|
||||
|
||||
or
|
||||
or
|
||||
|
||||
$ jc mount
|
||||
|
||||
@@ -25,7 +25,7 @@ Schema:
|
||||
"filesystem": string,
|
||||
"mount_point": string,
|
||||
"type": string,
|
||||
"access": [
|
||||
"options": [
|
||||
string
|
||||
]
|
||||
}
|
||||
@@ -39,7 +39,7 @@ Example:
|
||||
"filesystem": "sysfs",
|
||||
"mount_point": "/sys",
|
||||
"type": "sysfs",
|
||||
"access": [
|
||||
"options": [
|
||||
"rw",
|
||||
"nosuid",
|
||||
"nodev",
|
||||
@@ -51,7 +51,7 @@ Example:
|
||||
"filesystem": "proc",
|
||||
"mount_point": "/proc",
|
||||
"type": "proc",
|
||||
"access": [
|
||||
"options": [
|
||||
"rw",
|
||||
"nosuid",
|
||||
"nodev",
|
||||
@@ -63,7 +63,7 @@ Example:
|
||||
"filesystem": "udev",
|
||||
"mount_point": "/dev",
|
||||
"type": "devtmpfs",
|
||||
"access": [
|
||||
"options": [
|
||||
"rw",
|
||||
"nosuid",
|
||||
"relatime",
|
||||
@@ -96,6 +96,8 @@ Returns:
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, freebsd
|
||||
Compatibility: linux, darwin, freebsd, aix
|
||||
|
||||
Version 1.7 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
Source: [`jc/parsers/mount.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/mount.py)
|
||||
|
||||
Version 1.11 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
@@ -11,7 +11,7 @@ Usage (cli):
|
||||
|
||||
$ mpstat | jc --mpstat
|
||||
|
||||
or
|
||||
or
|
||||
|
||||
$ jc mpstat
|
||||
|
||||
@@ -137,4 +137,6 @@ Returns:
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Source: [`jc/parsers/mpstat.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/mpstat.py)
|
||||
|
||||
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user