mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2026-04-03 17:44:07 +02:00
Compare commits
1402 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
727fc9a701 | ||
|
|
306512d6bb | ||
|
|
6afb1d389c | ||
|
|
9861983481 | ||
|
|
ca79053db0 | ||
|
|
29c263f878 | ||
|
|
128c3c170a | ||
|
|
a531ab8864 | ||
|
|
0c1be7cc11 | ||
|
|
e4222b45f5 | ||
|
|
ac32c69c31 | ||
|
|
cb2dfeac8d | ||
|
|
9a3602e70b | ||
|
|
a9f53ee258 | ||
|
|
6be3d3d982 | ||
|
|
e49df72083 | ||
|
|
7ede7be7bf | ||
|
|
4758e28a36 | ||
|
|
4a1ee151b3 | ||
|
|
8c8afc1a92 | ||
|
|
ed205f7720 | ||
|
|
d65f7ae992 | ||
|
|
e2ffef57b9 | ||
|
|
002caa9fb3 | ||
|
|
b7c6faf3da | ||
|
|
554ca61d17 | ||
|
|
7b9722d255 | ||
|
|
5505bde8ef | ||
|
|
dbcd9a4060 | ||
|
|
4bdeb2b3aa | ||
|
|
6ae1d03187 | ||
|
|
f75b06abe4 | ||
|
|
1923925710 | ||
|
|
2c5c57ae04 | ||
|
|
f4d11d697e | ||
|
|
7f409b7082 | ||
|
|
937fa5aad2 | ||
|
|
19dcef5135 | ||
|
|
3d01356461 | ||
|
|
2d6f666fa4 | ||
|
|
4dda895f12 | ||
|
|
52617b1722 | ||
|
|
961968a0fc | ||
|
|
f026a788e5 | ||
|
|
2f7c03eb35 | ||
|
|
3afaa48eee | ||
|
|
3201452564 | ||
|
|
7ee1e34fc7 | ||
|
|
67dbf05016 | ||
|
|
4ac9f2e3da | ||
|
|
3f5f6e39a7 | ||
|
|
4723db8e3c | ||
|
|
ca914ec77d | ||
|
|
dcc7f3f357 | ||
|
|
cbdc666236 | ||
|
|
184ef3a1fa | ||
|
|
c732f75944 | ||
|
|
7a1ae4f5fc | ||
|
|
d04bc3757c | ||
|
|
73e8391653 | ||
|
|
f6c1463c15 | ||
|
|
d392c7f901 | ||
|
|
d0387f5820 | ||
|
|
76f92908a3 | ||
|
|
1a115da67b | ||
|
|
f0a37ccf30 | ||
|
|
f331f53a53 | ||
|
|
8611aff06b | ||
|
|
2f3f78e8d3 | ||
|
|
d1e0ee6123 | ||
|
|
45314c9808 | ||
|
|
df00945b46 | ||
|
|
fda0050d86 | ||
|
|
a76d46f9ec | ||
|
|
6b069a82d0 | ||
|
|
6b793d0521 | ||
|
|
ce9103f7cc | ||
|
|
671d6dee36 | ||
|
|
49929c714c | ||
|
|
2986771f07 | ||
|
|
520082d963 | ||
|
|
021e296d45 | ||
|
|
42e56fbcea | ||
|
|
a5b62a4055 | ||
|
|
be98c9b7f6 | ||
|
|
aceeb84507 | ||
|
|
1391063217 | ||
|
|
52157addd0 | ||
|
|
ec0bc6615e | ||
|
|
2f80800e38 | ||
|
|
3959d3347c | ||
|
|
b57d25c69a | ||
|
|
63e43a7cab | ||
|
|
21719f9a26 | ||
|
|
96ec70de4f | ||
|
|
a15a1967dc | ||
|
|
a10d756629 | ||
|
|
0700dc7a64 | ||
|
|
ca654b2140 | ||
|
|
4ff3b87c1c | ||
|
|
ea244fb7a9 | ||
|
|
8061f30e6f | ||
|
|
8f3b12e81e | ||
|
|
d0694ce0db | ||
|
|
0cd4c4bc7f | ||
|
|
12f90c349c | ||
|
|
26b8a1f167 | ||
|
|
3abe382c06 | ||
|
|
1e2edc2c7b | ||
|
|
5fe032a674 | ||
|
|
e825c02df1 | ||
|
|
a4a4d170b5 | ||
|
|
d0fcd523cb | ||
|
|
f72b7dc75d | ||
|
|
4101dc6bf7 | ||
|
|
ea5011b616 | ||
|
|
d6de81747f | ||
|
|
38f04b1c96 | ||
|
|
84169e1a91 | ||
|
|
1f96586a5e | ||
|
|
681176e4c9 | ||
|
|
8bb2663522 | ||
|
|
663abf3139 | ||
|
|
f7ac41db95 | ||
|
|
5502cda9e5 | ||
|
|
a2b165565f | ||
|
|
b426369815 | ||
|
|
ac0840cc0a | ||
|
|
ee98ab0a4a | ||
|
|
2adec2c003 | ||
|
|
f19c9c71bf | ||
|
|
e93adf1884 | ||
|
|
254c4fc507 | ||
|
|
74d5f60d14 | ||
|
|
db7dc0634b | ||
|
|
e156b0db45 | ||
|
|
50adc05fbd | ||
|
|
446cac7c21 | ||
|
|
28ffe3076b | ||
|
|
d4d5e206ca | ||
|
|
42fbe40a4a | ||
|
|
27e4a120e2 | ||
|
|
b5d5b7c73a | ||
|
|
e7471556ba | ||
|
|
640a21341b | ||
|
|
f5befad3e4 | ||
|
|
f8223023c3 | ||
|
|
7028e87f9b | ||
|
|
590728f9c1 | ||
|
|
7cc147fe2d | ||
|
|
3cfb3965bb | ||
|
|
155d421322 | ||
|
|
d3e10bb87b | ||
|
|
fd5433ee62 | ||
|
|
4568f2d06e | ||
|
|
c36e513d1b | ||
|
|
8e089baf3f | ||
|
|
386f6c317e | ||
|
|
75cd84ce8a | ||
|
|
6fad44e35d | ||
|
|
1caac750da | ||
|
|
16370dcb3d | ||
|
|
c1302f2573 | ||
|
|
6f0ffe0955 | ||
|
|
1f89745fe7 | ||
|
|
a46ac18ef7 | ||
|
|
1a05f1c575 | ||
|
|
08f818aa42 | ||
|
|
b3896650c2 | ||
|
|
f285539526 | ||
|
|
a896dcdf3b | ||
|
|
0a187d4ed0 | ||
|
|
2d65bc57d5 | ||
|
|
ab63809fde | ||
|
|
6f04707dc6 | ||
|
|
d14a86a9b5 | ||
|
|
8e6a31d3da | ||
|
|
6e7b6afe87 | ||
|
|
027c231097 | ||
|
|
f1cf7d1f95 | ||
|
|
df611cc263 | ||
|
|
0f3143bbbb | ||
|
|
c280757b76 | ||
|
|
d30b9d84ef | ||
|
|
50ded1dbd9 | ||
|
|
e319aea5a4 | ||
|
|
ba86509c1d | ||
|
|
0a9279ae6b | ||
|
|
a13dde12af | ||
|
|
e2ed358de1 | ||
|
|
a2cd366621 | ||
|
|
15addd9bfc | ||
|
|
a4e34b0053 | ||
|
|
d09529ac30 | ||
|
|
553097b505 | ||
|
|
49c5568577 | ||
|
|
6962b9ee8a | ||
|
|
b4575a3f78 | ||
|
|
35b54d235d | ||
|
|
583a5757e4 | ||
|
|
f355333eee | ||
|
|
4d7df10960 | ||
|
|
66b2c28f4b | ||
|
|
299a9c6d88 | ||
|
|
bd391d979c | ||
|
|
7309bd2282 | ||
|
|
ce84c09d33 | ||
|
|
b4fffbb647 | ||
|
|
3701b4198a | ||
|
|
d4c34098fa | ||
|
|
b3c531193b | ||
|
|
1d0e07c77b | ||
|
|
06a322cf9c | ||
|
|
623d148712 | ||
|
|
647e83d043 | ||
|
|
91a5544644 | ||
|
|
a1190998ae | ||
|
|
097d7a1850 | ||
|
|
302bf72e72 | ||
|
|
2c42baf3a4 | ||
|
|
03feb89c84 | ||
|
|
9dd553192f | ||
|
|
fa3f02e9d1 | ||
|
|
0a9dde58c5 | ||
|
|
70cb4453be | ||
|
|
830674cc6f | ||
|
|
fb406b58a1 | ||
|
|
55b272e412 | ||
|
|
94f62a9bf3 | ||
|
|
8d19e4cb7b | ||
|
|
7e510d48e0 | ||
|
|
7b20cffb14 | ||
|
|
5c934c43c1 | ||
|
|
8609298449 | ||
|
|
72cb0dc10b | ||
|
|
7b22fa81de | ||
|
|
0b6a130779 | ||
|
|
fdcf4338e0 | ||
|
|
ee43037f48 | ||
|
|
26e365563c | ||
|
|
1b39586bb1 | ||
|
|
8bb3a6bea3 | ||
|
|
e6900e2000 | ||
|
|
0ee244756b | ||
|
|
6d5ac9abe6 | ||
|
|
44f6d9e132 | ||
|
|
360154559c | ||
|
|
78672bd7ad | ||
|
|
65d96e26b5 | ||
|
|
241d53af9a | ||
|
|
5563829df2 | ||
|
|
3a4a27e1f9 | ||
|
|
9c887a36a8 | ||
|
|
bc7973af36 | ||
|
|
32972d8fdb | ||
|
|
b128d9109c | ||
|
|
929d7273a4 | ||
|
|
2a40f84274 | ||
|
|
9ff6fa818f | ||
|
|
dac73a4bfe | ||
|
|
d7895547f7 | ||
|
|
b7d439cb87 | ||
|
|
7cc903a5f5 | ||
|
|
c495a8291b | ||
|
|
5e1d7d777c | ||
|
|
7edad3f676 | ||
|
|
f7331001d4 | ||
|
|
f8e09ae2ff | ||
|
|
433c7cc0f0 | ||
|
|
d753e71a74 | ||
|
|
2e4f5a508b | ||
|
|
88b960eff6 | ||
|
|
88c77bd89e | ||
|
|
51a7a4251f | ||
|
|
51d2f316f3 | ||
|
|
ff78a46c48 | ||
|
|
ed4a9dc1d4 | ||
|
|
63182dba26 | ||
|
|
9c1eaa9389 | ||
|
|
bc520fcbcd | ||
|
|
46faac1a12 | ||
|
|
3c424c0cb3 | ||
|
|
3ac8d0362b | ||
|
|
d88b998e6c | ||
|
|
a9ed55c006 | ||
|
|
ea61434123 | ||
|
|
a73d0d26cb | ||
|
|
b4506976e3 | ||
|
|
34cb75a096 | ||
|
|
34df643f60 | ||
|
|
ac7c13fcc0 | ||
|
|
4fdb34c7d5 | ||
|
|
7ac468e35a | ||
|
|
df190aa299 | ||
|
|
9621475e86 | ||
|
|
82e0160de8 | ||
|
|
d03fb8b626 | ||
|
|
b300dfb3d7 | ||
|
|
a7de9111d9 | ||
|
|
7933dfdbe7 | ||
|
|
f7cb5f7d01 | ||
|
|
a26a298f1a | ||
|
|
dbd134d0da | ||
|
|
11aa01b0d9 | ||
|
|
6f18e53443 | ||
|
|
7b467c4665 | ||
|
|
537b8f2630 | ||
|
|
4d823575e7 | ||
|
|
541aa1d09f | ||
|
|
8f02021014 | ||
|
|
158a15157c | ||
|
|
2752e0d66a | ||
|
|
6c11e912af | ||
|
|
43d34461e2 | ||
|
|
4dfdc9b0f6 | ||
|
|
e2311cbb03 | ||
|
|
bf15575e90 | ||
|
|
406336c718 | ||
|
|
6665ffaeb8 | ||
|
|
dcf552ca0c | ||
|
|
7a6ebf3c95 | ||
|
|
d2dc4a983c | ||
|
|
1168259bc2 | ||
|
|
e8e4b46021 | ||
|
|
12d2de2282 | ||
|
|
0e2fe401e1 | ||
|
|
14247adb0a | ||
|
|
3a9f0934c4 | ||
|
|
caf0a5c871 | ||
|
|
cfb58b1cf3 | ||
|
|
975cf195cc | ||
|
|
8a46a259a3 | ||
|
|
e395142e59 | ||
|
|
caaeaf0d67 | ||
|
|
21e69a7cbf | ||
|
|
603964935b | ||
|
|
47eb83ae55 | ||
|
|
fc0ce6c959 | ||
|
|
077a29fb4e | ||
|
|
8568d0d328 | ||
|
|
597d39c28e | ||
|
|
eb888dcbbc | ||
|
|
d1b9ac0841 | ||
|
|
89a6d9c5c3 | ||
|
|
85d9837616 | ||
|
|
cd7731484d | ||
|
|
086da16b17 | ||
|
|
20830528f0 | ||
|
|
83371edd8f | ||
|
|
364a81decc | ||
|
|
ef09592ad3 | ||
|
|
4a86e109cc | ||
|
|
7fa5391b66 | ||
|
|
9b53ba5714 | ||
|
|
b59e38cfd2 | ||
|
|
5ba22dae59 | ||
|
|
4232e523ac | ||
|
|
bee80b35d2 | ||
|
|
c32395f695 | ||
|
|
735c5e1078 | ||
|
|
d09c94b292 | ||
|
|
4d04866f48 | ||
|
|
a2d90f4dfc | ||
|
|
93a5002c8b | ||
|
|
23bf5227a4 | ||
|
|
77c96fa2a9 | ||
|
|
3f5a1f015e | ||
|
|
b280c4fc18 | ||
|
|
3ab9b43a2e | ||
|
|
46f568414a | ||
|
|
cba2fd299f | ||
|
|
1e6e44f656 | ||
|
|
acac039994 | ||
|
|
50a3b34016 | ||
|
|
b45396070c | ||
|
|
218b9aec8a | ||
|
|
2b887debc6 | ||
|
|
0313e3f8ca | ||
|
|
1669e6e20c | ||
|
|
ef6de75dda | ||
|
|
a6bcec425a | ||
|
|
596ad9a64d | ||
|
|
7a91c93319 | ||
|
|
b5f7b35f89 | ||
|
|
2f47fb7f14 | ||
|
|
1b214c4036 | ||
|
|
8f94f8acc6 | ||
|
|
3a2a69cfa5 | ||
|
|
f599c65988 | ||
|
|
ad12849fd9 | ||
|
|
f36b3789e8 | ||
|
|
6d18c0ba61 | ||
|
|
17097abec9 | ||
|
|
b7ddd3b285 | ||
|
|
75b23f62c9 | ||
|
|
f88967b2a5 | ||
|
|
ba2846664b | ||
|
|
10dba37ca2 | ||
|
|
0e6f938514 | ||
|
|
159d87c112 | ||
|
|
9e7b1621cf | ||
|
|
2057817ef8 | ||
|
|
a1eabad2d3 | ||
|
|
92bf2b1ca2 | ||
|
|
2b2123a4ba | ||
|
|
908b2f9200 | ||
|
|
deff0c7bfd | ||
|
|
7cd01efa64 | ||
|
|
2dbe56456b | ||
|
|
6078a411ef | ||
|
|
4a3656562f | ||
|
|
ba75989a24 | ||
|
|
9e9e2c3628 | ||
|
|
9a2a8c6b61 | ||
|
|
dae42ef161 | ||
|
|
931f2cab78 | ||
|
|
72b061bed4 | ||
|
|
29a7c73990 | ||
|
|
2d1d68e300 | ||
|
|
c5c1e170d1 | ||
|
|
9c1bb66452 | ||
|
|
a4f3306bae | ||
|
|
1bc638b6ee | ||
|
|
9ad0cd9dae | ||
|
|
6d4a469127 | ||
|
|
ed6997e3ff | ||
|
|
eb788fca6e | ||
|
|
9186f5f377 | ||
|
|
30cff5f281 | ||
|
|
b724e0969a | ||
|
|
a62c49e871 | ||
|
|
9b160f6279 | ||
|
|
338a4e2612 | ||
|
|
0140688750 | ||
|
|
73e5ea98c1 | ||
|
|
77dcbc544d | ||
|
|
c7bcb0947a | ||
|
|
5cd3f7f71d | ||
|
|
5044388ab2 | ||
|
|
ee075db598 | ||
|
|
9904e0be61 | ||
|
|
31b69b3242 | ||
|
|
e6a80fea32 | ||
|
|
d6aec00e03 | ||
|
|
4aa7d81e11 | ||
|
|
48cdabc3b0 | ||
|
|
a1791ef547 | ||
|
|
7bc87f6c2d | ||
|
|
bbed9e274b | ||
|
|
486282b985 | ||
|
|
a4d45b653f | ||
|
|
22e151b01c | ||
|
|
7a4ebcd1ec | ||
|
|
651cbfe02f | ||
|
|
8c3e764516 | ||
|
|
b4e75da7e3 | ||
|
|
37223f086c | ||
|
|
a404033735 | ||
|
|
b7433ed085 | ||
|
|
224d3d65ad | ||
|
|
a349fb0bda | ||
|
|
e7ddcfb83f | ||
|
|
abd20dfe36 | ||
|
|
dc1fd3ef1b | ||
|
|
98a7686db4 | ||
|
|
9c6c6c4330 | ||
|
|
f9be5651da | ||
|
|
df9835a3e6 | ||
|
|
92363be2dd | ||
|
|
31b6203015 | ||
|
|
18805858d6 | ||
|
|
e676f0e20f | ||
|
|
20652edefa | ||
|
|
98c29d0747 | ||
|
|
41a6311f6b | ||
|
|
978760ec57 | ||
|
|
d410425537 | ||
|
|
6b7430329c | ||
|
|
40fe0d4a60 | ||
|
|
365c5354a0 | ||
|
|
b246a05cbb | ||
|
|
9e5a7a4abb | ||
|
|
f266acbcca | ||
|
|
4e3b471f18 | ||
|
|
5e28736c2e | ||
|
|
a91913a3b5 | ||
|
|
90c64f0ae0 | ||
|
|
7cc642ed1a | ||
|
|
809f64d35a | ||
|
|
a6f859a55e | ||
|
|
39ef88078f | ||
|
|
aeea5e8d2e | ||
|
|
1a0700bff4 | ||
|
|
b5fa6d068f | ||
|
|
1baec0b420 | ||
|
|
4f2a4e1dee | ||
|
|
758d617668 | ||
|
|
55322c37f5 | ||
|
|
d19ea5552b | ||
|
|
130c3527c1 | ||
|
|
3f221f4714 | ||
|
|
d64c4cb390 | ||
|
|
448c56aa46 | ||
|
|
9fbea15b6d | ||
|
|
932060314b | ||
|
|
5e68ae5009 | ||
|
|
d03541beae | ||
|
|
516fa571d9 | ||
|
|
a19c12096a | ||
|
|
758f27945d | ||
|
|
8b1e8d58df | ||
|
|
b967489d08 | ||
|
|
870d0218be | ||
|
|
84020bc2af | ||
|
|
4efe5344e0 | ||
|
|
9182c54513 | ||
|
|
28f0ab0b02 | ||
|
|
90d1a30696 | ||
|
|
130b3738cc | ||
|
|
92c7357615 | ||
|
|
c80f863334 | ||
|
|
4642c20179 | ||
|
|
5288eb22aa | ||
|
|
df8387a1a9 | ||
|
|
cc38c27f44 | ||
|
|
64f5357d69 | ||
|
|
51debb5649 | ||
|
|
b48d05a431 | ||
|
|
4e7f6b337d | ||
|
|
a509d99caf | ||
|
|
481e45fb64 | ||
|
|
e9038e1720 | ||
|
|
8fd9e582bf | ||
|
|
c1fd6f48a5 | ||
|
|
af615c7f4b | ||
|
|
bf0bc32d7a | ||
|
|
2d6b53e012 | ||
|
|
51271fea0f | ||
|
|
2deb473e0b | ||
|
|
23eeb33b3d | ||
|
|
f50dfaef45 | ||
|
|
55bb71e9d4 | ||
|
|
dab9357d28 | ||
|
|
27eb427245 | ||
|
|
260f3685d9 | ||
|
|
76e78fc0c3 | ||
|
|
1ac944fa02 | ||
|
|
986bc9b042 | ||
|
|
5a7942069b | ||
|
|
f6c6fc13ac | ||
|
|
1d8cfae89f | ||
|
|
787df51239 | ||
|
|
5e7f302a9c | ||
|
|
3d10fd40b5 | ||
|
|
57e3bf239c | ||
|
|
ccb09861e8 | ||
|
|
94551d75dd | ||
|
|
6e21218425 | ||
|
|
ff0fda48fc | ||
|
|
528aac7ad8 | ||
|
|
ab482e521d | ||
|
|
e08b61fa81 | ||
|
|
ce61bd1d2b | ||
|
|
7b708f7518 | ||
|
|
89ca50c7fc | ||
|
|
fb54899dcc | ||
|
|
0a625ad7dd | ||
|
|
d32e45efbe | ||
|
|
c77696bc78 | ||
|
|
736fde9e78 | ||
|
|
9c1ad92fed | ||
|
|
1a9fd2139d | ||
|
|
7661e7f27a | ||
|
|
f857b7fbf7 | ||
|
|
d94d12dbc5 | ||
|
|
700916276a | ||
|
|
834e52369c | ||
|
|
1ce53365de | ||
|
|
473f70668f | ||
|
|
0dbd2702f6 | ||
|
|
01e3764a9b | ||
|
|
ff9c81722a | ||
|
|
166aef7a02 | ||
|
|
78caf7646b | ||
|
|
1f99d40cec | ||
|
|
4c2912d3d5 | ||
|
|
45e6e06be5 | ||
|
|
fdbe3e05f3 | ||
|
|
7cc168f640 | ||
|
|
ff2d609c9b | ||
|
|
2689697b4c | ||
|
|
f90a0ea8ab | ||
|
|
caabe60f84 | ||
|
|
2bef4ed603 | ||
|
|
ee57be533b | ||
|
|
c5b7aaca25 | ||
|
|
7a1be905bb | ||
|
|
5798495a11 | ||
|
|
46171e2202 | ||
|
|
dd5c924ff5 | ||
|
|
30c4ab2976 | ||
|
|
26ea4d47b3 | ||
|
|
2732cd175c | ||
|
|
3e54b597be | ||
|
|
f10ebea209 | ||
|
|
2c6f3993cb | ||
|
|
708a696920 | ||
|
|
20bbb5d331 | ||
|
|
223e785b54 | ||
|
|
3d78692c59 | ||
|
|
5321a15dcf | ||
|
|
a452f8252a | ||
|
|
49267f09ac | ||
|
|
db47f35783 | ||
|
|
d48abf312c | ||
|
|
3b22ce4110 | ||
|
|
c521ca5bc9 | ||
|
|
3ddc1c6659 | ||
|
|
a8e19402b7 | ||
|
|
0927902b30 | ||
|
|
572548b42f | ||
|
|
ff7ab0a1ed | ||
|
|
5db71b05cb | ||
|
|
f9b952885a | ||
|
|
e7983bc0b2 | ||
|
|
473a643142 | ||
|
|
14f3d442cb | ||
|
|
d6f4ed9ab5 | ||
|
|
1b8d654444 | ||
|
|
6002af0dca | ||
|
|
0924d822a3 | ||
|
|
72a37b9289 | ||
|
|
5eef7bd769 | ||
|
|
c6893e1bd5 | ||
|
|
039f6612e4 | ||
|
|
95aec9c6f9 | ||
|
|
4e9652a8ec | ||
|
|
773b7f4b1f | ||
|
|
d17ffde9cd | ||
|
|
9c57c09c00 | ||
|
|
4d730a9de5 | ||
|
|
fc57bcfce2 | ||
|
|
fa5571486c | ||
|
|
9996c4fe23 | ||
|
|
038d429024 | ||
|
|
9bf6facb0d | ||
|
|
965717886e | ||
|
|
e9bfc3dd29 | ||
|
|
f46b33eacf | ||
|
|
f475fe44df | ||
|
|
5fdbe2962d | ||
|
|
ab291b9eef | ||
|
|
fd411fd772 | ||
|
|
b1e95a60a2 | ||
|
|
bb1439f0d5 | ||
|
|
ba963d98a0 | ||
|
|
83440ccb55 | ||
|
|
796f61bfa4 | ||
|
|
070cac4ae1 | ||
|
|
3ed84f9f42 | ||
|
|
a205afb6f3 | ||
|
|
a6d983dd8f | ||
|
|
b6c8d6d01d | ||
|
|
b5a5d5b133 | ||
|
|
da528e7814 | ||
|
|
4acebf4f62 | ||
|
|
4d40808d2b | ||
|
|
c543f00bd3 | ||
|
|
947cf41dfa | ||
|
|
8d8c58742e | ||
|
|
995ecc9bfb | ||
|
|
21a15225eb | ||
|
|
48921d4584 | ||
|
|
342db45edc | ||
|
|
5f88ecf844 | ||
|
|
a56aebfe70 | ||
|
|
422bb744a8 | ||
|
|
c3b814a15f | ||
|
|
e4574047a0 | ||
|
|
0d7d7951f8 | ||
|
|
da904e4770 | ||
|
|
19b540041a | ||
|
|
f2ffb93eea | ||
|
|
c0c0e05642 | ||
|
|
966978f17e | ||
|
|
8ab08a5231 | ||
|
|
48e534fa03 | ||
|
|
61851c1bd0 | ||
|
|
3c51b2d83d | ||
|
|
ee3a28528e | ||
|
|
916bcdae38 | ||
|
|
efb1d3e6b2 | ||
|
|
4e6ae66bac | ||
|
|
5ee88e7b67 | ||
|
|
c3b68903cb | ||
|
|
fe1f1013a7 | ||
|
|
fb14f5439f | ||
|
|
5ca0fc364e | ||
|
|
a1fe7037e5 | ||
|
|
c2af7d113e | ||
|
|
ff034e401d | ||
|
|
5abe095beb | ||
|
|
33de5f01e6 | ||
|
|
8ce155d843 | ||
|
|
b921d5ec95 | ||
|
|
e21542aaa2 | ||
|
|
6150aae0ae | ||
|
|
f27b35f371 | ||
|
|
d24f9a885d | ||
|
|
48dd82c8d1 | ||
|
|
e57167ad1f | ||
|
|
ada9137642 | ||
|
|
bd428a9fd7 | ||
|
|
934941332f | ||
|
|
0c209dbd10 | ||
|
|
56e041aa26 | ||
|
|
cf9d48582e | ||
|
|
92e2252bee | ||
|
|
fd7861db11 | ||
|
|
35464bbbfb | ||
|
|
db8ddd7f0e | ||
|
|
72207c54ee | ||
|
|
a683f68003 | ||
|
|
8d2d3db3fa | ||
|
|
eca785450d | ||
|
|
5b40a97ce4 | ||
|
|
66cb4e9bde | ||
|
|
d1f33645ca | ||
|
|
5eff65c326 | ||
|
|
929c38715d | ||
|
|
8c91a7b760 | ||
|
|
14289ecd6c | ||
|
|
b833c44783 | ||
|
|
e23aa818ea | ||
|
|
473d919c13 | ||
|
|
9f925d6ac9 | ||
|
|
f6ca32b3a3 | ||
|
|
4cbe84c3d6 | ||
|
|
ffac5bf9d3 | ||
|
|
9aa424f9f8 | ||
|
|
0a8495c68e | ||
|
|
6aea066cf0 | ||
|
|
ff3c2d809e | ||
|
|
145059fc89 | ||
|
|
20e5c19de4 | ||
|
|
4c98fd4b87 | ||
|
|
125e54213e | ||
|
|
0152e0665f | ||
|
|
0679bcbc56 | ||
|
|
5500648aa0 | ||
|
|
bb50caad4d | ||
|
|
7eef5d94d5 | ||
|
|
74f623f8d6 | ||
|
|
f638aca092 | ||
|
|
da35eaf80a | ||
|
|
ade0e8e8fc | ||
|
|
90076090f0 | ||
|
|
23635def8b | ||
|
|
4eeec087bd | ||
|
|
7331961038 | ||
|
|
e4acb3d5b7 | ||
|
|
c60549a994 | ||
|
|
d46fc8bbfa | ||
|
|
b133d1f90d | ||
|
|
5be615a97e | ||
|
|
ea1d820f96 | ||
|
|
47e262cf72 | ||
|
|
eec673be90 | ||
|
|
9a0fb2a7c8 | ||
|
|
b5145d6c14 | ||
|
|
9747ca414d | ||
|
|
312d465b61 | ||
|
|
7dcf87d24a | ||
|
|
cf3cfd16a9 | ||
|
|
fcc7e52949 | ||
|
|
3ab9d48014 | ||
|
|
7eddf41c5f | ||
|
|
27a196c938 | ||
|
|
e4324f05fb | ||
|
|
d36b332bd7 | ||
|
|
1f034826f6 | ||
|
|
246c707c98 | ||
|
|
b5d8968144 | ||
|
|
f7b9fbefdd | ||
|
|
b1fc453383 | ||
|
|
7581c8d0f4 | ||
|
|
32bf8ad6f4 | ||
|
|
b083bcc10f | ||
|
|
4f6fdd120d | ||
|
|
eb0038be24 | ||
|
|
7ecdf819fa | ||
|
|
c6aa4d0835 | ||
|
|
7c584b89a6 | ||
|
|
c166c0bfda | ||
|
|
a8dd3f7802 | ||
|
|
3b0e2f03f3 | ||
|
|
8390ae48c8 | ||
|
|
2db82c0a7e | ||
|
|
6147954075 | ||
|
|
691df271fc | ||
|
|
89f52b95f7 | ||
|
|
146acc1bf6 | ||
|
|
c4a345f59a | ||
|
|
dfd2703f75 | ||
|
|
325fab2de7 | ||
|
|
f3d00cf38a | ||
|
|
14838f7f5d | ||
|
|
af74047b81 | ||
|
|
660c59129c | ||
|
|
89a88e186e | ||
|
|
f861cf95b9 | ||
|
|
ee8f06cbdb | ||
|
|
a2e8b3c7b6 | ||
|
|
6c83846075 | ||
|
|
e0681eebb9 | ||
|
|
e5732d1cea | ||
|
|
6e7ae3cd3f | ||
|
|
f95632d1aa | ||
|
|
2f8b7b26e5 | ||
|
|
10292f7502 | ||
|
|
aef54705f5 | ||
|
|
bba5980fa5 | ||
|
|
977425abfb | ||
|
|
37a3565a1b | ||
|
|
13deb8bfb6 | ||
|
|
a3ed9d075a | ||
|
|
fb0ced549e | ||
|
|
7eb31bc7d2 | ||
|
|
6a06a39142 | ||
|
|
bdcdaee6c5 | ||
|
|
605353fdce | ||
|
|
490c9e1769 | ||
|
|
6ebebb659d | ||
|
|
0e70c5ee12 | ||
|
|
cd531acf60 | ||
|
|
908ac1f61c | ||
|
|
f5c7e7e404 | ||
|
|
001c700b5b | ||
|
|
9b41e9bef0 | ||
|
|
34bd6e32dc | ||
|
|
c5d058490b | ||
|
|
dd1ae6d9a7 | ||
|
|
d8ea9bde82 | ||
|
|
125edc9c90 | ||
|
|
15ea43e394 | ||
|
|
b55b02687c | ||
|
|
da611f0ac6 | ||
|
|
b8b8dfead4 | ||
|
|
4290a3cbd1 | ||
|
|
a5e2203cee | ||
|
|
e28c08b136 | ||
|
|
a4b6846f63 | ||
|
|
2bc8307861 | ||
|
|
9b39917c79 | ||
|
|
57c13cc0a3 | ||
|
|
b7355fd30d | ||
|
|
93ae309e40 | ||
|
|
5d8f8365e2 | ||
|
|
f26909eefb | ||
|
|
55bfbb2797 | ||
|
|
8970b8342a | ||
|
|
5285e699c3 | ||
|
|
275f3860d5 | ||
|
|
a73fdb7478 | ||
|
|
f2d746403a | ||
|
|
b7dbf2c49b | ||
|
|
21f3c97788 | ||
|
|
14b727cc71 | ||
|
|
abee226591 | ||
|
|
293ad39f4b | ||
|
|
9244302581 | ||
|
|
753cac25fb | ||
|
|
0548263e89 | ||
|
|
53776a9bf8 | ||
|
|
cc7def9b76 | ||
|
|
11a4422c25 | ||
|
|
3a44785260 | ||
|
|
e0d430c26c | ||
|
|
417b70020a | ||
|
|
7b29c464b7 | ||
|
|
26d5529d86 | ||
|
|
852103c478 | ||
|
|
26a115421b | ||
|
|
755b941a9a | ||
|
|
fd1ca82d86 | ||
|
|
6fe175344f | ||
|
|
3590cda13a | ||
|
|
2f1011dd85 | ||
|
|
2b155261b3 | ||
|
|
02f4d606d0 | ||
|
|
577811f00b | ||
|
|
b4098d67a3 | ||
|
|
88bd7554ae | ||
|
|
b5ec16c5ca | ||
|
|
68fcb60a14 | ||
|
|
e4781d60ce | ||
|
|
6201fb346a | ||
|
|
f88c8343f9 | ||
|
|
25410d3316 | ||
|
|
4ff9952938 | ||
|
|
5e3f63a412 | ||
|
|
e1f57be69e | ||
|
|
2c65d5eecc | ||
|
|
aa621f2f1e | ||
|
|
ac932c6e59 | ||
|
|
029f79da16 | ||
|
|
153b2b4a7a | ||
|
|
709b2fe4ee | ||
|
|
09c1fccc58 | ||
|
|
fd254d99b7 | ||
|
|
88bd2c1722 | ||
|
|
d03e2f0fc1 | ||
|
|
3f12a393bd | ||
|
|
8c21284c50 | ||
|
|
e7d396c215 | ||
|
|
f238fac0eb | ||
|
|
017228f80d | ||
|
|
286c5fa943 | ||
|
|
74cfc13abe | ||
|
|
0ee4a6c377 | ||
|
|
283433578d | ||
|
|
9559c85057 | ||
|
|
c5c020f565 | ||
|
|
95ec79bceb | ||
|
|
8f8be8aa33 | ||
|
|
5b60c7445a | ||
|
|
d9dbcc8b52 | ||
|
|
79bc525970 | ||
|
|
9dae1091dd | ||
|
|
74d3ac686a | ||
|
|
cf3cc636ba | ||
|
|
a720441e1d | ||
|
|
0a7ed0959d | ||
|
|
eb83c9b86d | ||
|
|
5c0142dd19 | ||
|
|
c326c8dc83 | ||
|
|
fc4082a03f | ||
|
|
c8655565ff | ||
|
|
638f879f16 | ||
|
|
1d221bf7e6 | ||
|
|
60ea71f0ef | ||
|
|
d8bdd35a3f | ||
|
|
7463891c53 | ||
|
|
7537aec76f | ||
|
|
62234e39a8 | ||
|
|
be004b7b3f | ||
|
|
82539444b2 | ||
|
|
a571d3cbaf | ||
|
|
a038c14c23 | ||
|
|
25a85d874c | ||
|
|
884c36ff42 | ||
|
|
b98e72b8b4 | ||
|
|
05885c0096 | ||
|
|
4c9761231a | ||
|
|
656eaa1508 | ||
|
|
1560dcddcf | ||
|
|
08d4cd4870 | ||
|
|
9767a50ced | ||
|
|
cd86890ed1 | ||
|
|
ba0dd3b9ca | ||
|
|
8d7fa07ffd | ||
|
|
cade1bfe6e | ||
|
|
daec4ab0a7 | ||
|
|
3c96bc3196 | ||
|
|
7f7d8d4bd6 | ||
|
|
47263661a4 | ||
|
|
4c42a086d2 | ||
|
|
5d2541a5c4 | ||
|
|
d91d170b49 | ||
|
|
6d1f4584a9 | ||
|
|
1d76d96bcf | ||
|
|
e8847c998c | ||
|
|
da88e49bae | ||
|
|
65c3a12e54 | ||
|
|
d8d600cc36 | ||
|
|
507999b117 | ||
|
|
8ad164eb34 | ||
|
|
a507df140b | ||
|
|
8912a99986 | ||
|
|
1953f98828 | ||
|
|
7515218ddd | ||
|
|
36c1120136 | ||
|
|
8fa0fe64d8 | ||
|
|
c1a8201b14 | ||
|
|
398bbac48c | ||
|
|
ea71a42bbd | ||
|
|
1c16d25b17 | ||
|
|
9d12ded889 | ||
|
|
5312701515 | ||
|
|
808c7bc0a9 | ||
|
|
4d394015f4 | ||
|
|
3638298af8 | ||
|
|
5f00973e40 | ||
|
|
0f6e2c14fc | ||
|
|
51813da619 | ||
|
|
e7751322ea | ||
|
|
26ef298437 | ||
|
|
badaf8ce73 | ||
|
|
b123a62203 | ||
|
|
cfd77e4252 | ||
|
|
38f814072e | ||
|
|
a0db7754e3 | ||
|
|
f07620afc7 | ||
|
|
c1b0d27752 | ||
|
|
430a5108aa | ||
|
|
111ce92fc9 | ||
|
|
c851e8a58d | ||
|
|
39f4bcd9b4 | ||
|
|
4a610c4c81 | ||
|
|
89ee11945d | ||
|
|
dadb09b74a | ||
|
|
1b1f638b97 | ||
|
|
794fc4ed44 | ||
|
|
72f735bf92 | ||
|
|
912877f25a | ||
|
|
2772c5ae43 | ||
|
|
a7ad24d2cb | ||
|
|
a364a6a9fa | ||
|
|
7b2dc86a8d | ||
|
|
ad645636d0 | ||
|
|
2f2f297b29 | ||
|
|
099ae3fde0 | ||
|
|
e9febe98ac | ||
|
|
5fbd07cccf | ||
|
|
5fed4698c2 | ||
|
|
ed7eb0983a | ||
|
|
90c7e18e5f | ||
|
|
953ab5c3bd | ||
|
|
699c97d8a0 | ||
|
|
e4ca0de92a | ||
|
|
04745a36b8 | ||
|
|
5936940532 | ||
|
|
b3eb064b67 | ||
|
|
e4b41057e3 | ||
|
|
1d41c46cc7 | ||
|
|
a5c444587b | ||
|
|
a56f471be9 | ||
|
|
6a6b26ed8d | ||
|
|
f62446c152 | ||
|
|
56011f1f17 | ||
|
|
6d44091c80 | ||
|
|
440c458eb4 | ||
|
|
798250af61 | ||
|
|
c762de29c6 | ||
|
|
0701e65e97 | ||
|
|
209d54e8b5 | ||
|
|
2b38462de7 | ||
|
|
1e8e553316 | ||
|
|
ab42e6bb15 | ||
|
|
6802884540 | ||
|
|
7cb8577b96 | ||
|
|
55810ccd1f | ||
|
|
f9921720cd | ||
|
|
cda1ebd271 | ||
|
|
6901e4a23a | ||
|
|
6bc21d3c73 | ||
|
|
1ef231e26a | ||
|
|
3cd43f0f98 | ||
|
|
1565019966 | ||
|
|
0a4de2d3a1 | ||
|
|
a058f6c174 | ||
|
|
d8e5d03b01 | ||
|
|
9dc62eff2e | ||
|
|
d4fea17c57 | ||
|
|
3dd7a5b77e | ||
|
|
d77c90a3ba | ||
|
|
01f0c20df0 | ||
|
|
aafbe576b3 | ||
|
|
bd68ad4034 | ||
|
|
bfee017c13 | ||
|
|
61f532cfd0 | ||
|
|
58dbbb75b6 | ||
|
|
8d88b91fcf | ||
|
|
ad39fc6029 | ||
|
|
89f1fd96e6 | ||
|
|
bd425f2493 | ||
|
|
46962ff02a | ||
|
|
e4cb88b051 | ||
|
|
32840703dc | ||
|
|
1f7aafd041 | ||
|
|
7378d5dce4 | ||
|
|
84f76866cd | ||
|
|
322da9ea6a | ||
|
|
58645301ec | ||
|
|
1e18dd30a8 | ||
|
|
cc6a19adcc | ||
|
|
2a5588b177 | ||
|
|
20f9b7f88b | ||
|
|
d7e32313cd | ||
|
|
fb5654d3c4 | ||
|
|
258f1433b3 | ||
|
|
fb723ae8bd | ||
|
|
283b89e37c | ||
|
|
f450f9eb8b | ||
|
|
b3f8cf99a4 | ||
|
|
4301ea8cae | ||
|
|
c672d1c174 | ||
|
|
229e953a38 | ||
|
|
87b506dc9b | ||
|
|
15c9002d9e | ||
|
|
042aaa61b9 | ||
|
|
ef856c6ba5 | ||
|
|
9cf5be73e3 | ||
|
|
63fc149e2a | ||
|
|
3c25839350 | ||
|
|
58246e33b7 | ||
|
|
8b1407c706 | ||
|
|
2fde4a4e22 | ||
|
|
60b9e97982 | ||
|
|
0adac79c0f | ||
|
|
9f485b5981 | ||
|
|
db17d21b8f | ||
|
|
996d394e89 | ||
|
|
5885b960f9 | ||
|
|
79987b35f3 | ||
|
|
661b3ef311 | ||
|
|
fb422726a8 | ||
|
|
4fb6f3ea59 | ||
|
|
f78fe771e1 | ||
|
|
567b887253 | ||
|
|
e516e6b946 | ||
|
|
62748676aa | ||
|
|
7351c72e45 | ||
|
|
2b7405c5e2 | ||
|
|
e2c77cb935 | ||
|
|
7ac621e4c9 | ||
|
|
d8b5d6c66c | ||
|
|
22b461eb4b | ||
|
|
b37ee8555a | ||
|
|
1d0ad2f045 | ||
|
|
ceccfb2c81 | ||
|
|
03c02953cd | ||
|
|
f254a0eaa1 | ||
|
|
9e3b88727c | ||
|
|
b12217466e | ||
|
|
8b9c932f9b | ||
|
|
5986ce03db | ||
|
|
a7b0e936e4 | ||
|
|
cb02211424 | ||
|
|
bd443bf392 | ||
|
|
1f547edd36 | ||
|
|
e4bac3a493 | ||
|
|
5e6bfa681a | ||
|
|
276160125e | ||
|
|
d4ae5543f2 | ||
|
|
55f360e267 | ||
|
|
fdedab2a0c | ||
|
|
a9be42e303 | ||
|
|
6da9510e46 | ||
|
|
0431798178 | ||
|
|
62432f3c48 | ||
|
|
9fbbc30906 | ||
|
|
d1567d1f62 | ||
|
|
6ca1f5970b | ||
|
|
1c880b9e24 | ||
|
|
3b7d54c720 | ||
|
|
44a7406057 | ||
|
|
8157dcfdb1 | ||
|
|
28762aea15 | ||
|
|
439871ea9f | ||
|
|
c9180b005c | ||
|
|
b14e0725f8 | ||
|
|
70fe3dcb4d | ||
|
|
8c554604a4 | ||
|
|
a0a35454bd | ||
|
|
e8467e2af5 | ||
|
|
7515deb566 | ||
|
|
ed9e52af24 | ||
|
|
592a380410 | ||
|
|
1a458d2d5b | ||
|
|
0e4cf53b92 | ||
|
|
e2f06ccb33 | ||
|
|
8abff004cd | ||
|
|
c4a0e2e3fe | ||
|
|
4f10f79c73 | ||
|
|
69e7a560fd | ||
|
|
59b1055808 | ||
|
|
6ed48c6289 | ||
|
|
f2fb4d3f41 | ||
|
|
6aeea59ea8 | ||
|
|
d016f3bbb3 | ||
|
|
7131c29718 | ||
|
|
7432442983 | ||
|
|
5344883394 | ||
|
|
3fcd2f6c2e | ||
|
|
f3d84bd5bf | ||
|
|
549780c232 | ||
|
|
2a6da69b82 | ||
|
|
5c538816cf | ||
|
|
7b8b378a7d | ||
|
|
e30a75e25c | ||
|
|
85ad5cfd0b | ||
|
|
88b9d5068c | ||
|
|
f8c4948a09 | ||
|
|
412322447f | ||
|
|
d4f289e40f | ||
|
|
e1f3feb8f5 | ||
|
|
37d3bc699c | ||
|
|
672fd18016 | ||
|
|
bc2c23a2a0 | ||
|
|
865f7e7812 | ||
|
|
720212b552 | ||
|
|
d3be61f608 | ||
|
|
13418b16b8 | ||
|
|
42d2017cd6 | ||
|
|
4345e76ead | ||
|
|
741431322b | ||
|
|
980beaaf41 | ||
|
|
2205034e09 | ||
|
|
82b9c87a66 | ||
|
|
dda517a937 | ||
|
|
4e6d283b9e | ||
|
|
55acab05aa | ||
|
|
ed38a18d23 | ||
|
|
95b3c11203 | ||
|
|
dce318f4fd | ||
|
|
85127f0fb8 | ||
|
|
fb45058244 | ||
|
|
45bb5ae389 | ||
|
|
339238ab36 | ||
|
|
032cda8b3d | ||
|
|
6badd3fb1e | ||
|
|
724d825745 | ||
|
|
ff1e32ad2e | ||
|
|
a5f97febd3 | ||
|
|
5baa6cc865 | ||
|
|
7a4f30b843 | ||
|
|
b2c385dc4f | ||
|
|
5d5da8d33f | ||
|
|
e604571578 | ||
|
|
f9dacc3f95 | ||
|
|
6086920332 | ||
|
|
f52f3163bc | ||
|
|
d18ff73e88 | ||
|
|
1e5d602cae | ||
|
|
12912521ec | ||
|
|
842ea3a94b | ||
|
|
a8560dbc15 | ||
|
|
a65e27540a | ||
|
|
c3c5ed11e6 | ||
|
|
ce24149335 | ||
|
|
0314ca8c48 | ||
|
|
ebd8ee49a9 | ||
|
|
38d10c9781 | ||
|
|
360106c24d | ||
|
|
ca470a5d02 | ||
|
|
57f66e6b1d | ||
|
|
e774f67924 | ||
|
|
ac10e576c1 | ||
|
|
bcae0a99cd | ||
|
|
c73c2ff879 | ||
|
|
c39b1a3356 | ||
|
|
125dc2d9e0 | ||
|
|
b7d4ddc7ce | ||
|
|
f5e546c6fa | ||
|
|
928e39cd10 | ||
|
|
d0b7ea68a0 | ||
|
|
8444690133 | ||
|
|
c03c42d767 | ||
|
|
ab67688a00 | ||
|
|
5dcb7166da | ||
|
|
14697b86d7 | ||
|
|
4f4b6276d4 | ||
|
|
7bc497e129 | ||
|
|
68a37a6a5a | ||
|
|
6f5cd1d7c5 | ||
|
|
126b1b121c | ||
|
|
2341e456a0 | ||
|
|
72d80e95bb | ||
|
|
f5ec82440c | ||
|
|
c8e526ead3 | ||
|
|
066adfb764 | ||
|
|
5b444d4717 | ||
|
|
69c95adc8d | ||
|
|
2b0e0d8f5c | ||
|
|
778d1bacbf | ||
|
|
7e1b041016 | ||
|
|
313b9b329c | ||
|
|
6830062256 | ||
|
|
323072c982 | ||
|
|
8719d96bdd | ||
|
|
dd5d318ab5 | ||
|
|
d6dc7f5e65 | ||
|
|
c203664eb5 | ||
|
|
19ecf1fa19 | ||
|
|
b8deb0426c | ||
|
|
3b8371f020 | ||
|
|
20bb1cdf39 | ||
|
|
301daa48d0 | ||
|
|
8421ec8803 | ||
|
|
74211eb012 | ||
|
|
60bd42f298 | ||
|
|
14bdd74526 | ||
|
|
fb0f3eda04 | ||
|
|
91ee6e6701 | ||
|
|
51f4e6927c | ||
|
|
94988d8667 | ||
|
|
fe36f5a98c | ||
|
|
f9eb18b927 | ||
|
|
cc60f36748 | ||
|
|
604ade791f | ||
|
|
690ac52a91 | ||
|
|
34ed772775 | ||
|
|
d5ab95571f | ||
|
|
ffb3a0ee5f | ||
|
|
94b12b57aa | ||
|
|
6d149e8457 | ||
|
|
1ad89c90d8 | ||
|
|
fb71c7b020 | ||
|
|
28ed17ad3b | ||
|
|
0c2a4e2bf7 | ||
|
|
62bec30de2 | ||
|
|
3fced77e4e | ||
|
|
a09d1d8b76 | ||
|
|
8f4243fbd8 | ||
|
|
47aaf20549 | ||
|
|
0c5289ea50 | ||
|
|
3e53323514 | ||
|
|
a5ee9861b9 | ||
|
|
feb8ca7654 | ||
|
|
a7abe4473b | ||
|
|
780b9b61de | ||
|
|
19ace36ffa | ||
|
|
5fff8afc9f | ||
|
|
4ad230c927 | ||
|
|
dd98eb1ec8 | ||
|
|
c6baf42e72 | ||
|
|
e2bac97d56 | ||
|
|
d112ee94d0 | ||
|
|
27b21b2faf | ||
|
|
8c96d5cd20 | ||
|
|
c29ed3fd69 | ||
|
|
cedf603f12 | ||
|
|
279161c36f | ||
|
|
ce0b43d919 | ||
|
|
ddafa5bf06 | ||
|
|
bc7116c31b | ||
|
|
53b7092721 | ||
|
|
beb9174b1b | ||
|
|
aea41ed341 | ||
|
|
d789494cb1 | ||
|
|
608e7b4cff | ||
|
|
4ee199c02a | ||
|
|
fbf47d4085 | ||
|
|
5a238e4b42 | ||
|
|
f852b8246a | ||
|
|
88140d929a | ||
|
|
45f7268240 | ||
|
|
3a3c8e4d4a | ||
|
|
c1ac183a04 | ||
|
|
18bb779ee5 | ||
|
|
8b6612fe79 | ||
|
|
fde0bc8534 | ||
|
|
e661a78939 | ||
|
|
847e346602 | ||
|
|
b969751688 | ||
|
|
ad6f2ba03a | ||
|
|
63c6a5edc0 | ||
|
|
9f4cf9dd5e | ||
|
|
51331b6dc0 | ||
|
|
efb6761033 | ||
|
|
6a4f737a0f | ||
|
|
be6864b778 | ||
|
|
de3b91a36c | ||
|
|
ef5482c3b5 | ||
|
|
d20b795137 | ||
|
|
8a134065df | ||
|
|
22aee1bfa4 | ||
|
|
b282820fd6 | ||
|
|
3ee098306d | ||
|
|
09e8f379a6 | ||
|
|
69018cdb3a | ||
|
|
d0d7254c6a | ||
|
|
cc0f0971d7 | ||
|
|
2af61730f0 | ||
|
|
83f41b83dc | ||
|
|
1fb84fce88 | ||
|
|
a8837e1244 | ||
|
|
04d2eec558 | ||
|
|
1b57ec92f0 | ||
|
|
4d88595404 | ||
|
|
52b1272a3a | ||
|
|
d2ccad6a83 | ||
|
|
cad6dde4ac | ||
|
|
06811c3539 | ||
|
|
0cb23c2b21 | ||
|
|
ac4688dca2 | ||
|
|
326c3b4670 | ||
|
|
9b29d0c268 | ||
|
|
e0013c3871 | ||
|
|
a75744075b | ||
|
|
525aec1a02 | ||
|
|
0bf9a7a072 | ||
|
|
d8f2f4c95b | ||
|
|
35d733b44f | ||
|
|
9179b4175c | ||
|
|
bb07d78c78 | ||
|
|
07b179cd7f | ||
|
|
054422d837 | ||
|
|
3e052d1810 | ||
|
|
c8e72805cf | ||
|
|
12a80e7db0 |
8
.github/workflows/pythonapp.yml
vendored
8
.github/workflows/pythonapp.yml
vendored
@@ -14,10 +14,16 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
os: [macos-latest, ubuntu-latest, windows-latest]
|
||||
python-version: [3.6, 3.7, 3.8]
|
||||
python-version: ["3.7", "3.8", "3.9", "3.10"]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: "Set up timezone to America/Los_Angeles"
|
||||
uses: szenius/set-timezone@v1.0
|
||||
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
|
||||
with:
|
||||
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -4,3 +4,5 @@ dist/
|
||||
build/
|
||||
*.egg-info/
|
||||
.github/
|
||||
.vscode/
|
||||
_config.yml
|
||||
|
||||
484
CHANGELOG
Normal file
484
CHANGELOG
Normal file
@@ -0,0 +1,484 @@
|
||||
jc changelog
|
||||
|
||||
20220305 v1.18.5
|
||||
- Fix date parser to ensure AM/PM period string is always uppercase
|
||||
|
||||
20220304 v1.18.4
|
||||
- Add nmcli command parser tested on linux
|
||||
- Enhance parse error messages at the cli
|
||||
- Add standard and streaming parser list functions to the public API
|
||||
- Enhance python developer documentation formatting
|
||||
|
||||
20220214 v1.18.3
|
||||
- Add rsync command and log file parser tested on linux and macOS
|
||||
- Add rsync command and log file streaming parser tested on linux and macOS
|
||||
- Add xrandr command parser tested on linux
|
||||
- Enhance timestamp performance with caching and format hints
|
||||
- Refactor ignore_exceptions functionality in streaming parsers
|
||||
- Fix man page in packages
|
||||
|
||||
20220127 v1.18.2
|
||||
- Fix for plugin parsers with underscores in the name
|
||||
- Add type hints to public API functions
|
||||
- Add plugin attribute to plugin parser metadata
|
||||
- Add C locale hint to parsing error messages
|
||||
- Refactor more cli code into lib
|
||||
|
||||
20220121 v1.18.1
|
||||
- Minor fix for MacOS binary
|
||||
|
||||
20220121 v1.18.0
|
||||
- Add high-level parse API for built-in and plugin parsers
|
||||
- Add python module developer documentation
|
||||
- Enhance magic syntax exception messages
|
||||
- Enhance documentation formatting
|
||||
|
||||
20220106 v1.17.7
|
||||
- Add stat command streaming parser tested on linux and macOS
|
||||
|
||||
20220103 v1.17.6
|
||||
- Add jar-manifest file parser (for MANIFEST.MF files)
|
||||
- Fix CSV parsers for some files that include doublequotes
|
||||
|
||||
20211221 v1.17.5
|
||||
- Add zipinfo parser tested on linux and macOS
|
||||
|
||||
20211207 v1.17.4
|
||||
- Add support for the NO_COLOR environment variable to set mono (http://no-color.org/)
|
||||
- Add -C option to force color output even when using pipes (overrides -m and NO_COLOR)
|
||||
|
||||
20211202 v1.17.3
|
||||
- Update parsers to exit with error if non-string input is detected (raise TypeError)
|
||||
- Update streaming parsers to exit with error if non-iterable input is detected (raise TypeError)
|
||||
- Simplify quiet-checking in parsers
|
||||
- Add iostat parser tested on linux
|
||||
- Add iostat streaming parser tested on linux
|
||||
|
||||
20211117 v1.17.2
|
||||
- Fix ping parser to add Alpine linux support
|
||||
- Fix netstat parser for older versions of netstat on linux
|
||||
- Fix df parser for cases where the filesystem field overflows the column length
|
||||
|
||||
20211030 v1.17.1
|
||||
- Fix file parser for gzip files
|
||||
- Fix uname parser for cases where the 'processor' and/or 'hardware_platform' fields are missing on linux
|
||||
- Fix uname parser on FreeBSD
|
||||
- Add lsusb parser tested on linux
|
||||
- Add CSV file streaming parser
|
||||
- Add testing for Python 3.10.0
|
||||
|
||||
20210923 v1.17.0
|
||||
- Note to Package Maintainers: please see note at 20210720 v1.16.0
|
||||
- Add wrapping of warning and error messages
|
||||
- Add vmstat parser tested on linux
|
||||
- Add support for streaming parsers
|
||||
- Add ls command streaming parser tested on linux, macOS, and freeBSD
|
||||
- Add ping command streaming parser tested on linux, macOS, and freeBSD
|
||||
- Add vmstat command streaming parser tested on linux
|
||||
- Add -u option to allow unbuffered output
|
||||
|
||||
20210830 v1.16.2
|
||||
- Note to Package Maintainers: please see note at 20210720 v1.16.0
|
||||
- Update sfdisk parser to support the -F option and newer versions of sfdisk
|
||||
|
||||
20210813 v1.16.1
|
||||
- Note to Package Maintainers: please see note at 20210720 v1.16.0
|
||||
- Fix issue with process substitution with the magic syntax
|
||||
- Fix issue with globs not including filenames with spaces with magic syntax
|
||||
- Fix stat parser to properly handle filenames with spaces on macOS/BSD
|
||||
|
||||
20210720 v1.16.0
|
||||
- Note to Package Maintainers:
|
||||
TL;DR: `/man/jc.1.gz` and `/jc/man/jc.1.gz` are deprecated and only `/man/jc.1` should be used.
|
||||
|
||||
The Man page in the PyPi source packages will be moving from `/jc/man/jc.1.gz` to `/man/jc.1`
|
||||
in version 1.17.0. For now the Man pages will be available in both locations, but be aware that
|
||||
the Man page at `/jc/man/jc.1.gz` is now considered deprecated.
|
||||
|
||||
Also, starting in v1.17.0, the Man page will no longer be compressed in the source package,
|
||||
therefore `/man/jc.1.gz` should also be considered deprecated and will no longer be available
|
||||
after v1.17.0. Please use `/man/jc.1` and compress downstream if you would like.
|
||||
- Include CHANGELOG in source distribution
|
||||
- Fix Man page location in source packages
|
||||
- Add sfdisk command parser tested on linux
|
||||
- Update unit test files to change the timezone when needed (POSIX only)
|
||||
- Binaries and DEB/RPM/MSI packages now include Python 3.9.5 interpreter
|
||||
|
||||
20210628 v1.15.6
|
||||
- Fix issue to only load local plugin parsers that have filenames that end in .py
|
||||
|
||||
20210520 v1.15.5
|
||||
- Fix issue where help and about information would not display if a 3rd party parser library was missing. (e.g. xmltodict)
|
||||
- Add more error message detail when encountering ParseError and LibraryNotFound exceptions
|
||||
|
||||
20210517 v1.15.4
|
||||
- Update ping parser to support error responses in OSX and BSD
|
||||
- Update ping parser to be more resilient against parsing errors for unknown error types
|
||||
- Update dig parser to support `+noall +answer` use case
|
||||
- Update dig parser compatibility to all platforms
|
||||
- Fix colors in Windows terminals (cmd.exe and PowerShell)
|
||||
- Fix epoch calculations when UTC is referenced as "Coordinated Universal Time"
|
||||
- Add Windows time format for systeminfo output
|
||||
- Add exceptions module to standardize parser exceptions
|
||||
- JC no longer swallows exit codes when using the "magic" syntax. See the Exit Codes section of the README and man page for details
|
||||
|
||||
20210426 v1.15.3
|
||||
- Add ufw status command parser tested on linux
|
||||
- Add ufw-appinfo command parser tested on linux
|
||||
- Fix deb package name to conform to standard
|
||||
- Add Caveats section to readme and manpage
|
||||
|
||||
20210418 v1.15.2
|
||||
- Add systeminfo parser tested on Windows
|
||||
- Update dig parser to fix an issue with IPv6 addresses in the server field
|
||||
- Update dig parser to fix an issue when axfr entries contain a semicolon
|
||||
- Update dig parser to add support for Additional Section and Opt Pseudosection
|
||||
- Update dig parser to add query_size field
|
||||
- Use dig parser as the main example in readme, documentation, and man page
|
||||
- Standardize int, float, and boolean conversion rules with functions in jc.utils
|
||||
|
||||
20210413 v1.15.1
|
||||
- New feature to show parser documentation interactively with -h --parser_name
|
||||
for example: $ jc -h --arp
|
||||
- Add man page to pypi package for easier packaging in homebrew
|
||||
- Update rpm-qi parser to add two calculated timestamp fields: install_date_epoch and install_date_epoch_utc
|
||||
- Clean up documentation and autogenerate the Parser Information section from metadata
|
||||
|
||||
20210407 v1.15.0
|
||||
- Add acpi command parser tested on linux
|
||||
- Add upower command parser tested on linux
|
||||
- Add /usr/bin/time command parser tested on linux and macOS
|
||||
- Add dpkg -l command parser tested on linux
|
||||
- Add rpm -qi command parser tested on linux
|
||||
- Add finger command parser tested on linux and macOS
|
||||
- Add dir command parser tested on Windows 10
|
||||
- Update date parser: complete rewrite (v2.0) providing many enhancements:
|
||||
- Make weekday numbering ISO 8601 compliant
|
||||
- Add a calculated naive timestamp field
|
||||
- Add a calculated UTC timestamp field (only if date output is in UTC)
|
||||
- Add several fields, including: hour_24, utc_offset, day_of_year, week_of_year, iso, and timezone_aware
|
||||
- Update uptime parser to add uptime_days, uptime_hours, uptime_minutes, uptime_total_seconds, time_hour,
|
||||
time_minute, and time_second fields
|
||||
- Update last parser to use new timestamp function
|
||||
- Update stat parser to add access_time_epoch, access_time_epoch_utc, modify_time_epoch, modify_time_epoch_utc,
|
||||
change_time_epoch, change_time_epoch_utc, birth_time_epoch, birth_time_epoch_utc fields
|
||||
- Update timedatectl parser to add epoch_utc field
|
||||
- Update who parser to add epoch field
|
||||
- Update dig parser to add when_epoch and when_epoch_utc fields
|
||||
- Update ls parser to add epoch and epoch_utc fields
|
||||
- Add -h option to display the help text. Piping errors no longer show the help text.
|
||||
- Add -v option to display version information.
|
||||
- Add contributing information to project root
|
||||
- Make all external python library dependencies optional: pygments, ruamel.yaml, xmltodict
|
||||
- JSON output now supports unencoded unicode characters
|
||||
- JSON output is now more compact unless the -p (pretty) option is used
|
||||
- Developer scripts added and enhanced to automate documentation and man page creation
|
||||
- Enhanced man page
|
||||
|
||||
20210305 v1.14.4
|
||||
- Packaging fix only for binaries and RPMs hosted on https://github.com/kellyjonbrazil/jc-packaging.
|
||||
Packages from PyPi and OS repositories are not affected. This fixes an issue that kept the YAML
|
||||
parser from initializing.
|
||||
|
||||
20210210 v1.14.3
|
||||
- Add hciconfig parser tested on linux
|
||||
- Update dig parser to simplify answer data logic
|
||||
|
||||
20210205 v1.14.2
|
||||
- Update dig parser to fix cases where there are spaces in the answer data (e.g. TXT records)
|
||||
|
||||
20210106 v1.14.1
|
||||
- Add iw-scan parser tested on linux (beta)
|
||||
- Update date parser for Ubuntu 20.04 support
|
||||
- Update last parser for last -F support
|
||||
- Update last parser to add convenience fields and augment data for easier parsing
|
||||
- Update man page
|
||||
- Minor documentation updates
|
||||
|
||||
20201231 v1.14.0
|
||||
- Add hashsum parser tested on linux, macos
|
||||
- Add hash parser tested on linux, macos
|
||||
- Add cksum parser tested on linux, macos
|
||||
- Add wc parser tested on linux, macos
|
||||
- Add printenv support under env parser
|
||||
- Add vdir support under ls parser
|
||||
- Add python 3.9 to github automation tests
|
||||
|
||||
20200805 v1.13.4
|
||||
- Update crontab and crontab-u parsers to tighten up variable detection
|
||||
- Update ping parser to tighten linux/bsd detection
|
||||
|
||||
20200804 v1.13.3
|
||||
- Update ping parser for Raspberry Pi compatibility
|
||||
|
||||
20200803 v1.13.2
|
||||
- Add key/value file parser (wrapper for ini parser)
|
||||
- Add date command parser
|
||||
- Update traceroute parser to more gracefully handle missing header row
|
||||
- Update traceroute parser to handle annotations
|
||||
- Update traceroute parser to only return successful probes
|
||||
|
||||
20200727 v1.13.1
|
||||
- Add route -6 tests
|
||||
|
||||
20200727 v1.13.0
|
||||
- Add ping and ping6 command parser tested on linux, macos, and freebsd
|
||||
- Add traceroute and traceroute6 command parser tested on linux, macos, and freebsd
|
||||
- Add tracepath command parser tested on linux
|
||||
- Update ini parser to support files only containing key/value pairs
|
||||
- Update uname parser exception with a hint to use "uname -a"
|
||||
- Update route parser to support IPv6 tables
|
||||
|
||||
20200711 v1.12.1
|
||||
- Fix tests when using older version of pygments library
|
||||
|
||||
20200710 v1.12.0
|
||||
- Add sysctl command parser tested on linux, macOS, and freebsd
|
||||
- Update the cli code to allow older versions of the pygments library (2.3.0) for debian packaging
|
||||
- Code cleanup on the cli
|
||||
- Add tests for the cli
|
||||
- Vendorize cgitb as tracebackplus for verbose debug messages
|
||||
|
||||
20200625 v1.11.8
|
||||
- Add verbose debug option using -dd argument
|
||||
|
||||
20200622 v1.11.7
|
||||
- Fix iptables parser issue which would not output the last chain
|
||||
|
||||
20200614 v1.11.6
|
||||
- Improve and standardize empty data check for all parsers
|
||||
|
||||
20200612 v1.11.5
|
||||
- Update airport_s parser to fix error on parsing empty data
|
||||
- Update arp parser to fix error on parsing empty data
|
||||
- Update blkid parser to fix error on parsing empty data
|
||||
- Update crontab parser to fix error on parsing empty data
|
||||
- Update crontab_u parser to fix error on parsing empty data
|
||||
- Update df parser to fix error on parsing empty data
|
||||
- Update free parser to fix error on parsing empty data
|
||||
- Update lsblk parser to fix error on parsing empty data
|
||||
- Update lsmod parser to fix error on parsing empty data
|
||||
- Update mount parser to fix error on parsing empty data
|
||||
- Update netstat parser to fix error on parsing empty data
|
||||
- Update ntpq parser to fix error on parsing empty data
|
||||
- Update ps parser to fix error on parsing empty data
|
||||
- Update route parser to fix error on parsing empty data
|
||||
- Update systemctl parser to fix error on parsing empty data
|
||||
- Update systemctl_lj parser to fix error on parsing empty data
|
||||
- Update systemctl_ls parser to fix error on parsing empty data
|
||||
- Update systemctl_luf parser to fix error on parsing empty data
|
||||
- Update uptime parser to fix error on parsing empty data
|
||||
- Update w parser to fix error on parsing empty data
|
||||
- Update xml parser to fix error on parsing empty data
|
||||
- Add tests to all parsers for no data condition
|
||||
- Update ss parser to fix integer fields
|
||||
|
||||
20200610 v1.11.4
|
||||
- Update ls parser to fix error on parsing an empty directory
|
||||
|
||||
20200609 v1.11.3
|
||||
- Add local parser plugin feature (contributed by Dean Serenevy)
|
||||
|
||||
20200530 v1.11.2
|
||||
- Update netstat parser to add freebsd support
|
||||
- Update netstat parser to add route_flags_pretty field
|
||||
- Update netstat parser to change osx_inode field name to unix_inode
|
||||
- Update netstat parser to change osx_flags field name to unix_flags
|
||||
- Update netstat parser to strip whitespace from state field
|
||||
- Update route parser to add flags_pretty field
|
||||
- Update arp parser to add permanent field (freebsd and osx)
|
||||
- Update arp parser to add expires field (freebsd)
|
||||
- Update w parser to strip whitespace from what field
|
||||
- Update last parser to fix FreeBSD issues
|
||||
- Update stat parser to change osx_flags field name to unix_flags
|
||||
- Update stat parser to add unix_device field for freebsd and osx
|
||||
- Fix freebsd compatibility message for df, fstab, mount, ntpq, stat, and uname parsers
|
||||
- Fix compatibility message for platforms that include the version number at the end (e.g. freebsd12)
|
||||
|
||||
20200523 v1.11.1
|
||||
- Update stat command parser to change osx_flags field to string
|
||||
|
||||
20200522 v1.11.0
|
||||
- Add dmidecode command parser
|
||||
- Update stat command parser to add OSX support
|
||||
- Update netstat command parser to add OSX support
|
||||
- Update netstat command parser to add -r (route) functionality for linux and OSX
|
||||
- Update netstat command parser to add -i (interface) functionality for linux and OSX
|
||||
|
||||
20200511 v1.10.12
|
||||
- Remove shebang from jc/cli.py for Fedora packaging
|
||||
|
||||
20200511 v1.10.11
|
||||
- Change file permissions for Fedora packaging
|
||||
|
||||
20200509 v1.10.10
|
||||
- Fix ls parser issue where the first file was skipped for ls -R on some platforms
|
||||
- Update last parser to handle 'gone - no logout' condition
|
||||
- Update netstat parser to handle bluetooth section (ignore gracefully for now)
|
||||
|
||||
20200508 v1.10.9
|
||||
- Add license info to vendorized ifconfig-parser class
|
||||
|
||||
20200508 v1.10.8
|
||||
- Add license file to dist for Fedora RPM packaging requirements
|
||||
- Remove tests from package to keep from polluting the global site-packages
|
||||
|
||||
20200501 v1.10.7
|
||||
- Requirements modifications for Fedora RPM packaging requirements
|
||||
|
||||
20200420 v1.10.6
|
||||
- Remove homebrew shim references from du osx tests
|
||||
|
||||
20200414 v1.10.5
|
||||
- Minor change of using sys.exit(0) instead of exit()
|
||||
|
||||
20200412 v1.10.4
|
||||
- Add color customization via JC_COLORS env variable
|
||||
|
||||
20200409 v1.10.3
|
||||
- Fix break on pipe error
|
||||
|
||||
20200409 v1.10.2
|
||||
- Change colors to ansi and match jello colors
|
||||
|
||||
20200402 v1.10.1
|
||||
- Code cleanup
|
||||
|
||||
20200402 v1.10.0
|
||||
- Add color output by default when not piping data to another program
|
||||
- Add -m option for monochrome output
|
||||
|
||||
20200326 v1.9.3
|
||||
- Add axfr support for dig command parser
|
||||
|
||||
20200312 v1.9.2
|
||||
- Updated arp parser to fix OSX detection for some edge cases
|
||||
|
||||
20200312 v1.9.1
|
||||
- Updated file command parser to make filename splitting more robust
|
||||
|
||||
20200311 v1.9.0
|
||||
- Added ntpq command parser
|
||||
- Added timedatectl status command parser
|
||||
- Added airport -I and airport -s command parser
|
||||
- Added file command parser
|
||||
- Optimized history command parser by https://github.com/philippeitis
|
||||
- Magic syntax fix for certain edge cases
|
||||
|
||||
20200308 v1.8.1
|
||||
- CLI optimizations by https://github.com/philippeitis
|
||||
- Refactored magic syntax function and added tests (https://github.com/philippeitis)
|
||||
- Github actions for CI testing on multiple platforms by https://github.com/philippeitis
|
||||
- Updated ls parser to fix parsing error in OSX with -lR when there are empty folders
|
||||
|
||||
20200303 v1.8.0
|
||||
- Added blkid command parser
|
||||
- Added last and lastb command parser
|
||||
- Added who command parser
|
||||
- Added CSV file parser
|
||||
- Added /etc/passwd file parser
|
||||
- Added /etc/shadow file parser
|
||||
- Added /etc/group file parser
|
||||
- Added /etc/gshadow file parser
|
||||
|
||||
20200227 v1.7.5
|
||||
- Updated ls parser to support filenames with newline characters
|
||||
|
||||
20200219 v1.7.4
|
||||
- Updated ls parser to support multiple directories, globbing, and -R (recursive)
|
||||
|
||||
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)
|
||||
|
||||
20200208 v1.7.2
|
||||
- Include test fixtures in wheel and sdist
|
||||
|
||||
20200205 v1.7.1
|
||||
- Add YAML file parser
|
||||
- Add INI file parser
|
||||
- Add XML file parser
|
||||
- Add id parser (tested on linux and OSX)
|
||||
- Add crontab file parser with user support (tested on linux)
|
||||
- Add __version__ variable to parser modules
|
||||
- Add exit code on error
|
||||
- Updated history parser to output "line" as an integer
|
||||
- Updated compatibility list for some parsers
|
||||
- Bugfix in crontab file parser: header insertion was clobbering first row
|
||||
- Just-in-time loading of parser modules instead of loading all at start
|
||||
|
||||
20191217 v1.6.1
|
||||
- Add du parser (tested on linux and OSX)
|
||||
- Add crontab parser (tested on linux and OSX)
|
||||
- Add pip list parser (tested on linux and OSX)
|
||||
- Add pip show parser (tested on linux and OSX)
|
||||
- Add OSX support for the ifconfig, arp, df, mount, and uname parsers
|
||||
- Add tests for ls, dig, ps, w, uptime on OSX
|
||||
- Add about option
|
||||
- Add universal parsers to refactor repetitive code
|
||||
- Updated ifconfig parser to output 'state' as an array
|
||||
|
||||
20191117 v1.5.1
|
||||
- Add ss parser
|
||||
- Add stat parser
|
||||
- Add /etc/hosts parser
|
||||
- Add /etc/fstab parser
|
||||
- Add systemctl parser (includes list-jobs, list-sockets, and list-unit-files)
|
||||
- Add -r and raw=True options. By default, jc will now convert numbers and boolean, if possible, and add other semantic information, while the raw output will keep all values as text and provide a more literal JSON output
|
||||
- Add -q and quiet=True options to suppress warnings to stderr
|
||||
- Add -d option to debug parsing issues
|
||||
- Add compatibility warnings to stderr
|
||||
- Add documentation
|
||||
- Updated iptables parser to allow --line-numbers option
|
||||
- Updated lsblk parser to allow parsing of added columns
|
||||
- Updated mount parser: changed 'access' field name to 'options'
|
||||
- Updated netstat parser to allow parsing of unix sockets and raw network connections
|
||||
- Updated w parser to fix unaligned data where blanks are possible
|
||||
- Clean up code and reorganize package
|
||||
|
||||
20191031 v1.1.1
|
||||
- Add arp parser
|
||||
- Add dig parser
|
||||
- Add unit tests
|
||||
- fix netstat parser (remove side effects due to global variable)
|
||||
|
||||
20191025 v1.0.1
|
||||
- Add w parser
|
||||
- Add uptime parser
|
||||
- Add history parser
|
||||
- Flatten env parser output
|
||||
- Remove problematic characters from key names in: df, free, history, lsblk, lsof, and w
|
||||
- Where possible, lowercase all keys (except cases like env where the key is the variable name)
|
||||
- Remove integer values
|
||||
- Handle CTRL-C gracefully
|
||||
|
||||
20191023 v0.9.1
|
||||
- Add jobs parser
|
||||
- Add lsof parser
|
||||
- Add lsmod parser
|
||||
- No blocking if no piped data
|
||||
- Better help text
|
||||
- Clean up iptables parser code
|
||||
|
||||
20191022 v0.8.1
|
||||
- Add env parser
|
||||
- Add df parser
|
||||
- Add free parser
|
||||
- Add lsblk parser
|
||||
- Add mount parser
|
||||
- Add uname parser
|
||||
- Add iptables parser
|
||||
|
||||
20191021 v0.6.4
|
||||
- Flatten netstat parser output
|
||||
- Clean up argument parsing
|
||||
- Fix command help
|
||||
|
||||
20191018 v0.5.5
|
||||
- Fix netstat -p parsing for Ubuntu
|
||||
- Add ps parser
|
||||
- Add route parser
|
||||
- ls parser fixes
|
||||
|
||||
20191017 v0.2.0
|
||||
- ifconfig, ls, and netstat support
|
||||
89
CONTRIBUTING.md
Normal file
89
CONTRIBUTING.md
Normal file
@@ -0,0 +1,89 @@
|
||||
# Contributing to jc
|
||||
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
|
||||
- Submitting a fix
|
||||
- Proposing new features
|
||||
- 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 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:
|
||||
|
||||
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)
|
||||
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
|
||||
|
||||
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**
|
||||
|
||||
Bad:
|
||||
```json
|
||||
{
|
||||
"Interface 1": [
|
||||
"192.168.1.1",
|
||||
"172.16.1.1"
|
||||
],
|
||||
"Wifi Interface 1": [
|
||||
"10.1.1.1"
|
||||
]
|
||||
}
|
||||
```
|
||||
Good:
|
||||
```json
|
||||
[
|
||||
{
|
||||
"interface": "Interface 1",
|
||||
"ip_addresses": [
|
||||
"192.168.1.1",
|
||||
"172.16.1.1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"interface": "Wifi Interface 1",
|
||||
"ip_addresses": [
|
||||
"10.1.1.1"
|
||||
]
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
## 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.
|
||||
|
||||
## 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.
|
||||
|
||||
## 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!
|
||||
|
||||
## Write bug reports with detail, background, and sample code
|
||||
**Great Bug Reports** tend to have:
|
||||
|
||||
- A quick summary and/or background
|
||||
- Steps to reproduce
|
||||
- Be specific!
|
||||
- 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)
|
||||
|
||||
## 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
|
||||
3985
EXAMPLES.md
Normal file
3985
EXAMPLES.md
Normal file
File diff suppressed because it is too large
Load Diff
2
MANIFEST.in
Normal file
2
MANIFEST.in
Normal file
@@ -0,0 +1,2 @@
|
||||
include man/jc.1
|
||||
include CHANGELOG
|
||||
208
changelog.txt
208
changelog.txt
@@ -1,208 +0,0 @@
|
||||
jc changelog
|
||||
|
||||
20200609 v1.11.3
|
||||
- Add local parser plugin feature (contributed by Dean Serenevy)
|
||||
|
||||
20200530 v1.11.2
|
||||
- Update netstat parser to add freebsd support
|
||||
- Update netstat parser to add route_flags_pretty field
|
||||
- Update netstat parser to change osx_inode field name to unix_inode
|
||||
- Update netstat parser to change osx_flags field name to unix_flags
|
||||
- Update netstat parser to strip whitespace from state field
|
||||
- Update route parser to add flags_pretty field
|
||||
- Update arp parser to add permanent field (freebsd and osx)
|
||||
- Update arp parser to add expires field (freebsd)
|
||||
- Update w parser to strip whitespace from what field
|
||||
- Update last parser to fix FreeBSD issues
|
||||
- Update stat parser to change osx_flags field name to unix_flags
|
||||
- Update stat parser to add unix_device field for freebsd and osx
|
||||
- Fix freebsd compatibility message for df, fstab, mount, ntpq, stat, and uname parsers
|
||||
- Fix compatibility message for platforms that include the version number at the end (e.g. freebsd12)
|
||||
|
||||
20200523 v1.11.1
|
||||
- Update stat command parser to change osx_flags field to string
|
||||
|
||||
20200522 v1.11.0
|
||||
- Add dmidecode command parser
|
||||
- Update stat command parser to add OSX support
|
||||
- Update netstat command parser to add OSX support
|
||||
- Update netstat command parser to add -r (route) functionality for linux and OSX
|
||||
- Update netstat command parser to add -i (interface) functionality for linux and OSX
|
||||
|
||||
20200511 v1.10.12
|
||||
- Remove shebang from jc/cli.py for Fedora packaging
|
||||
|
||||
20200511 v1.10.11
|
||||
- Change file permissions for Fedora packaging
|
||||
|
||||
20200509 v1.10.10
|
||||
- Fix ls parser issue where the first file was skipped for ls -R on some platforms
|
||||
- Update last parser to handle 'gone - no logout' condition
|
||||
- Update netstat parser to handle bluetooth section (ignore gracefully for now)
|
||||
|
||||
20200508 v1.10.9
|
||||
- Add license info to vendorized ifconfig-parser class
|
||||
|
||||
20200508 v1.10.8
|
||||
- Add license file to dist for Fedora RPM packaging requirements
|
||||
- Remove tests from package to keep from polluting the global site-packages
|
||||
|
||||
20200501 v1.10.7
|
||||
- Requirements modifications for Fedora RPM packaging requirements
|
||||
|
||||
20200420 v1.10.6
|
||||
- Remove homebrew shim references from du osx tests
|
||||
|
||||
20200414 v1.10.5
|
||||
- Minor change of using sys.exit(0) instead of exit()
|
||||
|
||||
20200412 v1.10.4
|
||||
- Add color customization via JC_COLORS env variable
|
||||
|
||||
20200409 v1.10.3
|
||||
- Fix break on pipe error
|
||||
|
||||
20200409 v1.10.2
|
||||
- Change colors to ansi and match jello colors
|
||||
|
||||
20200402 v1.10.1
|
||||
- Code cleanup
|
||||
|
||||
20200402 v1.10.0
|
||||
- Add color output by default when not piping data to another program
|
||||
- Add -m option for monochrome output
|
||||
|
||||
20200326 v1.9.3
|
||||
- Add axfr support for dig command parser
|
||||
|
||||
20200312 v1.9.2
|
||||
- Updated arp parser to fix OSX detection for some edge cases
|
||||
|
||||
20200312 v1.9.1
|
||||
- Updated file command parser to make filename splitting more robust
|
||||
|
||||
20200311 v1.9.0
|
||||
- Added ntpq command parser
|
||||
- Added timedatectl status command parser
|
||||
- Added airport -I and airport -s command parser
|
||||
- Added file command parser
|
||||
- Optimized history command parser by https://github.com/philippeitis
|
||||
- Magic syntax fix for certain edge cases
|
||||
|
||||
20200308 v1.8.1
|
||||
- CLI optimizations by https://github.com/philippeitis
|
||||
- Refactored magic syntax function and added tests (https://github.com/philippeitis)
|
||||
- Github actions for CI testing on multiple platforms by https://github.com/philippeitis
|
||||
- Updated ls parser to fix parsing error in OSX with -lR when there are empty folders
|
||||
|
||||
20200303 v1.8.0
|
||||
- Added blkid command parser
|
||||
- Added last and lastb command parser
|
||||
- Added who command parser
|
||||
- Added CSV file parser
|
||||
- Added /etc/passwd file parser
|
||||
- Added /etc/shadow file parser
|
||||
- Added /etc/group file parser
|
||||
- Added /etc/gshadow file parser
|
||||
|
||||
20200227 v1.7.5
|
||||
- Updated ls parser to support filenames with newline characters
|
||||
|
||||
20200219 v1.7.4
|
||||
- Updated ls parser to support multiple directories, globbing, and -R (recursive)
|
||||
|
||||
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)
|
||||
|
||||
20200208 v1.7.2
|
||||
- Include test fixtures in wheel and sdist
|
||||
|
||||
20200205 v1.7.1
|
||||
- Add YAML file parser
|
||||
- Add INI file parser
|
||||
- Add XML file parser
|
||||
- Add id parser (tested on linux and OSX)
|
||||
- Add crontab file parser with user support (tested on linux)
|
||||
- Add __version__ variable to parser modules
|
||||
- Add exit code on error
|
||||
- Updated history parser to output "line" as an integer
|
||||
- Updated compatibility list for some parsers
|
||||
- Bugfix in crontab file parser: header insertion was clobbering first row
|
||||
- Just-in-time loading of parser modules instead of loading all at start
|
||||
|
||||
20191217 v1.6.1
|
||||
- Add du parser (tested on linux and OSX)
|
||||
- Add crontab parser (tested on linux and OSX)
|
||||
- Add pip list parser (tested on linux and OSX)
|
||||
- Add pip show parser (tested on linux and OSX)
|
||||
- Add OSX support for the ifconfig, arp, df, mount, and uname parsers
|
||||
- Add tests for ls, dig, ps, w, uptime on OSX
|
||||
- Add about option
|
||||
- Add universal parsers to refactor repetitive code
|
||||
- Updated ifconfig parser to output 'state' as an array
|
||||
|
||||
20191117 v1.5.1
|
||||
- Add ss parser
|
||||
- Add stat parser
|
||||
- Add /etc/hosts parser
|
||||
- Add /etc/fstab parser
|
||||
- Add systemctl parser (includes list-jobs, list-sockets, and list-unit-files)
|
||||
- Add -r and raw=True options. By default, jc will now convert numbers and boolean, if possible, and add other semantic information, while the raw output will keep all values as text and provide a more literal JSON output
|
||||
- Add -q and quiet=True options to suppress warnings to stderr
|
||||
- Add -d option to debug parsing issues
|
||||
- Add compatibility warnings to stderr
|
||||
- Add documentation
|
||||
- Updated iptables parser to allow --line-numbers option
|
||||
- Updated lsblk parser to allow parsing of added columns
|
||||
- Updated mount parser: changed 'access' field name to 'options'
|
||||
- Updated netstat parser to allow parsing of unix sockets and raw network connections
|
||||
- Updated w parser to fix unaligned data where blanks are possible
|
||||
- Clean up code and reorganize package
|
||||
|
||||
20191031 v1.1.1
|
||||
- Add arp parser
|
||||
- Add dig parser
|
||||
- Add unit tests
|
||||
- fix netstat parser (remove side effects due to global variable)
|
||||
|
||||
20191025 v1.0.1
|
||||
- Add w parser
|
||||
- Add uptime parser
|
||||
- Add history parser
|
||||
- Flatten env parser output
|
||||
- Remove problematic characters from key names in: df, free, history, lsblk, lsof, and w
|
||||
- Where possible, lowercase all keys (except cases like env where the key is the variable name)
|
||||
- Remove integer values
|
||||
- Handle CTRL-C gracefully
|
||||
|
||||
20191023 v0.9.1
|
||||
- Add jobs parser
|
||||
- Add lsof parser
|
||||
- Add lsmod parser
|
||||
- No blocking if no piped data
|
||||
- Better help text
|
||||
- Clean up iptables parser code
|
||||
|
||||
20191022 v0.8.1
|
||||
- Add env parser
|
||||
- Add df parser
|
||||
- Add free parser
|
||||
- Add lsblk parser
|
||||
- Add mount parser
|
||||
- Add uname parser
|
||||
- Add iptables parser
|
||||
|
||||
20191021 v0.6.4
|
||||
- Flatten netstat parser output
|
||||
- Clean up argument parsing
|
||||
- Fix command help
|
||||
|
||||
20191018 v0.5.5
|
||||
- Fix netstat -p parsing for Ubuntu
|
||||
- Add ps parser
|
||||
- Add route parser
|
||||
- ls parser fixes
|
||||
|
||||
20191017 v0.2.0
|
||||
- ifconfig, ls, and netstat support
|
||||
169
docgen.sh
169
docgen.sh
@@ -1,57 +1,120 @@
|
||||
#!/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
|
||||
)
|
||||
|
||||
cd jc
|
||||
pydocmd simple jc+ > ../docs/readme.md
|
||||
pydocmd simple utils+ > ../docs/utils.md
|
||||
pydocmd simple jc.parsers.airport+ > ../docs/parsers/airport.md
|
||||
pydocmd simple jc.parsers.airport_s+ > ../docs/parsers/airport_s.md
|
||||
pydocmd simple jc.parsers.arp+ > ../docs/parsers/arp.md
|
||||
pydocmd simple jc.parsers.blkid+ > ../docs/parsers/blkid.md
|
||||
pydocmd simple jc.parsers.crontab+ > ../docs/parsers/crontab.md
|
||||
pydocmd simple jc.parsers.crontab_u+ > ../docs/parsers/crontab_u.md
|
||||
pydocmd simple jc.parsers.csv+ > ../docs/parsers/csv.md
|
||||
pydocmd simple jc.parsers.df+ > ../docs/parsers/df.md
|
||||
pydocmd simple jc.parsers.dig+ > ../docs/parsers/dig.md
|
||||
pydocmd simple jc.parsers.dmidecode+ > ../docs/parsers/dmidecode.md
|
||||
pydocmd simple jc.parsers.du+ > ../docs/parsers/du.md
|
||||
pydocmd simple jc.parsers.env+ > ../docs/parsers/env.md
|
||||
pydocmd simple jc.parsers.file+ > ../docs/parsers/file.md
|
||||
pydocmd simple jc.parsers.free+ > ../docs/parsers/free.md
|
||||
pydocmd simple jc.parsers.fstab+ > ../docs/parsers/fstab.md
|
||||
pydocmd simple jc.parsers.group+ > ../docs/parsers/group.md
|
||||
pydocmd simple jc.parsers.gshadow+ > ../docs/parsers/gshadow.md
|
||||
pydocmd simple jc.parsers.history+ > ../docs/parsers/history.md
|
||||
pydocmd simple jc.parsers.hosts+ > ../docs/parsers/hosts.md
|
||||
pydocmd simple jc.parsers.id+ > ../docs/parsers/id.md
|
||||
pydocmd simple jc.parsers.ifconfig+ > ../docs/parsers/ifconfig.md
|
||||
pydocmd simple jc.parsers.ini+ > ../docs/parsers/ini.md
|
||||
pydocmd simple jc.parsers.iptables+ > ../docs/parsers/iptables.md
|
||||
pydocmd simple jc.parsers.jobs+ > ../docs/parsers/jobs.md
|
||||
pydocmd simple jc.parsers.last+ > ../docs/parsers/last.md
|
||||
pydocmd simple jc.parsers.ls+ > ../docs/parsers/ls.md
|
||||
pydocmd simple jc.parsers.lsblk+ > ../docs/parsers/lsblk.md
|
||||
pydocmd simple jc.parsers.lsmod+ > ../docs/parsers/lsmod.md
|
||||
pydocmd simple jc.parsers.lsof+ > ../docs/parsers/lsof.md
|
||||
pydocmd simple jc.parsers.mount+ > ../docs/parsers/mount.md
|
||||
pydocmd simple jc.parsers.netstat+ > ../docs/parsers/netstat.md
|
||||
pydocmd simple jc.parsers.ntpq+ > ../docs/parsers/ntpq.md
|
||||
pydocmd simple jc.parsers.passwd+ > ../docs/parsers/passwd.md
|
||||
pydocmd simple jc.parsers.pip_list+ > ../docs/parsers/pip_list.md
|
||||
pydocmd simple jc.parsers.pip_show+ > ../docs/parsers/pip_show.md
|
||||
pydocmd simple jc.parsers.ps+ > ../docs/parsers/ps.md
|
||||
pydocmd simple jc.parsers.route+ > ../docs/parsers/route.md
|
||||
pydocmd simple jc.parsers.shadow+ > ../docs/parsers/shadow.md
|
||||
pydocmd simple jc.parsers.ss+ > ../docs/parsers/ss.md
|
||||
pydocmd simple jc.parsers.stat+ > ../docs/parsers/stat.md
|
||||
pydocmd simple jc.parsers.systemctl+ > ../docs/parsers/systemctl.md
|
||||
pydocmd simple jc.parsers.systemctl_lj+ > ../docs/parsers/systemctl_lj.md
|
||||
pydocmd simple jc.parsers.systemctl_ls+ > ../docs/parsers/systemctl_ls.md
|
||||
pydocmd simple jc.parsers.systemctl_luf+ > ../docs/parsers/systemctl_luf.md
|
||||
pydocmd simple jc.parsers.timedatectl+ > ../docs/parsers/timedatectl.md
|
||||
pydocmd simple jc.parsers.uname+ > ../docs/parsers/uname.md
|
||||
pydocmd simple jc.parsers.uptime+ > ../docs/parsers/uptime.md
|
||||
pydocmd simple jc.parsers.w+ > ../docs/parsers/w.md
|
||||
pydocmd simple jc.parsers.who+ > ../docs/parsers/who.md
|
||||
pydocmd simple jc.parsers.xml+ > ../docs/parsers/xml.md
|
||||
pydocmd simple jc.parsers.yaml+ > ../docs/parsers/yaml.md
|
||||
echo Building docs for: package
|
||||
pydoc-markdown -m jc "${readme_config}" > ../docs/readme.md
|
||||
|
||||
echo Building docs for: lib
|
||||
pydoc-markdown -m jc.lib "${toc_config}" > ../docs/lib.md
|
||||
|
||||
echo Building docs for: utils
|
||||
pydoc-markdown -m jc.utils "${toc_config}" > ../docs/utils.md
|
||||
|
||||
echo Building docs for: streaming
|
||||
pydoc-markdown -m jc.streaming "${toc_config}" > ../docs/streaming.md
|
||||
|
||||
echo Building docs for: universal parser
|
||||
pydoc-markdown -m jc.parsers.universal "${toc_config}" > ../docs/parsers/universal.md
|
||||
|
||||
# a bit of inception here... jc is being used to help
|
||||
# automate the generation of its own documentation. :)
|
||||
|
||||
# pull jc parser objects into a bash array from jq
|
||||
# filter out any plugin parsers
|
||||
parsers=()
|
||||
while read -r value
|
||||
do
|
||||
parsers+=("$value")
|
||||
done < <(jc -a | jq -c '.parsers[] | select(.plugin != true)')
|
||||
|
||||
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
|
||||
done
|
||||
|
||||
166
docs/lib.md
Normal file
166
docs/lib.md
Normal file
@@ -0,0 +1,166 @@
|
||||
# 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)
|
||||
|
||||
<a id="jc.lib"></a>
|
||||
|
||||
# jc.lib
|
||||
|
||||
jc - JSON Convert
|
||||
JC lib module
|
||||
|
||||
<a id="jc.lib.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
def parse(parser_mod_name: str,
|
||||
data: Union[str, Iterable[str]],
|
||||
quiet: bool = False,
|
||||
raw: bool = False,
|
||||
ignore_exceptions: bool = None,
|
||||
**kwargs) -> Union[Dict, List[Dict], Iterator[Dict]]
|
||||
```
|
||||
|
||||
Parse the string data using the supplied parser module.
|
||||
|
||||
This function provides a high-level API to simplify parser use. This
|
||||
function will call built-in parsers and custom plugin parsers.
|
||||
|
||||
Example:
|
||||
|
||||
>>> import jc
|
||||
>>> jc.parse('date', 'Tue Jan 18 10:23:07 PST 2022')
|
||||
{'year': 2022, 'month': 'Jan', 'month_num': 1, 'day'...}
|
||||
|
||||
To get a list of available parser module names, use `parser_mod_list()`.
|
||||
|
||||
You can also use the lower-level parser modules directly:
|
||||
|
||||
>>> import jc.parsers.date
|
||||
>>> jc.parsers.date.parse('Tue Jan 18 10:23:07 PST 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
|
||||
parsers without this API:
|
||||
|
||||
>>> import os
|
||||
>>> import sys
|
||||
>>> import jc.appdirs
|
||||
>>> data_dir = jc.appdirs.user_data_dir('jc', 'jc')
|
||||
>>> local_parsers_dir = os.path.join(data_dir, 'jcparsers')
|
||||
>>> sys.path.append(local_parsers_dir)
|
||||
>>> import my_custom_parser
|
||||
>>> my_custom_parser.parse('command_data')
|
||||
|
||||
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.
|
||||
|
||||
data: (string or data to parse (string for normal
|
||||
iterator) parsers, iterator of strings for
|
||||
streaming parsers)
|
||||
|
||||
raw: (boolean) output preprocessed JSON if True
|
||||
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
ignore_exceptions: (boolean) ignore parsing exceptions if True
|
||||
(streaming parsers only)
|
||||
|
||||
Returns:
|
||||
|
||||
Standard Parsers: Dictionary or List of Dictionaries
|
||||
Streaming Parsers: Generator Object containing Dictionaries
|
||||
|
||||
<a id="jc.lib.parser_mod_list"></a>
|
||||
|
||||
### parser\_mod\_list
|
||||
|
||||
```python
|
||||
def parser_mod_list() -> List[str]
|
||||
```
|
||||
|
||||
Returns a list of all available parser module names.
|
||||
|
||||
<a id="jc.lib.plugin_parser_mod_list"></a>
|
||||
|
||||
### plugin\_parser\_mod\_list
|
||||
|
||||
```python
|
||||
def plugin_parser_mod_list() -> 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>
|
||||
|
||||
### standard\_parser\_mod\_list
|
||||
|
||||
```python
|
||||
def standard_parser_mod_list() -> List[str]
|
||||
```
|
||||
|
||||
Returns a list of standard parser module names. This function is a
|
||||
subset of `parser_mod_list()` and does not contain any streaming
|
||||
parsers.
|
||||
|
||||
<a id="jc.lib.streaming_parser_mod_list"></a>
|
||||
|
||||
### streaming\_parser\_mod\_list
|
||||
|
||||
```python
|
||||
def streaming_parser_mod_list() -> 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) -> Dict
|
||||
```
|
||||
|
||||
Returns a dictionary that includes the module metadata.
|
||||
|
||||
This function will accept **module_name**, **cli-name**, and
|
||||
**--argument-name** variants of the module name string.
|
||||
|
||||
<a id="jc.lib.all_parser_info"></a>
|
||||
|
||||
### all\_parser\_info
|
||||
|
||||
```python
|
||||
def all_parser_info() -> List[Dict]
|
||||
```
|
||||
|
||||
Returns a list of dictionaries that includes metadata for all modules.
|
||||
|
||||
<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.
|
||||
|
||||
258
docs/parsers/acpi.md
Normal file
258
docs/parsers/acpi.md
Normal file
@@ -0,0 +1,258 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.acpi"></a>
|
||||
|
||||
# jc.parsers.acpi
|
||||
|
||||
jc - JSON Convert `acpi` command output parser
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ acpi -V | jc --acpi
|
||||
|
||||
or
|
||||
|
||||
$ jc acpi -V
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('acpi', acpi_command_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.acpi
|
||||
result = jc.parsers.acpi.parse(acpi_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"type": string,
|
||||
"id": integer,
|
||||
"state": string,
|
||||
"charge_percent": integer,
|
||||
"until_charged": string,
|
||||
"until_charged_hours": integer,
|
||||
"until_charged_minuts": integer,
|
||||
"until_charged_seconds": integer,
|
||||
"until_charged_total_seconds": integer,
|
||||
"charge_remaining": string,
|
||||
"charge_remaining_hours": integer,
|
||||
"charge_remaining_minutes": integer,
|
||||
"charge_remaining_seconds": integer,
|
||||
"charge_remaining_total_seconds": integer,
|
||||
"design_capacity_mah": integer,
|
||||
"last_full_capacity": integer,
|
||||
"last_full_capacity_percent": integer,
|
||||
"on-line": boolean,
|
||||
"mode": string,
|
||||
"temperature": float,
|
||||
"temperature_unit": string,
|
||||
"trip_points": [
|
||||
{
|
||||
"id": integer,
|
||||
"switches_to_mode": string,
|
||||
"temperature": float,
|
||||
"temperature_unit": string
|
||||
}
|
||||
],
|
||||
"messages": [
|
||||
string
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
$ acpi -V | jc --acpi -p
|
||||
[
|
||||
{
|
||||
"type": "Battery",
|
||||
"id": 0,
|
||||
"state": "Charging",
|
||||
"charge_percent": 71,
|
||||
"until_charged": "00:29:20",
|
||||
"design_capacity_mah": 2110,
|
||||
"last_full_capacity": 2271,
|
||||
"last_full_capacity_percent": 100,
|
||||
"until_charged_hours": 0,
|
||||
"until_charged_minutes": 29,
|
||||
"until_charged_seconds": 20,
|
||||
"until_charged_total_seconds": 1760
|
||||
},
|
||||
{
|
||||
"type": "Adapter",
|
||||
"id": 0,
|
||||
"on-line": true
|
||||
},
|
||||
{
|
||||
"type": "Thermal",
|
||||
"id": 0,
|
||||
"mode": "ok",
|
||||
"temperature": 46.0,
|
||||
"temperature_unit": "C",
|
||||
"trip_points": [
|
||||
{
|
||||
"id": 0,
|
||||
"switches_to_mode": "critical",
|
||||
"temperature": 127.0,
|
||||
"temperature_unit": "C"
|
||||
},
|
||||
{
|
||||
"id": 1,
|
||||
"switches_to_mode": "hot",
|
||||
"temperature": 127.0,
|
||||
"temperature_unit": "C"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Cooling",
|
||||
"id": 0,
|
||||
"messages": [
|
||||
"Processor 0 of 10"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Cooling",
|
||||
"id": 1,
|
||||
"messages": [
|
||||
"Processor 0 of 10"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Cooling",
|
||||
"id": 2,
|
||||
"messages": [
|
||||
"x86_pkg_temp no state information available"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Cooling",
|
||||
"id": 3,
|
||||
"messages": [
|
||||
"Processor 0 of 10"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Cooling",
|
||||
"id": 4,
|
||||
"messages": [
|
||||
"intel_powerclamp no state information available"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Cooling",
|
||||
"id": 5,
|
||||
"messages": [
|
||||
"Processor 0 of 10"
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
$ acpi -V | jc --acpi -p -r
|
||||
[
|
||||
{
|
||||
"type": "Battery",
|
||||
"id": "0",
|
||||
"state": "Charging",
|
||||
"charge_percent": "71",
|
||||
"until_charged": "00:29:20",
|
||||
"design_capacity_mah": "2110",
|
||||
"last_full_capacity": "2271",
|
||||
"last_full_capacity_percent": "100"
|
||||
},
|
||||
{
|
||||
"type": "Adapter",
|
||||
"id": "0",
|
||||
"on-line": true
|
||||
},
|
||||
{
|
||||
"type": "Thermal",
|
||||
"id": "0",
|
||||
"mode": "ok",
|
||||
"temperature": "46.0",
|
||||
"temperature_unit": "C",
|
||||
"trip_points": [
|
||||
{
|
||||
"id": "0",
|
||||
"switches_to_mode": "critical",
|
||||
"temperature": "127.0",
|
||||
"temperature_unit": "C"
|
||||
},
|
||||
{
|
||||
"id": "1",
|
||||
"switches_to_mode": "hot",
|
||||
"temperature": "127.0",
|
||||
"temperature_unit": "C"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Cooling",
|
||||
"id": "0",
|
||||
"messages": [
|
||||
"Processor 0 of 10"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Cooling",
|
||||
"id": "1",
|
||||
"messages": [
|
||||
"Processor 0 of 10"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Cooling",
|
||||
"id": "2",
|
||||
"messages": [
|
||||
"x86_pkg_temp no state information available"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Cooling",
|
||||
"id": "3",
|
||||
"messages": [
|
||||
"Processor 0 of 10"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Cooling",
|
||||
"id": "4",
|
||||
"messages": [
|
||||
"intel_powerclamp no state information available"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Cooling",
|
||||
"id": "5",
|
||||
"messages": [
|
||||
"Processor 0 of 10"
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
<a id="jc.parsers.acpi.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 Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
@@ -1,16 +1,49 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.airport"></a>
|
||||
|
||||
# jc.parsers.airport
|
||||
jc - JSON CLI output utility airport -I Parser
|
||||
|
||||
Usage:
|
||||
jc - JSON Convert `airport -I` command output parser
|
||||
|
||||
specify --airport as the first argument if the piped input is coming from airport -I (OSX)
|
||||
The `airport` program can be found at `/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport`.
|
||||
|
||||
This program can be found at:
|
||||
/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport
|
||||
Usage (cli):
|
||||
|
||||
Compatibility:
|
||||
$ airport -I | jc --airport
|
||||
|
||||
'darwin'
|
||||
or
|
||||
|
||||
$ jc airport -I
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('airport', airport_command_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.airport
|
||||
result = jc.parsers.airport.parse(airport_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
{
|
||||
"agrctlrssi": integer,
|
||||
"agrextrssi": integer,
|
||||
"agrctlnoise": integer,
|
||||
"agrextnoise": integer,
|
||||
"state": string,
|
||||
"op_mode": string,
|
||||
"lasttxrate": integer,
|
||||
"maxrate": integer,
|
||||
"lastassocstatus": integer,
|
||||
"802_11_auth": string,
|
||||
"link_auth": string,
|
||||
"bssid": string,
|
||||
"ssid": string,
|
||||
"mcs": integer,
|
||||
"channel": string
|
||||
}
|
||||
|
||||
Examples:
|
||||
|
||||
@@ -52,47 +85,12 @@ Examples:
|
||||
"channel": "48,80"
|
||||
}
|
||||
|
||||
## info
|
||||
<a id="jc.parsers.airport.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
info(self, /, *args, **kwargs)
|
||||
```
|
||||
|
||||
## process
|
||||
```python
|
||||
process(proc_data)
|
||||
```
|
||||
|
||||
Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
Dictionary. Structured data with the following schema:
|
||||
|
||||
{
|
||||
"agrctlrssi": integer,
|
||||
"agrextrssi": integer,
|
||||
"agrctlnoise": integer,
|
||||
"agrextnoise": integer,
|
||||
"state": string,
|
||||
"op_mode": string,
|
||||
"lasttxrate": integer,
|
||||
"maxrate": integer,
|
||||
"lastassocstatus": integer,
|
||||
"802_11_auth": string,
|
||||
"link_auth": string,
|
||||
"bssid": string,
|
||||
"ssid": string,
|
||||
"mcs": integer,
|
||||
"channel": string
|
||||
}
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@@ -100,10 +98,14 @@ Main text parsing function
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) output preprocessed JSON if True
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
Dictionary. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: darwin
|
||||
|
||||
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
@@ -1,16 +1,45 @@
|
||||
# jc.parsers.airport_s
|
||||
jc - JSON CLI output utility airport -s Parser
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.airport_s"></a>
|
||||
|
||||
Usage:
|
||||
# jc.parsers.airport\_s
|
||||
|
||||
specify --airport as the first argument if the piped input is coming from airport -s (OSX)
|
||||
jc - JSON Convert `airport -s` command output parser
|
||||
|
||||
This program can be found at:
|
||||
/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport
|
||||
The `airport` program can be found at `/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport`.
|
||||
|
||||
Compatibility:
|
||||
Usage (cli):
|
||||
|
||||
'darwin'
|
||||
$ airport -s | jc --airport-s
|
||||
|
||||
or
|
||||
|
||||
$ jc airport -s
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('airport_s', airport_s_command_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.airport_s
|
||||
result = jc.parsers.airport_s.parse(airport_s_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"ssid": string,
|
||||
"bssid": string,
|
||||
"rssi": integer,
|
||||
"channel": string,
|
||||
"ht": boolean,
|
||||
"cc": string,
|
||||
"security": [
|
||||
string,
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
@@ -84,42 +113,12 @@ Examples:
|
||||
...
|
||||
]
|
||||
|
||||
## info
|
||||
<a id="jc.parsers.airport_s.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
info(self, /, *args, **kwargs)
|
||||
```
|
||||
|
||||
## process
|
||||
```python
|
||||
process(proc_data)
|
||||
```
|
||||
|
||||
Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
[
|
||||
{
|
||||
"ssid": string,
|
||||
"bssid": string,
|
||||
"rssi": integer,
|
||||
"channel": string,
|
||||
"ht": boolean,
|
||||
"cc": string,
|
||||
"security": [
|
||||
string,
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@@ -127,10 +126,14 @@ Main text parsing function
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) output preprocessed JSON if True
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: darwin
|
||||
|
||||
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
@@ -1,17 +1,44 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.arp"></a>
|
||||
|
||||
# jc.parsers.arp
|
||||
jc - JSON CLI output utility arp Parser
|
||||
|
||||
Usage:
|
||||
jc - JSON Convert `arp` command output parser
|
||||
|
||||
specify --arp as the first argument if the piped input is coming from:
|
||||
Supports `arp` and `arp -a` output.
|
||||
|
||||
arp
|
||||
or
|
||||
arp -a
|
||||
Usage (cli):
|
||||
|
||||
Compatibility:
|
||||
$ arp | jc --arp
|
||||
|
||||
'linux', 'aix', 'freebsd', 'darwin'
|
||||
or
|
||||
|
||||
$ jc arp
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('arp', arp_command_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.arp
|
||||
result = jc.parsers.arp.parse(arp_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"name": string,
|
||||
"address": string,
|
||||
"hwtype": string,
|
||||
"hwaddress": string,
|
||||
"flags_mask": string,
|
||||
"iface": string,
|
||||
"permanent": boolean,
|
||||
"expires": integer
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
@@ -95,42 +122,12 @@ Examples:
|
||||
}
|
||||
]
|
||||
|
||||
## info
|
||||
<a id="jc.parsers.arp.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
info(self, /, *args, **kwargs)
|
||||
```
|
||||
|
||||
## process
|
||||
```python
|
||||
process(proc_data)
|
||||
```
|
||||
|
||||
Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
"name": string,
|
||||
"address": string,
|
||||
"hwtype": string,
|
||||
"hwaddress": string,
|
||||
"flags_mask": string,
|
||||
"iface": string,
|
||||
"permanent": boolean,
|
||||
"expires": integer
|
||||
}
|
||||
]
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@@ -138,10 +135,14 @@ Main text parsing function
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) output preprocessed JSON if True
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux, aix, freebsd, darwin
|
||||
|
||||
Version 1.8 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
@@ -1,99 +1,29 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.blkid"></a>
|
||||
|
||||
# jc.parsers.blkid
|
||||
jc - JSON CLI output utility blkid Parser
|
||||
|
||||
Usage:
|
||||
jc - JSON Convert `blkid` command output parser
|
||||
|
||||
specify --blkid as the first argument if the piped input is coming from blkid
|
||||
Usage (cli):
|
||||
|
||||
Compatibility:
|
||||
$ blkid | jc --blkid
|
||||
|
||||
'linux'
|
||||
or
|
||||
|
||||
Examples:
|
||||
$ jc blkid
|
||||
|
||||
$ blkid | jc --blkid -p
|
||||
[
|
||||
{
|
||||
"device": "/dev/sda1",
|
||||
"uuid": "05d927ab-5875-49e4-ada1-7f46cb32c932",
|
||||
"type": "xfs"
|
||||
},
|
||||
{
|
||||
"device": "/dev/sda2",
|
||||
"uuid": "3klkIj-w1kk-DkJi-0XBJ-y3i7-i2Ac-vHqWBM",
|
||||
"type": "LVM2_member"
|
||||
},
|
||||
{
|
||||
"device": "/dev/mapper/centos-root",
|
||||
"uuid": "07d718ff-950c-4e5b-98f0-42a1147c77d9",
|
||||
"type": "xfs"
|
||||
},
|
||||
{
|
||||
"device": "/dev/mapper/centos-swap",
|
||||
"uuid": "615eb89a-bcbf-46fd-80e3-c483ff5c931f",
|
||||
"type": "swap"
|
||||
}
|
||||
]
|
||||
Usage (module):
|
||||
|
||||
$ sudo blkid -o udev -ip /dev/sda2 | jc --blkid -p
|
||||
[
|
||||
{
|
||||
"id_fs_uuid": "3klkIj-w1kk-DkJi-0XBJ-y3i7-i2Ac-vHqWBM",
|
||||
"id_fs_uuid_enc": "3klkIj-w1kk-DkJi-0XBJ-y3i7-i2Ac-vHqWBM",
|
||||
"id_fs_version": "LVM2\x20001",
|
||||
"id_fs_type": "LVM2_member",
|
||||
"id_fs_usage": "raid",
|
||||
"id_iolimit_minimum_io_size": 512,
|
||||
"id_iolimit_physical_sector_size": 512,
|
||||
"id_iolimit_logical_sector_size": 512,
|
||||
"id_part_entry_scheme": "dos",
|
||||
"id_part_entry_type": "0x8e",
|
||||
"id_part_entry_number": 2,
|
||||
"id_part_entry_offset": 2099200,
|
||||
"id_part_entry_size": 39843840,
|
||||
"id_part_entry_disk": "8:0"
|
||||
}
|
||||
]
|
||||
import jc
|
||||
result = jc.parse('blkid', blkid_command_output)
|
||||
|
||||
$ sudo blkid -ip /dev/sda1 | jc --blkid -p -r
|
||||
[
|
||||
{
|
||||
"devname": "/dev/sda1",
|
||||
"uuid": "05d927bb-5875-49e3-ada1-7f46cb31c932",
|
||||
"type": "xfs",
|
||||
"usage": "filesystem",
|
||||
"minimum_io_size": "512",
|
||||
"physical_sector_size": "512",
|
||||
"logical_sector_size": "512",
|
||||
"part_entry_scheme": "dos",
|
||||
"part_entry_type": "0x83",
|
||||
"part_entry_flags": "0x80",
|
||||
"part_entry_number": "1",
|
||||
"part_entry_offset": "2048",
|
||||
"part_entry_size": "2097152",
|
||||
"part_entry_disk": "8:0"
|
||||
}
|
||||
]
|
||||
or
|
||||
|
||||
## info
|
||||
```python
|
||||
info(self, /, *args, **kwargs)
|
||||
```
|
||||
import jc.parsers.blkid
|
||||
result = jc.parsers.blkid.parse(blkid_command_output)
|
||||
|
||||
## process
|
||||
```python
|
||||
process(proc_data)
|
||||
```
|
||||
|
||||
Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
@@ -129,9 +59,78 @@ Returns:
|
||||
}
|
||||
]
|
||||
|
||||
## parse
|
||||
Examples:
|
||||
|
||||
$ blkid | jc --blkid -p
|
||||
[
|
||||
{
|
||||
"device": "/dev/sda1",
|
||||
"uuid": "05d927ab-5875-49e4-ada1-7f46cb32c932",
|
||||
"type": "xfs"
|
||||
},
|
||||
{
|
||||
"device": "/dev/sda2",
|
||||
"uuid": "3klkIj-w1kk-DkJi-0XBJ-y3i7-i2Ac-vHqWBM",
|
||||
"type": "LVM2_member"
|
||||
},
|
||||
{
|
||||
"device": "/dev/mapper/centos-root",
|
||||
"uuid": "07d718ff-950c-4e5b-98f0-42a1147c77d9",
|
||||
"type": "xfs"
|
||||
},
|
||||
{
|
||||
"device": "/dev/mapper/centos-swap",
|
||||
"uuid": "615eb89a-bcbf-46fd-80e3-c483ff5c931f",
|
||||
"type": "swap"
|
||||
}
|
||||
]
|
||||
|
||||
$ sudo blkid -o udev -ip /dev/sda2 | jc --blkid -p
|
||||
[
|
||||
{
|
||||
"id_fs_uuid": "3klkIj-w1kk-DkJi-0XBJ-y3i7-i2Ac-vHqWBM",
|
||||
"id_fs_uuid_enc": "3klkIj-w1kk-DkJi-0XBJ-y3i7-i2Ac-vHqWBM",
|
||||
"id_fs_version": "LVM2\\x20001",
|
||||
"id_fs_type": "LVM2_member",
|
||||
"id_fs_usage": "raid",
|
||||
"id_iolimit_minimum_io_size": 512,
|
||||
"id_iolimit_physical_sector_size": 512,
|
||||
"id_iolimit_logical_sector_size": 512,
|
||||
"id_part_entry_scheme": "dos",
|
||||
"id_part_entry_type": "0x8e",
|
||||
"id_part_entry_number": 2,
|
||||
"id_part_entry_offset": 2099200,
|
||||
"id_part_entry_size": 39843840,
|
||||
"id_part_entry_disk": "8:0"
|
||||
}
|
||||
]
|
||||
|
||||
$ sudo blkid -ip /dev/sda1 | jc --blkid -p -r
|
||||
[
|
||||
{
|
||||
"devname": "/dev/sda1",
|
||||
"uuid": "05d927bb-5875-49e3-ada1-7f46cb31c932",
|
||||
"type": "xfs",
|
||||
"usage": "filesystem",
|
||||
"minimum_io_size": "512",
|
||||
"physical_sector_size": "512",
|
||||
"logical_sector_size": "512",
|
||||
"part_entry_scheme": "dos",
|
||||
"part_entry_type": "0x83",
|
||||
"part_entry_flags": "0x80",
|
||||
"part_entry_number": "1",
|
||||
"part_entry_offset": "2048",
|
||||
"part_entry_size": "2097152",
|
||||
"part_entry_disk": "8:0"
|
||||
}
|
||||
]
|
||||
|
||||
<a id="jc.parsers.blkid.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@@ -139,10 +138,14 @@ Main text parsing function
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) output preprocessed JSON if True
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
85
docs/parsers/cksum.md
Normal file
85
docs/parsers/cksum.md
Normal file
@@ -0,0 +1,85 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.cksum"></a>
|
||||
|
||||
# jc.parsers.cksum
|
||||
|
||||
jc - JSON Convert `cksum` command output parser
|
||||
|
||||
This parser works with the following checksum calculation utilities:
|
||||
- `sum`
|
||||
- `cksum`
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ cksum file.txt | jc --cksum
|
||||
|
||||
or
|
||||
|
||||
$ jc cksum file.txt
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('cksum', cksum_command_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.cksum
|
||||
result = jc.parsers.cksum.parse(cksum_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"filename": string,
|
||||
"checksum": integer,
|
||||
"blocks": integer
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
$ cksum * | jc --cksum -p
|
||||
[
|
||||
{
|
||||
"filename": "__init__.py",
|
||||
"checksum": 4294967295,
|
||||
"blocks": 0
|
||||
},
|
||||
{
|
||||
"filename": "airport.py",
|
||||
"checksum": 2208551092,
|
||||
"blocks": 3745
|
||||
},
|
||||
{
|
||||
"filename": "airport_s.py",
|
||||
"checksum": 1113817598,
|
||||
"blocks": 4572
|
||||
},
|
||||
...
|
||||
]
|
||||
|
||||
<a id="jc.parsers.cksum.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 Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, aix, freebsd
|
||||
|
||||
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
@@ -1,13 +1,63 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.crontab"></a>
|
||||
|
||||
# jc.parsers.crontab
|
||||
jc - JSON CLI output utility crontab command and file Parser
|
||||
|
||||
Usage:
|
||||
jc - JSON Convert `crontab -l` command output and crontab
|
||||
file parser
|
||||
|
||||
specify --crontab as the first argument if the piped input is coming from crontab -l or a crontab file
|
||||
Supports `crontab -l` command output and crontab files.
|
||||
|
||||
Compatibility:
|
||||
Usage (cli):
|
||||
|
||||
'linux', 'darwin', 'aix', 'freebsd'
|
||||
$ crontab -l | jc --crontab
|
||||
|
||||
or
|
||||
|
||||
$ jc crontab -l
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('crontab', crontab_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.crontab
|
||||
result = jc.parsers.crontab.parse(crontab_output)
|
||||
|
||||
Schema:
|
||||
|
||||
{
|
||||
"variables": [
|
||||
{
|
||||
"name": string,
|
||||
"value": string
|
||||
}
|
||||
],
|
||||
"schedule": [
|
||||
{
|
||||
"occurrence" string,
|
||||
"minute": [
|
||||
string
|
||||
],
|
||||
"hour": [
|
||||
string
|
||||
],
|
||||
"day_of_month": [
|
||||
string
|
||||
],
|
||||
"month": [
|
||||
string
|
||||
],
|
||||
"day_of_week": [
|
||||
string
|
||||
],
|
||||
"occurrence": string,
|
||||
"command": string
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Examples:
|
||||
|
||||
@@ -128,59 +178,12 @@ Examples:
|
||||
]
|
||||
}
|
||||
|
||||
## info
|
||||
<a id="jc.parsers.crontab.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
info(self, /, *args, **kwargs)
|
||||
```
|
||||
|
||||
## process
|
||||
```python
|
||||
process(proc_data)
|
||||
```
|
||||
|
||||
Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
Dictionary. Structured data with the following schema:
|
||||
|
||||
{
|
||||
"variables": [
|
||||
"name": string,
|
||||
"value": string
|
||||
],
|
||||
"schedule": [
|
||||
{
|
||||
"occurrence" string,
|
||||
"minute": [
|
||||
string
|
||||
],
|
||||
"hour": [
|
||||
string
|
||||
],
|
||||
"day_of_month": [
|
||||
string
|
||||
],
|
||||
"month": [
|
||||
string
|
||||
],
|
||||
"day_of_week": [
|
||||
string
|
||||
],
|
||||
"occurrence": string,
|
||||
"command": string
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@@ -188,10 +191,14 @@ Main text parsing function
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) output preprocessed JSON if True
|
||||
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, aix, freebsd
|
||||
|
||||
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
@@ -1,158 +1,36 @@
|
||||
# jc.parsers.crontab_u
|
||||
jc - JSON CLI output utility crontab file Parser
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.crontab_u"></a>
|
||||
|
||||
Usage:
|
||||
# jc.parsers.crontab\_u
|
||||
|
||||
specify --crontab-u as the first argument if the piped input is coming from a crontab file with User specified
|
||||
jc - JSON Convert `crontab -l` command output and crontab
|
||||
file parser
|
||||
|
||||
Compatibility:
|
||||
This version of the `crontab -l` parser supports output that contains user
|
||||
information for processes.
|
||||
|
||||
'linux', 'darwin', 'aix', 'freebsd'
|
||||
Usage (cli):
|
||||
|
||||
Examples:
|
||||
$ crontab -l | jc --crontab-u
|
||||
|
||||
$ cat /etc/crontab | jc --crontab-u -p
|
||||
{
|
||||
"variables": [
|
||||
{
|
||||
"name": "PATH",
|
||||
"value": "/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"
|
||||
},
|
||||
{
|
||||
"name": "SHELL",
|
||||
"value": "/bin/sh"
|
||||
}
|
||||
],
|
||||
"schedule": [
|
||||
{
|
||||
"minute": [
|
||||
"25"
|
||||
],
|
||||
"hour": [
|
||||
"6"
|
||||
],
|
||||
"day_of_month": [
|
||||
"*"
|
||||
],
|
||||
"month": [
|
||||
"*"
|
||||
],
|
||||
"day_of_week": [
|
||||
"*"
|
||||
],
|
||||
"user": "root",
|
||||
"command": "test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )"
|
||||
},
|
||||
{
|
||||
"minute": [
|
||||
"47"
|
||||
],
|
||||
"hour": [
|
||||
"6"
|
||||
],
|
||||
"day_of_month": [
|
||||
"*"
|
||||
],
|
||||
"month": [
|
||||
"*"
|
||||
],
|
||||
"day_of_week": [
|
||||
"7"
|
||||
],
|
||||
"user": "root",
|
||||
"command": "test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )"
|
||||
},
|
||||
{
|
||||
"minute": [
|
||||
"52"
|
||||
],
|
||||
"hour": [
|
||||
"6"
|
||||
],
|
||||
"day_of_month": [
|
||||
"1"
|
||||
],
|
||||
"month": [
|
||||
"*"
|
||||
],
|
||||
"day_of_week": [
|
||||
"*"
|
||||
],
|
||||
"user": "root",
|
||||
"command": "test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )"
|
||||
}
|
||||
]
|
||||
}
|
||||
Usage (module):
|
||||
|
||||
$ cat /etc/crontab | jc --crontab-u -p -r
|
||||
{
|
||||
"variables": [
|
||||
{
|
||||
"name": "PATH",
|
||||
"value": "/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"
|
||||
},
|
||||
{
|
||||
"name": "SHELL",
|
||||
"value": "/bin/sh"
|
||||
}
|
||||
],
|
||||
"schedule": [
|
||||
{
|
||||
"minute": "25",
|
||||
"hour": "6",
|
||||
"day_of_month": "*",
|
||||
"month": "*",
|
||||
"day_of_week": "*",
|
||||
"user": "root",
|
||||
"command": "test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )"
|
||||
},
|
||||
{
|
||||
"minute": "47",
|
||||
"hour": "6",
|
||||
"day_of_month": "*",
|
||||
"month": "*",
|
||||
"day_of_week": "7",
|
||||
"user": "root",
|
||||
"command": "test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )"
|
||||
},
|
||||
{
|
||||
"minute": "52",
|
||||
"hour": "6",
|
||||
"day_of_month": "1",
|
||||
"month": "*",
|
||||
"day_of_week": "*",
|
||||
"user": "root",
|
||||
"command": "test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )"
|
||||
}
|
||||
]
|
||||
}
|
||||
import jc
|
||||
result = jc.parse('crontab_u', crontab_u_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.crontab_u
|
||||
result = jc.parsers.crontab_u.parse(crontab_u_output)
|
||||
|
||||
## info
|
||||
```python
|
||||
info(self, /, *args, **kwargs)
|
||||
```
|
||||
|
||||
## process
|
||||
```python
|
||||
process(proc_data)
|
||||
```
|
||||
|
||||
Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
Dictionary. Structured data with the following schema:
|
||||
Schema:
|
||||
|
||||
{
|
||||
"variables": [
|
||||
"name": string,
|
||||
"value": string
|
||||
{
|
||||
"name": string,
|
||||
"value": string
|
||||
}
|
||||
],
|
||||
"schedule": [
|
||||
{
|
||||
@@ -179,10 +57,130 @@ Returns:
|
||||
]
|
||||
}
|
||||
|
||||
Examples:
|
||||
|
||||
$ cat /etc/crontab | jc --crontab-u -p
|
||||
{
|
||||
"variables": [
|
||||
{
|
||||
"name": "PATH",
|
||||
"value": "/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sb..."
|
||||
},
|
||||
{
|
||||
"name": "SHELL",
|
||||
"value": "/bin/sh"
|
||||
}
|
||||
],
|
||||
"schedule": [
|
||||
{
|
||||
"minute": [
|
||||
"25"
|
||||
],
|
||||
"hour": [
|
||||
"6"
|
||||
],
|
||||
"day_of_month": [
|
||||
"*"
|
||||
],
|
||||
"month": [
|
||||
"*"
|
||||
],
|
||||
"day_of_week": [
|
||||
"*"
|
||||
],
|
||||
"user": "root",
|
||||
"command": "test -x /usr/sbin/anacron || ( cd / && run-parts ..."
|
||||
},
|
||||
{
|
||||
"minute": [
|
||||
"47"
|
||||
],
|
||||
"hour": [
|
||||
"6"
|
||||
],
|
||||
"day_of_month": [
|
||||
"*"
|
||||
],
|
||||
"month": [
|
||||
"*"
|
||||
],
|
||||
"day_of_week": [
|
||||
"7"
|
||||
],
|
||||
"user": "root",
|
||||
"command": "test -x /usr/sbin/anacron || ( cd / && run-parts ..."
|
||||
},
|
||||
{
|
||||
"minute": [
|
||||
"52"
|
||||
],
|
||||
"hour": [
|
||||
"6"
|
||||
],
|
||||
"day_of_month": [
|
||||
"1"
|
||||
],
|
||||
"month": [
|
||||
"*"
|
||||
],
|
||||
"day_of_week": [
|
||||
"*"
|
||||
],
|
||||
"user": "root",
|
||||
"command": "test -x /usr/sbin/anacron || ( cd / && run-parts ..."
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
$ cat /etc/crontab | jc --crontab-u -p -r
|
||||
{
|
||||
"variables": [
|
||||
{
|
||||
"name": "PATH",
|
||||
"value": "/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/..."
|
||||
},
|
||||
{
|
||||
"name": "SHELL",
|
||||
"value": "/bin/sh"
|
||||
}
|
||||
],
|
||||
"schedule": [
|
||||
{
|
||||
"minute": "25",
|
||||
"hour": "6",
|
||||
"day_of_month": "*",
|
||||
"month": "*",
|
||||
"day_of_week": "*",
|
||||
"user": "root",
|
||||
"command": "test -x /usr/sbin/anacron || ( cd / && run-parts ..."
|
||||
},
|
||||
{
|
||||
"minute": "47",
|
||||
"hour": "6",
|
||||
"day_of_month": "*",
|
||||
"month": "*",
|
||||
"day_of_week": "7",
|
||||
"user": "root",
|
||||
"command": "test -x /usr/sbin/anacron || ( cd / && run-parts ..."
|
||||
},
|
||||
{
|
||||
"minute": "52",
|
||||
"hour": "6",
|
||||
"day_of_month": "1",
|
||||
"month": "*",
|
||||
"day_of_week": "*",
|
||||
"user": "root",
|
||||
"command": "test -x /usr/sbin/anacron || ( cd / && run-parts ..."
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
<a id="jc.parsers.crontab_u.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@@ -190,10 +188,14 @@ Main text parsing function
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) output preprocessed JSON if True
|
||||
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, aix, freebsd
|
||||
|
||||
Version 1.7 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
@@ -1,21 +1,44 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.csv"></a>
|
||||
|
||||
# jc.parsers.csv
|
||||
jc - JSON CLI output utility csv Parser
|
||||
|
||||
Usage:
|
||||
jc - JSON Convert `csv` file parser
|
||||
|
||||
specify --csv as the first argument if the piped input is coming from a csv file.
|
||||
the csv parser will attempt to automatically detect the delimiter character.
|
||||
if the delimiter cannot be detected it will default to comma.
|
||||
the first row of the file must be a header row.
|
||||
The `csv` parser will attempt to automatically detect the delimiter
|
||||
character. If the delimiter cannot be detected it will default to comma.
|
||||
The first row of the file must be a header row.
|
||||
|
||||
Compatibility:
|
||||
Usage (cli):
|
||||
|
||||
'linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd'
|
||||
$ cat file.csv | jc --csv
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('csv', csv_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.csv
|
||||
result = jc.parsers.csv.parse(csv_output)
|
||||
|
||||
Schema:
|
||||
|
||||
csv file converted to a Dictionary:
|
||||
https://docs.python.org/3/library/csv.html
|
||||
|
||||
[
|
||||
{
|
||||
"column_name1": string,
|
||||
"column_name2": string
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
$ cat homes.csv
|
||||
"Sell", "List", "Living", "Rooms", "Beds", "Baths", "Age", "Acres", "Taxes"
|
||||
"Sell", "List", "Living", "Rooms", "Beds", "Baths", "Age", "Acres"...
|
||||
142, 160, 28, 10, 5, 3, 60, 0.28, 3167
|
||||
175, 180, 18, 8, 4, 1, 12, 0.43, 4033
|
||||
129, 132, 13, 6, 3, 1, 41, 0.33, 1471
|
||||
@@ -59,36 +82,12 @@ Examples:
|
||||
...
|
||||
]
|
||||
|
||||
## info
|
||||
<a id="jc.parsers.csv.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
info(self, /, *args, **kwargs)
|
||||
```
|
||||
|
||||
## process
|
||||
```python
|
||||
process(proc_data)
|
||||
```
|
||||
|
||||
Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Each dictionary represents a row in the csv file:
|
||||
|
||||
[
|
||||
{
|
||||
csv file converted to a Dictionary
|
||||
https://docs.python.org/3/library/csv.html
|
||||
}
|
||||
]
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@@ -96,10 +95,14 @@ Main text parsing function
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) output preprocessed JSON if True
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
|
||||
|
||||
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
102
docs/parsers/csv_s.md
Normal file
102
docs/parsers/csv_s.md
Normal file
@@ -0,0 +1,102 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.csv_s"></a>
|
||||
|
||||
# jc.parsers.csv\_s
|
||||
|
||||
jc - JSON Convert `csv` file streaming parser
|
||||
|
||||
> This streaming parser outputs JSON Lines
|
||||
|
||||
The `csv` streaming parser will attempt to automatically detect the
|
||||
delimiter character. If the delimiter cannot be detected it will default
|
||||
to comma. The first row of the file must be a header row.
|
||||
|
||||
Note: The first 100 rows are read into memory to enable delimiter detection,
|
||||
then the rest of the rows are loaded lazily.
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ cat file.csv | jc --csv-s
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
# result is an iterable object (generator)
|
||||
result = jc.parse('csv_s', csv_output.splitlines())
|
||||
for item in result:
|
||||
# do something
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.csv_s
|
||||
# result is an iterable object (generator)
|
||||
result = jc.parsers.csv_s.parse(csv_output.splitlines())
|
||||
for item in result:
|
||||
# do something
|
||||
|
||||
Schema:
|
||||
|
||||
csv file converted to a Dictionary:
|
||||
https://docs.python.org/3/library/csv.html
|
||||
|
||||
{
|
||||
"column_name1": string,
|
||||
"column_name2": string,
|
||||
|
||||
# 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
|
||||
}
|
||||
}
|
||||
|
||||
Examples:
|
||||
|
||||
$ cat homes.csv
|
||||
"Sell", "List", "Living", "Rooms", "Beds", "Baths", "Age", "Acres"...
|
||||
142, 160, 28, 10, 5, 3, 60, 0.28, 3167
|
||||
175, 180, 18, 8, 4, 1, 12, 0.43, 4033
|
||||
129, 132, 13, 6, 3, 1, 41, 0.33, 1471
|
||||
...
|
||||
|
||||
$ cat homes.csv | jc --csv-s
|
||||
{"Sell":"142","List":"160","Living":"28","Rooms":"10","Beds":"5"...}
|
||||
{"Sell":"175","List":"180","Living":"18","Rooms":"8","Beds":"4"...}
|
||||
{"Sell":"129","List":"132","Living":"13","Rooms":"6","Beds":"3"...}
|
||||
...
|
||||
|
||||
<a id="jc.parsers.csv_s.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
@add_jc_meta
|
||||
def parse(data, raw=False, quiet=False, ignore_exceptions=False)
|
||||
```
|
||||
|
||||
Main text parsing generator function. Returns an iterator 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
|
||||
|
||||
Yields:
|
||||
|
||||
Dictionary. Raw or processed structured data.
|
||||
|
||||
Returns:
|
||||
|
||||
Iterator object (generator)
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
|
||||
|
||||
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
108
docs/parsers/date.md
Normal file
108
docs/parsers/date.md
Normal file
@@ -0,0 +1,108 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.date"></a>
|
||||
|
||||
# jc.parsers.date
|
||||
|
||||
jc - JSON Convert `date` command output parser
|
||||
|
||||
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):
|
||||
|
||||
$ date | jc --date
|
||||
|
||||
or
|
||||
|
||||
$ jc date
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('date', date_command_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.date
|
||||
result = jc.parsers.date.parse(date_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
{
|
||||
"year": integer,
|
||||
"month": string,
|
||||
"month_num": integer,
|
||||
"day": integer,
|
||||
"weekday": string,
|
||||
"weekday_num": integer,
|
||||
"hour": integer,
|
||||
"hour_24": integer,
|
||||
"minute": integer,
|
||||
"second": integer,
|
||||
"period": string,
|
||||
"timezone": string,
|
||||
"utc_offset": string, # null if timezone field is not UTC
|
||||
"day_of_year": integer,
|
||||
"week_of_year": integer,
|
||||
"iso": string,
|
||||
"epoch": integer, # [0]
|
||||
"epoch_utc": integer, # [1]
|
||||
"timezone_aware": boolean # [2]
|
||||
}
|
||||
|
||||
[0] naive timestamp
|
||||
[1] timezone-aware timestamp. Only available if timezone field is UTC
|
||||
[2] if true, all fields are correctly based on UTC
|
||||
|
||||
Examples:
|
||||
|
||||
$ date | jc --date -p
|
||||
{
|
||||
"year": 2021,
|
||||
"month": "Mar",
|
||||
"month_num": 3,
|
||||
"day": 25,
|
||||
"weekday": "Thu",
|
||||
"weekday_num": 4,
|
||||
"hour": 2,
|
||||
"hour_24": 2,
|
||||
"minute": 2,
|
||||
"second": 26,
|
||||
"period": "AM",
|
||||
"timezone": "UTC",
|
||||
"utc_offset": "+0000",
|
||||
"day_of_year": 84,
|
||||
"week_of_year": 12,
|
||||
"iso": "2021-03-25T02:02:26+00:00",
|
||||
"epoch": 1616662946,
|
||||
"epoch_utc": 1616637746,
|
||||
"timezone_aware": true
|
||||
}
|
||||
|
||||
<a id="jc.parsers.date.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. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, freebsd
|
||||
|
||||
Version 2.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
@@ -1,13 +1,46 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.df"></a>
|
||||
|
||||
# jc.parsers.df
|
||||
jc - JSON CLI output utility df Parser
|
||||
|
||||
Usage:
|
||||
jc - JSON Convert `df` command output parser
|
||||
|
||||
specify --df as the first argument if the piped input is coming from df
|
||||
Usage (cli):
|
||||
|
||||
Compatibility:
|
||||
$ df | jc --df
|
||||
|
||||
'linux', 'darwin', 'freebsd'
|
||||
or
|
||||
|
||||
$ jc df
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('df', df_command_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.df
|
||||
result = jc.parsers.df.parse(df_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"filesystem": string,
|
||||
"size": string,
|
||||
"1k_blocks": integer,
|
||||
"512_blocks": integer,
|
||||
"used": integer,
|
||||
"available": integer,
|
||||
"capacity_percent": integer,
|
||||
"ifree": integer,
|
||||
"iused": integer,
|
||||
"use_percent": integer,
|
||||
"iused_percent": integer,
|
||||
"mounted_on": string
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
@@ -69,46 +102,12 @@ Examples:
|
||||
...
|
||||
]
|
||||
|
||||
## info
|
||||
<a id="jc.parsers.df.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
info(self, /, *args, **kwargs)
|
||||
```
|
||||
|
||||
## process
|
||||
```python
|
||||
process(proc_data)
|
||||
```
|
||||
|
||||
Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
"filesystem": string,
|
||||
"size": string,
|
||||
"1k_blocks": integer,
|
||||
"512_blocks": integer,
|
||||
"used": integer,
|
||||
"available": integer,
|
||||
"capacity_percent": integer,
|
||||
"ifree": integer,
|
||||
"iused": integer,
|
||||
"use_percent": integer,
|
||||
"iused_percent": integer,
|
||||
"mounted_on": string
|
||||
}
|
||||
]
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@@ -116,10 +115,14 @@ Main text parsing function
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) output preprocessed JSON if True
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, freebsd
|
||||
|
||||
Version 1.9 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
@@ -1,20 +1,124 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.dig"></a>
|
||||
|
||||
# jc.parsers.dig
|
||||
jc - JSON CLI output utility dig Parser
|
||||
|
||||
Usage:
|
||||
jc - JSON Convert `dig` command output parser
|
||||
|
||||
Specify --dig as the first argument if the piped input is coming from dig
|
||||
Options supported:
|
||||
- `+noall +answer` options are supported in cases where only the answer
|
||||
information is desired.
|
||||
- `+axfr` option is supported on its own
|
||||
|
||||
Compatibility:
|
||||
The `when_epoch` calculated timestamp field is naive. (i.e. based on the
|
||||
local time of the system the parser is run on)
|
||||
|
||||
'linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd'
|
||||
The `when_epoch_utc` calculated timestamp field is timezone-aware and is
|
||||
only available if the timezone field is UTC.
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ dig example.com | jc --dig
|
||||
|
||||
or
|
||||
|
||||
$ jc dig example.com
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('dig', dig_command_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.dig
|
||||
result = jc.parsers.dig.parse(dig_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"id": integer,
|
||||
"opcode": string,
|
||||
"status": string,
|
||||
"flags": [
|
||||
string
|
||||
],
|
||||
"query_num": integer,
|
||||
"answer_num": integer,
|
||||
"authority_num": integer,
|
||||
"additional_num": integer,
|
||||
"axfr": [
|
||||
{
|
||||
"name": string,
|
||||
"class": string,
|
||||
"type": string,
|
||||
"ttl": integer,
|
||||
"data": string
|
||||
}
|
||||
],
|
||||
"opt_pseudosection": {
|
||||
"edns": {
|
||||
"version": integer,
|
||||
"flags": [
|
||||
string
|
||||
],
|
||||
"udp": integer
|
||||
},
|
||||
"cookie": string
|
||||
},
|
||||
"question": {
|
||||
"name": string,
|
||||
"class": string,
|
||||
"type": string
|
||||
},
|
||||
"answer": [
|
||||
{
|
||||
"name": string,
|
||||
"class": string,
|
||||
"type": string,
|
||||
"ttl": integer,
|
||||
"data": string
|
||||
}
|
||||
],
|
||||
"additional": [
|
||||
{
|
||||
"name": string,
|
||||
"class": string,
|
||||
"type": string,
|
||||
"ttl": integer,
|
||||
"data": string
|
||||
}
|
||||
],
|
||||
"authority": [
|
||||
{
|
||||
"name": string,
|
||||
"class": string,
|
||||
"type": string,
|
||||
"ttl": integer,
|
||||
"data": string
|
||||
}
|
||||
],
|
||||
"query_size": integer,
|
||||
"query_time": integer, # in msec
|
||||
"server": string,
|
||||
"when": string,
|
||||
"when_epoch": integer, # [0]
|
||||
"when_epoch_utc": integer, # [1]
|
||||
"rcvd": integer
|
||||
"size": string
|
||||
}
|
||||
]
|
||||
|
||||
[0] naive timestamp if "when" field is parsable, else null
|
||||
[1] timezone aware timestamp availabe for UTC, else null
|
||||
|
||||
Examples:
|
||||
|
||||
$ dig cnn.com www.cnn.com @205.251.194.64 | jc --dig -p
|
||||
$ dig example.com | jc --dig -p
|
||||
[
|
||||
{
|
||||
"id": 34128,
|
||||
"id": 2951,
|
||||
"opcode": "QUERY",
|
||||
"status": "NOERROR",
|
||||
"flags": [
|
||||
@@ -23,117 +127,43 @@ Examples:
|
||||
"ra"
|
||||
],
|
||||
"query_num": 1,
|
||||
"answer_num": 4,
|
||||
"answer_num": 1,
|
||||
"authority_num": 0,
|
||||
"additional_num": 1,
|
||||
"opt_pseudosection": {
|
||||
"edns": {
|
||||
"version": 0,
|
||||
"flags": [],
|
||||
"udp": 4096
|
||||
}
|
||||
},
|
||||
"question": {
|
||||
"name": "cnn.com.",
|
||||
"name": "example.com.",
|
||||
"class": "IN",
|
||||
"type": "A"
|
||||
},
|
||||
"answer": [
|
||||
{
|
||||
"name": "cnn.com.",
|
||||
"name": "example.com.",
|
||||
"class": "IN",
|
||||
"type": "A",
|
||||
"ttl": 60,
|
||||
"data": "151.101.65.67"
|
||||
},
|
||||
{
|
||||
"name": "cnn.com.",
|
||||
"class": "IN",
|
||||
"type": "A",
|
||||
"ttl": 60,
|
||||
"data": "151.101.193.67"
|
||||
},
|
||||
{
|
||||
"name": "cnn.com.",
|
||||
"class": "IN",
|
||||
"type": "A",
|
||||
"ttl": 60,
|
||||
"data": "151.101.1.67"
|
||||
},
|
||||
{
|
||||
"name": "cnn.com.",
|
||||
"class": "IN",
|
||||
"type": "A",
|
||||
"ttl": 60,
|
||||
"data": "151.101.129.67"
|
||||
"ttl": 39302,
|
||||
"data": "93.184.216.34"
|
||||
}
|
||||
],
|
||||
"query_time": 37,
|
||||
"server": "2600",
|
||||
"when": "Tue Nov 12 07:14:42 PST 2019",
|
||||
"rcvd": 100
|
||||
},
|
||||
{
|
||||
"id": 15273,
|
||||
"opcode": "QUERY",
|
||||
"status": "NOERROR",
|
||||
"flags": [
|
||||
"qr",
|
||||
"aa",
|
||||
"rd"
|
||||
],
|
||||
"query_num": 1,
|
||||
"answer_num": 1,
|
||||
"authority_num": 4,
|
||||
"additional_num": 1,
|
||||
"question": {
|
||||
"name": "www.cnn.com.",
|
||||
"class": "IN",
|
||||
"type": "A"
|
||||
},
|
||||
"answer": [
|
||||
{
|
||||
"name": "www.cnn.com.",
|
||||
"class": "IN",
|
||||
"type": "CNAME",
|
||||
"ttl": 300,
|
||||
"data": "turner-tls.map.fastly.net."
|
||||
}
|
||||
],
|
||||
"authority": [
|
||||
{
|
||||
"name": "cnn.com.",
|
||||
"class": "IN",
|
||||
"type": "NS",
|
||||
"ttl": 3600,
|
||||
"data": "ns-1086.awsdns-07.org."
|
||||
},
|
||||
{
|
||||
"name": "cnn.com.",
|
||||
"class": "IN",
|
||||
"type": "NS",
|
||||
"ttl": 3600,
|
||||
"data": "ns-1630.awsdns-11.co.uk."
|
||||
},
|
||||
{
|
||||
"name": "cnn.com.",
|
||||
"class": "IN",
|
||||
"type": "NS",
|
||||
"ttl": 3600,
|
||||
"data": "ns-47.awsdns-05.com."
|
||||
},
|
||||
{
|
||||
"name": "cnn.com.",
|
||||
"class": "IN",
|
||||
"type": "NS",
|
||||
"ttl": 3600,
|
||||
"data": "ns-576.awsdns-08.net."
|
||||
}
|
||||
],
|
||||
"query_time": 23,
|
||||
"server": "205.251.194.64#53(205.251.194.64)",
|
||||
"when": "Tue Nov 12 07:14:42 PST 2019",
|
||||
"rcvd": 212
|
||||
"query_time": 49,
|
||||
"server": "2600:1700:bab0:d40::1#53(2600:1700:bab0:d40::1)",
|
||||
"when": "Fri Apr 16 16:05:10 PDT 2021",
|
||||
"rcvd": 56,
|
||||
"when_epoch": 1618614310,
|
||||
"when_epoch_utc": null
|
||||
}
|
||||
]
|
||||
|
||||
$ dig cnn.com www.cnn.com @205.251.194.64 | jc --dig -p -r
|
||||
[
|
||||
{
|
||||
"id": "23843",
|
||||
"id": "46052",
|
||||
"opcode": "QUERY",
|
||||
"status": "NOERROR",
|
||||
"flags": [
|
||||
@@ -142,117 +172,41 @@ Examples:
|
||||
"ra"
|
||||
],
|
||||
"query_num": "1",
|
||||
"answer_num": "4",
|
||||
"answer_num": "1",
|
||||
"authority_num": "0",
|
||||
"additional_num": "1",
|
||||
"opt_pseudosection": {
|
||||
"edns": {
|
||||
"version": "0",
|
||||
"flags": [],
|
||||
"udp": "4096"
|
||||
}
|
||||
},
|
||||
"question": {
|
||||
"name": "cnn.com.",
|
||||
"name": "example.com.",
|
||||
"class": "IN",
|
||||
"type": "A"
|
||||
},
|
||||
"answer": [
|
||||
{
|
||||
"name": "cnn.com.",
|
||||
"name": "example.com.",
|
||||
"class": "IN",
|
||||
"type": "A",
|
||||
"ttl": "30",
|
||||
"data": "151.101.193.67"
|
||||
},
|
||||
{
|
||||
"name": "cnn.com.",
|
||||
"class": "IN",
|
||||
"type": "A",
|
||||
"ttl": "30",
|
||||
"data": "151.101.1.67"
|
||||
},
|
||||
{
|
||||
"name": "cnn.com.",
|
||||
"class": "IN",
|
||||
"type": "A",
|
||||
"ttl": "30",
|
||||
"data": "151.101.65.67"
|
||||
},
|
||||
{
|
||||
"name": "cnn.com.",
|
||||
"class": "IN",
|
||||
"type": "A",
|
||||
"ttl": "30",
|
||||
"data": "151.101.129.67"
|
||||
"ttl": "40426",
|
||||
"data": "93.184.216.34"
|
||||
}
|
||||
],
|
||||
"query_time": "24 msec",
|
||||
"server": "192.168.1.254#53(192.168.1.254)",
|
||||
"when": "Tue Nov 12 07:16:19 PST 2019",
|
||||
"rcvd": "100"
|
||||
},
|
||||
{
|
||||
"id": "8266",
|
||||
"opcode": "QUERY",
|
||||
"status": "NOERROR",
|
||||
"flags": [
|
||||
"qr",
|
||||
"aa",
|
||||
"rd"
|
||||
],
|
||||
"query_num": "1",
|
||||
"answer_num": "1",
|
||||
"authority_num": "4",
|
||||
"additional_num": "1",
|
||||
"question": {
|
||||
"name": "www.cnn.com.",
|
||||
"class": "IN",
|
||||
"type": "A"
|
||||
},
|
||||
"answer": [
|
||||
{
|
||||
"name": "www.cnn.com.",
|
||||
"class": "IN",
|
||||
"type": "CNAME",
|
||||
"ttl": "300",
|
||||
"data": "turner-tls.map.fastly.net."
|
||||
}
|
||||
],
|
||||
"authority": [
|
||||
{
|
||||
"name": "cnn.com.",
|
||||
"class": "IN",
|
||||
"type": "NS",
|
||||
"ttl": "3600",
|
||||
"data": "ns-1086.awsdns-07.org."
|
||||
},
|
||||
{
|
||||
"name": "cnn.com.",
|
||||
"class": "IN",
|
||||
"type": "NS",
|
||||
"ttl": "3600",
|
||||
"data": "ns-1630.awsdns-11.co.uk."
|
||||
},
|
||||
{
|
||||
"name": "cnn.com.",
|
||||
"class": "IN",
|
||||
"type": "NS",
|
||||
"ttl": "3600",
|
||||
"data": "ns-47.awsdns-05.com."
|
||||
},
|
||||
{
|
||||
"name": "cnn.com.",
|
||||
"class": "IN",
|
||||
"type": "NS",
|
||||
"ttl": "3600",
|
||||
"data": "ns-576.awsdns-08.net."
|
||||
}
|
||||
],
|
||||
"query_time": "26 msec",
|
||||
"server": "205.251.194.64#53(205.251.194.64)",
|
||||
"when": "Tue Nov 12 07:16:19 PST 2019",
|
||||
"rcvd": "212"
|
||||
"query_time": "48 msec",
|
||||
"server": "2600:1700:bab0:d40::1#53(2600:1700:bab0:d40::1)",
|
||||
"when": "Fri Apr 16 16:06:12 PDT 2021",
|
||||
"rcvd": "56"
|
||||
}
|
||||
]
|
||||
|
||||
$ dig -x 1.1.1.1 | jc --dig -p
|
||||
[
|
||||
{
|
||||
"id": 34898,
|
||||
"id": 20785,
|
||||
"opcode": "QUERY",
|
||||
"status": "NOERROR",
|
||||
"flags": [
|
||||
@@ -264,6 +218,13 @@ Examples:
|
||||
"answer_num": 1,
|
||||
"authority_num": 0,
|
||||
"additional_num": 1,
|
||||
"opt_pseudosection": {
|
||||
"edns": {
|
||||
"version": 0,
|
||||
"flags": [],
|
||||
"udp": 4096
|
||||
}
|
||||
},
|
||||
"question": {
|
||||
"name": "1.1.1.1.in-addr.arpa.",
|
||||
"class": "IN",
|
||||
@@ -274,21 +235,23 @@ Examples:
|
||||
"name": "1.1.1.1.in-addr.arpa.",
|
||||
"class": "IN",
|
||||
"type": "PTR",
|
||||
"ttl": 952,
|
||||
"ttl": 1800,
|
||||
"data": "one.one.one.one."
|
||||
}
|
||||
],
|
||||
"query_time": 103,
|
||||
"server": "2600",
|
||||
"when": "Tue Nov 12 07:15:33 PST 2019",
|
||||
"rcvd": 78
|
||||
"query_time": 40,
|
||||
"server": "2600:1700:bab0:d40::1#53(2600:1700:bab0:d40::1)",
|
||||
"when": "Sat Apr 17 14:50:50 PDT 2021",
|
||||
"rcvd": 78,
|
||||
"when_epoch": 1618696250,
|
||||
"when_epoch_utc": null
|
||||
}
|
||||
]
|
||||
|
||||
$ dig -x 1.1.1.1 | jc --dig -p -r
|
||||
[
|
||||
{
|
||||
"id": "50986",
|
||||
"id": "32644",
|
||||
"opcode": "QUERY",
|
||||
"status": "NOERROR",
|
||||
"flags": [
|
||||
@@ -300,6 +263,13 @@ Examples:
|
||||
"answer_num": "1",
|
||||
"authority_num": "0",
|
||||
"additional_num": "1",
|
||||
"opt_pseudosection": {
|
||||
"edns": {
|
||||
"version": "0",
|
||||
"flags": [],
|
||||
"udp": "4096"
|
||||
}
|
||||
},
|
||||
"question": {
|
||||
"name": "1.1.1.1.in-addr.arpa.",
|
||||
"class": "IN",
|
||||
@@ -314,88 +284,55 @@ Examples:
|
||||
"data": "one.one.one.one."
|
||||
}
|
||||
],
|
||||
"query_time": "38 msec",
|
||||
"server": "2600",
|
||||
"when": "Tue Nov 12 07:17:19 PST 2019",
|
||||
"query_time": "52 msec",
|
||||
"server": "2600:1700:bab0:d40::1#53(2600:1700:bab0:d40::1)",
|
||||
"when": "Sat Apr 17 14:51:46 PDT 2021",
|
||||
"rcvd": "78"
|
||||
}
|
||||
]
|
||||
|
||||
## info
|
||||
```python
|
||||
info(self, /, *args, **kwargs)
|
||||
```
|
||||
|
||||
## process
|
||||
```python
|
||||
process(proc_data)
|
||||
```
|
||||
|
||||
Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
|
||||
$ dig +noall +answer cnn.com | jc --dig -p
|
||||
[
|
||||
{
|
||||
"id": integer,
|
||||
"opcode": string,
|
||||
"status": string,
|
||||
"flags": [
|
||||
string
|
||||
],
|
||||
"query_num": integer,
|
||||
"answer_num": integer,
|
||||
"authority_num": integer,
|
||||
"additional_num": integer,
|
||||
"axfr": [
|
||||
{
|
||||
"name": string,
|
||||
"class": string,
|
||||
"type": string,
|
||||
"ttl": integer,
|
||||
"data": string
|
||||
}
|
||||
],
|
||||
"question": {
|
||||
"name": string,
|
||||
"class": string,
|
||||
"type": string
|
||||
},
|
||||
"answer": [
|
||||
{
|
||||
"name": string,
|
||||
"class": string,
|
||||
"type": string,
|
||||
"ttl": integer,
|
||||
"data": string
|
||||
}
|
||||
],
|
||||
"authority": [
|
||||
"name": "cnn.com.",
|
||||
"class": "IN",
|
||||
"type": "A",
|
||||
"ttl": 60,
|
||||
"data": "151.101.193.67"
|
||||
},
|
||||
{
|
||||
"name": string,
|
||||
"class": string,
|
||||
"type": string,
|
||||
"ttl": integer,
|
||||
"data": string
|
||||
"name": "cnn.com.",
|
||||
"class": "IN",
|
||||
"type": "A",
|
||||
"ttl": 60,
|
||||
"data": "151.101.65.67"
|
||||
},
|
||||
{
|
||||
"name": "cnn.com.",
|
||||
"class": "IN",
|
||||
"type": "A",
|
||||
"ttl": 60,
|
||||
"data": "151.101.1.67"
|
||||
},
|
||||
{
|
||||
"name": "cnn.com.",
|
||||
"class": "IN",
|
||||
"type": "A",
|
||||
"ttl": 60,
|
||||
"data": "151.101.129.67"
|
||||
}
|
||||
],
|
||||
"query_time": integer, # in msec
|
||||
"server": string,
|
||||
"when": string,
|
||||
"rcvd": integer
|
||||
"size": string
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
## parse
|
||||
<a id="jc.parsers.dig.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@@ -403,10 +340,14 @@ Main text parsing function
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) output preprocessed JSON if True
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux, aix, freebsd, darwin, win32, cygwin
|
||||
|
||||
Version 2.3 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
151
docs/parsers/dir.md
Normal file
151
docs/parsers/dir.md
Normal file
@@ -0,0 +1,151 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.dir"></a>
|
||||
|
||||
# jc.parsers.dir
|
||||
|
||||
jc - JSON Convert `dir` command output parser
|
||||
|
||||
Options supported:
|
||||
- `/T timefield`
|
||||
- `/O sortorder`
|
||||
- `/C, /-C`
|
||||
- `/S`
|
||||
|
||||
The "Magic" syntax is not supported since the `dir` command is a shell
|
||||
builtin.
|
||||
|
||||
The `epoch` calculated timestamp field is naive. (i.e. based on the local
|
||||
time of the system the parser is run on)
|
||||
|
||||
Usage (cli):
|
||||
|
||||
C:> dir | jc --dir
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('dir', dir_command_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.dir
|
||||
result = jc.parsers.dir.parse(dir_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"date": string,
|
||||
"time": string,
|
||||
"epoch": integer, # naive timestamp
|
||||
"dir": boolean,
|
||||
"size": integer,
|
||||
"filename: string,
|
||||
"parent": string
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
C:> dir | jc --dir -p
|
||||
[
|
||||
{
|
||||
"date": "03/24/2021",
|
||||
"time": "03:15 PM",
|
||||
"dir": true,
|
||||
"size": null,
|
||||
"filename": ".",
|
||||
"parent": "C:\\Program Files\\Internet Explorer",
|
||||
"epoch": 1616624100
|
||||
},
|
||||
{
|
||||
"date": "03/24/2021",
|
||||
"time": "03:15 PM",
|
||||
"dir": true,
|
||||
"size": null,
|
||||
"filename": "..",
|
||||
"parent": "C:\\Program Files\\Internet Explorer",
|
||||
"epoch": 1616624100
|
||||
},
|
||||
{
|
||||
"date": "12/07/2019",
|
||||
"time": "02:49 AM",
|
||||
"dir": true,
|
||||
"size": null,
|
||||
"filename": "en-US",
|
||||
"parent": "C:\\Program Files\\Internet Explorer",
|
||||
"epoch": 1575715740
|
||||
},
|
||||
{
|
||||
"date": "12/07/2019",
|
||||
"time": "02:09 AM",
|
||||
"dir": false,
|
||||
"size": 54784,
|
||||
"filename": "ExtExport.exe",
|
||||
"parent": "C:\\Program Files\\Internet Explorer",
|
||||
"epoch": 1575713340
|
||||
},
|
||||
...
|
||||
]
|
||||
|
||||
C:> dir | jc --dir -p -r
|
||||
[
|
||||
{
|
||||
"date": "03/24/2021",
|
||||
"time": "03:15 PM",
|
||||
"dir": true,
|
||||
"size": null,
|
||||
"filename": ".",
|
||||
"parent": "C:\\Program Files\\Internet Explorer"
|
||||
},
|
||||
{
|
||||
"date": "03/24/2021",
|
||||
"time": "03:15 PM",
|
||||
"dir": true,
|
||||
"size": null,
|
||||
"filename": "..",
|
||||
"parent": "C:\\Program Files\\Internet Explorer"
|
||||
},
|
||||
{
|
||||
"date": "12/07/2019",
|
||||
"time": "02:49 AM",
|
||||
"dir": true,
|
||||
"size": null,
|
||||
"filename": "en-US",
|
||||
"parent": "C:\\Program Files\\Internet Explorer"
|
||||
},
|
||||
{
|
||||
"date": "12/07/2019",
|
||||
"time": "02:09 AM",
|
||||
"dir": false,
|
||||
"size": "54,784",
|
||||
"filename": "ExtExport.exe",
|
||||
"parent": "C:\\Program Files\\Internet Explorer"
|
||||
},
|
||||
...
|
||||
]
|
||||
|
||||
<a id="jc.parsers.dir.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 Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: win32
|
||||
|
||||
Version 1.5 by Rasheed Elsaleh (rasheed@rebelliondefense.com)
|
||||
@@ -1,13 +1,44 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.dmidecode"></a>
|
||||
|
||||
# jc.parsers.dmidecode
|
||||
jc - JSON CLI output utility dmidecode Parser
|
||||
|
||||
Usage:
|
||||
jc - JSON Convert `dmidecode` command output parser
|
||||
|
||||
specify --dmidecode as the first argument if the piped input is coming from dmidecode
|
||||
Usage (cli):
|
||||
|
||||
Compatibility:
|
||||
$ dmidecode | jc --dmidecode
|
||||
|
||||
'linux'
|
||||
or
|
||||
|
||||
$ jc dmidecode
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('dmidecode', dmidecode_command_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.dmidecode
|
||||
result = jc.parsers.dmidecode.parse(dmidecode_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"handle": string,
|
||||
"type": integer,
|
||||
"bytes": integer,
|
||||
"description": string,
|
||||
"values": { # null if empty
|
||||
"lowercase_no_spaces_keys": string,
|
||||
"multiline_key_values": [
|
||||
string,
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
@@ -99,44 +130,12 @@ Examples:
|
||||
...
|
||||
]
|
||||
|
||||
## info
|
||||
<a id="jc.parsers.dmidecode.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
info(self, /, *args, **kwargs)
|
||||
```
|
||||
|
||||
## process
|
||||
```python
|
||||
process(proc_data)
|
||||
```
|
||||
|
||||
Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
"handle": string,
|
||||
"type": integer,
|
||||
"bytes": integer,
|
||||
"description": string,
|
||||
"values": { (null if empty)
|
||||
"lowercase_no_spaces_keys": string,
|
||||
"multiline_key_values": [
|
||||
string,
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@@ -144,10 +143,14 @@ Main text parsing function
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) output preprocessed JSON if True
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
162
docs/parsers/dpkg_l.md
Normal file
162
docs/parsers/dpkg_l.md
Normal file
@@ -0,0 +1,162 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.dpkg_l"></a>
|
||||
|
||||
# jc.parsers.dpkg\_l
|
||||
|
||||
jc - JSON Convert `dpkg -l` command output parser
|
||||
|
||||
Set the `COLUMNS` environment variable to a large value to avoid field
|
||||
truncation. For example:
|
||||
|
||||
$ COLUMNS=500 dpkg -l | jc --dpkg-l
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ dpkg -l | jc --dpkg-l
|
||||
|
||||
or
|
||||
|
||||
$ jc dpkg -l
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('dpkg_l', dpkg_command_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.dpkg_l
|
||||
result = jc.parsers.dpkg_l.parse(dpkg_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"codes": string,
|
||||
"name": string,
|
||||
"version": string,
|
||||
"architecture": string,
|
||||
"description": string,
|
||||
"desired": string,
|
||||
"status": string,
|
||||
"error": string
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
$ dpkg -l | jc --dpkg-l -p
|
||||
[
|
||||
{
|
||||
"codes": "ii",
|
||||
"name": "accountsservice",
|
||||
"version": "0.6.45-1ubuntu1.3",
|
||||
"architecture": "amd64",
|
||||
"description": "query and manipulate user account information",
|
||||
"desired": "install",
|
||||
"status": "installed"
|
||||
},
|
||||
{
|
||||
"codes": "rc",
|
||||
"name": "acl",
|
||||
"version": "2.2.52-3build1",
|
||||
"architecture": "amd64",
|
||||
"description": "Access control list utilities",
|
||||
"desired": "remove",
|
||||
"status": "config-files"
|
||||
},
|
||||
{
|
||||
"codes": "uWR",
|
||||
"name": "acpi",
|
||||
"version": "1.7-1.1",
|
||||
"architecture": "amd64",
|
||||
"description": "displays information on ACPI devices",
|
||||
"desired": "unknown",
|
||||
"status": "trigger await",
|
||||
"error": "reinstall required"
|
||||
},
|
||||
{
|
||||
"codes": "rh",
|
||||
"name": "acpid",
|
||||
"version": "1:2.0.28-1ubuntu1",
|
||||
"architecture": "amd64",
|
||||
"description": "Advanced Configuration and Power Interface...",
|
||||
"desired": "remove",
|
||||
"status": "half installed"
|
||||
},
|
||||
{
|
||||
"codes": "pn",
|
||||
"name": "adduser",
|
||||
"version": "3.116ubuntu1",
|
||||
"architecture": "all",
|
||||
"description": "add and remove users and groups",
|
||||
"desired": "purge",
|
||||
"status": "not installed"
|
||||
},
|
||||
...
|
||||
]
|
||||
|
||||
$ dpkg -l | jc --dpkg-l -p -r
|
||||
[
|
||||
{
|
||||
"codes": "ii",
|
||||
"name": "accountsservice",
|
||||
"version": "0.6.45-1ubuntu1.3",
|
||||
"architecture": "amd64",
|
||||
"description": "query and manipulate user account information"
|
||||
},
|
||||
{
|
||||
"codes": "rc",
|
||||
"name": "acl",
|
||||
"version": "2.2.52-3build1",
|
||||
"architecture": "amd64",
|
||||
"description": "Access control list utilities"
|
||||
},
|
||||
{
|
||||
"codes": "uWR",
|
||||
"name": "acpi",
|
||||
"version": "1.7-1.1",
|
||||
"architecture": "amd64",
|
||||
"description": "displays information on ACPI devices"
|
||||
},
|
||||
{
|
||||
"codes": "rh",
|
||||
"name": "acpid",
|
||||
"version": "1:2.0.28-1ubuntu1",
|
||||
"architecture": "amd64",
|
||||
"description": "Advanced Configuration and Power Interface..."
|
||||
},
|
||||
{
|
||||
"codes": "pn",
|
||||
"name": "adduser",
|
||||
"version": "3.116ubuntu1",
|
||||
"architecture": "all",
|
||||
"description": "add and remove users and groups"
|
||||
},
|
||||
...
|
||||
]
|
||||
|
||||
<a id="jc.parsers.dpkg_l.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 Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
@@ -1,13 +1,36 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.du"></a>
|
||||
|
||||
# jc.parsers.du
|
||||
jc - JSON CLI output utility du Parser
|
||||
|
||||
Usage:
|
||||
jc - JSON Convert `du` command output parser
|
||||
|
||||
specify --du as the first argument if the piped input is coming from du
|
||||
Usage (cli):
|
||||
|
||||
Compatibility:
|
||||
$ du | jc --du
|
||||
|
||||
'linux', 'darwin', 'aix', 'freebsd'
|
||||
or
|
||||
|
||||
$ jc du
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('du', du_command_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.du
|
||||
result = jc.parsers.du.parse(du_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"size": integer,
|
||||
"name": string
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
@@ -19,23 +42,23 @@ Examples:
|
||||
},
|
||||
{
|
||||
"size": 56,
|
||||
"name": "/usr/standalone/firmware/iBridge1_1Customer.bundle/Contents/_CodeSignature"
|
||||
"name": "/usr/standalone/firmware/iBridge1_1Customer.bundle/..."
|
||||
},
|
||||
{
|
||||
"size": 0,
|
||||
"name": "/usr/standalone/firmware/iBridge1_1Customer.bundle/Contents/Resources/Firmware/usr/local/standalone"
|
||||
"name": "/usr/standalone/firmware/iBridge1_1Customer.bundle/..."
|
||||
},
|
||||
{
|
||||
"size": 0,
|
||||
"name": "/usr/standalone/firmware/iBridge1_1Customer.bundle/Contents/Resources/Firmware/usr/local"
|
||||
"name": "/usr/standalone/firmware/iBridge1_1Customer.bundle/..."
|
||||
},
|
||||
{
|
||||
"size": 0,
|
||||
"name": "/usr/standalone/firmware/iBridge1_1Customer.bundle/Contents/Resources/Firmware/usr"
|
||||
"name": "/usr/standalone/firmware/iBridge1_1Customer.bundle/..."
|
||||
},
|
||||
{
|
||||
"size": 1008,
|
||||
"name": "/usr/standalone/firmware/iBridge1_1Customer.bundle/Contents/Resources/Firmware/dfu"
|
||||
"name": "/usr/standalone/firmware/iBridge1_1Customer.bundle/..."
|
||||
},
|
||||
...
|
||||
]
|
||||
@@ -48,57 +71,33 @@ Examples:
|
||||
},
|
||||
{
|
||||
"size": "56",
|
||||
"name": "/usr/standalone/firmware/iBridge1_1Customer.bundle/Contents/_CodeSignature"
|
||||
"name": "/usr/standalone/firmware/iBridge1_1Customer.bundle/..."
|
||||
},
|
||||
{
|
||||
"size": "0",
|
||||
"name": "/usr/standalone/firmware/iBridge1_1Customer.bundle/Contents/Resources/Firmware/usr/local/standalone"
|
||||
"name": "/usr/standalone/firmware/iBridge1_1Customer.bundle/..."
|
||||
},
|
||||
{
|
||||
"size": "0",
|
||||
"name": "/usr/standalone/firmware/iBridge1_1Customer.bundle/Contents/Resources/Firmware/usr/local"
|
||||
"name": "/usr/standalone/firmware/iBridge1_1Customer.bundle/..."
|
||||
},
|
||||
{
|
||||
"size": "0",
|
||||
"name": "/usr/standalone/firmware/iBridge1_1Customer.bundle/Contents/Resources/Firmware/usr"
|
||||
"name": "/usr/standalone/firmware/iBridge1_1Customer.bundle/..."
|
||||
},
|
||||
{
|
||||
"size": "1008",
|
||||
"name": "/usr/standalone/firmware/iBridge1_1Customer.bundle/Contents/Resources/Firmware/dfu"
|
||||
"name": "/usr/standalone/firmware/iBridge1_1Customer.bundle/..."
|
||||
},
|
||||
...
|
||||
]
|
||||
|
||||
## info
|
||||
<a id="jc.parsers.du.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
info(self, /, *args, **kwargs)
|
||||
```
|
||||
|
||||
## process
|
||||
```python
|
||||
process(proc_data)
|
||||
```
|
||||
|
||||
Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
"size": integer,
|
||||
"name": string
|
||||
}
|
||||
]
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@@ -106,10 +105,14 @@ Main text parsing function
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) output preprocessed JSON if True
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, aix, freebsd
|
||||
|
||||
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
@@ -1,13 +1,41 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.env"></a>
|
||||
|
||||
# jc.parsers.env
|
||||
jc - JSON CLI output utility env Parser
|
||||
|
||||
Usage:
|
||||
jc - JSON Convert `env` and `printenv` command output parser
|
||||
|
||||
specify --env as the first argument if the piped input is coming from env
|
||||
This parser will output a list of dictionaries each containing `name` and
|
||||
`value` keys. If you would like a simple dictionary output, then use the
|
||||
`-r` command-line option or the `raw=True` argument in the `parse()`
|
||||
function.
|
||||
|
||||
Compatibility:
|
||||
Usage (cli):
|
||||
|
||||
'linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd'
|
||||
$ env | jc --env
|
||||
|
||||
or
|
||||
|
||||
$ jc env
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('env', env_command_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.env
|
||||
result = jc.parsers.env.parse(env_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"name": string,
|
||||
"value": string
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
@@ -49,36 +77,12 @@ Examples:
|
||||
"_": "/usr/bin/env"
|
||||
}
|
||||
|
||||
## info
|
||||
<a id="jc.parsers.env.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
info(self, /, *args, **kwargs)
|
||||
```
|
||||
|
||||
## process
|
||||
```python
|
||||
process(proc_data)
|
||||
```
|
||||
|
||||
Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
"name": string,
|
||||
"value": string
|
||||
}
|
||||
]
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@@ -86,11 +90,15 @@ Main text parsing function
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) output preprocessed JSON if True
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
Dictionary of raw structured data or
|
||||
list of dictionaries of processed structured data
|
||||
List of Dictionaries of processed structured data
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
|
||||
|
||||
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
@@ -1,13 +1,36 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.file"></a>
|
||||
|
||||
# jc.parsers.file
|
||||
jc - JSON CLI output utility file command Parser
|
||||
|
||||
Usage:
|
||||
jc - JSON Convert `file` command output parser
|
||||
|
||||
specify --file as the first argument if the piped input is coming from file.
|
||||
Usage (cli):
|
||||
|
||||
Compatibility:
|
||||
$ file * | jc --file
|
||||
|
||||
'linux', 'aix', 'freebsd', 'darwin'
|
||||
or
|
||||
|
||||
$ jc file *
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('file', file_command_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.file
|
||||
result = jc.parsers.file.parse(file_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"filename": string,
|
||||
"type": string
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
@@ -35,45 +58,21 @@ Examples:
|
||||
},
|
||||
{
|
||||
"filename": "cd_catalog.xml",
|
||||
"type": "XML 1.0 document text, ASCII text, with CRLF line terminators"
|
||||
"type": "XML 1.0 document text, ASCII text, with CRLF line ..."
|
||||
},
|
||||
{
|
||||
"filename": "centosserial.sh",
|
||||
"type": "Bourne-Again shell script text executable, UTF-8 Unicode text"
|
||||
"type": "Bourne-Again shell script text executable, UTF-8 ..."
|
||||
},
|
||||
...
|
||||
]
|
||||
|
||||
## info
|
||||
<a id="jc.parsers.file.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
info(self, /, *args, **kwargs)
|
||||
```
|
||||
|
||||
## process
|
||||
```python
|
||||
process(proc_data)
|
||||
```
|
||||
|
||||
Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
"filename": string,
|
||||
"type ": string
|
||||
}
|
||||
]
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@@ -81,10 +80,14 @@ Main text parsing function
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) output preprocessed JSON if True
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux, aix, freebsd, darwin
|
||||
|
||||
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
121
docs/parsers/finger.md
Normal file
121
docs/parsers/finger.md
Normal file
@@ -0,0 +1,121 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.finger"></a>
|
||||
|
||||
# jc.parsers.finger
|
||||
|
||||
jc - JSON Convert `finger` command output parser
|
||||
|
||||
Supports `-s` output option. Does not support the `-l` detail option.
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ finger | jc --finger
|
||||
|
||||
or
|
||||
|
||||
$ jc finger
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('finger', finger_command_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.finger
|
||||
result = jc.parsers.finger.parse(finger_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"login": string,
|
||||
"name": string,
|
||||
"tty": string,
|
||||
"idle": string, # null if empty
|
||||
"login_time": string,
|
||||
"details": string,
|
||||
"tty_writeable": boolean,
|
||||
"idle_minutes": integer,
|
||||
"idle_hours": integer,
|
||||
"idle_days": integer,
|
||||
"total_idle_minutes": integer
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
$ finger | jc --finger -p
|
||||
[
|
||||
{
|
||||
"login": "jdoe",
|
||||
"name": "John Doe",
|
||||
"tty": "tty1",
|
||||
"idle": "14d",
|
||||
"login_time": "Mar 22 21:14",
|
||||
"tty_writeable": false,
|
||||
"idle_minutes": 0,
|
||||
"idle_hours": 0,
|
||||
"idle_days": 14,
|
||||
"total_idle_minutes": 20160
|
||||
},
|
||||
{
|
||||
"login": "jdoe",
|
||||
"name": "John Doe",
|
||||
"tty": "pts/0",
|
||||
"idle": null,
|
||||
"login_time": "Apr 5 15:33",
|
||||
"details": "(192.168.1.22)",
|
||||
"tty_writeable": true,
|
||||
"idle_minutes": 0,
|
||||
"idle_hours": 0,
|
||||
"idle_days": 0,
|
||||
"total_idle_minutes": 0
|
||||
},
|
||||
...
|
||||
]
|
||||
|
||||
$ finger | jc --finger -p -r
|
||||
[
|
||||
{
|
||||
"login": "jdoe",
|
||||
"name": "John Doe",
|
||||
"tty": "*tty1",
|
||||
"idle": "14d",
|
||||
"login_time": "Mar 22 21:14"
|
||||
},
|
||||
{
|
||||
"login": "jdoe",
|
||||
"name": "John Doe",
|
||||
"tty": "pts/0",
|
||||
"idle": null,
|
||||
"login_time": "Apr 5 15:33",
|
||||
"details": "(192.168.1.22)"
|
||||
},
|
||||
...
|
||||
]
|
||||
|
||||
<a id="jc.parsers.finger.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 Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, freebsd
|
||||
|
||||
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
@@ -1,13 +1,41 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.free"></a>
|
||||
|
||||
# jc.parsers.free
|
||||
jc - JSON CLI output utility free Parser
|
||||
|
||||
Usage:
|
||||
jc - JSON Convert `free` command output parser
|
||||
|
||||
specify --free as the first argument if the piped input is coming from free
|
||||
Usage (cli):
|
||||
|
||||
Compatibility:
|
||||
$ free | jc --free
|
||||
|
||||
'linux'
|
||||
or
|
||||
|
||||
$ jc free
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('free', free_command_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.free
|
||||
result = jc.parsers.free.parse(free_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"type": string,
|
||||
"total": integer,
|
||||
"used": integer,
|
||||
"free": integer,
|
||||
"shared": integer,
|
||||
"buff_cache": integer,
|
||||
"available": integer
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
@@ -49,41 +77,12 @@ Examples:
|
||||
}
|
||||
]
|
||||
|
||||
## info
|
||||
<a id="jc.parsers.free.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
info(self, /, *args, **kwargs)
|
||||
```
|
||||
|
||||
## process
|
||||
```python
|
||||
process(proc_data)
|
||||
```
|
||||
|
||||
Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
"type": string,
|
||||
"total": integer,
|
||||
"used": integer,
|
||||
"free": integer,
|
||||
"shared": integer,
|
||||
"buff_cache": integer,
|
||||
"available": integer
|
||||
}
|
||||
]
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@@ -91,10 +90,14 @@ Main text parsing function
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) output preprocessed JSON if True
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
@@ -1,13 +1,36 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.fstab"></a>
|
||||
|
||||
# jc.parsers.fstab
|
||||
jc - JSON CLI output utility fstab Parser
|
||||
|
||||
Usage:
|
||||
jc - JSON Convert `fstab` file parser
|
||||
|
||||
specify --fstab as the first argument if the piped input is coming from a fstab file
|
||||
Usage (cli):
|
||||
|
||||
Compatibility:
|
||||
$ cat /etc/fstab | jc --fstab
|
||||
|
||||
'linux', 'freebsd'
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('fstab', fstab_command_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.fstab
|
||||
result = jc.parsers.fstab.parse(fstab_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"fs_spec": string,
|
||||
"fs_file": string,
|
||||
"fs_vfstype": string,
|
||||
"fs_mntops": string,
|
||||
"fs_freq": integer,
|
||||
"fs_passno": integer
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
@@ -67,40 +90,12 @@ Examples:
|
||||
}
|
||||
]
|
||||
|
||||
## info
|
||||
<a id="jc.parsers.fstab.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
info(self, /, *args, **kwargs)
|
||||
```
|
||||
|
||||
## process
|
||||
```python
|
||||
process(proc_data)
|
||||
```
|
||||
|
||||
Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
"fs_spec": string,
|
||||
"fs_file": string,
|
||||
"fs_vfstype": string,
|
||||
"fs_mntops": string,
|
||||
"fs_freq": integer,
|
||||
"fs_passno": integer
|
||||
}
|
||||
]
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@@ -108,10 +103,14 @@ Main text parsing function
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) output preprocessed JSON if True
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux, freebsd
|
||||
|
||||
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
@@ -1,13 +1,36 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.group"></a>
|
||||
|
||||
# jc.parsers.group
|
||||
jc - JSON CLI output utility /etc/group file Parser
|
||||
|
||||
Usage:
|
||||
jc - JSON Convert `/etc/group` file parser
|
||||
|
||||
specify --group as the first argument if the piped input is coming from /etc/group
|
||||
Usage (cli):
|
||||
|
||||
Compatibility:
|
||||
$ cat /etc/group | jc --group
|
||||
|
||||
'linux', 'darwin', 'aix', 'freebsd'
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('group', group_file_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.group
|
||||
result = jc.parsers.group.parse(group_file_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"group_name": string,
|
||||
"password": string,
|
||||
"gid": integer,
|
||||
"members": [
|
||||
string
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
@@ -91,40 +114,12 @@ Examples:
|
||||
...
|
||||
]
|
||||
|
||||
## info
|
||||
<a id="jc.parsers.group.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
info(self, /, *args, **kwargs)
|
||||
```
|
||||
|
||||
## process
|
||||
```python
|
||||
process(proc_data)
|
||||
```
|
||||
|
||||
Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
"group_name": string,
|
||||
"password": string,
|
||||
"gid": integer,
|
||||
"members": [
|
||||
string
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@@ -132,10 +127,14 @@ Main text parsing function
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) output preprocessed JSON if True
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, aix, freebsd
|
||||
|
||||
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
@@ -1,13 +1,38 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.gshadow"></a>
|
||||
|
||||
# jc.parsers.gshadow
|
||||
jc - JSON CLI output utility /etc/gshadow file Parser
|
||||
|
||||
Usage:
|
||||
jc - JSON Convert `/etc/gshadow` file parser
|
||||
|
||||
specify --gshadow as the first argument if the piped input is coming from /etc/gshadow
|
||||
Usage (cli):
|
||||
|
||||
Compatibility:
|
||||
$ cat /etc/gshadow | jc --gshadow
|
||||
|
||||
'linux', 'aix', 'freebsd'
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('gshadow', gshadow_file_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.gshadow
|
||||
result = jc.parsers.gshadow.parse(gshadow_file_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"group_name": string,
|
||||
"password": string,
|
||||
"administrators": [
|
||||
string
|
||||
],
|
||||
"members": [
|
||||
string
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
@@ -57,42 +82,12 @@ Examples:
|
||||
...
|
||||
]
|
||||
|
||||
## info
|
||||
<a id="jc.parsers.gshadow.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
info(self, /, *args, **kwargs)
|
||||
```
|
||||
|
||||
## process
|
||||
```python
|
||||
process(proc_data)
|
||||
```
|
||||
|
||||
Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
"group_name": string,
|
||||
"password": string,
|
||||
"administrators": [
|
||||
string
|
||||
],
|
||||
"members": [
|
||||
string
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@@ -100,10 +95,14 @@ Main text parsing function
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) output preprocessed JSON if True
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux, aix, freebsd
|
||||
|
||||
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
68
docs/parsers/hash.md
Normal file
68
docs/parsers/hash.md
Normal file
@@ -0,0 +1,68 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.hash"></a>
|
||||
|
||||
# jc.parsers.hash
|
||||
|
||||
jc - JSON Convert `hash` command output parser
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ hash | jc --hash
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('hash', hash_command_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.hash
|
||||
result = jc.parsers.hash.parse(hash_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"command": string,
|
||||
"hits": integer
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
$ hash | jc --hash -p
|
||||
[
|
||||
{
|
||||
"hits": 2,
|
||||
"command": "/bin/cat"
|
||||
},
|
||||
{
|
||||
"hits": 1,
|
||||
"command": "/bin/ls"
|
||||
}
|
||||
]
|
||||
|
||||
<a id="jc.parsers.hash.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 Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, aix, freebsd
|
||||
|
||||
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
99
docs/parsers/hashsum.md
Normal file
99
docs/parsers/hashsum.md
Normal file
@@ -0,0 +1,99 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.hashsum"></a>
|
||||
|
||||
# jc.parsers.hashsum
|
||||
|
||||
jc - JSON Convert `hash sum` command output parser
|
||||
|
||||
This parser works with the following hash calculation utilities:
|
||||
- `md5`
|
||||
- `md5sum`
|
||||
- `shasum`
|
||||
- `sha1sum`
|
||||
- `sha224sum`
|
||||
- `sha256sum`
|
||||
- `sha384sum`
|
||||
- `sha512sum`
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ md5sum file.txt | jc --hashsum
|
||||
|
||||
or
|
||||
|
||||
$ jc md5sum file.txt
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('hashsum', md5sum_command_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.hashsum
|
||||
result = jc.parsers.hashsum.parse(md5sum_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"filename": string,
|
||||
"hash": string,
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
$ md5sum * | jc --hashsum -p
|
||||
[
|
||||
{
|
||||
"filename": "devtoolset-3-gcc-4.9.2-6.el7.x86_64.rpm",
|
||||
"hash": "65fc958c1add637ec23c4b137aecf3d3"
|
||||
},
|
||||
{
|
||||
"filename": "digout",
|
||||
"hash": "5b9312ee5aff080927753c63a347707d"
|
||||
},
|
||||
{
|
||||
"filename": "dmidecode.out",
|
||||
"hash": "716fd11c2ac00db109281f7110b8fb9d"
|
||||
},
|
||||
{
|
||||
"filename": "file with spaces in the name",
|
||||
"hash": "d41d8cd98f00b204e9800998ecf8427e"
|
||||
},
|
||||
{
|
||||
"filename": "id-centos.out",
|
||||
"hash": "4295be239a14ad77ef3253103de976d2"
|
||||
},
|
||||
{
|
||||
"filename": "ifcfg.json",
|
||||
"hash": "01fda0d9ba9a75618b072e64ff512b43"
|
||||
},
|
||||
...
|
||||
]
|
||||
|
||||
<a id="jc.parsers.hashsum.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 Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, aix, freebsd
|
||||
|
||||
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
348
docs/parsers/hciconfig.md
Normal file
348
docs/parsers/hciconfig.md
Normal file
@@ -0,0 +1,348 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.hciconfig"></a>
|
||||
|
||||
# jc.parsers.hciconfig
|
||||
|
||||
jc - JSON Convert `hciconfig` command output parser
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ hciconfig | jc --hciconfig
|
||||
|
||||
or
|
||||
|
||||
$ jc hciconfig
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('hciconfig', hciconfig_command_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.hciconfig
|
||||
result = jc.parsers.hciconfig.parse(hciconfig_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"device": string,
|
||||
"type": string,
|
||||
"bus": string,
|
||||
"bd_address": string,
|
||||
"acl_mtu": integer,
|
||||
"acl_mtu_packets": integer,
|
||||
"sco_mtu": integer,
|
||||
"sco_mtu_packets": integer,
|
||||
"state": [
|
||||
string
|
||||
],
|
||||
"rx_bytes": integer,
|
||||
"rx_acl": integer,
|
||||
"rx_sco": integer,
|
||||
"rx_events": integer,
|
||||
"rx_errors": integer,
|
||||
"tx_bytes": integer,
|
||||
"tx_acl": integer,
|
||||
"tx_sco": integer,
|
||||
"tx_commands": integer,
|
||||
"tx_errors": integer,
|
||||
"features": [
|
||||
string
|
||||
],
|
||||
"packet_type": [
|
||||
string
|
||||
],
|
||||
"link_policy": [
|
||||
string
|
||||
],
|
||||
"link_mode": [
|
||||
string
|
||||
],
|
||||
"name": string,
|
||||
"class": string,
|
||||
"service_classes": [
|
||||
string # 'Unspecified' is null
|
||||
],
|
||||
"device_class": string,
|
||||
"hci_version": string,
|
||||
"hci_revision": string,
|
||||
"lmp_version": string,
|
||||
"lmp_subversion": string,
|
||||
"manufacturer": string
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
$ hciconfig -a | jc --hciconfig -p
|
||||
[
|
||||
{
|
||||
"device": "hci0",
|
||||
"type": "Primary",
|
||||
"bus": "USB",
|
||||
"bd_address": "00:1A:7D:DA:71:13",
|
||||
"acl_mtu": 310,
|
||||
"acl_mtu_packets": 10,
|
||||
"sco_mtu": 64,
|
||||
"sco_mtu_packets": 8,
|
||||
"state": [
|
||||
"UP",
|
||||
"RUNNING"
|
||||
],
|
||||
"rx_bytes": 13905869,
|
||||
"rx_acl": 0,
|
||||
"rx_sco": 0,
|
||||
"rx_events": 393300,
|
||||
"rx_errors": 0,
|
||||
"tx_bytes": 62629,
|
||||
"tx_acl": 0,
|
||||
"tx_sco": 0,
|
||||
"tx_commands": 3893,
|
||||
"tx_errors": 0,
|
||||
"features": [
|
||||
"0xff",
|
||||
"0xff",
|
||||
"0x8f",
|
||||
"0xfe",
|
||||
"0xdb",
|
||||
"0xff",
|
||||
"0x5b",
|
||||
"0x87"
|
||||
],
|
||||
"packet_type": [
|
||||
"DM1",
|
||||
"DM3",
|
||||
"DM5",
|
||||
"DH1",
|
||||
"DH3",
|
||||
"DH5",
|
||||
"HV1",
|
||||
"HV2",
|
||||
"HV3"
|
||||
],
|
||||
"link_policy": [
|
||||
"RSWITCH",
|
||||
"HOLD",
|
||||
"SNIFF",
|
||||
"PARK"
|
||||
],
|
||||
"link_mode": [
|
||||
"SLAVE",
|
||||
"ACCEPT"
|
||||
],
|
||||
"name": "CSR8510 A10",
|
||||
"class": "0x000000",
|
||||
"service_classes": null,
|
||||
"device_class": "Miscellaneous",
|
||||
"hci_version": "4.0 (0x6)",
|
||||
"hci_revision": "0x22bb",
|
||||
"lmp_version": "4.0 (0x6)",
|
||||
"lmp_subversion": "0x22bb",
|
||||
"manufacturer": "Cambridge Silicon Radio (10)"
|
||||
},
|
||||
{
|
||||
"device": "hci1",
|
||||
"type": "Primary",
|
||||
"bus": "USB",
|
||||
"bd_address": "00:1A:7D:DA:71:13",
|
||||
"acl_mtu": 310,
|
||||
"acl_mtu_packets": 10,
|
||||
"sco_mtu": 64,
|
||||
"sco_mtu_packets": 8,
|
||||
"state": [
|
||||
"DOWN"
|
||||
],
|
||||
"rx_bytes": 4388363,
|
||||
"rx_acl": 0,
|
||||
"rx_sco": 0,
|
||||
"rx_events": 122021,
|
||||
"rx_errors": 0,
|
||||
"tx_bytes": 52350,
|
||||
"tx_acl": 0,
|
||||
"tx_sco": 0,
|
||||
"tx_commands": 3480,
|
||||
"tx_errors": 2,
|
||||
"features": [
|
||||
"0xff",
|
||||
"0xff",
|
||||
"0x8f",
|
||||
"0xfe",
|
||||
"0xdb",
|
||||
"0xff",
|
||||
"0x5b",
|
||||
"0x87"
|
||||
],
|
||||
"packet_type": [
|
||||
"DM1",
|
||||
"DM3",
|
||||
"DM5",
|
||||
"DH1",
|
||||
"DH3",
|
||||
"DH5",
|
||||
"HV1",
|
||||
"HV2",
|
||||
"HV3"
|
||||
],
|
||||
"link_policy": [
|
||||
"RSWITCH",
|
||||
"HOLD",
|
||||
"SNIFF",
|
||||
"PARK"
|
||||
],
|
||||
"link_mode": [
|
||||
"SLAVE",
|
||||
"ACCEPT"
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
$ hciconfig -a | jc --hciconfig -p -r
|
||||
[
|
||||
{
|
||||
"device": "hci0",
|
||||
"type": "Primary",
|
||||
"bus": "USB",
|
||||
"bd_address": "00:1A:7D:DA:71:13",
|
||||
"acl_mtu": "310",
|
||||
"acl_mtu_packets": "10",
|
||||
"sco_mtu": "64",
|
||||
"sco_mtu_packets": "8",
|
||||
"state": [
|
||||
"UP",
|
||||
"RUNNING"
|
||||
],
|
||||
"rx_bytes": "13905869",
|
||||
"rx_acl": "0",
|
||||
"rx_sco": "0",
|
||||
"rx_events": "393300",
|
||||
"rx_errors": "0",
|
||||
"tx_bytes": "62629",
|
||||
"tx_acl": "0",
|
||||
"tx_sco": "0",
|
||||
"tx_commands": "3893",
|
||||
"tx_errors": "0",
|
||||
"features": [
|
||||
"0xff",
|
||||
"0xff",
|
||||
"0x8f",
|
||||
"0xfe",
|
||||
"0xdb",
|
||||
"0xff",
|
||||
"0x5b",
|
||||
"0x87"
|
||||
],
|
||||
"packet_type": [
|
||||
"DM1",
|
||||
"DM3",
|
||||
"DM5",
|
||||
"DH1",
|
||||
"DH3",
|
||||
"DH5",
|
||||
"HV1",
|
||||
"HV2",
|
||||
"HV3"
|
||||
],
|
||||
"link_policy": [
|
||||
"RSWITCH",
|
||||
"HOLD",
|
||||
"SNIFF",
|
||||
"PARK"
|
||||
],
|
||||
"link_mode": [
|
||||
"SLAVE",
|
||||
"ACCEPT"
|
||||
],
|
||||
"name": "CSR8510 A10",
|
||||
"class": "0x000000",
|
||||
"service_classes": [
|
||||
"Unspecified"
|
||||
],
|
||||
"device_class": "Miscellaneous",
|
||||
"hci_version": "4.0 (0x6)",
|
||||
"hci_revision": "0x22bb",
|
||||
"lmp_version": "4.0 (0x6)",
|
||||
"lmp_subversion": "0x22bb",
|
||||
"manufacturer": "Cambridge Silicon Radio (10)"
|
||||
},
|
||||
{
|
||||
"device": "hci1",
|
||||
"type": "Primary",
|
||||
"bus": "USB",
|
||||
"bd_address": "00:1A:7D:DA:71:13",
|
||||
"acl_mtu": "310",
|
||||
"acl_mtu_packets": "10",
|
||||
"sco_mtu": "64",
|
||||
"sco_mtu_packets": "8",
|
||||
"state": [
|
||||
"DOWN"
|
||||
],
|
||||
"rx_bytes": "4388363",
|
||||
"rx_acl": "0",
|
||||
"rx_sco": "0",
|
||||
"rx_events": "122021",
|
||||
"rx_errors": "0",
|
||||
"tx_bytes": "52350",
|
||||
"tx_acl": "0",
|
||||
"tx_sco": "0",
|
||||
"tx_commands": "3480",
|
||||
"tx_errors": "2",
|
||||
"features": [
|
||||
"0xff",
|
||||
"0xff",
|
||||
"0x8f",
|
||||
"0xfe",
|
||||
"0xdb",
|
||||
"0xff",
|
||||
"0x5b",
|
||||
"0x87"
|
||||
],
|
||||
"packet_type": [
|
||||
"DM1",
|
||||
"DM3",
|
||||
"DM5",
|
||||
"DH1",
|
||||
"DH3",
|
||||
"DH5",
|
||||
"HV1",
|
||||
"HV2",
|
||||
"HV3"
|
||||
],
|
||||
"link_policy": [
|
||||
"RSWITCH",
|
||||
"HOLD",
|
||||
"SNIFF",
|
||||
"PARK"
|
||||
],
|
||||
"link_mode": [
|
||||
"SLAVE",
|
||||
"ACCEPT"
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
<a id="jc.parsers.hciconfig.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 Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
@@ -1,13 +1,40 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.history"></a>
|
||||
|
||||
# jc.parsers.history
|
||||
jc - JSON CLI output utility history Parser
|
||||
|
||||
Usage:
|
||||
jc - JSON Convert `history` command output parser
|
||||
|
||||
specify --history as the first argument if the piped input is coming from history
|
||||
This parser will output a list of dictionaries each containing `line` and
|
||||
`command` keys. If you would like a simple dictionary output, then use the
|
||||
`-r` command-line option or the `raw=True` argument in the `parse()`
|
||||
function.
|
||||
|
||||
Compatibility:
|
||||
The "Magic" syntax is not supported since the `history` command is a shell
|
||||
builtin.
|
||||
|
||||
'linux', 'darwin', 'cygwin', 'aix', 'freebsd'
|
||||
Usage (cli):
|
||||
|
||||
$ history | jc --history
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('history', history_command_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.history
|
||||
result = jc.parsers.history.parse(history_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"line": integer,
|
||||
"command": string
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
@@ -23,7 +50,7 @@ Examples:
|
||||
},
|
||||
{
|
||||
"line": 120,
|
||||
"command": "echo "hello""
|
||||
"command": "echo \"hello\""
|
||||
},
|
||||
{
|
||||
"line": 121,
|
||||
@@ -36,41 +63,17 @@ Examples:
|
||||
{
|
||||
"118": "sleep 100",
|
||||
"119": "ls /bin",
|
||||
"120": "echo "hello"",
|
||||
"120": "echo \"hello\"",
|
||||
"121": "docker images",
|
||||
...
|
||||
}
|
||||
|
||||
## info
|
||||
<a id="jc.parsers.history.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
info(self, /, *args, **kwargs)
|
||||
```
|
||||
|
||||
## process
|
||||
```python
|
||||
process(proc_data)
|
||||
```
|
||||
|
||||
Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
"line": integer,
|
||||
"command": string
|
||||
}
|
||||
]
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@@ -78,11 +81,15 @@ Main text parsing function
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) output preprocessed JSON if True
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
Dictionary of raw structured data or
|
||||
list of dictionaries of processed structured data
|
||||
List of Dictionaries of processed structured data
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, aix, freebsd
|
||||
|
||||
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
@@ -1,13 +1,34 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.hosts"></a>
|
||||
|
||||
# jc.parsers.hosts
|
||||
jc - JSON CLI output utility hosts Parser
|
||||
|
||||
Usage:
|
||||
jc - JSON Convert `/etc/hosts` file parser
|
||||
|
||||
specify --hosts as the first argument if the piped input is coming from a hosts file
|
||||
Usage (cli):
|
||||
|
||||
Compatibility:
|
||||
$ cat /etc/hosts | jc --hosts
|
||||
|
||||
'linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd'
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('hosts', hosts_file_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.hosts
|
||||
result = jc.parsers.hosts.parse(hosts_file_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"ip": string,
|
||||
"hostname": [
|
||||
string
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
@@ -58,38 +79,12 @@ Examples:
|
||||
}
|
||||
]
|
||||
|
||||
## info
|
||||
<a id="jc.parsers.hosts.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
info(self, /, *args, **kwargs)
|
||||
```
|
||||
|
||||
## process
|
||||
```python
|
||||
process(proc_data)
|
||||
```
|
||||
|
||||
Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
"ip": string,
|
||||
"hostname": [
|
||||
string
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@@ -97,10 +92,14 @@ Main text parsing function
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) output preprocessed JSON if True
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
|
||||
|
||||
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
@@ -1,13 +1,56 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.id"></a>
|
||||
|
||||
# jc.parsers.id
|
||||
jc - JSON CLI output utility id Parser
|
||||
|
||||
Usage:
|
||||
jc - JSON Convert `id` command output parser
|
||||
|
||||
specify --id as the first argument if the piped input is coming from id
|
||||
Usage (cli):
|
||||
|
||||
Compatibility:
|
||||
$ id | jc --id
|
||||
|
||||
'linux', 'darwin', 'aix', 'freebsd'
|
||||
or
|
||||
|
||||
$ jc id
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('id', id_command_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.id
|
||||
result = jc.parsers.id.parse(id_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
{
|
||||
"uid": {
|
||||
"id": integer,
|
||||
"name": string
|
||||
},
|
||||
"gid": {
|
||||
"id": integer,
|
||||
"name": string
|
||||
},
|
||||
"groups": [
|
||||
{
|
||||
"id": integer,
|
||||
"name": string
|
||||
},
|
||||
{
|
||||
"id": integer,
|
||||
"name": string
|
||||
}
|
||||
],
|
||||
"context": {
|
||||
"user": string,
|
||||
"role": string,
|
||||
"type": string,
|
||||
"level": string
|
||||
}
|
||||
}
|
||||
|
||||
Examples:
|
||||
|
||||
@@ -67,56 +110,12 @@ Examples:
|
||||
}
|
||||
}
|
||||
|
||||
## info
|
||||
<a id="jc.parsers.id.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
info(self, /, *args, **kwargs)
|
||||
```
|
||||
|
||||
## process
|
||||
```python
|
||||
process(proc_data)
|
||||
```
|
||||
|
||||
Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
Dictionary. Structured data with the following schema:
|
||||
|
||||
{
|
||||
"uid": {
|
||||
"id": integer,
|
||||
"name": string
|
||||
},
|
||||
"gid": {
|
||||
"id": integer,
|
||||
"name": string
|
||||
},
|
||||
"groups": [
|
||||
{
|
||||
"id": integer,
|
||||
"name": string
|
||||
},
|
||||
{
|
||||
"id": integer,
|
||||
"name": string
|
||||
}
|
||||
],
|
||||
"context": {
|
||||
"user": string,
|
||||
"role": string,
|
||||
"type": string,
|
||||
"level": string
|
||||
}
|
||||
}
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@@ -124,10 +123,14 @@ Main text parsing function
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) output preprocessed JSON if True
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
Dictionary. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, aix, freebsd
|
||||
|
||||
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
@@ -1,15 +1,64 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.ifconfig"></a>
|
||||
|
||||
# jc.parsers.ifconfig
|
||||
jc - JSON CLI output utility ifconfig Parser
|
||||
|
||||
Usage:
|
||||
jc - JSON Convert `ifconfig` command output parser
|
||||
|
||||
specify --ifconfig as the first argument if the piped input is coming from ifconfig
|
||||
Note: No `ifconfig` options are supported.
|
||||
|
||||
no ifconfig options are supported.
|
||||
Usage (cli):
|
||||
|
||||
Compatibility:
|
||||
$ ifconfig | jc --ifconfig
|
||||
|
||||
'linux', 'aix', 'freebsd', 'darwin'
|
||||
or
|
||||
|
||||
$ jc ifconfig
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('ifconfig', ifconfig_command_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.ifconfig
|
||||
result = jc.parsers.ifconfig.parse(ifconfig_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"name": string,
|
||||
"flags": integer,
|
||||
"state": [
|
||||
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
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
@@ -142,73 +191,12 @@ Examples:
|
||||
}
|
||||
]
|
||||
|
||||
## info
|
||||
<a id="jc.parsers.ifconfig.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
info(self, /, *args, **kwargs)
|
||||
```
|
||||
|
||||
## IfconfigParser
|
||||
```python
|
||||
IfconfigParser(self, console_output)
|
||||
```
|
||||
|
||||
## InterfaceNotFound
|
||||
```python
|
||||
InterfaceNotFound(self, /, *args, **kwargs)
|
||||
```
|
||||
|
||||
|
||||
## process
|
||||
```python
|
||||
process(proc_data)
|
||||
```
|
||||
|
||||
Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
"name": string,
|
||||
"flags": integer,
|
||||
"state": [
|
||||
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
|
||||
}
|
||||
]
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@@ -216,10 +204,14 @@ Main text parsing function
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) output preprocessed JSON if True
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux, aix, freebsd, darwin
|
||||
|
||||
Version 1.11 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
@@ -1,13 +1,41 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.ini"></a>
|
||||
|
||||
# jc.parsers.ini
|
||||
jc - JSON CLI output utility INI Parser
|
||||
|
||||
Usage:
|
||||
jc - JSON Convert `INI` file parser
|
||||
|
||||
specify --ini as the first argument if the piped input is coming from an INI file
|
||||
Parses standard `INI` files and files containing simple key/value pairs.
|
||||
Delimiter can be `=` or `:`. Missing values are supported. Comment prefix
|
||||
can be `#` or `;`. Comments must be on their own line.
|
||||
|
||||
Compatibility:
|
||||
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()`.
|
||||
|
||||
'linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd'
|
||||
Usage (cli):
|
||||
|
||||
$ cat foo.ini | jc --ini
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('ini', ini_file_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.ini
|
||||
result = jc.parsers.ini.parse(ini_file_output)
|
||||
|
||||
Schema:
|
||||
|
||||
ini or key/value document converted to a dictionary - see the
|
||||
configparser standard library documentation for more details.
|
||||
|
||||
{
|
||||
"key1": string,
|
||||
"key2": string
|
||||
}
|
||||
|
||||
Examples:
|
||||
|
||||
@@ -43,34 +71,12 @@ Examples:
|
||||
}
|
||||
}
|
||||
|
||||
## info
|
||||
<a id="jc.parsers.ini.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
info(self, /, *args, **kwargs)
|
||||
```
|
||||
|
||||
## process
|
||||
```python
|
||||
process(proc_data)
|
||||
```
|
||||
|
||||
Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
Dictionary representing an ini document:
|
||||
|
||||
{
|
||||
ini document converted to a dictionary
|
||||
see configparser standard library documentation for more details
|
||||
}
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@@ -78,10 +84,14 @@ Main text parsing function
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) output preprocessed JSON if True
|
||||
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
|
||||
|
||||
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
190
docs/parsers/iostat.md
Normal file
190
docs/parsers/iostat.md
Normal file
@@ -0,0 +1,190 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.iostat"></a>
|
||||
|
||||
# jc.parsers.iostat
|
||||
|
||||
jc - JSON Convert `iostat` command output parser
|
||||
|
||||
Note: `iostat` version 11 and higher include a JSON output option
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ iostat | jc --iostat
|
||||
|
||||
or
|
||||
|
||||
$ jc iostat
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('iostat', iostat_command_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.iostat
|
||||
result = jc.parsers.iostat.parse(iostat_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"type": string,
|
||||
"percent_user": float,
|
||||
"percent_nice": float,
|
||||
"percent_system": float,
|
||||
"percent_iowait": float,
|
||||
"percent_steal": float,
|
||||
"percent_idle": float,
|
||||
"device": string,
|
||||
"tps": float,
|
||||
"kb_read_s": float,
|
||||
"mb_read_s": float,
|
||||
"kb_wrtn_s": float,
|
||||
"mb_wrtn_s": float,
|
||||
"kb_read": integer,
|
||||
"mb_read": integer,
|
||||
"kb_wrtn": integer,
|
||||
"mb_wrtn": integer,
|
||||
'kb_dscd': integer,
|
||||
'mb_dscd': integer,
|
||||
"rrqm_s": float,
|
||||
"wrqm_s": float,
|
||||
"r_s": float,
|
||||
"w_s": float,
|
||||
"rmb_s": float,
|
||||
"rkb_s": float,
|
||||
"wmb_s": float,
|
||||
"wkb_s": float,
|
||||
"avgrq_sz": float,
|
||||
"avgqu_sz": float,
|
||||
"await": float,
|
||||
"r_await": float,
|
||||
"w_await": float,
|
||||
"svctm": float,
|
||||
"aqu_sz": float,
|
||||
"rareq_sz": float,
|
||||
"wareq_sz": float,
|
||||
"d_s": float,
|
||||
"dkb_s": float,
|
||||
"dmb_s": float,
|
||||
"drqm_s": float,
|
||||
"percent_drqm": float,
|
||||
"d_await": float,
|
||||
"dareq_sz": float,
|
||||
"f_s": float,
|
||||
"f_await": float,
|
||||
"kb_dscd_s": float,
|
||||
"mb_dscd_s": float,
|
||||
"percent_util": float,
|
||||
"percent_rrqm": float,
|
||||
"percent_wrqm": float
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
$ iostat | jc --iostat -p
|
||||
[
|
||||
{
|
||||
"percent_user": 0.15,
|
||||
"percent_nice": 0.0,
|
||||
"percent_system": 0.18,
|
||||
"percent_iowait": 0.0,
|
||||
"percent_steal": 0.0,
|
||||
"percent_idle": 99.67,
|
||||
"type": "cpu"
|
||||
},
|
||||
{
|
||||
"device": "sda",
|
||||
"tps": 0.29,
|
||||
"kb_read_s": 7.22,
|
||||
"kb_wrtn_s": 1.25,
|
||||
"kb_read": 194341,
|
||||
"kb_wrtn": 33590,
|
||||
"type": "device"
|
||||
},
|
||||
{
|
||||
"device": "dm-0",
|
||||
"tps": 0.29,
|
||||
"kb_read_s": 5.99,
|
||||
"kb_wrtn_s": 1.17,
|
||||
"kb_read": 161361,
|
||||
"kb_wrtn": 31522,
|
||||
"type": "device"
|
||||
},
|
||||
{
|
||||
"device": "dm-1",
|
||||
"tps": 0.0,
|
||||
"kb_read_s": 0.08,
|
||||
"kb_wrtn_s": 0.0,
|
||||
"kb_read": 2204,
|
||||
"kb_wrtn": 0,
|
||||
"type": "device"
|
||||
}
|
||||
]
|
||||
|
||||
$ iostat | jc --iostat -p -r
|
||||
[
|
||||
{
|
||||
"percent_user": "0.15",
|
||||
"percent_nice": "0.00",
|
||||
"percent_system": "0.18",
|
||||
"percent_iowait": "0.00",
|
||||
"percent_steal": "0.00",
|
||||
"percent_idle": "99.67",
|
||||
"type": "cpu"
|
||||
},
|
||||
{
|
||||
"device": "sda",
|
||||
"tps": "0.29",
|
||||
"kb_read_s": "7.22",
|
||||
"kb_wrtn_s": "1.25",
|
||||
"kb_read": "194341",
|
||||
"kb_wrtn": "33590",
|
||||
"type": "device"
|
||||
},
|
||||
{
|
||||
"device": "dm-0",
|
||||
"tps": "0.29",
|
||||
"kb_read_s": "5.99",
|
||||
"kb_wrtn_s": "1.17",
|
||||
"kb_read": "161361",
|
||||
"kb_wrtn": "31522",
|
||||
"type": "device"
|
||||
},
|
||||
{
|
||||
"device": "dm-1",
|
||||
"tps": "0.00",
|
||||
"kb_read_s": "0.08",
|
||||
"kb_wrtn_s": "0.00",
|
||||
"kb_read": "2204",
|
||||
"kb_wrtn": "0",
|
||||
"type": "device"
|
||||
}
|
||||
]
|
||||
|
||||
<a id="jc.parsers.iostat.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 Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
139
docs/parsers/iostat_s.md
Normal file
139
docs/parsers/iostat_s.md
Normal file
@@ -0,0 +1,139 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.iostat_s"></a>
|
||||
|
||||
# jc.parsers.iostat\_s
|
||||
|
||||
jc - JSON Convert `iostat` command output streaming parser
|
||||
|
||||
> This streaming parser outputs JSON Lines
|
||||
|
||||
Note: `iostat` version 11 and higher include a JSON output option
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ iostat | jc --iostat-s
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
# result is an iterable object (generator)
|
||||
result = jc.parse('iostat_s', iostat_command_output.splitlines())
|
||||
for item in result:
|
||||
# do something
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.iostat_s
|
||||
# result is an iterable object (generator)
|
||||
result = jc.parsers.iostat_s.parse(iostat_command_output.splitlines())
|
||||
for item in result:
|
||||
# do something
|
||||
|
||||
Schema:
|
||||
|
||||
{
|
||||
"type": string,
|
||||
"percent_user": float,
|
||||
"percent_nice": float,
|
||||
"percent_system": float,
|
||||
"percent_iowait": float,
|
||||
"percent_steal": float,
|
||||
"percent_idle": float,
|
||||
"device": string,
|
||||
"tps": float,
|
||||
"kb_read_s": float,
|
||||
"mb_read_s": float,
|
||||
"kb_wrtn_s": float,
|
||||
"mb_wrtn_s": float,
|
||||
"kb_read": integer,
|
||||
"mb_read": integer,
|
||||
"kb_wrtn": integer,
|
||||
"mb_wrtn": integer,
|
||||
'kb_dscd': integer,
|
||||
'mb_dscd': integer,
|
||||
"rrqm_s": float,
|
||||
"wrqm_s": float,
|
||||
"r_s": float,
|
||||
"w_s": float,
|
||||
"rmb_s": float,
|
||||
"rkb_s": float,
|
||||
"wmb_s": float,
|
||||
"wkb_s": float,
|
||||
"avgrq_sz": float,
|
||||
"avgqu_sz": float,
|
||||
"await": float,
|
||||
"r_await": float,
|
||||
"w_await": float,
|
||||
"svctm": float,
|
||||
"aqu_sz": float,
|
||||
"rareq_sz": float,
|
||||
"wareq_sz": float,
|
||||
"d_s": float,
|
||||
"dkb_s": float,
|
||||
"dmb_s": float,
|
||||
"drqm_s": float,
|
||||
"percent_drqm": float,
|
||||
"d_await": float,
|
||||
"dareq_sz": float,
|
||||
"f_s": float,
|
||||
"f_await": float,
|
||||
"kb_dscd_s": float,
|
||||
"mb_dscd_s": float,
|
||||
"percent_util": float,
|
||||
"percent_rrqm": float,
|
||||
"percent_wrqm": float,
|
||||
|
||||
# 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
|
||||
}
|
||||
}
|
||||
|
||||
Examples:
|
||||
|
||||
$ iostat | jc --iostat-s
|
||||
{"percent_user":0.14,"percent_nice":0.0,"percent_system":0.16,...}
|
||||
{"device":"sda","tps":0.24,"kb_read_s":5.28,"kb_wrtn_s":1.1...}
|
||||
...
|
||||
|
||||
$ iostat | jc --iostat-s -r
|
||||
{"percent_user":"0.14","percent_nice":"0.00","percent_system":"0.16"...}
|
||||
{"device":"sda","tps":"0.24","kb_read_s":"5.28","kb_wrtn_s":"1.10"...}
|
||||
...
|
||||
|
||||
<a id="jc.parsers.iostat_s.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
@add_jc_meta
|
||||
def parse(data, raw=False, quiet=False, ignore_exceptions=False)
|
||||
```
|
||||
|
||||
Main text parsing generator function. Returns an iterator 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
|
||||
|
||||
Yields:
|
||||
|
||||
Dictionary. Raw or processed structured data.
|
||||
|
||||
Returns:
|
||||
|
||||
Iterator object (generator)
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
@@ -1,15 +1,52 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.iptables"></a>
|
||||
|
||||
# jc.parsers.iptables
|
||||
jc - JSON CLI output utility ipables Parser
|
||||
|
||||
Usage:
|
||||
jc - JSON Convert `iptables` command output parser
|
||||
|
||||
Specify --iptables as the first argument if the piped input is coming from iptables
|
||||
Supports `-vLn` and `--line-numbers` for all tables.
|
||||
|
||||
Supports -vLn and --line-numbers for all tables
|
||||
Usage (cli):
|
||||
|
||||
Compatibility:
|
||||
$ sudo iptables -L -t nat | jc --iptables
|
||||
|
||||
'linux'
|
||||
or
|
||||
|
||||
$ jc iptables -L -t nat
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('iptables', iptables_command_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.iptables
|
||||
result = jc.parsers.iptables.parse(iptables_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"chain": string,
|
||||
"rules": [
|
||||
{
|
||||
"num" integer,
|
||||
"pkts": integer,
|
||||
"bytes": integer, # converted based on suffix
|
||||
"target": string,
|
||||
"prot": string,
|
||||
"opt": string, # "--" = Null
|
||||
"in": string,
|
||||
"out": string,
|
||||
"source": string,
|
||||
"destination": string,
|
||||
"options": string
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
@@ -131,50 +168,12 @@ Examples:
|
||||
...
|
||||
]
|
||||
|
||||
## info
|
||||
<a id="jc.parsers.iptables.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
info(self, /, *args, **kwargs)
|
||||
```
|
||||
|
||||
## process
|
||||
```python
|
||||
process(proc_data)
|
||||
```
|
||||
|
||||
Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
"chain": string,
|
||||
"rules": [
|
||||
{
|
||||
"num" integer,
|
||||
"pkts": integer,
|
||||
"bytes": integer, # converted based on suffix
|
||||
"target": string,
|
||||
"prot": string,
|
||||
"opt": string, # "--" = Null
|
||||
"in": string,
|
||||
"out": string,
|
||||
"source": string,
|
||||
"destination": string,
|
||||
"options": string
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@@ -182,10 +181,14 @@ Main text parsing function
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) output preprocessed JSON if True
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Version 1.7 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
152
docs/parsers/iw_scan.md
Normal file
152
docs/parsers/iw_scan.md
Normal file
@@ -0,0 +1,152 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.iw_scan"></a>
|
||||
|
||||
# jc.parsers.iw\_scan
|
||||
|
||||
jc - JSON Convert `iw dev <device> scan` command output parser
|
||||
|
||||
This parser is considered beta quality. Not all fields are parsed and there
|
||||
are not enough samples to test.
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ iw dev wlan0 scan | jc --iw-scan
|
||||
|
||||
or
|
||||
|
||||
$ jc iw dev wlan0 scan
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('iw_scan', iw_scan_command_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.iw_scan
|
||||
result = jc.parsers.iw_scan.parse(iw_scan_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"foo": string/integer/float, # best guess based on value
|
||||
"bar": string/integer/float,
|
||||
"baz": string/integer/float
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
$ iw dev wlan0 scan | jc --iw-scan -p
|
||||
[
|
||||
{
|
||||
"bssid": "71:31:72:65:e1:a2",
|
||||
"interface": "wlan0",
|
||||
"freq": 2462,
|
||||
"capability": "ESS Privacy ShortSlotTime (0x0411)",
|
||||
"ssid": "WLAN-1234",
|
||||
"supported_rates": [
|
||||
1.0,
|
||||
2.0,
|
||||
5.5,
|
||||
11.0,
|
||||
18.0,
|
||||
24.0,
|
||||
36.0,
|
||||
54.0
|
||||
],
|
||||
"erp": "<no flags>",
|
||||
"erp_d4.0": "<no flags>",
|
||||
"rsn": "Version: 1",
|
||||
"group_cipher": "CCMP",
|
||||
"pairwise_ciphers": "CCMP",
|
||||
"authentication_suites": "PSK",
|
||||
"capabilities": "0x186c",
|
||||
"extended_supported_rates": [
|
||||
6.0,
|
||||
9.0,
|
||||
12.0,
|
||||
48.0
|
||||
],
|
||||
"ht_rx_mcs_rate_indexes_supported": "0-15",
|
||||
"primary_channel": 11,
|
||||
"secondary_channel_offset": "no secondary",
|
||||
"rifs": 1,
|
||||
"ht_protection": "no",
|
||||
"non-gf_present": 1,
|
||||
"obss_non-gf_present": 0,
|
||||
"dual_beacon": 0,
|
||||
"dual_cts_protection": 0,
|
||||
"stbc_beacon": 0,
|
||||
"l-sig_txop_prot": 0,
|
||||
"pco_active": 0,
|
||||
"pco_phase": 0,
|
||||
"bss_width_channel_transition_delay_factor": 5,
|
||||
"extended_capabilities": "HT Information Exchange Supported",
|
||||
"wmm": "Parameter version 1",
|
||||
"be": "CW 15-1023, AIFSN 3",
|
||||
"bk": "CW 15-1023, AIFSN 7",
|
||||
"vi": "CW 7-15, AIFSN 2, TXOP 3008 usec",
|
||||
"vo": "CW 3-7, AIFSN 2, TXOP 1504 usec",
|
||||
"wps": "Version: 1.0",
|
||||
"wi-fi_protected_setup_state": "2 (Configured)",
|
||||
"selected_registrar": "0x0",
|
||||
"response_type": "3 (AP)",
|
||||
"uuid": "00000000-0000-0003-0000-75317074f1a2",
|
||||
"manufacturer": "Corporation",
|
||||
"model": "VGV8539JW",
|
||||
"model_number": "1.47.000",
|
||||
"serial_number": "J144024542",
|
||||
"primary_device_type": "6-0050f204-1",
|
||||
"device_name": "Wireless Router(WFA)",
|
||||
"config_methods": "Label, PBC",
|
||||
"rf_bands": "0x3",
|
||||
"tsf_usec": 212098649788,
|
||||
"sta_channel_width_mhz": 20,
|
||||
"passive_dwell_tus": 20,
|
||||
"active_dwell_tus": 10,
|
||||
"channel_width_trigger_scan_interval_s": 300,
|
||||
"scan_passive_total_per_channel_tus": 200,
|
||||
"scan_active_total_per_channel_tus": 20,
|
||||
"beacon_interval_tus": 100,
|
||||
"signal_dbm": -80.0,
|
||||
"last_seen_ms": 11420,
|
||||
"selected_rates": [
|
||||
1.0,
|
||||
2.0,
|
||||
5.5,
|
||||
11.0
|
||||
],
|
||||
"obss_scan_activity_threshold_percent": 0.25,
|
||||
"ds_parameter_set_channel": 11,
|
||||
"max_amsdu_length_bytes": 7935,
|
||||
"minimum_rx_ampdu_time_spacing_usec": 16
|
||||
},
|
||||
...
|
||||
]
|
||||
|
||||
<a id="jc.parsers.iw_scan.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 Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Version 0.7 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
108
docs/parsers/jar_manifest.md
Normal file
108
docs/parsers/jar_manifest.md
Normal file
@@ -0,0 +1,108 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.jar_manifest"></a>
|
||||
|
||||
# jc.parsers.jar\_manifest
|
||||
|
||||
jc - JSON Convert `MANIFEST.MF` file parser
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ cat MANIFEST.MF | jc --jar-manifest
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('jar_manifest', jar_manifest_file_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.jar_manifest
|
||||
result = jc.parsers.jar_manifest.parse(jar_manifest_file_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"key1": string,
|
||||
"key2": string
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
$ cat MANIFEST.MF | jc --jar-manifest -p
|
||||
$ unzip -c log4j-core-2.16.0.jar META-INF/MANIFEST.MF | \\
|
||||
jc --jar-manifest -p
|
||||
$ unzip -c 'apache-log4j-2.16.0-bin/*.jar' META-INF/MANIFEST.MF | \\
|
||||
jc --jar-manifest -p
|
||||
|
||||
$ cat MANIFEST.MF | jc --jar-manifest -p
|
||||
[
|
||||
{
|
||||
"Import_Package": "com.conversantmedia.util.concurrent;resoluti...",
|
||||
"Export_Package": "org.apache.logging.log4j.core;uses:=\"org.ap...",
|
||||
"Manifest_Version": "1.0",
|
||||
"Bundle_License": "https://www.apache.org/licenses/LICENSE-2.0.txt",
|
||||
"Bundle_SymbolicName": "org.apache.logging.log4j.core",
|
||||
"Built_By": "matt",
|
||||
"Bnd_LastModified": "1639373735804",
|
||||
"Implementation_Vendor_Id": "org.apache.logging.log4j",
|
||||
"Specification_Title": "Apache Log4j Core",
|
||||
"Log4jReleaseManager": "Matt Sicker",
|
||||
...
|
||||
}
|
||||
]
|
||||
|
||||
$ unzip -c 'apache-log4j-2.16.0-bin/*.jar' META-INF/MANIFEST.MF | \\
|
||||
jc --jar-manifest -p
|
||||
[
|
||||
...
|
||||
{
|
||||
"Archive": "apache-log4j-2.16.0-bin/log4j-spring-boot-2.16.0-so...",
|
||||
"Manifest_Version": "1.0",
|
||||
"Built_By": "matt",
|
||||
"Created_By": "Apache Maven 3.8.4",
|
||||
"Build_Jdk": "1.8.0_312"
|
||||
},
|
||||
{
|
||||
"Archive": "apache-log4j-2.16.0-bin/log4j-spring-boot-2.16.0-ja...",
|
||||
"Manifest_Version": "1.0",
|
||||
"Built_By": "matt",
|
||||
"Created_By": "Apache Maven 3.8.4",
|
||||
"Build_Jdk": "1.8.0_312"
|
||||
},
|
||||
{
|
||||
"Bundle_SymbolicName": "org.apache.logging.log4j.spring-cloud-c...",
|
||||
"Export_Package": "org.apache.logging.log4j.spring.cloud.config...",
|
||||
"Archive": "apache-log4j-2.16.0-bin/log4j-spring-cloud-config-c...",
|
||||
"Manifest_Version": "1.0",
|
||||
"Bundle_License": "https://www.apache.org/licenses/LICENSE-2.0.txt",
|
||||
...
|
||||
}
|
||||
...
|
||||
]
|
||||
|
||||
<a id="jc.parsers.jar_manifest.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 Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
|
||||
|
||||
Version 0.01 by Matt J (https://github.com/listuser)
|
||||
@@ -1,15 +1,40 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.jobs"></a>
|
||||
|
||||
# jc.parsers.jobs
|
||||
jc - JSON CLI output utility jobs Parser
|
||||
|
||||
Usage:
|
||||
jc - JSON Convert `jobs` command output parser
|
||||
|
||||
specify --jobs as the first argument if the piped input is coming from jobs
|
||||
Also supports the `-l` option.
|
||||
|
||||
Also supports the -l option
|
||||
The "Magic" syntax is not supported since the `jobs` command is a shell
|
||||
builtin.
|
||||
|
||||
Compatibility:
|
||||
Usage (cli):
|
||||
|
||||
'linux', 'darwin', 'cygwin', 'aix', 'freebsd'
|
||||
$ jobs | jc --jobs
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('jobs', jobs_command_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.jobs
|
||||
result = jc.parsers.jobs.parse(jobs_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"job_number": integer,
|
||||
"pid": integer,
|
||||
"history": string,
|
||||
"status": string,
|
||||
"command": string
|
||||
}
|
||||
]
|
||||
|
||||
Example:
|
||||
|
||||
@@ -73,39 +98,12 @@ Example:
|
||||
}
|
||||
]
|
||||
|
||||
## info
|
||||
<a id="jc.parsers.jobs.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
info(self, /, *args, **kwargs)
|
||||
```
|
||||
|
||||
## process
|
||||
```python
|
||||
process(proc_data)
|
||||
```
|
||||
|
||||
Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
"job_number": integer,
|
||||
"pid": integer,
|
||||
"history": string,
|
||||
"status": string,
|
||||
"command": string
|
||||
}
|
||||
]
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@@ -113,10 +111,14 @@ Main text parsing function
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) output preprocessed JSON if True
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, aix, freebsd
|
||||
|
||||
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
86
docs/parsers/kv.md
Normal file
86
docs/parsers/kv.md
Normal file
@@ -0,0 +1,86 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.kv"></a>
|
||||
|
||||
# jc.parsers.kv
|
||||
|
||||
jc - JSON Convert `Key/Value` file parser
|
||||
|
||||
Supports files containing simple key/value pairs. Delimiter can be `=` or
|
||||
`:`. Missing values are supported. Comment prefix can be `#` or `;`.
|
||||
Comments must be on their own line.
|
||||
|
||||
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
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('kv', kv_file_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.kv
|
||||
result = jc.parsers.kv.parse(kv_file_output)
|
||||
|
||||
Schema:
|
||||
|
||||
key/value document converted to a dictionary - see the
|
||||
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"
|
||||
|
||||
$ cat keyvalue.txt | jc --kv -p
|
||||
{
|
||||
"name": "John Doe",
|
||||
"address": "555 California Drive",
|
||||
"age": "34",
|
||||
"occupation": "Engineer"
|
||||
}
|
||||
|
||||
<a id="jc.parsers.kv.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
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
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
Dictionary representing the key/value file
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
|
||||
|
||||
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
@@ -1,40 +1,82 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.last"></a>
|
||||
|
||||
# jc.parsers.last
|
||||
jc - JSON CLI output utility last Parser
|
||||
|
||||
Usage:
|
||||
jc - JSON Convert `last` and `lastb` command output parser
|
||||
|
||||
specify --last as the first argument if the piped input is coming from last or lastb
|
||||
Supports `-w` and `-F` options.
|
||||
|
||||
Compatibility:
|
||||
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
|
||||
`last` command output.
|
||||
|
||||
'linux', 'darwin', 'aix', 'freebsd'
|
||||
Usage (cli):
|
||||
|
||||
$ last | jc --last
|
||||
|
||||
or
|
||||
|
||||
$ jc last
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('last', last_command_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.last
|
||||
result = jc.parsers.last.parse(last_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"user": string,
|
||||
"tty": string,
|
||||
"hostname": string,
|
||||
"login": string,
|
||||
"logout": string,
|
||||
"duration": string,
|
||||
"login_epoch": integer, # (naive) available w/last -F option
|
||||
"logout_epoch": integer, # (naive) available w/last -F option
|
||||
"duration_seconds": integer # available w/last -F option
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
$ last | jc --last -p
|
||||
$ last -F | jc --last -p
|
||||
[
|
||||
{
|
||||
"user": "kbrazil",
|
||||
"tty": "ttys002",
|
||||
"hostname": null,
|
||||
"login": "Thu Feb 27 14:31",
|
||||
"login": "Mon Dec 28 17:24:10 2020",
|
||||
"logout": "still logged in"
|
||||
},
|
||||
{
|
||||
"user": "kbrazil",
|
||||
"tty": "ttys003",
|
||||
"hostname": null,
|
||||
"login": "Thu Feb 27 10:38",
|
||||
"logout": "10:38",
|
||||
"duration": "00:00"
|
||||
"login": "Mon Dec 28 17:24:10 2020",
|
||||
"logout": "Mon Dec 28 17:25:01 2020",
|
||||
"duration": "00:00",
|
||||
"login_epoch": 1565891826,
|
||||
"logout_epoch": 1565895404,
|
||||
"duration_seconds": 3578
|
||||
},
|
||||
{
|
||||
"user": "kbrazil",
|
||||
"tty": "ttys003",
|
||||
"hostname": null,
|
||||
"login": "Thu Feb 27 10:18",
|
||||
"logout": "10:18",
|
||||
"duration": "00:00"
|
||||
"login": "Mon Dec 28 17:24:10 2020",
|
||||
"logout": "Mon Dec 28 17:25:01 2020",
|
||||
"duration": "00:00",
|
||||
"login_epoch": 1565891826,
|
||||
"logout_epoch": 1565895404,
|
||||
"duration_seconds": 3578
|
||||
},
|
||||
...
|
||||
]
|
||||
@@ -67,41 +109,12 @@ Examples:
|
||||
...
|
||||
]
|
||||
|
||||
<a id="jc.parsers.last.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
## info
|
||||
```python
|
||||
info(self, /, *args, **kwargs)
|
||||
```
|
||||
|
||||
## process
|
||||
```python
|
||||
process(proc_data)
|
||||
```
|
||||
|
||||
Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
"user": string,
|
||||
"tty": string,
|
||||
"hostname": string,
|
||||
"login": string,
|
||||
"logout": string,
|
||||
"duration": string
|
||||
}
|
||||
]
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@@ -109,10 +122,14 @@ Main text parsing function
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) output preprocessed JSON if True
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, aix, freebsd
|
||||
|
||||
Version 1.8 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
@@ -1,25 +1,64 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.ls"></a>
|
||||
|
||||
# jc.parsers.ls
|
||||
jc - JSON CLI output utility ls Parser
|
||||
|
||||
Note: The -l or -b option of ls should be used to correctly parse filenames that include newline characters.
|
||||
Since ls does not encode newlines in filenames when outputting to a pipe it will cause jc to see
|
||||
multiple files instead of a single file if -l or -b is not used.
|
||||
jc - JSON Convert `ls` and `vdir` command output parser
|
||||
|
||||
Usage:
|
||||
Options supported:
|
||||
- `lbaR1`
|
||||
- `--time-style=full-iso`
|
||||
|
||||
specify --ls as the first argument if the piped input is coming from ls
|
||||
Note: The `-1`, `-l`, or `-b` option of `ls` should be used to correctly
|
||||
parse filenames that include newline characters. Since `ls` does not encode
|
||||
newlines in filenames when outputting to a pipe it will cause `jc` to see
|
||||
multiple files instead of a single file if `-1`, `-l`, or `-b` is not used.
|
||||
Alternatively, `vdir` can be used, which is the same as running `ls -lb`.
|
||||
|
||||
ls options supported:
|
||||
The `epoch` calculated timestamp field is naive. (i.e. based on the local
|
||||
time of the system the parser is run on)
|
||||
|
||||
-lbaR
|
||||
--time-style=full-iso
|
||||
-h file sizes will be available in text form with -r but larger file sizes
|
||||
with human readable suffixes will be converted to Null in default view
|
||||
since the parser attempts to convert this field to an integer.
|
||||
The `epoch_utc` calculated timestamp field is timezone-aware and is only
|
||||
available if the timezone field is UTC.
|
||||
|
||||
Compatibility:
|
||||
Usage (cli):
|
||||
|
||||
'linux', 'darwin', 'cygwin', 'aix', 'freebsd'
|
||||
$ ls | jc --ls
|
||||
|
||||
or
|
||||
|
||||
$ jc ls
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('ls', ls_command_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.ls
|
||||
result = jc.parsers.ls.parse(ls_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"filename": string,
|
||||
"flags": string,
|
||||
"links": integer,
|
||||
"parent": string,
|
||||
"owner": string,
|
||||
"group": string,
|
||||
"size": integer,
|
||||
"date": string,
|
||||
"epoch": integer, # [0]
|
||||
"epoch_utc": integer # [1]
|
||||
}
|
||||
]
|
||||
|
||||
[0] naive timestamp if date field exists and can be converted.
|
||||
[1] timezone aware timestamp if date field is in UTC and can
|
||||
be converted.
|
||||
|
||||
Examples:
|
||||
|
||||
@@ -31,12 +70,6 @@ Examples:
|
||||
{
|
||||
"filename": "arch"
|
||||
},
|
||||
{
|
||||
"filename": "awk"
|
||||
},
|
||||
{
|
||||
"filename": "base64"
|
||||
},
|
||||
...
|
||||
]
|
||||
|
||||
@@ -61,15 +94,6 @@ Examples:
|
||||
"size": 62744,
|
||||
"date": "Aug 8 16:14"
|
||||
},
|
||||
{
|
||||
"filename": "arch",
|
||||
"flags": "-rwxr-xr-x.",
|
||||
"links": 1,
|
||||
"owner": "root",
|
||||
"group": "root",
|
||||
"size": 33080,
|
||||
"date": "Aug 19 23:25"
|
||||
},
|
||||
...
|
||||
]
|
||||
|
||||
@@ -94,93 +118,15 @@ Examples:
|
||||
"size": "33080",
|
||||
"date": "Aug 19 23:25"
|
||||
},
|
||||
{
|
||||
"filename": "awk",
|
||||
"link_to": "gawk",
|
||||
"flags": "lrwxrwxrwx.",
|
||||
"links": "1",
|
||||
"owner": "root",
|
||||
"group": "root",
|
||||
"size": "4",
|
||||
"date": "Aug 15 10:53"
|
||||
},
|
||||
{
|
||||
"filename": "base64",
|
||||
"flags": "-rwxr-xr-x.",
|
||||
"links": "1",
|
||||
"owner": "root",
|
||||
"group": "root",
|
||||
"size": "37360",
|
||||
"date": "Aug 19 23:25"
|
||||
},
|
||||
{
|
||||
"filename": "basename",
|
||||
"flags": "-rwxr-xr-x.",
|
||||
"links": "1",
|
||||
"owner": "root",
|
||||
"group": "root",
|
||||
"size": "29032",
|
||||
"date": "Aug 19 23:25"
|
||||
},
|
||||
{
|
||||
"filename": "bash",
|
||||
"flags": "-rwxr-xr-x.",
|
||||
"links": "1",
|
||||
"owner": "root",
|
||||
"group": "root",
|
||||
"size": "964600",
|
||||
"date": "Aug 8 05:06"
|
||||
},
|
||||
...
|
||||
]
|
||||
|
||||
$ ls -l /usr/bin | jc --ls | jq '.[] | select(.size > 50000000)'
|
||||
{
|
||||
"filename": "emacs",
|
||||
"flags": "-r-xr-xr-x",
|
||||
"links": 1,
|
||||
"owner": "root",
|
||||
"group": "wheel",
|
||||
"size": 117164432,
|
||||
"date": "May 3 2019"
|
||||
}
|
||||
<a id="jc.parsers.ls.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
## info
|
||||
```python
|
||||
info(self, /, *args, **kwargs)
|
||||
```
|
||||
|
||||
## process
|
||||
```python
|
||||
process(proc_data)
|
||||
```
|
||||
|
||||
Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
"filename": string,
|
||||
"flags": string,
|
||||
"links": integer,
|
||||
"parent": string,
|
||||
"owner": string,
|
||||
"group": string,
|
||||
"size": integer,
|
||||
"date": string
|
||||
}
|
||||
]
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@@ -188,10 +134,14 @@ Main text parsing function
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) output preprocessed JSON if True
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, aix, freebsd
|
||||
|
||||
Version 1.11 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
116
docs/parsers/ls_s.md
Normal file
116
docs/parsers/ls_s.md
Normal file
@@ -0,0 +1,116 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.ls_s"></a>
|
||||
|
||||
# jc.parsers.ls\_s
|
||||
|
||||
jc - JSON Convert `ls` and `vdir` command output streaming
|
||||
parser
|
||||
|
||||
> This streaming parser outputs JSON Lines
|
||||
|
||||
Requires the `-l` option to be used on `ls`. If there are newline characters
|
||||
in the filename, then make sure to use the `-b` option on `ls`.
|
||||
|
||||
The `jc` `-qq` option can be used to ignore parsing errors. (e.g. filenames
|
||||
with newline characters, but `-b` was not used)
|
||||
|
||||
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):
|
||||
|
||||
$ ls | jc --ls-s
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
# result is an iterable object (generator)
|
||||
result = jc.parse('ls_s', ls_command_output.splitlines())
|
||||
for item in result:
|
||||
# do something
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.ls_s
|
||||
# result is an iterable object (generator)
|
||||
result = jc.parsers.ls_s.parse(ls_command_output.splitlines())
|
||||
for item in result:
|
||||
# do something
|
||||
|
||||
Schema:
|
||||
|
||||
{
|
||||
"filename": string,
|
||||
"flags": string,
|
||||
"links": integer,
|
||||
"parent": string,
|
||||
"owner": string,
|
||||
"group": string,
|
||||
"size": integer,
|
||||
"date": string,
|
||||
"epoch": integer, # [0]
|
||||
"epoch_utc": integer, # [1]
|
||||
|
||||
# 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] naive timestamp if date field exists and can be converted.
|
||||
[1] timezone aware timestamp if date field is in UTC and can
|
||||
be converted
|
||||
|
||||
Examples:
|
||||
|
||||
$ ls -l /usr/bin | jc --ls-s
|
||||
{"filename":"2to3-","flags":"-rwxr-xr-x","links":4,"owner":"root","...}
|
||||
{"filename":"2to3-2.7","link_to":"../../System/Library/Frameworks/P...}
|
||||
{"filename":"AssetCacheLocatorUtil","flags":"-rwxr-xr-x","links":1,...}
|
||||
...
|
||||
|
||||
$ ls -l /usr/bin | jc --ls-s -r
|
||||
{"filename":"2to3-","flags":"-rwxr-xr-x","links":"4","owner":"roo"..."}
|
||||
{"filename":"2to3-2.7","link_to":"../../System/Library/Frameworks/P...}
|
||||
{"filename":"AssetCacheLocatorUtil","flags":"-rwxr-xr-x","links":"1...}
|
||||
...
|
||||
|
||||
<a id="jc.parsers.ls_s.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
@add_jc_meta
|
||||
def parse(data, raw=False, quiet=False, ignore_exceptions=False)
|
||||
```
|
||||
|
||||
Main text parsing generator function. Returns an iterator 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
|
||||
|
||||
Yields:
|
||||
|
||||
Dictionary. Raw or processed structured data.
|
||||
|
||||
Returns:
|
||||
|
||||
Iterator object (generator)
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, aix, freebsd
|
||||
|
||||
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
@@ -1,236 +1,29 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.lsblk"></a>
|
||||
|
||||
# jc.parsers.lsblk
|
||||
jc - JSON CLI output utility lsblk Parser
|
||||
|
||||
Usage:
|
||||
jc - JSON Convert `lsblk` command output parser
|
||||
|
||||
specify --lsblk as the first argument if the piped input is coming from lsblk
|
||||
Usage (cli):
|
||||
|
||||
Compatibility:
|
||||
$ lsblk | jc --lsblk
|
||||
|
||||
'linux'
|
||||
or
|
||||
|
||||
Examples:
|
||||
$ jc lsblk
|
||||
|
||||
$ lsblk | jc --lsblk -p
|
||||
[
|
||||
{
|
||||
"name": "sda",
|
||||
"maj_min": "8:0",
|
||||
"rm": false,
|
||||
"size": "20G",
|
||||
"ro": false,
|
||||
"type": "disk",
|
||||
"mountpoint": null
|
||||
},
|
||||
{
|
||||
"name": "sda1",
|
||||
"maj_min": "8:1",
|
||||
"rm": false,
|
||||
"size": "1G",
|
||||
"ro": false,
|
||||
"type": "part",
|
||||
"mountpoint": "/boot"
|
||||
},
|
||||
...
|
||||
]
|
||||
Usage (module):
|
||||
|
||||
$ lsblk -o +KNAME,FSTYPE,LABEL,UUID,PARTLABEL,PARTUUID,RA,MODEL,SERIAL,STATE,OWNER,GROUP,MODE,ALIGNMENT,MIN-IO,OPT-IO,PHY-SEC,LOG-SEC,ROTA,SCHED,RQ-SIZE,DISC-ALN,DISC-GRAN,DISC-MAX,DISC-ZERO,WSAME,WWN,RAND,PKNAME,HCTL,TRAN,REV,VENDOR | jc --lsblk -p
|
||||
[
|
||||
{
|
||||
"name": "sda",
|
||||
"maj_min": "8:0",
|
||||
"rm": false,
|
||||
"size": "20G",
|
||||
"ro": false,
|
||||
"type": "disk",
|
||||
"mountpoint": null,
|
||||
"kname": "sda",
|
||||
"fstype": null,
|
||||
"label": null,
|
||||
"uuid": null,
|
||||
"partlabel": null,
|
||||
"partuuid": null,
|
||||
"ra": 4096,
|
||||
"model": "VMware Virtual S",
|
||||
"serial": null,
|
||||
"state": "running",
|
||||
"owner": "root",
|
||||
"group": "disk",
|
||||
"mode": "brw-rw----",
|
||||
"alignment": 0,
|
||||
"min_io": 512,
|
||||
"opt_io": 0,
|
||||
"phy_sec": 512,
|
||||
"log_sec": 512,
|
||||
"rota": true,
|
||||
"sched": "deadline",
|
||||
"rq_size": 128,
|
||||
"disc_aln": 0,
|
||||
"disc_gran": "0B",
|
||||
"disc_max": "0B",
|
||||
"disc_zero": false,
|
||||
"wsame": "32M",
|
||||
"wwn": null,
|
||||
"rand": true,
|
||||
"pkname": null,
|
||||
"hctl": "0:0:0:0",
|
||||
"tran": "spi",
|
||||
"rev": "1.0",
|
||||
"vendor": "VMware,"
|
||||
},
|
||||
{
|
||||
"name": "sda1",
|
||||
"maj_min": "8:1",
|
||||
"rm": false,
|
||||
"size": "1G",
|
||||
"ro": false,
|
||||
"type": "part",
|
||||
"mountpoint": "/boot",
|
||||
"kname": "sda1",
|
||||
"fstype": "xfs",
|
||||
"label": null,
|
||||
"uuid": "05d927bb-5875-49e3-ada1-7f46cb31c932",
|
||||
"partlabel": null,
|
||||
"partuuid": null,
|
||||
"ra": 4096,
|
||||
"model": null,
|
||||
"serial": null,
|
||||
"state": null,
|
||||
"owner": "root",
|
||||
"group": "disk",
|
||||
"mode": "brw-rw----",
|
||||
"alignment": 0,
|
||||
"min_io": 512,
|
||||
"opt_io": 0,
|
||||
"phy_sec": 512,
|
||||
"log_sec": 512,
|
||||
"rota": true,
|
||||
"sched": "deadline",
|
||||
"rq_size": 128,
|
||||
"disc_aln": 0,
|
||||
"disc_gran": "0B",
|
||||
"disc_max": "0B",
|
||||
"disc_zero": false,
|
||||
"wsame": "32M",
|
||||
"wwn": null,
|
||||
"rand": true,
|
||||
"pkname": "sda",
|
||||
"hctl": null,
|
||||
"tran": null,
|
||||
"rev": null,
|
||||
"vendor": null
|
||||
},
|
||||
...
|
||||
]
|
||||
import jc
|
||||
result = jc.parse('lsblk', lsblk_command_output)
|
||||
|
||||
$ lsblk -o +KNAME,FSTYPE,LABEL,UUID,PARTLABEL,PARTUUID,RA,MODEL,SERIAL,STATE,OWNER,GROUP,MODE,ALIGNMENT,MIN-IO,OPT-IO,PHY-SEC,LOG-SEC,ROTA,SCHED,RQ-SIZE,DISC-ALN,DISC-GRAN,DISC-MAX,DISC-ZERO,WSAME,WWN,RAND,PKNAME,HCTL,TRAN,REV,VENDOR | jc --lsblk -p -r
|
||||
[
|
||||
{
|
||||
"name": "sda",
|
||||
"maj_min": "8:0",
|
||||
"rm": "0",
|
||||
"size": "20G",
|
||||
"ro": "0",
|
||||
"type": "disk",
|
||||
"mountpoint": null,
|
||||
"kname": "sda",
|
||||
"fstype": null,
|
||||
"label": null,
|
||||
"uuid": null,
|
||||
"partlabel": null,
|
||||
"partuuid": null,
|
||||
"ra": "4096",
|
||||
"model": "VMware Virtual S",
|
||||
"serial": null,
|
||||
"state": "running",
|
||||
"owner": "root",
|
||||
"group": "disk",
|
||||
"mode": "brw-rw----",
|
||||
"alignment": "0",
|
||||
"min_io": "512",
|
||||
"opt_io": "0",
|
||||
"phy_sec": "512",
|
||||
"log_sec": "512",
|
||||
"rota": "1",
|
||||
"sched": "deadline",
|
||||
"rq_size": "128",
|
||||
"disc_aln": "0",
|
||||
"disc_gran": "0B",
|
||||
"disc_max": "0B",
|
||||
"disc_zero": "0",
|
||||
"wsame": "32M",
|
||||
"wwn": null,
|
||||
"rand": "1",
|
||||
"pkname": null,
|
||||
"hctl": "0:0:0:0",
|
||||
"tran": "spi",
|
||||
"rev": "1.0",
|
||||
"vendor": "VMware,"
|
||||
},
|
||||
{
|
||||
"name": "sda1",
|
||||
"maj_min": "8:1",
|
||||
"rm": "0",
|
||||
"size": "1G",
|
||||
"ro": "0",
|
||||
"type": "part",
|
||||
"mountpoint": "/boot",
|
||||
"kname": "sda1",
|
||||
"fstype": "xfs",
|
||||
"label": null,
|
||||
"uuid": "05d927bb-5875-49e3-ada1-7f46cb31c932",
|
||||
"partlabel": null,
|
||||
"partuuid": null,
|
||||
"ra": "4096",
|
||||
"model": null,
|
||||
"serial": null,
|
||||
"state": null,
|
||||
"owner": "root",
|
||||
"group": "disk",
|
||||
"mode": "brw-rw----",
|
||||
"alignment": "0",
|
||||
"min_io": "512",
|
||||
"opt_io": "0",
|
||||
"phy_sec": "512",
|
||||
"log_sec": "512",
|
||||
"rota": "1",
|
||||
"sched": "deadline",
|
||||
"rq_size": "128",
|
||||
"disc_aln": "0",
|
||||
"disc_gran": "0B",
|
||||
"disc_max": "0B",
|
||||
"disc_zero": "0",
|
||||
"wsame": "32M",
|
||||
"wwn": null,
|
||||
"rand": "1",
|
||||
"pkname": "sda",
|
||||
"hctl": null,
|
||||
"tran": null,
|
||||
"rev": null,
|
||||
"vendor": null
|
||||
},
|
||||
...
|
||||
]
|
||||
or
|
||||
|
||||
## info
|
||||
```python
|
||||
info(self, /, *args, **kwargs)
|
||||
```
|
||||
import jc.parsers.lsblk
|
||||
result = jc.parsers.lsblk.parse(lsblk_command_output)
|
||||
|
||||
## process
|
||||
```python
|
||||
process(proc_data)
|
||||
```
|
||||
|
||||
Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
@@ -277,9 +70,221 @@ Returns:
|
||||
}
|
||||
]
|
||||
|
||||
## parse
|
||||
Examples:
|
||||
|
||||
$ lsblk | jc --lsblk -p
|
||||
[
|
||||
{
|
||||
"name": "sda",
|
||||
"maj_min": "8:0",
|
||||
"rm": false,
|
||||
"size": "20G",
|
||||
"ro": false,
|
||||
"type": "disk",
|
||||
"mountpoint": null
|
||||
},
|
||||
{
|
||||
"name": "sda1",
|
||||
"maj_min": "8:1",
|
||||
"rm": false,
|
||||
"size": "1G",
|
||||
"ro": false,
|
||||
"type": "part",
|
||||
"mountpoint": "/boot"
|
||||
},
|
||||
...
|
||||
]
|
||||
|
||||
$ lsblk -o +KNAME,FSTYPE,LABEL,UUID,PARTLABEL,PARTUUID,RA,MODEL,SERIAL,\\
|
||||
STATE,OWNER,GROUP,MODE,ALIGNMENT,MIN-IO,OPT-IO,PHY-SEC,LOG-SEC,ROTA,\\
|
||||
SCHED,RQ-SIZE,DISC-ALN,DISC-GRAN,DISC-MAX,DISC-ZERO,WSAME,WWN,RAND,\\
|
||||
PKNAME,HCTL,TRAN,REV,VENDOR | jc --lsblk -p
|
||||
[
|
||||
{
|
||||
"name": "sda",
|
||||
"maj_min": "8:0",
|
||||
"rm": false,
|
||||
"size": "20G",
|
||||
"ro": false,
|
||||
"type": "disk",
|
||||
"mountpoint": null,
|
||||
"kname": "sda",
|
||||
"fstype": null,
|
||||
"label": null,
|
||||
"uuid": null,
|
||||
"partlabel": null,
|
||||
"partuuid": null,
|
||||
"ra": 4096,
|
||||
"model": "VMware Virtual S",
|
||||
"serial": null,
|
||||
"state": "running",
|
||||
"owner": "root",
|
||||
"group": "disk",
|
||||
"mode": "brw-rw----",
|
||||
"alignment": 0,
|
||||
"min_io": 512,
|
||||
"opt_io": 0,
|
||||
"phy_sec": 512,
|
||||
"log_sec": 512,
|
||||
"rota": true,
|
||||
"sched": "deadline",
|
||||
"rq_size": 128,
|
||||
"disc_aln": 0,
|
||||
"disc_gran": "0B",
|
||||
"disc_max": "0B",
|
||||
"disc_zero": false,
|
||||
"wsame": "32M",
|
||||
"wwn": null,
|
||||
"rand": true,
|
||||
"pkname": null,
|
||||
"hctl": "0:0:0:0",
|
||||
"tran": "spi",
|
||||
"rev": "1.0",
|
||||
"vendor": "VMware,"
|
||||
},
|
||||
{
|
||||
"name": "sda1",
|
||||
"maj_min": "8:1",
|
||||
"rm": false,
|
||||
"size": "1G",
|
||||
"ro": false,
|
||||
"type": "part",
|
||||
"mountpoint": "/boot",
|
||||
"kname": "sda1",
|
||||
"fstype": "xfs",
|
||||
"label": null,
|
||||
"uuid": "05d927bb-5875-49e3-ada1-7f46cb31c932",
|
||||
"partlabel": null,
|
||||
"partuuid": null,
|
||||
"ra": 4096,
|
||||
"model": null,
|
||||
"serial": null,
|
||||
"state": null,
|
||||
"owner": "root",
|
||||
"group": "disk",
|
||||
"mode": "brw-rw----",
|
||||
"alignment": 0,
|
||||
"min_io": 512,
|
||||
"opt_io": 0,
|
||||
"phy_sec": 512,
|
||||
"log_sec": 512,
|
||||
"rota": true,
|
||||
"sched": "deadline",
|
||||
"rq_size": 128,
|
||||
"disc_aln": 0,
|
||||
"disc_gran": "0B",
|
||||
"disc_max": "0B",
|
||||
"disc_zero": false,
|
||||
"wsame": "32M",
|
||||
"wwn": null,
|
||||
"rand": true,
|
||||
"pkname": "sda",
|
||||
"hctl": null,
|
||||
"tran": null,
|
||||
"rev": null,
|
||||
"vendor": null
|
||||
},
|
||||
...
|
||||
]
|
||||
|
||||
$ lsblk -o +KNAME,FSTYPE,LABEL,UUID,PARTLABEL,PARTUUID,RA,MODEL,SERIAL,\\
|
||||
STATE,OWNER,GROUP,MODE,ALIGNMENT,MIN-IO,OPT-IO,PHY-SEC,LOG-SEC,ROTA,\\
|
||||
SCHED,RQ-SIZE,DISC-ALN,DISC-GRAN,DISC-MAX,DISC-ZERO,WSAME,WWN,RAND,\\
|
||||
PKNAME,HCTL,TRAN,REV,VENDOR | jc --lsblk -p -r
|
||||
[
|
||||
{
|
||||
"name": "sda",
|
||||
"maj_min": "8:0",
|
||||
"rm": "0",
|
||||
"size": "20G",
|
||||
"ro": "0",
|
||||
"type": "disk",
|
||||
"mountpoint": null,
|
||||
"kname": "sda",
|
||||
"fstype": null,
|
||||
"label": null,
|
||||
"uuid": null,
|
||||
"partlabel": null,
|
||||
"partuuid": null,
|
||||
"ra": "4096",
|
||||
"model": "VMware Virtual S",
|
||||
"serial": null,
|
||||
"state": "running",
|
||||
"owner": "root",
|
||||
"group": "disk",
|
||||
"mode": "brw-rw----",
|
||||
"alignment": "0",
|
||||
"min_io": "512",
|
||||
"opt_io": "0",
|
||||
"phy_sec": "512",
|
||||
"log_sec": "512",
|
||||
"rota": "1",
|
||||
"sched": "deadline",
|
||||
"rq_size": "128",
|
||||
"disc_aln": "0",
|
||||
"disc_gran": "0B",
|
||||
"disc_max": "0B",
|
||||
"disc_zero": "0",
|
||||
"wsame": "32M",
|
||||
"wwn": null,
|
||||
"rand": "1",
|
||||
"pkname": null,
|
||||
"hctl": "0:0:0:0",
|
||||
"tran": "spi",
|
||||
"rev": "1.0",
|
||||
"vendor": "VMware,"
|
||||
},
|
||||
{
|
||||
"name": "sda1",
|
||||
"maj_min": "8:1",
|
||||
"rm": "0",
|
||||
"size": "1G",
|
||||
"ro": "0",
|
||||
"type": "part",
|
||||
"mountpoint": "/boot",
|
||||
"kname": "sda1",
|
||||
"fstype": "xfs",
|
||||
"label": null,
|
||||
"uuid": "05d927bb-5875-49e3-ada1-7f46cb31c932",
|
||||
"partlabel": null,
|
||||
"partuuid": null,
|
||||
"ra": "4096",
|
||||
"model": null,
|
||||
"serial": null,
|
||||
"state": null,
|
||||
"owner": "root",
|
||||
"group": "disk",
|
||||
"mode": "brw-rw----",
|
||||
"alignment": "0",
|
||||
"min_io": "512",
|
||||
"opt_io": "0",
|
||||
"phy_sec": "512",
|
||||
"log_sec": "512",
|
||||
"rota": "1",
|
||||
"sched": "deadline",
|
||||
"rq_size": "128",
|
||||
"disc_aln": "0",
|
||||
"disc_gran": "0B",
|
||||
"disc_max": "0B",
|
||||
"disc_zero": "0",
|
||||
"wsame": "32M",
|
||||
"wwn": null,
|
||||
"rand": "1",
|
||||
"pkname": "sda",
|
||||
"hctl": null,
|
||||
"tran": null,
|
||||
"rev": null,
|
||||
"vendor": null
|
||||
},
|
||||
...
|
||||
]
|
||||
|
||||
<a id="jc.parsers.lsblk.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@@ -287,10 +292,14 @@ Main text parsing function
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) output preprocessed JSON if True
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Version 1.8 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
@@ -1,13 +1,40 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.lsmod"></a>
|
||||
|
||||
# jc.parsers.lsmod
|
||||
jc - JSON CLI output utility lsmod Parser
|
||||
|
||||
Usage:
|
||||
jc - JSON Convert `lsmod` command output parser
|
||||
|
||||
specify --lsmod as the first argument if the piped input is coming from lsmod
|
||||
Usage (cli):
|
||||
|
||||
Compatibility:
|
||||
$ lsmod | jc --lsmod
|
||||
|
||||
'linux'
|
||||
or
|
||||
|
||||
$ jc lsmod
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('lsmod', lsmod_command_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.lsmod
|
||||
result = jc.parsers.lsmod.parse(lsmod_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"module": string,
|
||||
"size": integer,
|
||||
"used": integer,
|
||||
"by": [
|
||||
string
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
@@ -103,40 +130,12 @@ Examples:
|
||||
...
|
||||
]
|
||||
|
||||
## info
|
||||
<a id="jc.parsers.lsmod.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
info(self, /, *args, **kwargs)
|
||||
```
|
||||
|
||||
## process
|
||||
```python
|
||||
process(proc_data)
|
||||
```
|
||||
|
||||
Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
"module": string,
|
||||
"size": integer,
|
||||
"used": integer,
|
||||
"by": [
|
||||
string
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@@ -144,10 +143,14 @@ Main text parsing function
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) output preprocessed JSON if True
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
@@ -1,13 +1,44 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.lsof"></a>
|
||||
|
||||
# jc.parsers.lsof
|
||||
jc - JSON CLI output utility lsof Parser
|
||||
|
||||
Usage:
|
||||
jc - JSON Convert `lsof` command output parser
|
||||
|
||||
specify --lsof as the first argument if the piped input is coming from lsof
|
||||
Usage (cli):
|
||||
|
||||
Compatibility:
|
||||
$ lsof | jc --lsof
|
||||
|
||||
'linux'
|
||||
or
|
||||
|
||||
$ jc lsof
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('lsof', lsof_command_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.lsof
|
||||
result = jc.parsers.lsof.parse(lsof_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"command": string,
|
||||
"pid": integer,
|
||||
"tid": integer,
|
||||
"user": string,
|
||||
"fd": string,
|
||||
"type": string,
|
||||
"device": string,
|
||||
"size_off": integer,
|
||||
"node": integer,
|
||||
"name": string
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
@@ -93,44 +124,12 @@ Examples:
|
||||
...
|
||||
]
|
||||
|
||||
## info
|
||||
<a id="jc.parsers.lsof.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
info(self, /, *args, **kwargs)
|
||||
```
|
||||
|
||||
## process
|
||||
```python
|
||||
process(proc_data)
|
||||
```
|
||||
|
||||
Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
"command": string,
|
||||
"pid": integer,
|
||||
"tid": integer,
|
||||
"user": string,
|
||||
"fd": string,
|
||||
"type": string,
|
||||
"device": string,
|
||||
"size_off": integer,
|
||||
"node": integer,
|
||||
"name": string
|
||||
}
|
||||
]
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@@ -138,10 +137,14 @@ Main text parsing function
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) output preprocessed JSON if True
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
292
docs/parsers/lsusb.md
Normal file
292
docs/parsers/lsusb.md
Normal file
@@ -0,0 +1,292 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.lsusb"></a>
|
||||
|
||||
# jc.parsers.lsusb
|
||||
|
||||
jc - JSON Convert `lsusb` command output parser
|
||||
|
||||
Supports the `-v` option or no options.
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ lsusb -v | jc --lsusb
|
||||
|
||||
or
|
||||
|
||||
$ jc lsusb -v
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('lsusb', lsusb_command_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.lsusb
|
||||
result = jc.parsers.lsusb.parse(lsusb_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
Note: <item> object keynames are assigned directly from the lsusb
|
||||
output. If there are duplicate <item> names in a section, only the
|
||||
last one is converted.
|
||||
|
||||
[
|
||||
{
|
||||
"bus": string,
|
||||
"device": string,
|
||||
"id": string,
|
||||
"description": string,
|
||||
"device_descriptor": {
|
||||
"<item>": {
|
||||
"value": string,
|
||||
"description": string,
|
||||
"attributes": [
|
||||
string
|
||||
]
|
||||
},
|
||||
"configuration_descriptor": {
|
||||
"<item>": {
|
||||
"value": string,
|
||||
"description": string,
|
||||
"attributes": [
|
||||
string
|
||||
]
|
||||
},
|
||||
"interface_association": {
|
||||
"<item>": {
|
||||
"value": string,
|
||||
"description": string,
|
||||
"attributes": [
|
||||
string
|
||||
]
|
||||
}
|
||||
},
|
||||
"interface_descriptors": [
|
||||
{
|
||||
"<item>": {
|
||||
"value": string,
|
||||
"description": string,
|
||||
"attributes": [
|
||||
string
|
||||
]
|
||||
},
|
||||
"cdc_header": {
|
||||
"<item>": {
|
||||
"value": string,
|
||||
"description": string,
|
||||
"attributes": [
|
||||
string
|
||||
]
|
||||
}
|
||||
},
|
||||
"cdc_call_management": {
|
||||
"<item>": {
|
||||
"value": string,
|
||||
"description": string,
|
||||
"attributes": [
|
||||
string
|
||||
]
|
||||
}
|
||||
},
|
||||
"cdc_acm": {
|
||||
"<item>": {
|
||||
"value": string,
|
||||
"description": string,
|
||||
"attributes": [
|
||||
string
|
||||
]
|
||||
}
|
||||
},
|
||||
"cdc_union": {
|
||||
"<item>": {
|
||||
"value": string,
|
||||
"description": string,
|
||||
"attributes": [
|
||||
string
|
||||
]
|
||||
}
|
||||
},
|
||||
"endpoint_descriptors": [
|
||||
{
|
||||
"<item>": {
|
||||
"value": string,
|
||||
"description": string,
|
||||
"attributes": [
|
||||
string
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"hub_descriptor": {
|
||||
"<item>": {
|
||||
"value": string,
|
||||
"description": string,
|
||||
"attributes": [
|
||||
string,
|
||||
]
|
||||
},
|
||||
"hub_port_status": {
|
||||
"<item>": {
|
||||
"value": string,
|
||||
"attributes": [
|
||||
string
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"device_status": {
|
||||
"value": string,
|
||||
"description": string
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
$ lsusb -v | jc --lsusb -p
|
||||
[
|
||||
{
|
||||
"bus": "002",
|
||||
"device": "001",
|
||||
"id": "1d6b:0001",
|
||||
"description": "Linux Foundation 1.1 root hub",
|
||||
"device_descriptor": {
|
||||
"bLength": {
|
||||
"value": "18"
|
||||
},
|
||||
"bDescriptorType": {
|
||||
"value": "1"
|
||||
},
|
||||
"bcdUSB": {
|
||||
"value": "1.10"
|
||||
},
|
||||
...
|
||||
"bNumConfigurations": {
|
||||
"value": "1"
|
||||
},
|
||||
"configuration_descriptor": {
|
||||
"bLength": {
|
||||
"value": "9"
|
||||
},
|
||||
...
|
||||
"iConfiguration": {
|
||||
"value": "0"
|
||||
},
|
||||
"bmAttributes": {
|
||||
"value": "0xe0",
|
||||
"attributes": [
|
||||
"Self Powered",
|
||||
"Remote Wakeup"
|
||||
]
|
||||
},
|
||||
"MaxPower": {
|
||||
"description": "0mA"
|
||||
},
|
||||
"interface_descriptors": [
|
||||
{
|
||||
"bLength": {
|
||||
"value": "9"
|
||||
},
|
||||
...
|
||||
"bInterfaceProtocol": {
|
||||
"value": "0",
|
||||
"description": "Full speed (or root) hub"
|
||||
},
|
||||
"iInterface": {
|
||||
"value": "0"
|
||||
},
|
||||
"endpoint_descriptors": [
|
||||
{
|
||||
"bLength": {
|
||||
"value": "7"
|
||||
},
|
||||
...
|
||||
"bmAttributes": {
|
||||
"value": "3",
|
||||
"attributes": [
|
||||
"Transfer Type Interrupt",
|
||||
"Synch Type None",
|
||||
"Usage Type Data"
|
||||
]
|
||||
},
|
||||
"wMaxPacketSize": {
|
||||
"value": "0x0002",
|
||||
"description": "1x 2 bytes"
|
||||
},
|
||||
"bInterval": {
|
||||
"value": "255"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"hub_descriptor": {
|
||||
"bLength": {
|
||||
"value": "9"
|
||||
},
|
||||
...
|
||||
"wHubCharacteristic": {
|
||||
"value": "0x000a",
|
||||
"attributes": [
|
||||
"No power switching (usb 1.0)",
|
||||
"Per-port overcurrent protection"
|
||||
]
|
||||
},
|
||||
...
|
||||
"hub_port_status": {
|
||||
"Port 1": {
|
||||
"value": "0000.0103",
|
||||
"attributes": [
|
||||
"power",
|
||||
"enable",
|
||||
"connect"
|
||||
]
|
||||
},
|
||||
"Port 2": {
|
||||
"value": "0000.0103",
|
||||
"attributes": [
|
||||
"power",
|
||||
"enable",
|
||||
"connect"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"device_status": {
|
||||
"value": "0x0001",
|
||||
"description": "Self Powered"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
<a id="jc.parsers.lsusb.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 Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
@@ -1,13 +1,40 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.mount"></a>
|
||||
|
||||
# jc.parsers.mount
|
||||
jc - JSON CLI output utility mount Parser
|
||||
|
||||
Usage:
|
||||
jc - JSON Convert `mount` command output parser
|
||||
|
||||
specify --mount as the first argument if the piped input is coming from mount
|
||||
Usage (cli):
|
||||
|
||||
Compatibility:
|
||||
$ mount | jc --mount
|
||||
|
||||
'linux', 'darwin', 'freebsd'
|
||||
or
|
||||
|
||||
$ jc mount
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('mount', mount_command_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.mount
|
||||
result = jc.parsers.mount.parse(mount_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"filesystem": string,
|
||||
"mount_point": string,
|
||||
"type": string,
|
||||
"access": [
|
||||
string
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
Example:
|
||||
|
||||
@@ -53,40 +80,12 @@ Example:
|
||||
...
|
||||
]
|
||||
|
||||
## info
|
||||
<a id="jc.parsers.mount.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
info(self, /, *args, **kwargs)
|
||||
```
|
||||
|
||||
## process
|
||||
```python
|
||||
process(proc_data)
|
||||
```
|
||||
|
||||
Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
"filesystem": string,
|
||||
"mount_point": string,
|
||||
"type": string,
|
||||
"access": [
|
||||
string
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@@ -94,10 +93,14 @@ Main text parsing function
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) output preprocessed JSON if True
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, freebsd
|
||||
|
||||
Version 1.7 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
@@ -1,18 +1,133 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.netstat"></a>
|
||||
|
||||
# jc.parsers.netstat
|
||||
jc - JSON CLI output utility netstat Parser
|
||||
|
||||
Usage:
|
||||
|
||||
Specify --netstat as the first argument if the piped input is coming from netstat
|
||||
jc - JSON Convert `netstat` command output parser
|
||||
|
||||
Caveats:
|
||||
- Use of multiple `l` options is not supported on OSX (e.g. `netstat -rlll`)
|
||||
- Use of the `A` option is not supported on OSX when using the `r` option
|
||||
(e.g. `netstat -rA`)
|
||||
|
||||
- Use of multiple 'l' options is not supported on OSX (e.g. 'netstat -rlll')
|
||||
- Use of the 'A' option is not supported on OSX when using the 'r' option (e.g. netstat -rA)
|
||||
Usage (cli):
|
||||
|
||||
Compatibility:
|
||||
$ netstat | jc --netstat
|
||||
|
||||
'linux', 'darwin', 'freebsd'
|
||||
or
|
||||
|
||||
$ jc netstat
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('netstat', netstat_command_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.netstat
|
||||
result = jc.parsers.netstat.parse(netstat_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"proto": string,
|
||||
"recv_q": integer,
|
||||
"send_q": integer,
|
||||
"transport_protocol" string,
|
||||
"network_protocol": string,
|
||||
"local_address": string,
|
||||
"local_port": string,
|
||||
"local_port_num": integer,
|
||||
"foreign_address": string,
|
||||
"foreign_port": string,
|
||||
"foreign_port_num": integer,
|
||||
"state": string,
|
||||
"program_name": string,
|
||||
"pid": integer,
|
||||
"user": string,
|
||||
"security_context": string,
|
||||
"refcnt": integer,
|
||||
"flags": string,
|
||||
"type": string,
|
||||
"inode": integer,
|
||||
"path": string,
|
||||
"kind": string,
|
||||
"address": string,
|
||||
"unix_inode": string,
|
||||
"conn": string,
|
||||
"refs": string,
|
||||
"nextref": string,
|
||||
"name": string,
|
||||
"unit": integer,
|
||||
"vendor": integer,
|
||||
"class": integer,
|
||||
"subcla": integer,
|
||||
"unix_flags": integer,
|
||||
"pcbcount": integer,
|
||||
"rcvbuf": integer,
|
||||
"sndbuf": integer,
|
||||
"rxbytes": integer,
|
||||
"txbytes": integer,
|
||||
"destination": string,
|
||||
"gateway": string,
|
||||
"route_flags": string,
|
||||
"route_flags_pretty": [
|
||||
string,
|
||||
]
|
||||
"route_refs": integer,
|
||||
"use": integer,
|
||||
"mtu": integer,
|
||||
"expire": string,
|
||||
"genmask": string,
|
||||
"mss": integer,
|
||||
"window": integer,
|
||||
"irtt": integer,
|
||||
"iface": string,
|
||||
"metric": integer,
|
||||
"network": string,
|
||||
"address": string,
|
||||
"ipkts": integer, # - = null
|
||||
"ierrs": integer, # - = null
|
||||
"idrop": integer, # - = null
|
||||
"opkts": integer, # - = null
|
||||
"oerrs": integer, # - = null
|
||||
"coll": integer, # - = null
|
||||
"rx_ok": integer,
|
||||
"rx_err": integer,
|
||||
"rx_drp": integer,
|
||||
"rx_ovr": integer,
|
||||
"tx_ok": integer,
|
||||
"tx_err": integer,
|
||||
"tx_drp": integer,
|
||||
"tx_ovr": integer,
|
||||
"flg": string,
|
||||
"ibytes": integer,
|
||||
"obytes": integer,
|
||||
"r_mbuf": integer,
|
||||
"s_mbuf": integer,
|
||||
"r_clus": integer,
|
||||
"s_clus": integer,
|
||||
"r_hiwa": integer,
|
||||
"s_hiwa": integer,
|
||||
"r_lowa": integer,
|
||||
"s_lowa": integer,
|
||||
"r_bcnt": integer,
|
||||
"s_bcnt": integer,
|
||||
"r_bmax": integer,
|
||||
"s_bmax": integer,
|
||||
"rexmit": integer,
|
||||
"ooorcv": integer,
|
||||
"0_win": integer,
|
||||
"rexmt": float,
|
||||
"persist": float,
|
||||
"keep": float,
|
||||
"2msl": float,
|
||||
"delack": float,
|
||||
"rcvtime": float,
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
@@ -245,128 +360,12 @@ Examples:
|
||||
}
|
||||
]
|
||||
|
||||
## info
|
||||
<a id="jc.parsers.netstat.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
info(self, /, *args, **kwargs)
|
||||
```
|
||||
|
||||
## process
|
||||
```python
|
||||
process(proc_data)
|
||||
```
|
||||
|
||||
Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
"proto": string,
|
||||
"recv_q": integer,
|
||||
"send_q": integer,
|
||||
"transport_protocol" string,
|
||||
"network_protocol": string,
|
||||
"local_address": string,
|
||||
"local_port": string,
|
||||
"local_port_num": integer,
|
||||
"foreign_address": string,
|
||||
"foreign_port": string,
|
||||
"foreign_port_num": integer,
|
||||
"state": string,
|
||||
"program_name": string,
|
||||
"pid": integer,
|
||||
"user": string,
|
||||
"security_context": string,
|
||||
"refcnt": integer,
|
||||
"flags": string,
|
||||
"type": string,
|
||||
"inode": integer,
|
||||
"path": string,
|
||||
"kind": string,
|
||||
"address": string,
|
||||
"unix_inode": string,
|
||||
"conn": string,
|
||||
"refs": string,
|
||||
"nextref": string,
|
||||
"name": string,
|
||||
"unit": integer,
|
||||
"vendor": integer,
|
||||
"class": integer,
|
||||
"subcla": integer,
|
||||
"unix_flags": integer,
|
||||
"pcbcount": integer,
|
||||
"rcvbuf": integer,
|
||||
"sndbuf": integer,
|
||||
"rxbytes": integer,
|
||||
"txbytes": integer,
|
||||
"destination": string,
|
||||
"gateway": string,
|
||||
"route_flags": string,
|
||||
"route_flags_pretty": [
|
||||
string,
|
||||
]
|
||||
"route_refs": integer,
|
||||
"use": integer,
|
||||
"mtu": integer,
|
||||
"expire": string,
|
||||
"genmask": string,
|
||||
"mss": integer,
|
||||
"window": integer,
|
||||
"irtt": integer,
|
||||
"iface": string,
|
||||
"metric": integer,
|
||||
"network": string,
|
||||
"address": string,
|
||||
"ipkts": integer, - = null
|
||||
"ierrs": integer, - = null
|
||||
"idrop": integer, - = null
|
||||
"opkts": integer, - = null
|
||||
"oerrs": integer, - = null
|
||||
"coll": integer, - = null
|
||||
"rx_ok": integer,
|
||||
"rx_err": integer,
|
||||
"rx_drp": integer,
|
||||
"rx_ovr": integer,
|
||||
"tx_ok": integer,
|
||||
"tx_err": integer,
|
||||
"tx_drp": integer,
|
||||
"tx_ovr": integer,
|
||||
"flg": string,
|
||||
"ibytes": integer,
|
||||
"obytes": integer,
|
||||
"r_mbuf": integer,
|
||||
"s_mbuf": integer,
|
||||
"r_clus": integer,
|
||||
"s_clus": integer,
|
||||
"r_hiwa": integer,
|
||||
"s_hiwa": integer,
|
||||
"r_lowa": integer,
|
||||
"s_lowa": integer,
|
||||
"r_bcnt": integer,
|
||||
"s_bcnt": integer,
|
||||
"r_bmax": integer,
|
||||
"s_bmax": integer,
|
||||
"rexmit": integer,
|
||||
"ooorcv": integer,
|
||||
"0_win": integer,
|
||||
"rexmt": float,
|
||||
"persist": float,
|
||||
"keep": float,
|
||||
"2msl": float,
|
||||
"delack": float,
|
||||
"rcvtime": float,
|
||||
}
|
||||
]
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@@ -374,10 +373,14 @@ Main text parsing function
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) output preprocessed JSON if True
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, freebsd
|
||||
|
||||
Version 1.12 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
176
docs/parsers/nmcli.md
Normal file
176
docs/parsers/nmcli.md
Normal file
@@ -0,0 +1,176 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.nmcli"></a>
|
||||
|
||||
# jc.parsers.nmcli
|
||||
|
||||
jc - JSON Convert `nmcli` command output parser
|
||||
|
||||
Supports the following `nmcli` subcommands:
|
||||
- `nmcli general`
|
||||
- `nmcli general permissions`
|
||||
- `nmcli connection`
|
||||
- `nmcli connection show <device_name>`
|
||||
- `nmcli device`
|
||||
- `nmcli device show`
|
||||
- `nmcli device show <device_name>`
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ nmcli device show lo | jc --nmcli
|
||||
|
||||
or
|
||||
|
||||
$ jc nmcli device show lo
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('nmcli', nmcli_command_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.nmcli
|
||||
result = jc.parsers.nmcli.parse(nmcli_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
Because there are so many options, the schema is not strictly defined.
|
||||
Integer and Float value conversions are attempted and the original
|
||||
values are kept if they fail. If you don't want automatic conversion,
|
||||
then use the -r or raw=True option to disable it.
|
||||
|
||||
The structure is flat, for the most part, but there are a couple of
|
||||
"well-known" keys that are further parsed into objects for convenience.
|
||||
These are documented below.
|
||||
|
||||
[
|
||||
{
|
||||
"<key>": string/integer/float, [0]
|
||||
"dhcp4_option_x": {
|
||||
"name": string,
|
||||
"value": string/integer/float,
|
||||
},
|
||||
"dhcp6_option_x": {
|
||||
"name": string,
|
||||
"value": string/integer/float,
|
||||
},
|
||||
"ip4_route_x": {
|
||||
"dst": string,
|
||||
"nh": string,
|
||||
"mt": integer
|
||||
},
|
||||
"ip6_route_x": {
|
||||
"dst": string,
|
||||
"nh": string,
|
||||
"mt": integer,
|
||||
"table": integer
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
[0] all values of `---` are converted to null
|
||||
|
||||
Examples:
|
||||
|
||||
$ nmcli connection show ens33 | jc --nmcli -p
|
||||
[
|
||||
{
|
||||
"connection_id": "ens33",
|
||||
"connection_uuid": "d92ece08-9e02-47d5-b2d2-92c80e155744",
|
||||
"connection_stable_id": null,
|
||||
"connection_type": "802-3-ethernet",
|
||||
"connection_interface_name": "ens33",
|
||||
"connection_autoconnect": "yes",
|
||||
...
|
||||
"ip4_address_1": "192.168.71.180/24",
|
||||
"ip4_gateway": "192.168.71.2",
|
||||
"ip4_route_1": {
|
||||
"dst": "0.0.0.0/0",
|
||||
"nh": "192.168.71.2",
|
||||
"mt": 100
|
||||
},
|
||||
"ip4_route_2": {
|
||||
"dst": "192.168.71.0/24",
|
||||
"nh": "0.0.0.0",
|
||||
"mt": 100
|
||||
},
|
||||
"ip4_dns_1": "192.168.71.2",
|
||||
"ip4_domain_1": "localdomain",
|
||||
"dhcp4_option_1": {
|
||||
"name": "broadcast_address",
|
||||
"value": "192.168.71.255"
|
||||
},
|
||||
...
|
||||
"ip6_address_1": "fe80::c1cb:715d:bc3e:b8a0/64",
|
||||
"ip6_gateway": null,
|
||||
"ip6_route_1": {
|
||||
"dst": "fe80::/64",
|
||||
"nh": "::",
|
||||
"mt": 100
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
$ nmcli connection show ens33 | jc --nmcli -p -r
|
||||
[
|
||||
{
|
||||
"connection_id": "ens33",
|
||||
"connection_uuid": "d92ece08-9e02-47d5-b2d2-92c80e155744",
|
||||
"connection_stable_id": null,
|
||||
"connection_type": "802-3-ethernet",
|
||||
"connection_interface_name": "ens33",
|
||||
"connection_autoconnect": "yes",
|
||||
...
|
||||
"ip4_address_1": "192.168.71.180/24",
|
||||
"ip4_gateway": "192.168.71.2",
|
||||
"ip4_route_1": {
|
||||
"dst": "0.0.0.0/0",
|
||||
"nh": "192.168.71.2",
|
||||
"mt": "100"
|
||||
},
|
||||
"ip4_route_2": {
|
||||
"dst": "192.168.71.0/24",
|
||||
"nh": "0.0.0.0",
|
||||
"mt": "100"
|
||||
},
|
||||
"ip4_dns_1": "192.168.71.2",
|
||||
"ip4_domain_1": "localdomain",
|
||||
"dhcp4_option_1": {
|
||||
"name": "broadcast_address",
|
||||
"value": "192.168.71.255"
|
||||
},
|
||||
...
|
||||
"ip6_address_1": "fe80::c1cb:715d:bc3e:b8a0/64",
|
||||
"ip6_gateway": null,
|
||||
"ip6_route_1": {
|
||||
"dst": "fe80::/64",
|
||||
"nh": "::",
|
||||
"mt": "100"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
<a id="jc.parsers.nmcli.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
|
||||
|
||||
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
@@ -1,13 +1,45 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.ntpq"></a>
|
||||
|
||||
# jc.parsers.ntpq
|
||||
jc - JSON CLI output utility ntpq Parser
|
||||
|
||||
Usage:
|
||||
jc - JSON Convert `ntpq -p` command output parser
|
||||
|
||||
specify --ntpq as the first argument if the piped input is coming from ntpq -p
|
||||
Usage (cli):
|
||||
|
||||
Compatibility:
|
||||
$ ntpq -p | jc --ntpq
|
||||
|
||||
'linux', 'freebsd'
|
||||
or
|
||||
|
||||
$ jc ntpq -p
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('ntpq', ntpq_command_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.ntpq
|
||||
result = jc.parsers.ntpq.parse(ntpq_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"state": string, # space/~ converted to null
|
||||
"remote": string,
|
||||
"refid": string,
|
||||
"st": integer,
|
||||
"t": string,
|
||||
"when": integer, # - converted to null
|
||||
"poll": integer,
|
||||
"reach": integer,
|
||||
"delay": float,
|
||||
"offset": float,
|
||||
"jitter": float
|
||||
},
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
@@ -179,46 +211,12 @@ Examples:
|
||||
}
|
||||
]
|
||||
|
||||
## info
|
||||
<a id="jc.parsers.ntpq.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
info(self, /, *args, **kwargs)
|
||||
```
|
||||
|
||||
## process
|
||||
```python
|
||||
process(proc_data)
|
||||
```
|
||||
|
||||
Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
"state": string, # space/~ converted to null
|
||||
"remote": string,
|
||||
"refid": string,
|
||||
"st": integer,
|
||||
"t": string,
|
||||
"when": integer, # - converted to null
|
||||
"poll": integer,
|
||||
"reach": integer,
|
||||
"delay": float,
|
||||
"offset": float,
|
||||
"jitter": float
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@@ -226,10 +224,14 @@ Main text parsing function
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) output preprocessed JSON if True
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux, freebsd
|
||||
|
||||
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
@@ -1,13 +1,37 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.passwd"></a>
|
||||
|
||||
# jc.parsers.passwd
|
||||
jc - JSON CLI output utility /etc/passwd file Parser
|
||||
|
||||
Usage:
|
||||
jc - JSON Convert `/etc/passwd` file Parser
|
||||
|
||||
specify --passwd as the first argument if the piped input is coming from /etc/passwd
|
||||
Usage (cli):
|
||||
|
||||
Compatibility:
|
||||
$ cat /etc/passwd | jc --passwd
|
||||
|
||||
'linux', 'darwin', 'aix', 'freebsd'
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('passwd', passwd_file_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.passwd
|
||||
result = jc.parsers.passwd.parse(passwd_file_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"username": string,
|
||||
"password": string,
|
||||
"uid": integer,
|
||||
"gid": integer,
|
||||
"comment": string,
|
||||
"home": string,
|
||||
"shell": string
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
@@ -75,41 +99,12 @@ Examples:
|
||||
...
|
||||
]
|
||||
|
||||
## info
|
||||
<a id="jc.parsers.passwd.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
info(self, /, *args, **kwargs)
|
||||
```
|
||||
|
||||
## process
|
||||
```python
|
||||
process(proc_data)
|
||||
```
|
||||
|
||||
Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
"username": string,
|
||||
"password": string,
|
||||
"uid": integer,
|
||||
"gid": integer,
|
||||
"comment": string,
|
||||
"home": string,
|
||||
"shell": string
|
||||
}
|
||||
]
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@@ -117,10 +112,14 @@ Main text parsing function
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) output preprocessed JSON if True
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, aix, freebsd
|
||||
|
||||
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
193
docs/parsers/ping.md
Normal file
193
docs/parsers/ping.md
Normal file
@@ -0,0 +1,193 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.ping"></a>
|
||||
|
||||
# jc.parsers.ping
|
||||
|
||||
jc - JSON Convert `ping` command output parser
|
||||
|
||||
Supports `ping` and `ping6` output.
|
||||
|
||||
Usage (cli):
|
||||
|
||||
Note: Use the ping `-c` (count) option, otherwise data will not be
|
||||
piped to `jc`.
|
||||
|
||||
$ ping -c 3 1.2.3.4 | jc --ping
|
||||
|
||||
or
|
||||
|
||||
$ jc ping -c 3 1.2.3.4
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('ping', ping_command_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.ping
|
||||
result = jc.parsers.ping.parse(ping_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
{
|
||||
"source_ip": string,
|
||||
"destination_ip": string,
|
||||
"data_bytes": integer,
|
||||
"pattern": string, # null if not set
|
||||
"destination": string,
|
||||
"packets_transmitted": integer,
|
||||
"packets_received": integer,
|
||||
"packet_loss_percent": float,
|
||||
"duplicates": integer,
|
||||
"round_trip_ms_min": float,
|
||||
"round_trip_ms_avg": float,
|
||||
"round_trip_ms_max": float,
|
||||
"round_trip_ms_stddev": float,
|
||||
"responses": [
|
||||
{
|
||||
"type": string, # [0]
|
||||
"unparsed_line": string, # [1]
|
||||
"timestamp": float,
|
||||
"bytes": integer,
|
||||
"response_ip": string,
|
||||
"icmp_seq": integer,
|
||||
"ttl": integer,
|
||||
"time_ms": float,
|
||||
"duplicate": boolean,
|
||||
"vr": integer, # [2]
|
||||
"hl": integer, # [2]
|
||||
"tos": integer, # [2]
|
||||
"len": integer, # [2]
|
||||
"id": integer, # [2]
|
||||
"flg": integer, # [2]
|
||||
"off": integer, # [2]
|
||||
"pro": integer, # [2]
|
||||
"cks": ingeger, # [2]
|
||||
"src": string,
|
||||
"dst": string
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
[0] 'reply', 'timeout', 'unparsable_line', etc. See
|
||||
`_error_type.type_map` for all options
|
||||
[1] only if an 'unparsable_line' type
|
||||
[2] hex value converted to decimal
|
||||
|
||||
Examples:
|
||||
|
||||
$ ping -c 3 -p ff cnn.com | jc --ping -p
|
||||
{
|
||||
"destination_ip": "151.101.1.67",
|
||||
"data_bytes": 56,
|
||||
"pattern": "0xff",
|
||||
"destination": "cnn.com",
|
||||
"packets_transmitted": 3,
|
||||
"packets_received": 3,
|
||||
"packet_loss_percent": 0.0,
|
||||
"duplicates": 0,
|
||||
"round_trip_ms_min": 28.015,
|
||||
"round_trip_ms_avg": 32.848,
|
||||
"round_trip_ms_max": 39.376,
|
||||
"round_trip_ms_stddev": 4.79,
|
||||
"responses": [
|
||||
{
|
||||
"type": "reply",
|
||||
"bytes": 64,
|
||||
"response_ip": "151.101.1.67",
|
||||
"icmp_seq": 0,
|
||||
"ttl": 59,
|
||||
"time_ms": 28.015,
|
||||
"duplicate": false
|
||||
},
|
||||
{
|
||||
"type": "reply",
|
||||
"bytes": 64,
|
||||
"response_ip": "151.101.1.67",
|
||||
"icmp_seq": 1,
|
||||
"ttl": 59,
|
||||
"time_ms": 39.376,
|
||||
"duplicate": false
|
||||
},
|
||||
{
|
||||
"type": "reply",
|
||||
"bytes": 64,
|
||||
"response_ip": "151.101.1.67",
|
||||
"icmp_seq": 2,
|
||||
"ttl": 59,
|
||||
"time_ms": 31.153,
|
||||
"duplicate": false
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
$ ping -c 3 -p ff cnn.com | jc --ping -p -r
|
||||
{
|
||||
"destination_ip": "151.101.129.67",
|
||||
"data_bytes": "56",
|
||||
"pattern": "0xff",
|
||||
"destination": "cnn.com",
|
||||
"packets_transmitted": "3",
|
||||
"packets_received": "3",
|
||||
"packet_loss_percent": "0.0",
|
||||
"duplicates": "0",
|
||||
"round_trip_ms_min": "25.078",
|
||||
"round_trip_ms_avg": "29.543",
|
||||
"round_trip_ms_max": "32.553",
|
||||
"round_trip_ms_stddev": "3.221",
|
||||
"responses": [
|
||||
{
|
||||
"type": "reply",
|
||||
"bytes": "64",
|
||||
"response_ip": "151.101.129.67",
|
||||
"icmp_seq": "0",
|
||||
"ttl": "59",
|
||||
"time_ms": "25.078",
|
||||
"duplicate": false
|
||||
},
|
||||
{
|
||||
"type": "reply",
|
||||
"bytes": "64",
|
||||
"response_ip": "151.101.129.67",
|
||||
"icmp_seq": "1",
|
||||
"ttl": "59",
|
||||
"time_ms": "30.999",
|
||||
"duplicate": false
|
||||
},
|
||||
{
|
||||
"type": "reply",
|
||||
"bytes": "64",
|
||||
"response_ip": "151.101.129.67",
|
||||
"icmp_seq": "2",
|
||||
"ttl": "59",
|
||||
"time_ms": "32.553",
|
||||
"duplicate": false
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
<a id="jc.parsers.ping.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. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, freebsd
|
||||
|
||||
Version 1.7 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
122
docs/parsers/ping_s.md
Normal file
122
docs/parsers/ping_s.md
Normal file
@@ -0,0 +1,122 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.ping_s"></a>
|
||||
|
||||
# jc.parsers.ping\_s
|
||||
|
||||
jc - JSON Convert `ping` command output streaming parser
|
||||
|
||||
> This streaming parser outputs JSON Lines
|
||||
|
||||
Supports `ping` and `ping6` output.
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ ping | jc --ping-s
|
||||
|
||||
> Note: When piping `jc` converted `ping` output to other processes it may
|
||||
appear the output is hanging due to the OS pipe buffers. This is because
|
||||
`ping` output is too small to quickly fill up the buffer. Use the `-u`
|
||||
option to unbuffer the `jc` output if you would like immediate output.
|
||||
See the [readme](https://github.com/kellyjonbrazil/jc/tree/master#unbuffering-output)
|
||||
for more information.
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
# result is an iterable object (generator)
|
||||
result = jc.parse('ping_s', ping_command_output.splitlines())
|
||||
for item in result:
|
||||
# do something
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.ping_s
|
||||
# result is an iterable object (generator)
|
||||
result = jc.parsers.ping_s.parse(ping_command_output.splitlines())
|
||||
for item in result:
|
||||
# do something
|
||||
|
||||
Schema:
|
||||
|
||||
{
|
||||
"type": string, # [0]
|
||||
"source_ip": string,
|
||||
"destination_ip": string,
|
||||
"sent_bytes": integer,
|
||||
"pattern": string, # (null if not set)
|
||||
"destination": string,
|
||||
"timestamp": float,
|
||||
"response_bytes": integer,
|
||||
"response_ip": string,
|
||||
"icmp_seq": integer,
|
||||
"ttl": integer,
|
||||
"time_ms": float,
|
||||
"duplicate": boolean,
|
||||
"packets_transmitted": integer,
|
||||
"packets_received": integer,
|
||||
"packet_loss_percent": float,
|
||||
"duplicates": integer,
|
||||
"round_trip_ms_min": float,
|
||||
"round_trip_ms_avg": float,
|
||||
"round_trip_ms_max": float,
|
||||
"round_trip_ms_stddev": float,
|
||||
|
||||
# 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] 'reply', 'timeout', 'summary', etc. See `_error_type.type_map`
|
||||
for all options.
|
||||
|
||||
Examples:
|
||||
|
||||
$ ping 1.1.1.1 | jc --ping-s
|
||||
{"type":"reply","destination_ip":"1.1.1.1","sent_bytes":56,"patte...}
|
||||
{"type":"reply","destination_ip":"1.1.1.1","sent_bytes":56,"patte...}
|
||||
{"type":"reply","destination_ip":"1.1.1.1","sent_bytes":56,"patte...}
|
||||
...
|
||||
|
||||
$ ping 1.1.1.1 | jc --ping-s -r
|
||||
{"type":"reply","destination_ip":"1.1.1.1","sent_bytes":"56","patte...}
|
||||
{"type":"reply","destination_ip":"1.1.1.1","sent_bytes":"56","patte...}
|
||||
{"type":"reply","destination_ip":"1.1.1.1","sent_bytes":"56","patte...}
|
||||
...
|
||||
|
||||
<a id="jc.parsers.ping_s.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
@add_jc_meta
|
||||
def parse(data, raw=False, quiet=False, ignore_exceptions=False)
|
||||
```
|
||||
|
||||
Main text parsing generator function. Returns an iterator 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
|
||||
|
||||
Yields:
|
||||
|
||||
Dictionary. Raw or processed structured data.
|
||||
|
||||
Returns:
|
||||
|
||||
Iterator object (generator)
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, freebsd
|
||||
|
||||
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
@@ -1,13 +1,37 @@
|
||||
# jc.parsers.pip_list
|
||||
jc - JSON CLI output utility pip-list Parser
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.pip_list"></a>
|
||||
|
||||
Usage:
|
||||
# jc.parsers.pip\_list
|
||||
|
||||
specify --pip-list as the first argument if the piped input is coming from pip list
|
||||
jc - JSON Convert `pip-list` command output parser
|
||||
|
||||
Compatibility:
|
||||
Usage (cli):
|
||||
|
||||
'linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd'
|
||||
$ pip list | jc --pip-list
|
||||
|
||||
or
|
||||
|
||||
$ jc pip list
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('pip_list', pip_list_command_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.pip_list
|
||||
result = jc.parsers.pip_list.parse(pip_list_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"package": string,
|
||||
"version": string,
|
||||
"location": string
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
@@ -28,37 +52,12 @@ Examples:
|
||||
...
|
||||
]
|
||||
|
||||
## info
|
||||
<a id="jc.parsers.pip_list.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
info(self, /, *args, **kwargs)
|
||||
```
|
||||
|
||||
## process
|
||||
```python
|
||||
process(proc_data)
|
||||
```
|
||||
|
||||
Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
"package": string,
|
||||
"version": string,
|
||||
"location": string
|
||||
}
|
||||
]
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@@ -66,10 +65,14 @@ Main text parsing function
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) output preprocessed JSON if True
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
|
||||
|
||||
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
@@ -1,13 +1,44 @@
|
||||
# jc.parsers.pip_show
|
||||
jc - JSON CLI output utility pip-show Parser
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.pip_show"></a>
|
||||
|
||||
Usage:
|
||||
# jc.parsers.pip\_show
|
||||
|
||||
specify --pip-show as the first argument if the piped input is coming from pip show
|
||||
jc - JSON Convert `pip-show` command output parser
|
||||
|
||||
Compatibility:
|
||||
Usage (cli):
|
||||
|
||||
'linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd'
|
||||
$ pip show | jc --pip-show
|
||||
|
||||
or
|
||||
|
||||
$ jc pip show
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('pip_show', pip_show_command_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.pip_show
|
||||
result = jc.parsers.pip_show.parse(pip_show_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"name": string,
|
||||
"version": string,
|
||||
"summary": string,
|
||||
"home_page": string,
|
||||
"author": string,
|
||||
"author_email": string,
|
||||
"license": string,
|
||||
"location": string,
|
||||
"requires": string,
|
||||
"required_by": string
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
@@ -39,45 +70,12 @@ Examples:
|
||||
}
|
||||
]
|
||||
|
||||
## info
|
||||
<a id="jc.parsers.pip_show.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
info(self, /, *args, **kwargs)
|
||||
```
|
||||
|
||||
## process
|
||||
```python
|
||||
process(proc_data)
|
||||
```
|
||||
|
||||
Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
"name": string,
|
||||
"version": string,
|
||||
"summary": string,
|
||||
"home_page": string,
|
||||
"author": string,
|
||||
"author_email": string,
|
||||
"license": string,
|
||||
"location": string,
|
||||
"requires": string,
|
||||
"required_by": string
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@@ -85,10 +83,14 @@ Main text parsing function
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) output preprocessed JSON if True
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
|
||||
|
||||
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
@@ -1,17 +1,55 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.ps"></a>
|
||||
|
||||
# jc.parsers.ps
|
||||
jc - JSON CLI output utility ps Parser
|
||||
|
||||
Usage:
|
||||
jc - JSON Convert `ps` command output parser
|
||||
|
||||
specify --ps as the first argument if the piped input is coming from ps
|
||||
`ps` options supported:
|
||||
- `ef`
|
||||
- `axu`
|
||||
|
||||
ps options supported:
|
||||
- ef
|
||||
- axu
|
||||
Usage (cli):
|
||||
|
||||
Compatibility:
|
||||
$ ps | jc --ps
|
||||
|
||||
'linux', 'darwin', 'cygwin', 'aix', 'freebsd'
|
||||
or
|
||||
|
||||
$ jc ps
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('ps', ps_command_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.ps
|
||||
result = jc.parsers.ps.parse(ps_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"uid": string,
|
||||
"pid": integer,
|
||||
"ppid": integer,
|
||||
"c": integer,
|
||||
"stime": string,
|
||||
"tty": string, # ? or ?? = Null
|
||||
"tt": string, # ?? = Null
|
||||
"time": string,
|
||||
"cmd": string,
|
||||
"user": string,
|
||||
"cpu_percent": float,
|
||||
"mem_percent": float,
|
||||
"vsz": integer,
|
||||
"rss": integer,
|
||||
"stat": string,
|
||||
"start": string,
|
||||
"command": string
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
@@ -25,7 +63,7 @@ Examples:
|
||||
"stime": "Nov01",
|
||||
"tty": null,
|
||||
"time": "00:00:11",
|
||||
"cmd": "/usr/lib/systemd/systemd --switched-root --system --deserialize 22"
|
||||
"cmd": "/usr/lib/systemd/systemd --switched-root --system --dese..."
|
||||
},
|
||||
{
|
||||
"uid": "root",
|
||||
@@ -60,7 +98,7 @@ Examples:
|
||||
"stime": "Nov01",
|
||||
"tty": "?",
|
||||
"time": "00:00:11",
|
||||
"cmd": "/usr/lib/systemd/systemd --switched-root --system --deserialize 22"
|
||||
"cmd": "/usr/lib/systemd/systemd --switched-root --system --dese..."
|
||||
},
|
||||
{
|
||||
"uid": "root",
|
||||
@@ -98,7 +136,7 @@ Examples:
|
||||
"stat": "Ss",
|
||||
"start": "Nov09",
|
||||
"time": "0:08",
|
||||
"command": "/usr/lib/systemd/systemd --switched-root --system --deserialize 22"
|
||||
"command": "/usr/lib/systemd/systemd --switched-root --system --..."
|
||||
},
|
||||
{
|
||||
"user": "root",
|
||||
@@ -142,7 +180,7 @@ Examples:
|
||||
"stat": "Ss",
|
||||
"start": "Nov09",
|
||||
"time": "0:08",
|
||||
"command": "/usr/lib/systemd/systemd --switched-root --system --deserialize 22"
|
||||
"command": "/usr/lib/systemd/systemd --switched-root --system --..."
|
||||
},
|
||||
{
|
||||
"user": "root",
|
||||
@@ -173,51 +211,12 @@ Examples:
|
||||
...
|
||||
]
|
||||
|
||||
## info
|
||||
<a id="jc.parsers.ps.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
info(self, /, *args, **kwargs)
|
||||
```
|
||||
|
||||
## process
|
||||
```python
|
||||
process(proc_data)
|
||||
```
|
||||
|
||||
Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
"uid": string,
|
||||
"pid": integer,
|
||||
"ppid": integer,
|
||||
"c": integer,
|
||||
"stime": string,
|
||||
"tty": string, # ? or ?? = Null
|
||||
"tt": string, # ?? = Null
|
||||
"time": string,
|
||||
"cmd": string,
|
||||
"user": string,
|
||||
"cpu_percent": float,
|
||||
"mem_percent": float,
|
||||
"vsz": integer,
|
||||
"rss": integer,
|
||||
"stat": string,
|
||||
"start": string,
|
||||
"command": string
|
||||
}
|
||||
]
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@@ -225,10 +224,14 @@ Main text parsing function
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) output preprocessed JSON if True
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, aix, freebsd
|
||||
|
||||
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
@@ -1,13 +1,48 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.route"></a>
|
||||
|
||||
# jc.parsers.route
|
||||
jc - JSON CLI output utility route Parser
|
||||
|
||||
Usage:
|
||||
jc - JSON Convert `route` command output parser
|
||||
|
||||
specify --route as the first argument if the piped input is coming from route
|
||||
Usage (cli):
|
||||
|
||||
Compatibility:
|
||||
$ route | jc --route
|
||||
|
||||
'linux'
|
||||
or
|
||||
|
||||
$ jc route
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('route', route_command_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.route
|
||||
result = jc.parsers.route.parse(route_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"destination": string,
|
||||
"gateway": string,
|
||||
"genmask": string,
|
||||
"flags": string,
|
||||
"flags_pretty": [
|
||||
string
|
||||
]
|
||||
"metric": integer,
|
||||
"ref": integer,
|
||||
"use": integer,
|
||||
"mss": integer,
|
||||
"window": integer,
|
||||
"irtt": integer,
|
||||
"iface": string
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
@@ -48,7 +83,6 @@ Examples:
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
$ route -ee | jc --route -p -r
|
||||
[
|
||||
{
|
||||
@@ -79,49 +113,12 @@ Examples:
|
||||
}
|
||||
]
|
||||
|
||||
<a id="jc.parsers.route.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
## info
|
||||
```python
|
||||
info(self, /, *args, **kwargs)
|
||||
```
|
||||
|
||||
## process
|
||||
```python
|
||||
process(proc_data)
|
||||
```
|
||||
|
||||
Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
"destination": string,
|
||||
"gateway": string,
|
||||
"genmask": string,
|
||||
"flags": string,
|
||||
"flags_pretty": [
|
||||
string,
|
||||
]
|
||||
"metric": integer,
|
||||
"ref": integer,
|
||||
"use": integer,
|
||||
"mss": integer,
|
||||
"window": integer,
|
||||
"irtt": integer,
|
||||
"iface": string
|
||||
}
|
||||
]
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@@ -129,10 +126,14 @@ Main text parsing function
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) output preprocessed JSON if True
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Version 1.7 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
192
docs/parsers/rpm_qi.md
Normal file
192
docs/parsers/rpm_qi.md
Normal file
@@ -0,0 +1,192 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.rpm_qi"></a>
|
||||
|
||||
# jc.parsers.rpm\_qi
|
||||
|
||||
jc - JSON Convert `rpm -qi` command output parser
|
||||
|
||||
Works with `rpm -qi [package]` or `rpm -qia`.
|
||||
|
||||
The `..._epoch` calculated timestamp fields are naive. (i.e. based on the
|
||||
local time of the system the parser is run on)
|
||||
|
||||
The `..._epoch_utc` calculated timestamp fields are timezone-aware and is
|
||||
only available if the timezone field is UTC.
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ rpm -qia | jc --rpm-qi
|
||||
|
||||
or
|
||||
|
||||
$ jc rpm -qia
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('rpm_qi', rpm_qi_command_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.rpm_qi
|
||||
result = jc.parsers.rpm_qi.parse(rpm_qi_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"name": string,
|
||||
"epoch": integer,
|
||||
"version": string,
|
||||
"release": string,
|
||||
"architecture": string,
|
||||
"install_date": string,
|
||||
"install_date_epoch": integer, # [0]
|
||||
"install_date_epoch_utc": integer, # [1]
|
||||
"group": string,
|
||||
"size": integer,
|
||||
"license": string,
|
||||
"signature": string,
|
||||
"source_rpm": string,
|
||||
"build_date": string,
|
||||
"build_epoch": integer, # [0]
|
||||
"build_epoch_utc": integer, # [1]
|
||||
"build_host": string,
|
||||
"relocations": string,
|
||||
"packager": string,
|
||||
"vendor": string,
|
||||
"url": string,
|
||||
"summary": string,
|
||||
"description": string
|
||||
}
|
||||
]
|
||||
|
||||
[0] naive timestamp
|
||||
[1] Aware timestamp if timezone is UTC
|
||||
|
||||
Examples:
|
||||
|
||||
$ rpm -qia | jc --rpm-qi -p
|
||||
[
|
||||
{
|
||||
"name": "make",
|
||||
"epoch": 1,
|
||||
"version": "3.82",
|
||||
"release": "24.el7",
|
||||
"architecture": "x86_64",
|
||||
"install_date": "Wed 16 Oct 2019 09:21:42 AM PDT",
|
||||
"group": "Development/Tools",
|
||||
"size": 1160660,
|
||||
"license": "GPLv2+",
|
||||
"signature": "RSA/SHA256, Thu 22 Aug 2019 02:34:59 PM PDT, Key ...",
|
||||
"source_rpm": "make-3.82-24.el7.src.rpm",
|
||||
"build_date": "Thu 08 Aug 2019 05:47:25 PM PDT",
|
||||
"build_host": "x86-01.bsys.centos.org",
|
||||
"relocations": "(not relocatable)",
|
||||
"packager": "CentOS BuildSystem <http://bugs.centos.org>",
|
||||
"vendor": "CentOS",
|
||||
"url": "http://www.gnu.org/software/make/",
|
||||
"summary": "A GNU tool which simplifies the build process for ...",
|
||||
"description": "A GNU tool for controlling the generation of ex...",
|
||||
"build_epoch": 1565311645,
|
||||
"build_epoch_utc": null,
|
||||
"install_date_epoch": 1571242902,
|
||||
"install_date_epoch_utc": null
|
||||
},
|
||||
{
|
||||
"name": "kbd-legacy",
|
||||
"version": "1.15.5",
|
||||
"release": "15.el7",
|
||||
"architecture": "noarch",
|
||||
"install_date": "Thu 15 Aug 2019 10:53:08 AM PDT",
|
||||
"group": "System Environment/Base",
|
||||
"size": 503608,
|
||||
"license": "GPLv2+",
|
||||
"signature": "RSA/SHA256, Mon 12 Nov 2018 07:17:49 AM PST, Key ...",
|
||||
"source_rpm": "kbd-1.15.5-15.el7.src.rpm",
|
||||
"build_date": "Tue 30 Oct 2018 03:40:00 PM PDT",
|
||||
"build_host": "x86-01.bsys.centos.org",
|
||||
"relocations": "(not relocatable)",
|
||||
"packager": "CentOS BuildSystem <http://bugs.centos.org>",
|
||||
"vendor": "CentOS",
|
||||
"url": "http://ftp.altlinux.org/pub/people/legion/kbd",
|
||||
"summary": "Legacy data for kbd package",
|
||||
"description": "The kbd-legacy package contains original keymap...",
|
||||
"build_epoch": 1540939200,
|
||||
"build_epoch_utc": null,
|
||||
"install_date_epoch": 1565891588,
|
||||
"install_date_epoch_utc": null
|
||||
},
|
||||
...
|
||||
]
|
||||
|
||||
$ rpm -qia | jc --rpm-qi -p -r
|
||||
[
|
||||
{
|
||||
"name": "make",
|
||||
"epoch": "1",
|
||||
"version": "3.82",
|
||||
"release": "24.el7",
|
||||
"architecture": "x86_64",
|
||||
"install_date": "Wed 16 Oct 2019 09:21:42 AM PDT",
|
||||
"group": "Development/Tools",
|
||||
"size": "1160660",
|
||||
"license": "GPLv2+",
|
||||
"signature": "RSA/SHA256, Thu 22 Aug 2019 02:34:59 PM PDT, Key ...",
|
||||
"source_rpm": "make-3.82-24.el7.src.rpm",
|
||||
"build_date": "Thu 08 Aug 2019 05:47:25 PM PDT",
|
||||
"build_host": "x86-01.bsys.centos.org",
|
||||
"relocations": "(not relocatable)",
|
||||
"packager": "CentOS BuildSystem <http://bugs.centos.org>",
|
||||
"vendor": "CentOS",
|
||||
"url": "http://www.gnu.org/software/make/",
|
||||
"summary": "A GNU tool which simplifies the build process for...",
|
||||
"description": "A GNU tool for controlling the generation of exe..."
|
||||
},
|
||||
{
|
||||
"name": "kbd-legacy",
|
||||
"version": "1.15.5",
|
||||
"release": "15.el7",
|
||||
"architecture": "noarch",
|
||||
"install_date": "Thu 15 Aug 2019 10:53:08 AM PDT",
|
||||
"group": "System Environment/Base",
|
||||
"size": "503608",
|
||||
"license": "GPLv2+",
|
||||
"signature": "RSA/SHA256, Mon 12 Nov 2018 07:17:49 AM PST, Key ...",
|
||||
"source_rpm": "kbd-1.15.5-15.el7.src.rpm",
|
||||
"build_date": "Tue 30 Oct 2018 03:40:00 PM PDT",
|
||||
"build_host": "x86-01.bsys.centos.org",
|
||||
"relocations": "(not relocatable)",
|
||||
"packager": "CentOS BuildSystem <http://bugs.centos.org>",
|
||||
"vendor": "CentOS",
|
||||
"url": "http://ftp.altlinux.org/pub/people/legion/kbd",
|
||||
"summary": "Legacy data for kbd package",
|
||||
"description": "The kbd-legacy package contains original keymaps..."
|
||||
},
|
||||
...
|
||||
]
|
||||
|
||||
<a id="jc.parsers.rpm_qi.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 Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
165
docs/parsers/rsync.md
Normal file
165
docs/parsers/rsync.md
Normal file
@@ -0,0 +1,165 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.rsync"></a>
|
||||
|
||||
# jc.parsers.rsync
|
||||
|
||||
jc - JSON Convert `rsync` command output parser
|
||||
|
||||
Supports the `-i` or `--itemize-changes` options with all levels of
|
||||
verbosity. This parser will process the STDOUT output or a log file
|
||||
generated with the `--log-file` option.
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ rsync -i -a source/ dest | jc --rsync
|
||||
|
||||
or
|
||||
|
||||
$ jc rsync -i -a source/ dest
|
||||
|
||||
or
|
||||
|
||||
$ cat rsync-backup.log | jc --rsync
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('rsync', rsync_command_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.rsync
|
||||
result = jc.parsers.rsync.parse(rsync_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"summary": {
|
||||
"date": string,
|
||||
"time": string,
|
||||
"process": integer,
|
||||
"sent": integer,
|
||||
"received": integer,
|
||||
"total_size": integer,
|
||||
"matches": integer,
|
||||
"hash_hits": integer,
|
||||
"false_alarms": integer,
|
||||
"data": integer,
|
||||
"bytes_sec": float,
|
||||
"speedup": float
|
||||
},
|
||||
"files": [
|
||||
{
|
||||
"filename": string,
|
||||
"date": string,
|
||||
"time": string,
|
||||
"process": integer,
|
||||
"metadata": string,
|
||||
"update_type": string/null, [0]
|
||||
"file_type": string/null, [1]
|
||||
"checksum_or_value_different": bool/null,
|
||||
"size_different": bool/null,
|
||||
"modification_time_different": bool/null,
|
||||
"permissions_different": bool/null,
|
||||
"owner_different": bool/null,
|
||||
"group_different": bool/null,
|
||||
"acl_different": bool/null,
|
||||
"extended_attribute_different": bool/null,
|
||||
"epoch": integer, [2]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
[0] 'file sent', 'file received', 'local change or creation',
|
||||
'hard link', 'not updated', 'message'
|
||||
[1] 'file', 'directory', 'symlink', 'device', 'special file'
|
||||
[2] naive timestamp if time and date fields exist and can be converted.
|
||||
|
||||
Examples:
|
||||
|
||||
$ rsync -i -a source/ dest | jc --rsync -p
|
||||
[
|
||||
{
|
||||
"summary": {
|
||||
"sent": 1708,
|
||||
"received": 8209,
|
||||
"bytes_sec": 19834.0,
|
||||
"total_size": 235,
|
||||
"speedup": 0.02
|
||||
},
|
||||
"files": [
|
||||
{
|
||||
"filename": "./",
|
||||
"metadata": ".d..t......",
|
||||
"update_type": "not updated",
|
||||
"file_type": "directory",
|
||||
"checksum_or_value_different": false,
|
||||
"size_different": false,
|
||||
"modification_time_different": true,
|
||||
"permissions_different": false,
|
||||
"owner_different": false,
|
||||
"group_different": false,
|
||||
"acl_different": false,
|
||||
"extended_attribute_different": false
|
||||
},
|
||||
...
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
$ rsync | jc --rsync -p -r
|
||||
[
|
||||
{
|
||||
"summary": {
|
||||
"sent": "1,708",
|
||||
"received": "8,209",
|
||||
"bytes_sec": "19,834.00",
|
||||
"total_size": "235",
|
||||
"speedup": "0.02"
|
||||
},
|
||||
"files": [
|
||||
{
|
||||
"filename": "./",
|
||||
"metadata": ".d..t......",
|
||||
"update_type": "not updated",
|
||||
"file_type": "directory",
|
||||
"checksum_or_value_different": false,
|
||||
"size_different": false,
|
||||
"modification_time_different": true,
|
||||
"permissions_different": false,
|
||||
"owner_different": false,
|
||||
"group_different": false,
|
||||
"acl_different": false,
|
||||
"extended_attribute_different": false
|
||||
},
|
||||
...
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
<a id="jc.parsers.rsync.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, freebsd
|
||||
|
||||
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
130
docs/parsers/rsync_s.md
Normal file
130
docs/parsers/rsync_s.md
Normal file
@@ -0,0 +1,130 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.rsync_s"></a>
|
||||
|
||||
# jc.parsers.rsync\_s
|
||||
|
||||
jc - JSON Convert `rsync` command output streaming parser
|
||||
|
||||
> This streaming parser outputs JSON Lines
|
||||
|
||||
Supports the `-i` or `--itemize-changes` options with all levels of
|
||||
verbosity. This parser will process the STDOUT output or a log file
|
||||
generated with the `--log-file` option.
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ rsync -i -a source/ dest | jc --rsync-s
|
||||
|
||||
or
|
||||
|
||||
$ cat rsync-backup.log | jc --rsync-s
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
# result is an iterable object (generator)
|
||||
result = jc.parse('rsync_s', rsync_command_output.splitlines())
|
||||
for item in result:
|
||||
# do something
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.rsync_s
|
||||
# result is an iterable object (generator)
|
||||
result = jc.parsers.rsync_s.parse(rsync_command_output.splitlines())
|
||||
for item in result:
|
||||
# do something
|
||||
|
||||
Schema:
|
||||
|
||||
{
|
||||
"type": string, # 'file' or 'summary'
|
||||
"date": string,
|
||||
"time": string,
|
||||
"process": integer,
|
||||
"sent": integer,
|
||||
"received": integer,
|
||||
"total_size": integer,
|
||||
"matches": integer,
|
||||
"hash_hits": integer,
|
||||
"false_alarms": integer,
|
||||
"data": integer,
|
||||
"bytes_sec": float,
|
||||
"speedup": float,
|
||||
"filename": string,
|
||||
"date": string,
|
||||
"time": string,
|
||||
"process": integer,
|
||||
"metadata": string,
|
||||
"update_type": string/null, [0]
|
||||
"file_type": string/null, [1]
|
||||
"checksum_or_value_different": bool/null,
|
||||
"size_different": bool/null,
|
||||
"modification_time_different": bool/null,
|
||||
"permissions_different": bool/null,
|
||||
"owner_different": bool/null,
|
||||
"group_different": bool/null,
|
||||
"acl_different": bool/null,
|
||||
"extended_attribute_different": bool/null,
|
||||
"epoch": integer, [2]
|
||||
|
||||
# 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] 'file sent', 'file received', 'local change or creation',
|
||||
'hard link', 'not updated', 'message'
|
||||
[1] 'file', 'directory', 'symlink', 'device', 'special file'
|
||||
[2] naive timestamp if time and date fields exist and can be converted.
|
||||
|
||||
Examples:
|
||||
|
||||
$ rsync -i -a source/ dest | jc --rsync-s
|
||||
{"type":"file","filename":"./","metadata":".d..t......","update_...}
|
||||
...
|
||||
|
||||
$ cat rsync_backup.log | jc --rsync-s
|
||||
{"type":"file","filename":"./","date":"2022/01/28","time":"03:53...}
|
||||
...
|
||||
|
||||
<a id="jc.parsers.rsync_s.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
@add_jc_meta
|
||||
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 iterator 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
|
||||
|
||||
Yields:
|
||||
|
||||
Dictionary. Raw or processed structured data.
|
||||
|
||||
Returns:
|
||||
|
||||
Iterator object (generator)
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, freebsd
|
||||
|
||||
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
233
docs/parsers/sfdisk.md
Normal file
233
docs/parsers/sfdisk.md
Normal file
@@ -0,0 +1,233 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.sfdisk"></a>
|
||||
|
||||
# jc.parsers.sfdisk
|
||||
|
||||
jc - JSON Convert `sfdisk` command output parser
|
||||
|
||||
Supports the following `sfdisk` options:
|
||||
- `-l`
|
||||
- `-F`
|
||||
- `-d` (deprecated - only for older versions of util-linux)
|
||||
- `-uM` (deprecated - only for older versions of util-linux)
|
||||
- `-uC` (deprecated - only for older versions of util-linux)
|
||||
- `-uS` (deprecated - only for older versions of util-linux)
|
||||
- `-uB` (deprecated - only for older versions of util-linux)
|
||||
|
||||
Usage (cli):
|
||||
|
||||
# sfdisk -l | jc --sfdisk
|
||||
|
||||
or
|
||||
|
||||
# jc sfdisk -l
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('sfdisk', sfdisk_command_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.sfdisk
|
||||
result = jc.parsers.sfdisk.parse(sfdisk_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"disk": string,
|
||||
"disk_size": string,
|
||||
"free_disk_size": string,
|
||||
"bytes": integer,
|
||||
"free_bytes": integer,
|
||||
"sectors": integer,
|
||||
"free_sectors": integer,
|
||||
"cylinders": integer,
|
||||
"heads": integer,
|
||||
"sectors_per_track": integer,
|
||||
"units": string,
|
||||
"logical_sector_size": integer,
|
||||
"physical_sector_size": integer,
|
||||
"min_io_size": integer,
|
||||
"optimal_io_size": integer,
|
||||
"disk_label_type": string,
|
||||
"disk_identifier": string,
|
||||
"disk_model": string,
|
||||
"partitions": [
|
||||
{
|
||||
"device": string,
|
||||
"boot": boolean,
|
||||
"start": integer,
|
||||
"end": integer,
|
||||
"size": string, # [0]
|
||||
"cyls": integer,
|
||||
"mib": integer,
|
||||
"blocks": integer,
|
||||
"sectors": integer,
|
||||
"id": string,
|
||||
"system": string,
|
||||
"type": string
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
[0] will be integer when using deprecated -d sfdisk option
|
||||
|
||||
Examples:
|
||||
|
||||
# sfdisk -l | jc --sfdisk -p
|
||||
[
|
||||
{
|
||||
"disk": "/dev/sda",
|
||||
"cylinders": 2610,
|
||||
"heads": 255,
|
||||
"sectors_per_track": 63,
|
||||
"units": "cylinders of 8225280 bytes, blocks of 1024 bytes, ...",
|
||||
"partitions": [
|
||||
{
|
||||
"device": "/dev/sda1",
|
||||
"boot": true,
|
||||
"start": 0,
|
||||
"end": 130,
|
||||
"cyls": 131,
|
||||
"blocks": 1048576,
|
||||
"id": "83",
|
||||
"system": "Linux"
|
||||
},
|
||||
{
|
||||
"device": "/dev/sda2",
|
||||
"boot": false,
|
||||
"start": 130,
|
||||
"end": 2610,
|
||||
"cyls": 2481,
|
||||
"blocks": 19921920,
|
||||
"id": "8e",
|
||||
"system": "Linux LVM"
|
||||
},
|
||||
{
|
||||
"device": "/dev/sda3",
|
||||
"boot": false,
|
||||
"start": 0,
|
||||
"end": null,
|
||||
"cyls": 0,
|
||||
"blocks": 0,
|
||||
"id": "0",
|
||||
"system": "Empty"
|
||||
},
|
||||
{
|
||||
"device": "/dev/sda4",
|
||||
"boot": false,
|
||||
"start": 0,
|
||||
"end": null,
|
||||
"cyls": 0,
|
||||
"blocks": 0,
|
||||
"id": "0",
|
||||
"system": "Empty"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"disk": "/dev/mapper/centos-root",
|
||||
"cylinders": 2218,
|
||||
"heads": 255,
|
||||
"sectors_per_track": 63
|
||||
},
|
||||
{
|
||||
"disk": "/dev/mapper/centos-swap",
|
||||
"cylinders": 261,
|
||||
"heads": 255,
|
||||
"sectors_per_track": 63
|
||||
}
|
||||
]
|
||||
|
||||
# sfdisk -l | jc --sfdisk -p -r
|
||||
[
|
||||
{
|
||||
"disk": "/dev/sda",
|
||||
"cylinders": "2610",
|
||||
"heads": "255",
|
||||
"sectors_per_track": "63",
|
||||
"units": "cylinders of 8225280 bytes, blocks of 1024 bytes, co...",
|
||||
"partitions": [
|
||||
{
|
||||
"device": "/dev/sda1",
|
||||
"boot": "*",
|
||||
"start": "0+",
|
||||
"end": "130-",
|
||||
"cyls": "131-",
|
||||
"blocks": "1048576",
|
||||
"id": "83",
|
||||
"system": "Linux"
|
||||
},
|
||||
{
|
||||
"device": "/dev/sda2",
|
||||
"boot": null,
|
||||
"start": "130+",
|
||||
"end": "2610-",
|
||||
"cyls": "2481-",
|
||||
"blocks": "19921920",
|
||||
"id": "8e",
|
||||
"system": "Linux LVM"
|
||||
},
|
||||
{
|
||||
"device": "/dev/sda3",
|
||||
"boot": null,
|
||||
"start": "0",
|
||||
"end": "-",
|
||||
"cyls": "0",
|
||||
"blocks": "0",
|
||||
"id": "0",
|
||||
"system": "Empty"
|
||||
},
|
||||
{
|
||||
"device": "/dev/sda4",
|
||||
"boot": null,
|
||||
"start": "0",
|
||||
"end": "-",
|
||||
"cyls": "0",
|
||||
"blocks": "0",
|
||||
"id": "0",
|
||||
"system": "Empty"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"disk": "/dev/mapper/centos-root",
|
||||
"cylinders": "2218",
|
||||
"heads": "255",
|
||||
"sectors_per_track": "63"
|
||||
},
|
||||
{
|
||||
"disk": "/dev/mapper/centos-swap",
|
||||
"cylinders": "261",
|
||||
"heads": "255",
|
||||
"sectors_per_track": "63"
|
||||
}
|
||||
]
|
||||
|
||||
<a id="jc.parsers.sfdisk.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 Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
@@ -1,13 +1,38 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.shadow"></a>
|
||||
|
||||
# jc.parsers.shadow
|
||||
jc - JSON CLI output utility /etc/shadow file Parser
|
||||
|
||||
Usage:
|
||||
jc - JSON Convert `/etc/shadow` file parser
|
||||
|
||||
specify --shadow as the first argument if the piped input is coming from /etc/shadow
|
||||
Usage (cli):
|
||||
|
||||
Compatibility:
|
||||
$ sudo cat /etc/shadow | jc --shadow
|
||||
|
||||
'linux', 'darwin', 'aix', 'freebsd'
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('shadow', shadow_file_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.shadow
|
||||
result = jc.parsers.shadow.parse(shadow_file_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"username": string,
|
||||
"password": string,
|
||||
"last_changed": integer,
|
||||
"minimum": integer,
|
||||
"maximum": integer,
|
||||
"warn": integer,
|
||||
"inactive": integer,
|
||||
"expire": integer
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
@@ -81,42 +106,12 @@ Examples:
|
||||
...
|
||||
]
|
||||
|
||||
## info
|
||||
<a id="jc.parsers.shadow.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
info(self, /, *args, **kwargs)
|
||||
```
|
||||
|
||||
## process
|
||||
```python
|
||||
process(proc_data)
|
||||
```
|
||||
|
||||
Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
"username": string,
|
||||
"password": string,
|
||||
"last_changed": integer,
|
||||
"minimum": integer,
|
||||
"maximum": integer,
|
||||
"warn": integer,
|
||||
"inactive": integer,
|
||||
"expire": integer
|
||||
}
|
||||
]
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@@ -124,10 +119,14 @@ Main text parsing function
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) output preprocessed JSON if True
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, aix, freebsd
|
||||
|
||||
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
@@ -1,17 +1,55 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.ss"></a>
|
||||
|
||||
# jc.parsers.ss
|
||||
jc - JSON CLI output utility ss Parser
|
||||
|
||||
Usage:
|
||||
jc - JSON Convert `ss` command output parser
|
||||
|
||||
specify --ss as the first argument if the piped input is coming from ss
|
||||
Extended information options like -e and -p are not supported and may cause
|
||||
parsing irregularities.
|
||||
|
||||
Limitations:
|
||||
Usage (cli):
|
||||
|
||||
Extended information options like -e and -p are not supported and may cause parsing irregularities
|
||||
$ ss | jc --ss
|
||||
|
||||
Compatibility:
|
||||
or
|
||||
|
||||
'linux'
|
||||
$ jc ss
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('ss', ss_command_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.ss
|
||||
result = jc.parsers.ss.parse(ss_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
Information from https://www.cyberciti.biz/files/ss.html used to define
|
||||
field names
|
||||
|
||||
[
|
||||
{
|
||||
"netid": string,
|
||||
"state": string,
|
||||
"recv_q": integer,
|
||||
"send_q": integer,
|
||||
"local_address": string,
|
||||
"local_port": string,
|
||||
"local_port_num": integer,
|
||||
"peer_address": string,
|
||||
"peer_port": string,
|
||||
"peer_port_num": integer,
|
||||
"interface": string,
|
||||
"link_layer" string,
|
||||
"channel": string,
|
||||
"path": string,
|
||||
"pid": integer
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
@@ -247,51 +285,12 @@ Examples:
|
||||
}
|
||||
]
|
||||
|
||||
## info
|
||||
<a id="jc.parsers.ss.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
info(self, /, *args, **kwargs)
|
||||
```
|
||||
|
||||
## process
|
||||
```python
|
||||
process(proc_data)
|
||||
```
|
||||
|
||||
Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
"netid": string,
|
||||
"state": string,
|
||||
"recv_q": integer,
|
||||
"send_q": integer,
|
||||
"local_address": string,
|
||||
"local_port": string,
|
||||
"local_port_num": integer,
|
||||
"peer_address": string,
|
||||
"peer_port": string,
|
||||
"peer_port_num": integer,
|
||||
"interface": string,
|
||||
"link_layer" string,
|
||||
"channel": string,
|
||||
"path": string,
|
||||
"pid": integer
|
||||
}
|
||||
]
|
||||
|
||||
Information from https://www.cyberciti.biz/files/ss.html used to define field names
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@@ -299,10 +298,14 @@ Main text parsing function
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) output preprocessed JSON if True
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
@@ -1,13 +1,71 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.stat"></a>
|
||||
|
||||
# jc.parsers.stat
|
||||
jc - JSON CLI output utility stat Parser
|
||||
|
||||
Usage:
|
||||
jc - JSON Convert `stat` command output parser
|
||||
|
||||
specify --stat as the first argument if the piped input is coming from stat
|
||||
The `xxx_epoch` calculated timestamp fields are naive. (i.e. based on the
|
||||
local time of the system the parser is run on)
|
||||
|
||||
Compatibility:
|
||||
The `xxx_epoch_utc` calculated timestamp fields are timezone-aware and are
|
||||
only available if the timezone field is UTC.
|
||||
|
||||
'linux', 'darwin', 'freebsd'
|
||||
Usage (cli):
|
||||
|
||||
$ stat * | jc --stat
|
||||
|
||||
or
|
||||
|
||||
$ jc stat *
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('stat', stat_command_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.stat
|
||||
result = jc.parsers.stat.parse(stat_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"file": string,
|
||||
"link_to" string,
|
||||
"size": integer,
|
||||
"blocks": integer,
|
||||
"io_blocks": integer,
|
||||
"type": string,
|
||||
"device": string,
|
||||
"inode": integer,
|
||||
"links": integer,
|
||||
"access": string,
|
||||
"flags": string,
|
||||
"uid": integer,
|
||||
"user": string,
|
||||
"gid": integer,
|
||||
"group": string,
|
||||
"access_time": string, # - = null
|
||||
"access_time_epoch": integer, # naive timestamp
|
||||
"access_time_epoch_utc": integer, # timezone-aware timestamp
|
||||
"modify_time": string, # - = null
|
||||
"modify_time_epoch": integer, # naive timestamp
|
||||
"modify_time_epoch_utc": integer, # timezone-aware timestamp
|
||||
"change_time": string, # - = null
|
||||
"change_time_epoch": integer, # naive timestamp
|
||||
"change_time_epoch_utc": integer, # timezone-aware timestamp
|
||||
"birth_time": string, # - = null
|
||||
"birth_time_epoch": integer, # naive timestamp
|
||||
"birth_time_epoch_utc": integer, # timezone-aware timestamp
|
||||
"unix_device": integer,
|
||||
"rdev": integer,
|
||||
"block_size": integer,
|
||||
"unix_flags": string
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
@@ -31,7 +89,15 @@ Examples:
|
||||
"access_time": "2019-11-14 08:18:03.509681766 +0000",
|
||||
"modify_time": "2019-06-06 22:28:15.000000000 +0000",
|
||||
"change_time": "2019-08-12 17:21:29.521945390 +0000",
|
||||
"birth_time": null
|
||||
"birth_time": null,
|
||||
"access_time_epoch": 1573748283,
|
||||
"access_time_epoch_utc": 1573719483,
|
||||
"modify_time_epoch": 1559885295,
|
||||
"modify_time_epoch_utc": 1559860095,
|
||||
"change_time_epoch": 1565655689,
|
||||
"change_time_epoch_utc": 1565630489,
|
||||
"birth_time_epoch": null,
|
||||
"birth_time_epoch_utc": null
|
||||
},
|
||||
{
|
||||
"file": "/bin/btrfs",
|
||||
@@ -51,7 +117,15 @@ Examples:
|
||||
"access_time": "2019-11-14 08:18:28.990834276 +0000",
|
||||
"modify_time": "2018-03-12 23:04:27.000000000 +0000",
|
||||
"change_time": "2019-08-12 17:21:29.545944399 +0000",
|
||||
"birth_time": null
|
||||
"birth_time": null,
|
||||
"access_time_epoch": 1573748308,
|
||||
"access_time_epoch_utc": 1573719508,
|
||||
"modify_time_epoch": 1520921067,
|
||||
"modify_time_epoch_utc": 1520895867,
|
||||
"change_time_epoch": 1565655689,
|
||||
"change_time_epoch_utc": 1565630489,
|
||||
"birth_time_epoch": null,
|
||||
"birth_time_epoch_utc": null
|
||||
},
|
||||
...
|
||||
]
|
||||
@@ -98,60 +172,15 @@ Examples:
|
||||
"change_time": "2019-08-12 17:21:29.545944399 +0000",
|
||||
"birth_time": null
|
||||
},
|
||||
..
|
||||
...
|
||||
]
|
||||
|
||||
## info
|
||||
<a id="jc.parsers.stat.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
info(self, /, *args, **kwargs)
|
||||
```
|
||||
|
||||
## process
|
||||
```python
|
||||
process(proc_data)
|
||||
```
|
||||
|
||||
Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
"file": string,
|
||||
"link_to" string,
|
||||
"size": integer,
|
||||
"blocks": integer,
|
||||
"io_blocks": integer,
|
||||
"type": string,
|
||||
"device": string,
|
||||
"inode": integer,
|
||||
"links": integer,
|
||||
"access": string,
|
||||
"flags": string,
|
||||
"uid": integer,
|
||||
"user": string,
|
||||
"gid": integer,
|
||||
"group": string,
|
||||
"access_time": string, # - = null
|
||||
"modify_time": string, # - = null
|
||||
"change_time": string, # - = null
|
||||
"birth_time": string, # - = null
|
||||
"unix_device": integer,
|
||||
"rdev": integer,
|
||||
"block_size": integer,
|
||||
"unix_flags": string
|
||||
}
|
||||
]
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@@ -159,10 +188,14 @@ Main text parsing function
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) output preprocessed JSON if True
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, freebsd
|
||||
|
||||
Version 1.11 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
120
docs/parsers/stat_s.md
Normal file
120
docs/parsers/stat_s.md
Normal file
@@ -0,0 +1,120 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.stat_s"></a>
|
||||
|
||||
# jc.parsers.stat\_s
|
||||
|
||||
jc - JSON Convert `stat` command output streaming parser
|
||||
|
||||
> This streaming parser outputs JSON Lines
|
||||
|
||||
The `xxx_epoch` calculated timestamp fields are naive. (i.e. based on the
|
||||
local time of the system the parser is run on).
|
||||
|
||||
The `xxx_epoch_utc` calculated timestamp fields are timezone-aware and are
|
||||
only available if the timezone field is UTC.
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ stat * | jc --stat-s
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
# result is an iterable object (generator)
|
||||
result = jc.parse('stat_s', stat_command_output.splitlines())
|
||||
for item in result:
|
||||
# do something
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.stat_s
|
||||
# result is an iterable object (generator)
|
||||
result = jc.parsers.stat_s.parse(stat_command_output.splitlines())
|
||||
for item in result:
|
||||
# do something
|
||||
|
||||
Schema:
|
||||
|
||||
{
|
||||
"file": string,
|
||||
"link_to" string,
|
||||
"size": integer,
|
||||
"blocks": integer,
|
||||
"io_blocks": integer,
|
||||
"type": string,
|
||||
"device": string,
|
||||
"inode": integer,
|
||||
"links": integer,
|
||||
"access": string,
|
||||
"flags": string,
|
||||
"uid": integer,
|
||||
"user": string,
|
||||
"gid": integer,
|
||||
"group": string,
|
||||
"access_time": string, # - = null
|
||||
"access_time_epoch": integer, # naive timestamp
|
||||
"access_time_epoch_utc": integer, # timezone-aware timestamp
|
||||
"modify_time": string, # - = null
|
||||
"modify_time_epoch": integer, # naive timestamp
|
||||
"modify_time_epoch_utc": integer, # timezone-aware timestamp
|
||||
"change_time": string, # - = null
|
||||
"change_time_epoch": integer, # naive timestamp
|
||||
"change_time_epoch_utc": integer, # timezone-aware timestamp
|
||||
"birth_time": string, # - = null
|
||||
"birth_time_epoch": integer, # naive timestamp
|
||||
"birth_time_epoch_utc": integer, # timezone-aware timestamp
|
||||
"unix_device": integer,
|
||||
"rdev": integer,
|
||||
"block_size": integer,
|
||||
"unix_flags": string,
|
||||
|
||||
# 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
|
||||
}
|
||||
}
|
||||
|
||||
Examples:
|
||||
|
||||
$ stat | jc --stat-s
|
||||
{"file":"(stdin)","unix_device":1027739696,"inode":1155,"flags":"cr...}
|
||||
|
||||
$ stat | jc --stat-s -r
|
||||
{"file":"(stdin)","unix_device":"1027739696","inode":"1155","flag...}
|
||||
|
||||
<a id="jc.parsers.stat_s.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
@add_jc_meta
|
||||
def parse(data, raw=False, quiet=False, ignore_exceptions=False)
|
||||
```
|
||||
|
||||
Main text parsing generator function. Returns an iterator 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
|
||||
|
||||
Yields:
|
||||
|
||||
Dictionary. Raw or processed structured data.
|
||||
|
||||
Returns:
|
||||
|
||||
Iterator object (generator)
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, freebsd
|
||||
|
||||
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
88
docs/parsers/sysctl.md
Normal file
88
docs/parsers/sysctl.md
Normal file
@@ -0,0 +1,88 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.sysctl"></a>
|
||||
|
||||
# jc.parsers.sysctl
|
||||
|
||||
jc - JSON Convert `sysctl -a` command output parser
|
||||
|
||||
Note: Since `sysctl` output is not easily parsable only a very simple
|
||||
key/value object will be output. An attempt is made to convert obvious
|
||||
integers and floats. If no conversion is desired, use the `-r`
|
||||
command-line argument or the `raw=True` argument in `parse()`.
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ sysctl -a | jc --sysctl
|
||||
|
||||
or
|
||||
|
||||
$ jc sysctl -a
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('sysctl', sysctl_command_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.sysctl
|
||||
result = jc.parsers.sysctl.parse(sysctl_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
{
|
||||
"key1": string/integer/float, # best guess based on value
|
||||
"key2": string/integer/float,
|
||||
"key3": string/integer/float
|
||||
}
|
||||
|
||||
Examples:
|
||||
|
||||
$ sysctl -a | jc --sysctl -p
|
||||
{
|
||||
"user.cs_path": "/usr/bin:/bin:/usr/sbin:/sbin",
|
||||
"user.bc_base_max": 99,
|
||||
"user.bc_dim_max": 2048,
|
||||
"user.bc_scale_max": 99,
|
||||
"user.bc_string_max": 1000,
|
||||
"user.coll_weights_max": 2,
|
||||
"user.expr_nest_max": 32
|
||||
...
|
||||
}
|
||||
|
||||
$ sysctl -a | jc --sysctl -p -r
|
||||
{
|
||||
"user.cs_path": "/usr/bin:/bin:/usr/sbin:/sbin",
|
||||
"user.bc_base_max": "99",
|
||||
"user.bc_dim_max": "2048",
|
||||
"user.bc_scale_max": "99",
|
||||
"user.bc_string_max": "1000",
|
||||
"user.coll_weights_max": "2",
|
||||
"user.expr_nest_max": "32",
|
||||
...
|
||||
}
|
||||
|
||||
<a id="jc.parsers.sysctl.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. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, freebsd
|
||||
|
||||
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
@@ -1,61 +1,29 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.systemctl"></a>
|
||||
|
||||
# jc.parsers.systemctl
|
||||
jc - JSON CLI output utility systemctl Parser
|
||||
|
||||
Usage:
|
||||
jc - JSON Convert `systemctl` command output parser
|
||||
|
||||
specify --systemctl as the first argument if the piped input is coming from systemctl
|
||||
Usage (cli):
|
||||
|
||||
Compatibility:
|
||||
$ systemctl | jc --systemctl
|
||||
|
||||
'linux'
|
||||
or
|
||||
|
||||
Examples:
|
||||
$ jc systemctl
|
||||
|
||||
$ systemctl -a | jc --systemctl -p
|
||||
[
|
||||
{
|
||||
"unit": "proc-sys-fs-binfmt_misc.automount",
|
||||
"load": "loaded",
|
||||
"active": "active",
|
||||
"sub": "waiting",
|
||||
"description": "Arbitrary Executable File Formats File System Automount Point"
|
||||
},
|
||||
{
|
||||
"unit": "dev-block-8:2.device",
|
||||
"load": "loaded",
|
||||
"active": "active",
|
||||
"sub": "plugged",
|
||||
"description": "LVM PV 3klkIj-w1qk-DkJi-0XBJ-y3o7-i2Ac-vHqWBM on /dev/sda2 2"
|
||||
},
|
||||
{
|
||||
"unit": "dev-cdrom.device",
|
||||
"load": "loaded",
|
||||
"active": "active",
|
||||
"sub": "plugged",
|
||||
"description": "VMware_Virtual_IDE_CDROM_Drive"
|
||||
},
|
||||
...
|
||||
]
|
||||
Usage (module):
|
||||
|
||||
## info
|
||||
```python
|
||||
info(self, /, *args, **kwargs)
|
||||
```
|
||||
import jc
|
||||
result = jc.parse('systemctl', systemctl_command_output)
|
||||
|
||||
## process
|
||||
```python
|
||||
process(proc_data)
|
||||
```
|
||||
or
|
||||
|
||||
Final processing to conform to the schema.
|
||||
import jc.parsers.systemctl
|
||||
result = jc.parsers.systemctl.parse(systemctl_command_output)
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
@@ -67,9 +35,40 @@ Returns:
|
||||
}
|
||||
]
|
||||
|
||||
## parse
|
||||
Examples:
|
||||
|
||||
$ systemctl -a | jc --systemctl -p
|
||||
[
|
||||
{
|
||||
"unit": "proc-sys-fs-binfmt_misc.automount",
|
||||
"load": "loaded",
|
||||
"active": "active",
|
||||
"sub": "waiting",
|
||||
"description": "Arbitrary Executable File Formats File System ..."
|
||||
},
|
||||
{
|
||||
"unit": "dev-block-8:2.device",
|
||||
"load": "loaded",
|
||||
"active": "active",
|
||||
"sub": "plugged",
|
||||
"description": "LVM PV 3klkIj-w1qk-DkJi-0XBJ-y3o7-i2Ac-vHqWBM o..."
|
||||
},
|
||||
{
|
||||
"unit": "dev-cdrom.device",
|
||||
"load": "loaded",
|
||||
"active": "active",
|
||||
"sub": "plugged",
|
||||
"description": "VMware_Virtual_IDE_CDROM_Drive"
|
||||
},
|
||||
...
|
||||
]
|
||||
|
||||
<a id="jc.parsers.systemctl.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@@ -77,10 +76,14 @@ Main text parsing function
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) output preprocessed JSON if True
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
@@ -1,13 +1,38 @@
|
||||
# jc.parsers.systemctl_lj
|
||||
jc - JSON CLI output utility systemctl-lj Parser
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.systemctl_lj"></a>
|
||||
|
||||
Usage:
|
||||
# jc.parsers.systemctl\_lj
|
||||
|
||||
specify --systemctl-lj as the first argument if the piped input is coming from systemctl list-jobs
|
||||
jc - JSON Convert `systemctl list-jobs` command output parser
|
||||
|
||||
Compatibility:
|
||||
Usage (cli):
|
||||
|
||||
'linux'
|
||||
$ systemctl list-jobs | jc --systemctl-lj
|
||||
|
||||
or
|
||||
|
||||
$ jc systemctl list-jobs
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('systemctl_lj', systemctl_lj_command_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.systemctl_lj
|
||||
result = jc.parsers.systemctl_lj.parse(systemctl_lj_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"job": integer,
|
||||
"unit": string,
|
||||
"type": string,
|
||||
"state": string
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
@@ -55,39 +80,12 @@ Examples:
|
||||
}
|
||||
]
|
||||
|
||||
<a id="jc.parsers.systemctl_lj.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
## info
|
||||
```python
|
||||
info(self, /, *args, **kwargs)
|
||||
```
|
||||
|
||||
## process
|
||||
```python
|
||||
process(proc_data)
|
||||
```
|
||||
|
||||
Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
"job": integer,
|
||||
"unit": string,
|
||||
"type": string,
|
||||
"state": string
|
||||
}
|
||||
]
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@@ -95,10 +93,14 @@ Main text parsing function
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) output preprocessed JSON if True
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
@@ -1,13 +1,38 @@
|
||||
# jc.parsers.systemctl_ls
|
||||
jc - JSON CLI output utility systemctl-ls Parser
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.systemctl_ls"></a>
|
||||
|
||||
Usage:
|
||||
# jc.parsers.systemctl\_ls
|
||||
|
||||
specify --systemctl-ls as the first argument if the piped input is coming from systemctl list-sockets
|
||||
jc - JSON Convert `systemctl list-sockets` command output
|
||||
parser
|
||||
|
||||
Compatibility:
|
||||
Usage (cli):
|
||||
|
||||
'linux'
|
||||
$ systemctl list-sockets | jc --systemctl-ls
|
||||
|
||||
or
|
||||
|
||||
$ jc systemctl list-sockets
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('systemctl_ls', systemctl_ls_command_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.systemctl_ls
|
||||
result = jc.parsers.systemctl_ls.parse(systemctl_ls_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"listen": string,
|
||||
"unit": string,
|
||||
"activates": string
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
@@ -31,37 +56,12 @@ Examples:
|
||||
...
|
||||
]
|
||||
|
||||
## info
|
||||
<a id="jc.parsers.systemctl_ls.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
info(self, /, *args, **kwargs)
|
||||
```
|
||||
|
||||
## process
|
||||
```python
|
||||
process(proc_data)
|
||||
```
|
||||
|
||||
Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
"listen": string,
|
||||
"unit": string,
|
||||
"activates": string
|
||||
}
|
||||
]
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@@ -69,10 +69,14 @@ Main text parsing function
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) output preprocessed JSON if True
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
@@ -1,13 +1,37 @@
|
||||
# jc.parsers.systemctl_luf
|
||||
jc - JSON CLI output utility systemctl-luf Parser
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.systemctl_luf"></a>
|
||||
|
||||
Usage:
|
||||
# jc.parsers.systemctl\_luf
|
||||
|
||||
specify --systemctl-luf as the first argument if the piped input is coming from systemctl list-unit-files
|
||||
jc - JSON Convert `systemctl list-unit-files` command output
|
||||
parser
|
||||
|
||||
Compatibility:
|
||||
Usage (cli):
|
||||
|
||||
'linux'
|
||||
$ systemctl list-unit-files | jc --systemctl-luf
|
||||
|
||||
or
|
||||
|
||||
$ jc systemctl list-unit-files
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('systemctl_luf', systemctl_luf_command_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.systemctl_luf
|
||||
result = jc.parsers.systemctl_luf.parse(systemctl_luf_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"unit_file": string,
|
||||
"state": string
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
@@ -28,36 +52,12 @@ Examples:
|
||||
...
|
||||
]
|
||||
|
||||
## info
|
||||
<a id="jc.parsers.systemctl_luf.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
info(self, /, *args, **kwargs)
|
||||
```
|
||||
|
||||
## process
|
||||
```python
|
||||
process(proc_data)
|
||||
```
|
||||
|
||||
Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
"unit_file": string,
|
||||
"state": string
|
||||
}
|
||||
]
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@@ -65,10 +65,14 @@ Main text parsing function
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) output preprocessed JSON if True
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
242
docs/parsers/systeminfo.md
Normal file
242
docs/parsers/systeminfo.md
Normal file
@@ -0,0 +1,242 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.systeminfo"></a>
|
||||
|
||||
# jc.parsers.systeminfo
|
||||
|
||||
jc - JSON Convert `systeminfo` command output parser
|
||||
|
||||
Blank or missing elements are set to `null`.
|
||||
|
||||
The `original_install_date_epoch` and `system_boot_time_epoch` calculated
|
||||
timestamp fields are naive. (i.e. based on the local time of the system the
|
||||
parser is run on)
|
||||
|
||||
The `original_install_date_epoch_utc` and `system_boot_time_epoch_utc`
|
||||
calculated timestamp fields are timezone-aware and are only available if
|
||||
the timezone field is UTC.
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ systeminfo | jc --systeminfo
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('systeminfo', systeminfo_command_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.systeminfo
|
||||
result = jc.parsers.systeminfo.parse(systeminfo_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
{
|
||||
"host_name": string,
|
||||
"os_name": string,
|
||||
"os_version": string,
|
||||
"os_manufacturer": string,
|
||||
"os_configuration": string,
|
||||
"os_build_type": string,
|
||||
"registered_owner": string,
|
||||
"registered_organization": string,
|
||||
"product_id": string,
|
||||
"original_install_date": string,
|
||||
"original_install_date_epoch": integer, # [0]
|
||||
"original_install_date_epoch_utc": integer, # [1]
|
||||
"system_boot_time": string,
|
||||
"system_boot_time_epoch": integer, # [0]
|
||||
"system_boot_time_epoch_utc": integer, # [1]
|
||||
"system_manufacturer": string,
|
||||
"system_model": string,
|
||||
"system_type": string,
|
||||
"processors": [
|
||||
string
|
||||
],
|
||||
"bios_version": string,
|
||||
"windows_directory": string,
|
||||
"system_directory": string,
|
||||
"boot_device": string,
|
||||
"system_locale": string,
|
||||
"input_locale": string,
|
||||
"time_zone": string,
|
||||
"total_physical_memory_mb": string,
|
||||
"available_physical_memory_mb": integer,
|
||||
"virtual_memory_max_size_mb": integer,
|
||||
"virtual_memory_available_mb": integer,
|
||||
"virtual_memory_in_use_mb": integer,
|
||||
"page_file_locations": string,
|
||||
"domain": string,
|
||||
"logon_server": string,
|
||||
"hotfixs": [
|
||||
string
|
||||
],
|
||||
"network_cards": [
|
||||
{
|
||||
"name": string,
|
||||
"connection_name": string,
|
||||
"status": string,
|
||||
"dhcp_enabled": boolean,
|
||||
"dhcp_server": string,
|
||||
"ip_addresses": [
|
||||
string
|
||||
]
|
||||
}
|
||||
],
|
||||
"hyperv_requirements": {
|
||||
"vm_monitor_mode_extensions": boolean,
|
||||
"virtualization_enabled_in_firmware": boolean,
|
||||
"second_level_address_translation": boolean,
|
||||
"data_execution_prevention_available": boolean
|
||||
}
|
||||
}
|
||||
|
||||
[0] naive timestamp
|
||||
[1] timezone-aware timestamp
|
||||
|
||||
Examples:
|
||||
|
||||
$ systeminfo | jc --systeminfo -p
|
||||
{
|
||||
"host_name": "TESTLAPTOP",
|
||||
"os_name": "Microsoft Windows 10 Enterprise",
|
||||
"os_version": "10.0.17134 N/A Build 17134",
|
||||
"os_manufacturer": "Microsoft Corporation",
|
||||
"os_configuration": "Member Workstation",
|
||||
"os_build_type": "Multiprocessor Free",
|
||||
"registered_owner": "Test, Inc.",
|
||||
"registered_organization": "Test, Inc.",
|
||||
"product_id": "11111-11111-11111-AA111",
|
||||
"original_install_date": "3/26/2019, 3:51:30 PM",
|
||||
"system_boot_time": "3/30/2021, 6:13:59 AM",
|
||||
"system_manufacturer": "Dell Inc.",
|
||||
"system_model": "Precision 5530",
|
||||
"system_type": "x64-based PC",
|
||||
"processors": [
|
||||
"Intel64 Family 6 Model 158 Stepping 10 GenuineIntel ~2592 Mhz"
|
||||
],
|
||||
"bios_version": "Dell Inc. 1.16.2, 4/21/2020",
|
||||
"windows_directory": "C:\\WINDOWS",
|
||||
"system_directory": "C:\\WINDOWS\\system32",
|
||||
"boot_device": "\\Device\\HarddiskVolume2",
|
||||
"system_locale": "en-us;English (United States)",
|
||||
"input_locale": "en-us;English (United States)",
|
||||
"time_zone": "(UTC+00:00) UTC",
|
||||
"total_physical_memory_mb": 32503,
|
||||
"available_physical_memory_mb": 19743,
|
||||
"virtual_memory_max_size_mb": 37367,
|
||||
"virtual_memory_available_mb": 22266,
|
||||
"virtual_memory_in_use_mb": 15101,
|
||||
"page_file_locations": "C:\\pagefile.sys",
|
||||
"domain": "test.com",
|
||||
"logon_server": "\\\\TESTDC01",
|
||||
"hotfixs": [
|
||||
"KB2693643",
|
||||
"KB4601054"
|
||||
],
|
||||
"network_cards": [
|
||||
{
|
||||
"name": "Intel(R) Wireless-AC 9260 160MHz",
|
||||
"connection_name": "Wi-Fi",
|
||||
"status": null,
|
||||
"dhcp_enabled": true,
|
||||
"dhcp_server": "192.168.2.1",
|
||||
"ip_addresses": [
|
||||
"192.168.2.219"
|
||||
]
|
||||
}
|
||||
],
|
||||
"hyperv_requirements": {
|
||||
"vm_monitor_mode_extensions": true,
|
||||
"virtualization_enabled_in_firmware": true,
|
||||
"second_level_address_translation": false,
|
||||
"data_execution_prevention_available": true
|
||||
},
|
||||
"original_install_date_epoch": 1553640690,
|
||||
"original_install_date_epoch_utc": 1553615490,
|
||||
"system_boot_time_epoch": 1617110039,
|
||||
"system_boot_time_epoch_utc": 1617084839
|
||||
}
|
||||
|
||||
$ systeminfo | jc --systeminfo -p -r
|
||||
{
|
||||
"host_name": "TESTLAPTOP",
|
||||
"os_name": "Microsoft Windows 10 Enterprise",
|
||||
"os_version": "10.0.17134 N/A Build 17134",
|
||||
"os_manufacturer": "Microsoft Corporation",
|
||||
"os_configuration": "Member Workstation",
|
||||
"os_build_type": "Multiprocessor Free",
|
||||
"registered_owner": "Test, Inc.",
|
||||
"registered_organization": "Test, Inc.",
|
||||
"product_id": "11111-11111-11111-AA111",
|
||||
"original_install_date": "3/26/2019, 3:51:30 PM",
|
||||
"system_boot_time": "3/30/2021, 6:13:59 AM",
|
||||
"system_manufacturer": "Dell Inc.",
|
||||
"system_model": "Precision 5530",
|
||||
"system_type": "x64-based PC",
|
||||
"processors": [
|
||||
"Intel64 Family 6 Model 158 Stepping 10 GenuineIntel ~2592 Mhz"
|
||||
],
|
||||
"bios_version": "Dell Inc. 1.16.2, 4/21/2020",
|
||||
"windows_directory": "C:\\WINDOWS",
|
||||
"system_directory": "C:\\WINDOWS\\system32",
|
||||
"boot_device": "\\Device\\HarddiskVolume2",
|
||||
"system_locale": "en-us;English (United States)",
|
||||
"input_locale": "en-us;English (United States)",
|
||||
"time_zone": "(UTC+00:00) UTC",
|
||||
"total_physical_memory_mb": "32,503 MB",
|
||||
"available_physical_memory_mb": "19,743 MB",
|
||||
"virtual_memory_max_size_mb": "37,367 MB",
|
||||
"virtual_memory_available_mb": "22,266 MB",
|
||||
"virtual_memory_in_use_mb": "15,101 MB",
|
||||
"page_file_locations": "C:\\pagefile.sys",
|
||||
"domain": "test.com",
|
||||
"logon_server": "\\\\TESTDC01",
|
||||
"hotfixs": [
|
||||
"KB2693643",
|
||||
"KB4601054"
|
||||
],
|
||||
"network_cards": [
|
||||
{
|
||||
"name": "Intel(R) Wireless-AC 9260 160MHz",
|
||||
"connection_name": "Wi-Fi",
|
||||
"status": "",
|
||||
"dhcp_enabled": "Yes",
|
||||
"dhcp_server": "192.168.2.1",
|
||||
"ip_addresses": [
|
||||
"192.168.2.219"
|
||||
]
|
||||
}
|
||||
],
|
||||
"hyperv_requirements": {
|
||||
"vm_monitor_mode_extensions": "Yes",
|
||||
"virtualization_enabled_in_firmware": "Yes",
|
||||
"second_level_address_translation": "No",
|
||||
"data_execution_prevention_available": "Yes"
|
||||
}
|
||||
}
|
||||
|
||||
<a id="jc.parsers.systeminfo.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 Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: win32
|
||||
|
||||
Version 1.2 by Jon Smith (jon@rebelliondefense.com)
|
||||
163
docs/parsers/time.md
Normal file
163
docs/parsers/time.md
Normal file
@@ -0,0 +1,163 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.time"></a>
|
||||
|
||||
# jc.parsers.time
|
||||
|
||||
jc - JSON Convert `/usr/bin/time` command output parser
|
||||
|
||||
Output from `/usr/bin/time` is sent to `STDERR`, so the `-o` option can be
|
||||
used to redirect the output to a file that can be read by `jc`.
|
||||
|
||||
Alternatively, the output from `/usr/bin/time` can be redirected to `STDOUT`
|
||||
so `jc` can receive it.
|
||||
|
||||
Note: `/usr/bin/time` is similar but different from the Bash builtin
|
||||
`time` command.
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ /usr/bin/time -o timefile.out sleep 2; cat timefile.out | \\
|
||||
jc --time -p
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('time', time_command_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.time
|
||||
result = jc.parsers.time.parse(time_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
Source: https://www.freebsd.org/cgi/man.cgi?query=getrusage
|
||||
https://man7.org/linux/man-pages/man1/time.1.html
|
||||
|
||||
{
|
||||
"real_time": float,
|
||||
"user_time": float,
|
||||
"system_time": float,
|
||||
"elapsed_time": string,
|
||||
"elapsed_time_hours": integer,
|
||||
"elapsed_time_minutes": integer,
|
||||
"elapsed_time_seconds": integer,
|
||||
"elapsed_time_centiseconds": integer,
|
||||
"elapsed_time_total_seconds": float,
|
||||
"cpu_percent": integer, # null if ?
|
||||
"average_shared_text_size": integer,
|
||||
"average_unshared_data_size": integer,
|
||||
"average_unshared_stack_size": integer,
|
||||
"average_shared_memory_size": integer,
|
||||
"maximum_resident_set_size": integer,
|
||||
"block_input_operations": integer, # [0]
|
||||
"block_output_operations": integer, # [1]
|
||||
"major_pagefaults": integer,
|
||||
"minor_pagefaults": integer,
|
||||
"swaps": integer,
|
||||
"page_reclaims": integer,
|
||||
"page_faults": integer,
|
||||
"messages_sent": integer,
|
||||
"messages_received": integer,
|
||||
"signals_received": integer,
|
||||
"voluntary_context_switches": integer,
|
||||
"involuntary_context_switches": integer
|
||||
"command_being_timed": string,
|
||||
"average_stack_size": integer,
|
||||
"average_total_size": integer,
|
||||
"average_resident_set_size": integer,
|
||||
"signals_delivered": integer,
|
||||
"page_size": integer,
|
||||
"exit_status": integer
|
||||
}
|
||||
|
||||
[0] aka File system inputs
|
||||
[1] aka File system outputs
|
||||
|
||||
Examples:
|
||||
|
||||
$ /usr/bin/time --verbose -o timefile.out sleep 2; cat timefile.out | \\
|
||||
jc --time -p
|
||||
{
|
||||
"command_being_timed": "sleep 2",
|
||||
"user_time": 0.0,
|
||||
"system_time": 0.0,
|
||||
"cpu_percent": 0,
|
||||
"elapsed_time": "0:02.00",
|
||||
"average_shared_text_size": 0,
|
||||
"average_unshared_data_size": 0,
|
||||
"average_stack_size": 0,
|
||||
"average_total_size": 0,
|
||||
"maximum_resident_set_size": 2084,
|
||||
"average_resident_set_size": 0,
|
||||
"major_pagefaults": 0,
|
||||
"minor_pagefaults": 72,
|
||||
"voluntary_context_switches": 2,
|
||||
"involuntary_context_switches": 1,
|
||||
"swaps": 0,
|
||||
"block_input_operations": 0,
|
||||
"block_output_operations": 0,
|
||||
"messages_sent": 0,
|
||||
"messages_received": 0,
|
||||
"signals_delivered": 0,
|
||||
"page_size": 4096,
|
||||
"exit_status": 0,
|
||||
"elapsed_time_hours": 0,
|
||||
"elapsed_time_minutes": 0,
|
||||
"elapsed_time_seconds": 2,
|
||||
"elapsed_time_centiseconds": 50,
|
||||
"elapsed_time_total_seconds": 2.5
|
||||
}
|
||||
|
||||
$ /usr/bin/time --verbose -o timefile.out sleep 2; cat timefile.out | \\
|
||||
jc --time -p -r
|
||||
{
|
||||
"command_being_timed": "\"sleep 2\"",
|
||||
"user_time": "0.00",
|
||||
"system_time": "0.00",
|
||||
"cpu_percent": "0",
|
||||
"elapsed_time": "0:02.00",
|
||||
"average_shared_text_size": "0",
|
||||
"average_unshared_data_size": "0",
|
||||
"average_stack_size": "0",
|
||||
"average_total_size": "0",
|
||||
"maximum_resident_set_size": "2084",
|
||||
"average_resident_set_size": "0",
|
||||
"major_pagefaults": "0",
|
||||
"minor_pagefaults": "72",
|
||||
"voluntary_context_switches": "2",
|
||||
"involuntary_context_switches": "0",
|
||||
"swaps": "0",
|
||||
"block_input_operations": "0",
|
||||
"block_output_operations": "0",
|
||||
"messages_sent": "0",
|
||||
"messages_received": "0",
|
||||
"signals_delivered": "0",
|
||||
"page_size": "4096",
|
||||
"exit_status": "0"
|
||||
}
|
||||
|
||||
<a id="jc.parsers.time.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. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, aix, freebsd
|
||||
|
||||
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
@@ -1,13 +1,46 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.timedatectl"></a>
|
||||
|
||||
# jc.parsers.timedatectl
|
||||
jc - JSON CLI output utility timedatectl Parser
|
||||
|
||||
Usage:
|
||||
jc - JSON Convert `timedatectl` command output parser
|
||||
|
||||
specify --timedatectl as the first argument if the piped input is coming from timedatectl or timedatectl status
|
||||
The `epoch_utc` calculated timestamp field is timezone-aware and is only
|
||||
available if the `universal_time` field is available.
|
||||
|
||||
Compatibility:
|
||||
Usage (cli):
|
||||
|
||||
'linux'
|
||||
$ timedatectl | jc --timedatectl
|
||||
|
||||
or
|
||||
|
||||
$ jc timedatectl
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('timedatectl', timedatectl_command_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.timedatectl
|
||||
result = jc.parsers.timedatectl.parse(timedatectl_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
{
|
||||
"local_time": string,
|
||||
"universal_time": string,
|
||||
"epoch_utc": integer, # timezone-aware
|
||||
"rtc_time": string,
|
||||
"time_zone": string,
|
||||
"ntp_enabled": boolean,
|
||||
"ntp_synchronized": boolean,
|
||||
"system_clock_synchronized": boolean,
|
||||
"systemd-timesyncd.service_active": boolean,
|
||||
"rtc_in_local_tz": boolean,
|
||||
"dst_active": boolean
|
||||
}
|
||||
|
||||
Examples:
|
||||
|
||||
@@ -20,7 +53,8 @@ Examples:
|
||||
"ntp_enabled": true,
|
||||
"ntp_synchronized": true,
|
||||
"rtc_in_local_tz": false,
|
||||
"dst_active": true
|
||||
"dst_active": true,
|
||||
"epoch_utc": 1583888001
|
||||
}
|
||||
|
||||
$ timedatectl | jc --timedatectl -p -r
|
||||
@@ -35,42 +69,12 @@ Examples:
|
||||
"dst_active": "yes"
|
||||
}
|
||||
|
||||
## info
|
||||
<a id="jc.parsers.timedatectl.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
info(self, /, *args, **kwargs)
|
||||
```
|
||||
|
||||
## process
|
||||
```python
|
||||
process(proc_data)
|
||||
```
|
||||
|
||||
Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
Dictionary. Structured data with the following schema:
|
||||
|
||||
{
|
||||
"local_time": string,
|
||||
"universal_time": string,
|
||||
"rtc_time": string,
|
||||
"time_zone": string,
|
||||
"ntp_enabled": boolean,
|
||||
"ntp_synchronized": boolean,
|
||||
"system_clock_synchronized": boolean,
|
||||
"systemd-timesyncd.service_active": boolean,
|
||||
"rtc_in_local_tz": boolean,
|
||||
"dst_active": boolean
|
||||
}
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@@ -78,10 +82,14 @@ Main text parsing function
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) output preprocessed JSON if True
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
Dictionary. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
162
docs/parsers/tracepath.md
Normal file
162
docs/parsers/tracepath.md
Normal file
@@ -0,0 +1,162 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.tracepath"></a>
|
||||
|
||||
# jc.parsers.tracepath
|
||||
|
||||
jc - JSON Convert `tracepath` command output parser
|
||||
|
||||
Supports `tracepath` and `tracepath6` output.
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ tracepath 1.2.3.4 | jc --tracepath
|
||||
|
||||
or
|
||||
|
||||
$ jc tracepath 1.2.3.4
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('tracepath', tracepath_command_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.tracepath
|
||||
result = jc.parsers.tracepath.parse(tracepath_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
{
|
||||
"pmtu": integer,
|
||||
"forward_hops": integer,
|
||||
"return_hops": integer,
|
||||
"hops": [
|
||||
{
|
||||
"ttl": integer,
|
||||
"guess": boolean,
|
||||
"host": string,
|
||||
"reply_ms": float,
|
||||
"pmtu": integer,
|
||||
"asymmetric_difference": integer,
|
||||
"reached": boolean
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Examples:
|
||||
|
||||
$ tracepath6 3ffe:2400:0:109::2 | jc --tracepath -p
|
||||
{
|
||||
"pmtu": 1480,
|
||||
"forward_hops": 2,
|
||||
"return_hops": 2,
|
||||
"hops": [
|
||||
{
|
||||
"ttl": 1,
|
||||
"guess": true,
|
||||
"host": "[LOCALHOST]",
|
||||
"reply_ms": null,
|
||||
"pmtu": 1500,
|
||||
"asymmetric_difference": null,
|
||||
"reached": false
|
||||
},
|
||||
{
|
||||
"ttl": 1,
|
||||
"guess": false,
|
||||
"host": "dust.inr.ac.ru",
|
||||
"reply_ms": 0.411,
|
||||
"pmtu": null,
|
||||
"asymmetric_difference": null,
|
||||
"reached": false
|
||||
},
|
||||
{
|
||||
"ttl": 2,
|
||||
"guess": false,
|
||||
"host": "dust.inr.ac.ru",
|
||||
"reply_ms": 0.39,
|
||||
"pmtu": 1480,
|
||||
"asymmetric_difference": 1,
|
||||
"reached": false
|
||||
},
|
||||
{
|
||||
"ttl": 2,
|
||||
"guess": false,
|
||||
"host": "3ffe:2400:0:109::2",
|
||||
"reply_ms": 463.514,
|
||||
"pmtu": null,
|
||||
"asymmetric_difference": null,
|
||||
"reached": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
$ tracepath6 3ffe:2400:0:109::2 | jc --tracepath -p -r
|
||||
{
|
||||
"pmtu": "1480",
|
||||
"forward_hops": "2",
|
||||
"return_hops": "2",
|
||||
"hops": [
|
||||
{
|
||||
"ttl": "1",
|
||||
"guess": true,
|
||||
"host": "[LOCALHOST]",
|
||||
"reply_ms": null,
|
||||
"pmtu": "1500",
|
||||
"asymmetric_difference": null,
|
||||
"reached": false
|
||||
},
|
||||
{
|
||||
"ttl": "1",
|
||||
"guess": false,
|
||||
"host": "dust.inr.ac.ru",
|
||||
"reply_ms": "0.411",
|
||||
"pmtu": null,
|
||||
"asymmetric_difference": null,
|
||||
"reached": false
|
||||
},
|
||||
{
|
||||
"ttl": "2",
|
||||
"guess": false,
|
||||
"host": "dust.inr.ac.ru",
|
||||
"reply_ms": "0.390",
|
||||
"pmtu": "1480",
|
||||
"asymmetric_difference": "1",
|
||||
"reached": false
|
||||
},
|
||||
{
|
||||
"ttl": "2",
|
||||
"guess": false,
|
||||
"host": "3ffe:2400:0:109::2",
|
||||
"reply_ms": "463.514",
|
||||
"pmtu": null,
|
||||
"asymmetric_difference": null,
|
||||
"reached": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
<a id="jc.parsers.tracepath.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. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
151
docs/parsers/traceroute.md
Normal file
151
docs/parsers/traceroute.md
Normal file
@@ -0,0 +1,151 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.traceroute"></a>
|
||||
|
||||
# jc.parsers.traceroute
|
||||
|
||||
jc - JSON Convert `traceroute` command output parser
|
||||
|
||||
Supports `traceroute` and `traceroute6` output.
|
||||
|
||||
Note: On some operating systems you will need to redirect `STDERR` to
|
||||
`STDOUT` for destination info since the header line is sent to
|
||||
`STDERR`. A warning message will be printed to `STDERR` if the
|
||||
header row is not found.
|
||||
|
||||
e.g. `$ traceroute 8.8.8.8 2>&1 | jc --traceroute`
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ traceroute 1.2.3.4 | jc --traceroute
|
||||
|
||||
or
|
||||
|
||||
$ jc traceroute 1.2.3.4
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('traceroute', traceroute_command_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.traceroute
|
||||
result = jc.parsers.traceroute.parse(traceroute_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
{
|
||||
"destination_ip": string,
|
||||
"destination_name": string,
|
||||
"hops": [
|
||||
{
|
||||
"hop": integer,
|
||||
"probes": [
|
||||
{
|
||||
"annotation": string,
|
||||
"asn": integer,
|
||||
"ip": string,
|
||||
"name": string,
|
||||
"rtt": float
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Examples:
|
||||
|
||||
$ traceroute google.com | jc --traceroute -p
|
||||
{
|
||||
"destination_ip": "216.58.194.46",
|
||||
"destination_name": "google.com",
|
||||
"hops": [
|
||||
{
|
||||
"hop": 1,
|
||||
"probes": [
|
||||
{
|
||||
"annotation": null,
|
||||
"asn": null,
|
||||
"ip": "216.230.231.141",
|
||||
"name": "216-230-231-141.static.houston.tx.oplink.net",
|
||||
"rtt": 198.574
|
||||
},
|
||||
{
|
||||
"annotation": null,
|
||||
"asn": null,
|
||||
"ip": "216.230.231.141",
|
||||
"name": "216-230-231-141.static.houston.tx.oplink.net",
|
||||
"rtt": null
|
||||
},
|
||||
{
|
||||
"annotation": null,
|
||||
"asn": null,
|
||||
"ip": "216.230.231.141",
|
||||
"name": "216-230-231-141.static.houston.tx.oplink.net",
|
||||
"rtt": 198.65
|
||||
}
|
||||
]
|
||||
},
|
||||
...
|
||||
]
|
||||
}
|
||||
|
||||
$ traceroute google.com | jc --traceroute -p -r
|
||||
{
|
||||
"destination_ip": "216.58.194.46",
|
||||
"destination_name": "google.com",
|
||||
"hops": [
|
||||
{
|
||||
"hop": "1",
|
||||
"probes": [
|
||||
{
|
||||
"annotation": null,
|
||||
"asn": null,
|
||||
"ip": "216.230.231.141",
|
||||
"name": "216-230-231-141.static.houston.tx.oplink.net",
|
||||
"rtt": "198.574"
|
||||
},
|
||||
{
|
||||
"annotation": null,
|
||||
"asn": null,
|
||||
"ip": "216.230.231.141",
|
||||
"name": "216-230-231-141.static.houston.tx.oplink.net",
|
||||
"rtt": null
|
||||
},
|
||||
{
|
||||
"annotation": null,
|
||||
"asn": null,
|
||||
"ip": "216.230.231.141",
|
||||
"name": "216-230-231-141.static.houston.tx.oplink.net",
|
||||
"rtt": "198.650"
|
||||
}
|
||||
]
|
||||
},
|
||||
...
|
||||
]
|
||||
}
|
||||
|
||||
<a id="jc.parsers.traceroute.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. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, freebsd
|
||||
|
||||
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
231
docs/parsers/ufw.md
Normal file
231
docs/parsers/ufw.md
Normal file
@@ -0,0 +1,231 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.ufw"></a>
|
||||
|
||||
# jc.parsers.ufw
|
||||
|
||||
jc - JSON Convert `ufw status` command output parser
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ ufw status | jc --ufw
|
||||
|
||||
or
|
||||
|
||||
$ jc ufw status
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('ufw', ufw_command_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.ufw
|
||||
result = jc.parsers.ufw.parse(ufw_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
{
|
||||
"status": string,
|
||||
"logging": string,
|
||||
"logging_level": string,
|
||||
"default": string,
|
||||
"new_profiles": string,
|
||||
"rules": [
|
||||
{
|
||||
"action": string,
|
||||
"action_direction": string, # null if blank
|
||||
"index": integer, # null if blank
|
||||
"network_protocol": string,
|
||||
"to_ip": string,
|
||||
"to_ip_prefix": integer,
|
||||
"to_interface": string,
|
||||
"to_transport": string,
|
||||
"to_ports": [
|
||||
integer
|
||||
],
|
||||
"to_port_ranges": [
|
||||
{
|
||||
"start": integer,
|
||||
"end": integer
|
||||
}
|
||||
],
|
||||
"to_service": string, # [0]
|
||||
"from_ip": string,
|
||||
"from_ip_prefix": integer,
|
||||
"from_interface": string,
|
||||
"from_transport": string,
|
||||
"from_ports": [
|
||||
integer
|
||||
],
|
||||
"from_port_ranges": [
|
||||
{
|
||||
"start": integer,
|
||||
"end": integer
|
||||
}
|
||||
],
|
||||
"from_service": string, # [1]
|
||||
"comment": string # null if no comment
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
[0] null if any 'to' ports or port_ranges are set
|
||||
[1] null if any 'from' ports or port_ranges are set
|
||||
|
||||
Examples:
|
||||
|
||||
$ ufw status verbose | jc --ufw -p
|
||||
{
|
||||
"status": "active",
|
||||
"logging": "on",
|
||||
"logging_level": "low",
|
||||
"default": "deny (incoming), allow (outgoing), disabled (routed)",
|
||||
"new_profiles": "skip",
|
||||
"rules": [
|
||||
{
|
||||
"action": "ALLOW",
|
||||
"action_direction": "IN",
|
||||
"index": null,
|
||||
"network_protocol": "ipv4",
|
||||
"to_interface": "any",
|
||||
"to_transport": "any",
|
||||
"to_service": null,
|
||||
"to_ports": [
|
||||
22
|
||||
],
|
||||
"to_ip": "0.0.0.0",
|
||||
"to_ip_prefix": 0,
|
||||
"comment": null,
|
||||
"from_ip": "0.0.0.0",
|
||||
"from_ip_prefix": 0,
|
||||
"from_interface": "any",
|
||||
"from_transport": "any",
|
||||
"from_port_ranges": [
|
||||
{
|
||||
"start": 0,
|
||||
"end": 65535
|
||||
}
|
||||
],
|
||||
"from_service": null
|
||||
},
|
||||
{
|
||||
"action": "ALLOW",
|
||||
"action_direction": "IN",
|
||||
"index": null,
|
||||
"network_protocol": "ipv4",
|
||||
"to_interface": "any",
|
||||
"to_transport": "tcp",
|
||||
"to_service": null,
|
||||
"to_ports": [
|
||||
80,
|
||||
443
|
||||
],
|
||||
"to_ip": "0.0.0.0",
|
||||
"to_ip_prefix": 0,
|
||||
"comment": null,
|
||||
"from_ip": "0.0.0.0",
|
||||
"from_ip_prefix": 0,
|
||||
"from_interface": "any",
|
||||
"from_transport": "any",
|
||||
"from_port_ranges": [
|
||||
{
|
||||
"start": 0,
|
||||
"end": 65535
|
||||
}
|
||||
],
|
||||
"from_service": null
|
||||
},
|
||||
...
|
||||
]
|
||||
}
|
||||
|
||||
$ ufw status verbose | jc --ufw -p -r
|
||||
{
|
||||
"status": "active",
|
||||
"logging": "on",
|
||||
"logging_level": "low",
|
||||
"default": "deny (incoming), allow (outgoing), disabled (routed)",
|
||||
"new_profiles": "skip",
|
||||
"rules": [
|
||||
{
|
||||
"action": "ALLOW",
|
||||
"action_direction": "IN",
|
||||
"index": null,
|
||||
"network_protocol": "ipv4",
|
||||
"to_interface": "any",
|
||||
"to_transport": "any",
|
||||
"to_service": null,
|
||||
"to_ports": [
|
||||
"22"
|
||||
],
|
||||
"to_ip": "0.0.0.0",
|
||||
"to_ip_prefix": "0",
|
||||
"comment": null,
|
||||
"from_ip": "0.0.0.0",
|
||||
"from_ip_prefix": "0",
|
||||
"from_interface": "any",
|
||||
"from_transport": "any",
|
||||
"from_port_ranges": [
|
||||
{
|
||||
"start": "0",
|
||||
"end": "65535"
|
||||
}
|
||||
],
|
||||
"from_service": null
|
||||
},
|
||||
{
|
||||
"action": "ALLOW",
|
||||
"action_direction": "IN",
|
||||
"index": null,
|
||||
"network_protocol": "ipv4",
|
||||
"to_interface": "any",
|
||||
"to_transport": "tcp",
|
||||
"to_service": null,
|
||||
"to_ports": [
|
||||
"80",
|
||||
"443"
|
||||
],
|
||||
"to_ip": "0.0.0.0",
|
||||
"to_ip_prefix": "0",
|
||||
"comment": null,
|
||||
"from_ip": "0.0.0.0",
|
||||
"from_ip_prefix": "0",
|
||||
"from_interface": "any",
|
||||
"from_transport": "any",
|
||||
"from_port_ranges": [
|
||||
{
|
||||
"start": "0",
|
||||
"end": "65535"
|
||||
}
|
||||
],
|
||||
"from_service": null
|
||||
},
|
||||
...
|
||||
]
|
||||
}
|
||||
|
||||
<a id="jc.parsers.ufw.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. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
169
docs/parsers/ufw_appinfo.md
Normal file
169
docs/parsers/ufw_appinfo.md
Normal file
@@ -0,0 +1,169 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.ufw_appinfo"></a>
|
||||
|
||||
# jc.parsers.ufw\_appinfo
|
||||
|
||||
jc - JSON Convert `ufw app info [application]` command
|
||||
output parser
|
||||
|
||||
Supports individual apps via `ufw app info [application]` and all apps list
|
||||
via `ufw app info all`.
|
||||
|
||||
Because `ufw` application definitions allow overlapping ports and port
|
||||
ranges, this parser preserves that behavior, but also provides `normalized`
|
||||
lists and ranges that remove duplicate ports and merge overlapping ranges.
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ ufw app info OpenSSH | jc --ufw-appinfo
|
||||
|
||||
or
|
||||
|
||||
$ jc ufw app info OpenSSH
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('ufw_appinfo', ufw_appinfo_command_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.ufw_appinfo
|
||||
result = jc.parsers.ufw_appinfo.parse(ufw_appinfo_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"profile": string,
|
||||
"title": string,
|
||||
"description": string,
|
||||
"tcp_list": [
|
||||
integer
|
||||
],
|
||||
"tcp_ranges": [
|
||||
{
|
||||
"start": integer, # [0]
|
||||
"end": integer
|
||||
}
|
||||
],
|
||||
"udp_list": [
|
||||
integer
|
||||
],
|
||||
"udp_ranges": [
|
||||
{
|
||||
"start": integer, # [0]
|
||||
"end": integer
|
||||
}
|
||||
],
|
||||
"normalized_tcp_list": [
|
||||
integers # [1]
|
||||
],
|
||||
"normalized_tcp_ranges": [
|
||||
{
|
||||
"start": integer, # [0]
|
||||
"end": integers # [2]
|
||||
}
|
||||
],
|
||||
"normalized_udp_list": [
|
||||
integers # [1]
|
||||
],
|
||||
"normalized_udp_ranges": [
|
||||
{
|
||||
"start": integer, # [0]
|
||||
"end": integers # [2]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
[0] 'any' is converted to start/end: 0/65535
|
||||
[1] duplicates and overlapping are removed
|
||||
[2] overlapping are merged
|
||||
|
||||
Examples:
|
||||
|
||||
$ ufw app info MSN | jc --ufw-appinfo -p
|
||||
[
|
||||
{
|
||||
"profile": "MSN",
|
||||
"title": "MSN Chat",
|
||||
"description": "MSN chat protocol (with file transfer and voice)",
|
||||
"tcp_list": [
|
||||
1863,
|
||||
6901
|
||||
],
|
||||
"udp_list": [
|
||||
1863,
|
||||
6901
|
||||
],
|
||||
"tcp_ranges": [
|
||||
{
|
||||
"start": 6891,
|
||||
"end": 6900
|
||||
}
|
||||
],
|
||||
"normalized_tcp_list": [
|
||||
1863,
|
||||
6901
|
||||
],
|
||||
"normalized_tcp_ranges": [
|
||||
{
|
||||
"start": 6891,
|
||||
"end": 6900
|
||||
}
|
||||
],
|
||||
"normalized_udp_list": [
|
||||
1863,
|
||||
6901
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
$ ufw app info MSN | jc --ufw-appinfo -p -r
|
||||
[
|
||||
{
|
||||
"profile": "MSN",
|
||||
"title": "MSN Chat",
|
||||
"description": "MSN chat protocol (with file transfer and voice)",
|
||||
"tcp_list": [
|
||||
"1863",
|
||||
"6901"
|
||||
],
|
||||
"udp_list": [
|
||||
"1863",
|
||||
"6901"
|
||||
],
|
||||
"tcp_ranges": [
|
||||
{
|
||||
"start": "6891",
|
||||
"end": "6900"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
<a id="jc.parsers.ufw_appinfo.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 Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
@@ -1,17 +1,42 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.uname"></a>
|
||||
|
||||
# jc.parsers.uname
|
||||
jc - JSON CLI output utility uname Parser
|
||||
|
||||
Usage:
|
||||
jc - JSON Convert `uname -a` command output parser
|
||||
|
||||
specify --uname as the first argument if the piped input is coming from uname
|
||||
Note: Must use `uname -a`
|
||||
|
||||
Limitations:
|
||||
Usage (cli):
|
||||
|
||||
must use 'uname -a'
|
||||
$ uname -a | jc --uname
|
||||
|
||||
Compatibility:
|
||||
or
|
||||
|
||||
'linux', 'darwin', 'freebsd'
|
||||
$ jc uname -a
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('uname', uname_command_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.uname
|
||||
result = jc.parsers.uname.parse(uname_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
{
|
||||
"kernel_name": string,
|
||||
"node_name": string,
|
||||
"kernel_release": string,
|
||||
"operating_system": string,
|
||||
"hardware_platform": string,
|
||||
"processor": string,
|
||||
"machine": string,
|
||||
"kernel_version": string
|
||||
}
|
||||
|
||||
Example:
|
||||
|
||||
@@ -27,40 +52,12 @@ Example:
|
||||
"kernel_version": "#74-Ubuntu SMP Tue Sep 17 17:06:04 UTC 2019"
|
||||
}
|
||||
|
||||
## info
|
||||
<a id="jc.parsers.uname.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
info(self, /, *args, **kwargs)
|
||||
```
|
||||
|
||||
## process
|
||||
```python
|
||||
process(proc_data)
|
||||
```
|
||||
|
||||
Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
Dictionary. Structured data with the following schema:
|
||||
|
||||
{
|
||||
"kernel_name": string,
|
||||
"node_name": string,
|
||||
"kernel_release": string,
|
||||
"operating_system": string,
|
||||
"hardware_platform": string,
|
||||
"processor": string,
|
||||
"machine": string,
|
||||
"kernel_version": string
|
||||
}
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@@ -68,10 +65,14 @@ Main text parsing function
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) output preprocessed JSON if True
|
||||
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, freebsd
|
||||
|
||||
Version 1.7 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
70
docs/parsers/universal.md
Normal file
70
docs/parsers/universal.md
Normal file
@@ -0,0 +1,70 @@
|
||||
# Table of Contents
|
||||
|
||||
* [jc.parsers.universal](#jc.parsers.universal)
|
||||
* [simple\_table\_parse](#jc.parsers.universal.simple_table_parse)
|
||||
* [sparse\_table\_parse](#jc.parsers.universal.sparse_table_parse)
|
||||
|
||||
<a id="jc.parsers.universal"></a>
|
||||
|
||||
# jc.parsers.universal
|
||||
|
||||
jc - JSON Convert universal parsers
|
||||
|
||||
<a id="jc.parsers.universal.simple_table_parse"></a>
|
||||
|
||||
### simple\_table\_parse
|
||||
|
||||
```python
|
||||
def simple_table_parse(data: List[str]) -> List[Dict]
|
||||
```
|
||||
|
||||
Parse simple tables. The last column may contain data with spaces.
|
||||
|
||||
Parameters:
|
||||
|
||||
data: (list) Text data to parse that has been split into lines
|
||||
via .splitlines(). Item 0 must be the header row.
|
||||
Any spaces in header names should be changed to
|
||||
underscore '_'. You should also ensure headers are
|
||||
lowercase by using .lower().
|
||||
|
||||
Also, ensure there are no blank lines (list items)
|
||||
in the data.
|
||||
|
||||
Returns:
|
||||
|
||||
List of Dictionaries
|
||||
|
||||
<a id="jc.parsers.universal.sparse_table_parse"></a>
|
||||
|
||||
### sparse\_table\_parse
|
||||
|
||||
```python
|
||||
def sparse_table_parse(data: List[str], delim: str = '\u2063') -> List[Dict]
|
||||
```
|
||||
|
||||
Parse tables with missing column data or with spaces in column data.
|
||||
|
||||
Parameters:
|
||||
|
||||
data: (list) Text data to parse that has been split into lines
|
||||
via .splitlines(). Item 0 must be the header row.
|
||||
Any spaces in header names should be changed to
|
||||
underscore '_'. You should also ensure headers are
|
||||
lowercase by using .lower(). Do not change the
|
||||
position of header names as the positions are used
|
||||
to find the data.
|
||||
|
||||
Also, ensure there are no blank lines (list items)
|
||||
in the data.
|
||||
|
||||
delim: (string) Delimiter to use. By default `u\\2063`
|
||||
(invisible separator) is used since it is unlikely
|
||||
to ever be seen in terminal output. You can change
|
||||
this for troubleshooting purposes or if there is a
|
||||
delimiter conflict with your data.
|
||||
|
||||
Returns:
|
||||
|
||||
List of Dictionaries
|
||||
|
||||
229
docs/parsers/upower.md
Normal file
229
docs/parsers/upower.md
Normal file
@@ -0,0 +1,229 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.upower"></a>
|
||||
|
||||
# jc.parsers.upower
|
||||
|
||||
jc - JSON Convert `upower` command output parser
|
||||
|
||||
The `updated_epoch` calculated timestamp field is naive. (i.e. based on the
|
||||
local time of the system the parser is run on)
|
||||
|
||||
The `updated_epoch_utc` calculated timestamp field is timezone-aware and is
|
||||
only available if the timezone field is UTC.
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ upower -d | jc --upower
|
||||
|
||||
or
|
||||
|
||||
$ jc upower -d
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('upower', upower_command_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.upower
|
||||
result = jc.parsers.upower.parse(upower_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"type": string,
|
||||
"device_name": string,
|
||||
"native_path": string,
|
||||
"power_supply": boolean,
|
||||
"updated": string,
|
||||
"updated_epoch": integer, # [0]
|
||||
"updated_epoch_utc": integer, # [0]
|
||||
"updated_seconds_ago": integer,
|
||||
"has_history": boolean,
|
||||
"has_statistics": boolean,
|
||||
"detail": {
|
||||
"type": string,
|
||||
"warning_level": string, # null if none
|
||||
"online": boolean,
|
||||
"icon_name": string
|
||||
"present": boolean,
|
||||
"rechargeable": boolean,
|
||||
"state": string,
|
||||
"energy": float,
|
||||
"energy_unit": string,
|
||||
"energy_empty": float,
|
||||
"energy_empty_unit": string,
|
||||
"energy_full": float,
|
||||
"energy_full_unit": string,
|
||||
"energy_full_design": float,
|
||||
"energy_full_design_unit": string,
|
||||
"energy_rate": float,
|
||||
"energy_rate_unit": string,
|
||||
"voltage": float,
|
||||
"voltage_unit": string,
|
||||
"time_to_full": float,
|
||||
"time_to_full_unit": string,
|
||||
"percentage": float,
|
||||
"capacity": float,
|
||||
"technology": string
|
||||
},
|
||||
"history_charge": [
|
||||
{
|
||||
"time": integer,
|
||||
"percent_charged": float,
|
||||
"status": string
|
||||
}
|
||||
],
|
||||
"history_rate":[
|
||||
{
|
||||
"time": integer,
|
||||
"percent_charged": float,
|
||||
"status": string
|
||||
}
|
||||
],
|
||||
"daemon_version": string,
|
||||
"on_battery": boolean,
|
||||
"lid_is_closed": boolean,
|
||||
"lid_is_present": boolean,
|
||||
"critical_action": string
|
||||
}
|
||||
]
|
||||
|
||||
[0] null if date-time conversion fails
|
||||
|
||||
Examples:
|
||||
|
||||
$ upower -i /org/freedesktop/UPower/devices/battery | jc --upower -p
|
||||
[
|
||||
{
|
||||
"native_path": "/sys/devices/LNXSYSTM:00/device:00/PNP0C0A:00/p...",
|
||||
"vendor": "NOTEBOOK",
|
||||
"model": "BAT",
|
||||
"serial": "0001",
|
||||
"power_supply": true,
|
||||
"updated": "Thu 11 Mar 2021 06:28:08 PM UTC",
|
||||
"has_history": true,
|
||||
"has_statistics": true,
|
||||
"detail": {
|
||||
"type": "battery",
|
||||
"present": true,
|
||||
"rechargeable": true,
|
||||
"state": "charging",
|
||||
"energy": 22.3998,
|
||||
"energy_empty": 0.0,
|
||||
"energy_full": 52.6473,
|
||||
"energy_full_design": 62.16,
|
||||
"energy_rate": 31.6905,
|
||||
"voltage": 12.191,
|
||||
"time_to_full": 57.3,
|
||||
"percentage": 42.5469,
|
||||
"capacity": 84.6964,
|
||||
"technology": "lithium-ion",
|
||||
"energy_unit": "Wh",
|
||||
"energy_empty_unit": "Wh",
|
||||
"energy_full_unit": "Wh",
|
||||
"energy_full_design_unit": "Wh",
|
||||
"energy_rate_unit": "W",
|
||||
"voltage_unit": "V",
|
||||
"time_to_full_unit": "minutes"
|
||||
},
|
||||
"history_charge": [
|
||||
{
|
||||
"time": 1328809335,
|
||||
"percent_charged": 42.547,
|
||||
"status": "charging"
|
||||
},
|
||||
{
|
||||
"time": 1328809305,
|
||||
"percent_charged": 42.02,
|
||||
"status": "charging"
|
||||
}
|
||||
],
|
||||
"history_rate": [
|
||||
{
|
||||
"time": 1328809335,
|
||||
"percent_charged": 31.691,
|
||||
"status": "charging"
|
||||
}
|
||||
],
|
||||
"updated_seconds_ago": 441975,
|
||||
"updated_epoch": 1615516088,
|
||||
"updated_epoch_utc": 1615487288
|
||||
}
|
||||
]
|
||||
|
||||
$ upower -i /org/freedesktop/UPower/devices/battery | jc --upower -p -r
|
||||
[
|
||||
{
|
||||
"native_path": "/sys/devices/LNXSYSTM:00/device:00/PNP0C0A:00/p...",
|
||||
"vendor": "NOTEBOOK",
|
||||
"model": "BAT",
|
||||
"serial": "0001",
|
||||
"power_supply": "yes",
|
||||
"updated": "Thu 11 Mar 2021 06:28:08 PM UTC (441975 seconds ago)",
|
||||
"has_history": "yes",
|
||||
"has_statistics": "yes",
|
||||
"detail": {
|
||||
"type": "battery",
|
||||
"present": "yes",
|
||||
"rechargeable": "yes",
|
||||
"state": "charging",
|
||||
"energy": "22.3998 Wh",
|
||||
"energy_empty": "0 Wh",
|
||||
"energy_full": "52.6473 Wh",
|
||||
"energy_full_design": "62.16 Wh",
|
||||
"energy_rate": "31.6905 W",
|
||||
"voltage": "12.191 V",
|
||||
"time_to_full": "57.3 minutes",
|
||||
"percentage": "42.5469%",
|
||||
"capacity": "84.6964%",
|
||||
"technology": "lithium-ion"
|
||||
},
|
||||
"history_charge": [
|
||||
{
|
||||
"time": "1328809335",
|
||||
"percent_charged": "42.547",
|
||||
"status": "charging"
|
||||
},
|
||||
{
|
||||
"time": "1328809305",
|
||||
"percent_charged": "42.020",
|
||||
"status": "charging"
|
||||
}
|
||||
],
|
||||
"history_rate": [
|
||||
{
|
||||
"time": "1328809335",
|
||||
"percent_charged": "31.691",
|
||||
"status": "charging"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
<a id="jc.parsers.upower.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 Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
@@ -1,68 +1,81 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.uptime"></a>
|
||||
|
||||
# jc.parsers.uptime
|
||||
jc - JSON CLI output utility uptime Parser
|
||||
|
||||
Usage:
|
||||
jc - JSON Convert `uptime` command output parser
|
||||
|
||||
specify --uptime as the first argument if the piped input is coming from uptime
|
||||
Usage (cli):
|
||||
|
||||
Compatibility:
|
||||
$ uptime | jc --uptime
|
||||
|
||||
'linux', 'darwin', 'cygwin', 'aix', 'freebsd'
|
||||
or
|
||||
|
||||
$ jc uptime
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('uptime', uptime_command_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.uptime
|
||||
result = jc.parsers.uptime.parse(uptime_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
{
|
||||
"time": string,
|
||||
"time_hour": integer,
|
||||
"time_minute": integer,
|
||||
"time_second": integer, # null if not displayed
|
||||
"uptime": string,
|
||||
"uptime_days": integer,
|
||||
"uptime_hours": integer,
|
||||
"uptime_minutes": integer,
|
||||
"uptime_total_seconds": integer,
|
||||
"users": integer,
|
||||
"load_1m": float,
|
||||
"load_5m": float,
|
||||
"load_15m": float
|
||||
}
|
||||
|
||||
Example:
|
||||
|
||||
$ uptime | jc --uptime -p
|
||||
{
|
||||
"time": "11:30:44",
|
||||
"uptime": "1 day, 21:17",
|
||||
"users": 1,
|
||||
"load_1m": 0.01,
|
||||
"load_5m": 0.04,
|
||||
"load_15m": 0.05
|
||||
"time": "11:35",
|
||||
"uptime": "3 days, 4:03",
|
||||
"users": 5,
|
||||
"load_1m": 1.88,
|
||||
"load_5m": 2.0,
|
||||
"load_15m": 1.94,
|
||||
"time_hour": 11,
|
||||
"time_minute": 35,
|
||||
"time_second": null,
|
||||
"uptime_days": 3,
|
||||
"uptime_hours": 4,
|
||||
"uptime_minutes": 3,
|
||||
"uptime_total_seconds": 273780
|
||||
}
|
||||
|
||||
$ uptime | jc --uptime -p -r
|
||||
{
|
||||
"time": "11:31:09",
|
||||
"uptime": "1 day, 21:17",
|
||||
"users": "1",
|
||||
"load_1m": "0.00",
|
||||
"load_5m": "0.04",
|
||||
"load_15m": "0.05"
|
||||
"time": "11:36",
|
||||
"uptime": "3 days, 4:04",
|
||||
"users": "5",
|
||||
"load_1m": "1.88",
|
||||
"load_5m": "1.99",
|
||||
"load_15m": "1.94"
|
||||
}
|
||||
|
||||
## info
|
||||
<a id="jc.parsers.uptime.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
info(self, /, *args, **kwargs)
|
||||
```
|
||||
|
||||
## process
|
||||
```python
|
||||
process(proc_data)
|
||||
```
|
||||
|
||||
Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
Dictionary. Structured data with the following schema:
|
||||
|
||||
{
|
||||
"time": string,
|
||||
"uptime": string,
|
||||
"users": integer,
|
||||
"load_1m": float,
|
||||
"load_5m": float,
|
||||
"load_15m": float
|
||||
}
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@@ -70,10 +83,14 @@ Main text parsing function
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) output preprocessed JSON if True
|
||||
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, aix, freebsd
|
||||
|
||||
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
157
docs/parsers/vmstat.md
Normal file
157
docs/parsers/vmstat.md
Normal file
@@ -0,0 +1,157 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.vmstat"></a>
|
||||
|
||||
# jc.parsers.vmstat
|
||||
|
||||
jc - JSON Convert `vmstat` command output parser
|
||||
|
||||
Options supported: `-a`, `-w`, `-d`, `-t`
|
||||
|
||||
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):
|
||||
|
||||
$ vmstat | jc --vmstat
|
||||
|
||||
or
|
||||
|
||||
$ jc vmstat
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('vmstat', vmstat_command_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.vmstat
|
||||
result = jc.parsers.vmstat.parse(vmstat_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"runnable_procs": integer,
|
||||
"uninterruptible_sleeping_procs": integer,
|
||||
"virtual_mem_used": integer,
|
||||
"free_mem": integer,
|
||||
"buffer_mem": integer,
|
||||
"cache_mem": integer,
|
||||
"inactive_mem": integer,
|
||||
"active_mem": integer,
|
||||
"swap_in": integer,
|
||||
"swap_out": integer,
|
||||
"blocks_in": integer,
|
||||
"blocks_out": integer,
|
||||
"interrupts": integer,
|
||||
"context_switches": integer,
|
||||
"user_time": integer,
|
||||
"system_time": integer,
|
||||
"idle_time": integer,
|
||||
"io_wait_time": integer,
|
||||
"stolen_time": integer,
|
||||
"disk": string,
|
||||
"total_reads": integer,
|
||||
"merged_reads": integer,
|
||||
"sectors_read": integer,
|
||||
"reading_ms": integer,
|
||||
"total_writes": integer,
|
||||
"merged_writes": integer,
|
||||
"sectors_written": integer,
|
||||
"writing_ms": integer,
|
||||
"current_io": integer,
|
||||
"io_seconds": integer,
|
||||
"timestamp": string,
|
||||
"timezone": string,
|
||||
"epoch": integer, # [0]
|
||||
"epoch_utc": integer # [1]
|
||||
}
|
||||
]
|
||||
|
||||
[0] naive timestamp if -t flag is used
|
||||
[1] aware timestamp if -t flag is used and UTC TZ
|
||||
|
||||
Examples:
|
||||
|
||||
$ vmstat | jc --vmstat -p
|
||||
[
|
||||
{
|
||||
"runnable_procs": 2,
|
||||
"uninterruptible_sleeping_procs": 0,
|
||||
"virtual_mem_used": 0,
|
||||
"free_mem": 2794468,
|
||||
"buffer_mem": 2108,
|
||||
"cache_mem": 741208,
|
||||
"inactive_mem": null,
|
||||
"active_mem": null,
|
||||
"swap_in": 0,
|
||||
"swap_out": 0,
|
||||
"blocks_in": 1,
|
||||
"blocks_out": 3,
|
||||
"interrupts": 29,
|
||||
"context_switches": 57,
|
||||
"user_time": 0,
|
||||
"system_time": 0,
|
||||
"idle_time": 99,
|
||||
"io_wait_time": 0,
|
||||
"stolen_time": 0,
|
||||
"timestamp": null,
|
||||
"timezone": null
|
||||
}
|
||||
]
|
||||
|
||||
$ vmstat | jc --vmstat -p -r
|
||||
[
|
||||
{
|
||||
"runnable_procs": "2",
|
||||
"uninterruptible_sleeping_procs": "0",
|
||||
"virtual_mem_used": "0",
|
||||
"free_mem": "2794468",
|
||||
"buffer_mem": "2108",
|
||||
"cache_mem": "741208",
|
||||
"inactive_mem": null,
|
||||
"active_mem": null,
|
||||
"swap_in": "0",
|
||||
"swap_out": "0",
|
||||
"blocks_in": "1",
|
||||
"blocks_out": "3",
|
||||
"interrupts": "29",
|
||||
"context_switches": "57",
|
||||
"user_time": "0",
|
||||
"system_time": "0",
|
||||
"idle_time": "99",
|
||||
"io_wait_time": "0",
|
||||
"stolen_time": "0",
|
||||
"timestamp": null,
|
||||
"timezone": null
|
||||
}
|
||||
]
|
||||
|
||||
<a id="jc.parsers.vmstat.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 Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
139
docs/parsers/vmstat_s.md
Normal file
139
docs/parsers/vmstat_s.md
Normal file
@@ -0,0 +1,139 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.vmstat_s"></a>
|
||||
|
||||
# jc.parsers.vmstat\_s
|
||||
|
||||
jc - JSON Convert `vmstat` command output streaming parser
|
||||
|
||||
> This streaming parser outputs JSON Lines
|
||||
|
||||
Options supported: `-a`, `-w`, `-d`, `-t`
|
||||
|
||||
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):
|
||||
|
||||
$ vmstat | jc --vmstat-s
|
||||
|
||||
> Note: When piping `jc` converted `vmstat` output to other processes it may
|
||||
appear the output is hanging due to the OS pipe buffers. This is because
|
||||
`vmstat` output is too small to quickly fill up the buffer. Use the `-u`
|
||||
option to unbuffer the `jc` output if you would like immediate output. See
|
||||
the [readme](https://github.com/kellyjonbrazil/jc/tree/master#unbuffering-output)
|
||||
for more information.
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
# result is an iterable object (generator)
|
||||
result = jc.parse('vmstat_s', vmstat_command_output.splitlines())
|
||||
for item in result:
|
||||
# do something
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.vmstat_s
|
||||
# result is an iterable object (generator)
|
||||
result = jc.parsers.vmstat_s.parse(vmstat_command_output.splitlines())
|
||||
for item in result:
|
||||
# do something
|
||||
|
||||
Schema:
|
||||
|
||||
{
|
||||
"runnable_procs": integer,
|
||||
"uninterruptible_sleeping_procs": integer,
|
||||
"virtual_mem_used": integer,
|
||||
"free_mem": integer,
|
||||
"buffer_mem": integer,
|
||||
"cache_mem": integer,
|
||||
"inactive_mem": integer,
|
||||
"active_mem": integer,
|
||||
"swap_in": integer,
|
||||
"swap_out": integer,
|
||||
"blocks_in": integer,
|
||||
"blocks_out": integer,
|
||||
"interrupts": integer,
|
||||
"context_switches": integer,
|
||||
"user_time": integer,
|
||||
"system_time": integer,
|
||||
"idle_time": integer,
|
||||
"io_wait_time": integer,
|
||||
"stolen_time": integer,
|
||||
"disk": string,
|
||||
"total_reads": integer,
|
||||
"merged_reads": integer,
|
||||
"sectors_read": integer,
|
||||
"reading_ms": integer,
|
||||
"total_writes": integer,
|
||||
"merged_writes": integer,
|
||||
"sectors_written": integer,
|
||||
"writing_ms": integer,
|
||||
"current_io": integer,
|
||||
"io_seconds": integer,
|
||||
"timestamp": string,
|
||||
"timezone": string,
|
||||
"epoch": integer, # [0]
|
||||
"epoch_utc": integer # [1]
|
||||
|
||||
# Below object only exists if using -qq or ignore_exceptions=True
|
||||
|
||||
"_jc_meta":
|
||||
{
|
||||
"success": boolean, # [2]
|
||||
"error": string, # [3]
|
||||
"line": string # [3]
|
||||
}
|
||||
}
|
||||
|
||||
[0] naive timestamp if -t flag is used
|
||||
[1] aware timestamp if -t flag is used and UTC TZ
|
||||
[2] false if error parsing
|
||||
[3] exists if "success" is false
|
||||
|
||||
Examples:
|
||||
|
||||
$ vmstat | jc --vmstat-s
|
||||
{"runnable_procs":2,"uninterruptible_sleeping_procs":0,"virtual_mem...}
|
||||
...
|
||||
|
||||
$ vmstat | jc --vmstat-s -r
|
||||
{"runnable_procs":"2","uninterruptible_sleeping_procs":"0","virtua...}
|
||||
...
|
||||
|
||||
<a id="jc.parsers.vmstat_s.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
@add_jc_meta
|
||||
def parse(data, raw=False, quiet=False, ignore_exceptions=False)
|
||||
```
|
||||
|
||||
Main text parsing generator function. Returns an iterator 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
|
||||
|
||||
Yields:
|
||||
|
||||
Dictionary. Raw or processed structured data.
|
||||
|
||||
Returns:
|
||||
|
||||
Iterator object (generator)
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
@@ -1,13 +1,42 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.w"></a>
|
||||
|
||||
# jc.parsers.w
|
||||
jc - JSON CLI output utility w Parser
|
||||
|
||||
Usage:
|
||||
jc - JSON Convert `w` command output parser
|
||||
|
||||
specify --w as the first argument if the piped input is coming from w
|
||||
Usage (cli):
|
||||
|
||||
Compatibility:
|
||||
$ w | jc --w
|
||||
|
||||
'linux', 'darwin', 'cygwin', 'aix', 'freebsd'
|
||||
or
|
||||
|
||||
$ jc w
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('w', w_command_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.w
|
||||
result = jc.parsers.w.parse(w_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"user": string, # '-' = null
|
||||
"tty": string, # '-' = null
|
||||
"from": string, # '-' = null
|
||||
"login_at": string, # '-' = null
|
||||
"idle": string, # '-' = null
|
||||
"jcpu": string,
|
||||
"pcpu": string,
|
||||
"what": string # '-' = null
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
@@ -79,42 +108,12 @@ Examples:
|
||||
}
|
||||
]
|
||||
|
||||
## info
|
||||
<a id="jc.parsers.w.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
info(self, /, *args, **kwargs)
|
||||
```
|
||||
|
||||
## process
|
||||
```python
|
||||
process(proc_data)
|
||||
```
|
||||
|
||||
Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
"user": string, # '-'' = null
|
||||
"tty": string, # '-'' = null
|
||||
"from": string, # '-'' = null
|
||||
"login_at": string, # '-'' = null
|
||||
"idle": string, # '-'' = null
|
||||
"jcpu": string,
|
||||
"pcpu": string,
|
||||
"what": string # '-'' = null
|
||||
}
|
||||
]
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@@ -122,10 +121,14 @@ Main text parsing function
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) output preprocessed JSON if True
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, aix, freebsd
|
||||
|
||||
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
85
docs/parsers/wc.md
Normal file
85
docs/parsers/wc.md
Normal file
@@ -0,0 +1,85 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.wc"></a>
|
||||
|
||||
# jc.parsers.wc
|
||||
|
||||
jc - JSON Convert `wc` command output parser
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ wc file.txt | jc --wc
|
||||
|
||||
or
|
||||
|
||||
$ jc wc file.txt
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('wc', wc_command_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.wc
|
||||
result = jc.parsers.wc.parse(wc_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"filename": string,
|
||||
"lines": integer,
|
||||
"words": integer,
|
||||
"characters": integer
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
$ wc * | jc --wc -p
|
||||
[
|
||||
{
|
||||
"filename": "airport-I.json",
|
||||
"lines": 1,
|
||||
"words": 30,
|
||||
"characters": 307
|
||||
},
|
||||
{
|
||||
"filename": "airport-I.out",
|
||||
"lines": 15,
|
||||
"words": 33,
|
||||
"characters": 348
|
||||
},
|
||||
{
|
||||
"filename": "airport-s.json",
|
||||
"lines": 1,
|
||||
"words": 202,
|
||||
"characters": 2152
|
||||
},
|
||||
...
|
||||
]
|
||||
|
||||
<a id="jc.parsers.wc.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 Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, aix, freebsd
|
||||
|
||||
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
@@ -1,15 +1,51 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.who"></a>
|
||||
|
||||
# jc.parsers.who
|
||||
jc - JSON CLI output utility who Parser
|
||||
|
||||
Usage:
|
||||
jc - JSON Convert `who` command output parser
|
||||
|
||||
specify --who as the first argument if the piped input is coming from who
|
||||
Accepts any of the following who options (or no options): `-aTH`
|
||||
|
||||
accepts any of the following who options (or no options): -aTH
|
||||
The `epoch` calculated timestamp field is naive. (i.e. based on the local
|
||||
time of the system the parser is run on)
|
||||
|
||||
Compatibility:
|
||||
Usage (cli):
|
||||
|
||||
'linux', 'darwin', 'cygwin', 'aix', 'freebsd'
|
||||
$ who | jc --who
|
||||
|
||||
or
|
||||
|
||||
$ jc who
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('who', who_command_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.who
|
||||
result = jc.parsers.who.parse(who_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"user": string,
|
||||
"event": string,
|
||||
"writeable_tty": string,
|
||||
"tty": string,
|
||||
"time": string,
|
||||
"epoch": integer, # [0]
|
||||
"idle": string,
|
||||
"pid": integer,
|
||||
"from": string,
|
||||
"comment": string
|
||||
}
|
||||
]
|
||||
|
||||
[0] naive timestamp. null if time cannot be converted
|
||||
|
||||
Examples:
|
||||
|
||||
@@ -18,7 +54,8 @@ Examples:
|
||||
{
|
||||
"event": "reboot",
|
||||
"time": "Feb 7 23:31",
|
||||
"pid": 1
|
||||
"pid": 1,
|
||||
"epoch": null
|
||||
},
|
||||
{
|
||||
"user": "joeuser",
|
||||
@@ -26,7 +63,8 @@ Examples:
|
||||
"tty": "console",
|
||||
"time": "Feb 7 23:32",
|
||||
"idle": "old",
|
||||
"pid": 105
|
||||
"pid": 105,
|
||||
"epoch": null
|
||||
},
|
||||
{
|
||||
"user": "joeuser",
|
||||
@@ -35,7 +73,8 @@ Examples:
|
||||
"time": "Feb 13 16:44",
|
||||
"idle": ".",
|
||||
"pid": 51217,
|
||||
"comment": "term=0 exit=0"
|
||||
"comment": "term=0 exit=0",
|
||||
"epoch": null
|
||||
},
|
||||
{
|
||||
"user": "joeuser",
|
||||
@@ -43,7 +82,8 @@ Examples:
|
||||
"tty": "ttys003",
|
||||
"time": "Feb 28 08:59",
|
||||
"idle": "01:36",
|
||||
"pid": 41402
|
||||
"pid": 41402,
|
||||
"epoch": null
|
||||
},
|
||||
{
|
||||
"user": "joeuser",
|
||||
@@ -52,7 +92,8 @@ Examples:
|
||||
"time": "Mar 1 16:35",
|
||||
"idle": ".",
|
||||
"pid": 15679,
|
||||
"from": "192.168.1.5"
|
||||
"from": "192.168.1.5",
|
||||
"epoch": null
|
||||
}
|
||||
]
|
||||
|
||||
@@ -99,43 +140,12 @@ Examples:
|
||||
}
|
||||
]
|
||||
|
||||
## info
|
||||
<a id="jc.parsers.who.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
info(self, /, *args, **kwargs)
|
||||
```
|
||||
|
||||
## process
|
||||
```python
|
||||
process(proc_data)
|
||||
```
|
||||
|
||||
Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
"user": string,
|
||||
"event": string,
|
||||
"writeable_tty": string,
|
||||
"tty": string,
|
||||
"time": string,
|
||||
"idle": string,
|
||||
"pid": integer,
|
||||
"from": string,
|
||||
"comment": string
|
||||
}
|
||||
]
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@@ -143,10 +153,14 @@ Main text parsing function
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) output preprocessed JSON if True
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, aix, freebsd
|
||||
|
||||
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
@@ -1,13 +1,33 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.xml"></a>
|
||||
|
||||
# jc.parsers.xml
|
||||
jc - JSON CLI output utility XML Parser
|
||||
|
||||
Usage:
|
||||
jc - JSON Convert `XML` file parser
|
||||
|
||||
specify --xml as the first argument if the piped input is coming from an XML file
|
||||
Usage (cli):
|
||||
|
||||
Compatibility:
|
||||
$ cat foo.xml | jc --xml
|
||||
|
||||
'linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd'
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('xml', xml_file_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.xml
|
||||
result = jc.parsers.xml.parse(xml_file_output)
|
||||
|
||||
Schema:
|
||||
|
||||
XML Document converted to a Dictionary
|
||||
See https://github.com/martinblech/xmltodict for details
|
||||
|
||||
{
|
||||
"key1": string/object,
|
||||
"key2": string/object
|
||||
}
|
||||
|
||||
Examples:
|
||||
|
||||
@@ -55,34 +75,12 @@ Examples:
|
||||
...
|
||||
}
|
||||
|
||||
## info
|
||||
<a id="jc.parsers.xml.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
info(self, /, *args, **kwargs)
|
||||
```
|
||||
|
||||
## process
|
||||
```python
|
||||
process(proc_data)
|
||||
```
|
||||
|
||||
Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
Dictionary representing an XML document:
|
||||
|
||||
{
|
||||
XML Document converted to a Dictionary
|
||||
See https://github.com/martinblech/xmltodict for details
|
||||
}
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@@ -90,10 +88,14 @@ Main text parsing function
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) output preprocessed JSON if True
|
||||
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
|
||||
|
||||
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
168
docs/parsers/xrandr.md
Normal file
168
docs/parsers/xrandr.md
Normal file
@@ -0,0 +1,168 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.xrandr"></a>
|
||||
|
||||
# jc.parsers.xrandr
|
||||
|
||||
jc - JSON Convert `xrandr` command output parser
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ xrandr | jc --xrandr
|
||||
|
||||
or
|
||||
|
||||
$ jc xrandr
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('xrandr', xrandr_command_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.xrandr
|
||||
result = jc.parsers.xrandr.parse(xrandr_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
{
|
||||
"screens": [
|
||||
{
|
||||
"screen_number": integer,
|
||||
"minimum_width": integer,
|
||||
"minimum_height": integer,
|
||||
"current_width": integer,
|
||||
"current_height": integer,
|
||||
"maximum_width": integer,
|
||||
"maximum_height": integer,
|
||||
"associated_device": {
|
||||
"associated_modes": [
|
||||
{
|
||||
"resolution_width": integer,
|
||||
"resolution_height": integer,
|
||||
"is_high_resolution": boolean,
|
||||
"frequencies": [
|
||||
{
|
||||
"frequency": float,
|
||||
"is_current": boolean,
|
||||
"is_preferred": boolean
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"is_connected": boolean,
|
||||
"is_primary": boolean,
|
||||
"device_name": string,
|
||||
"resolution_width": integer,
|
||||
"resolution_height": integer,
|
||||
"offset_width": integer,
|
||||
"offset_height": integer,
|
||||
"dimension_width": integer,
|
||||
"dimension_height": integer
|
||||
}
|
||||
],
|
||||
"unassociated_devices": [
|
||||
{
|
||||
"associated_modes": [
|
||||
{
|
||||
"resolution_width": integer,
|
||||
"resolution_height": integer,
|
||||
"is_high_resolution": boolean,
|
||||
"frequencies": [
|
||||
{
|
||||
"frequency": float,
|
||||
"is_current": boolean,
|
||||
"is_preferred": boolean
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Examples:
|
||||
|
||||
$ xrandr | jc --xrandr -p
|
||||
{
|
||||
"screens": [
|
||||
{
|
||||
"screen_number": 0,
|
||||
"minimum_width": 8,
|
||||
"minimum_height": 8,
|
||||
"current_width": 1920,
|
||||
"current_height": 1080,
|
||||
"maximum_width": 32767,
|
||||
"maximum_height": 32767,
|
||||
"associated_device": {
|
||||
"associated_modes": [
|
||||
{
|
||||
"resolution_width": 1920,
|
||||
"resolution_height": 1080,
|
||||
"is_high_resolution": false,
|
||||
"frequencies": [
|
||||
{
|
||||
"frequency": 60.03,
|
||||
"is_current": true,
|
||||
"is_preferred": true
|
||||
},
|
||||
{
|
||||
"frequency": 59.93,
|
||||
"is_current": false,
|
||||
"is_preferred": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"resolution_width": 1680,
|
||||
"resolution_height": 1050,
|
||||
"is_high_resolution": false,
|
||||
"frequencies": [
|
||||
{
|
||||
"frequency": 59.88,
|
||||
"is_current": false,
|
||||
"is_preferred": false
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"is_connected": true,
|
||||
"is_primary": true,
|
||||
"device_name": "eDP1",
|
||||
"resolution_width": 1920,
|
||||
"resolution_height": 1080,
|
||||
"offset_width": 0,
|
||||
"offset_height": 0,
|
||||
"dimension_width": 310,
|
||||
"dimension_height": 170
|
||||
}
|
||||
}
|
||||
],
|
||||
"unassociated_devices": []
|
||||
}
|
||||
|
||||
<a id="jc.parsers.xrandr.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, aix, freebsd
|
||||
|
||||
Version 1.0 by Kevin Lyter (lyter_git at sent.com)
|
||||
@@ -1,13 +1,35 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.yaml"></a>
|
||||
|
||||
# jc.parsers.yaml
|
||||
jc - JSON CLI output utility YAML Parser
|
||||
|
||||
Usage:
|
||||
jc - JSON Convert `YAML` file parser
|
||||
|
||||
specify --yaml as the first argument if the piped input is coming from a YAML file
|
||||
Usage (cli):
|
||||
|
||||
Compatibility:
|
||||
$ cat foo.yaml | jc --yaml
|
||||
|
||||
'linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd'
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('yaml', yaml_file_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.yaml
|
||||
result = jc.parsers.yaml.parse(yaml_file_output)
|
||||
|
||||
Schema:
|
||||
|
||||
YAML Document converted to a Dictionary
|
||||
See https://pypi.org/project/ruamel.yaml for details
|
||||
|
||||
[
|
||||
{
|
||||
"key1": string/int/float/boolean/null/array/object,
|
||||
"key2": string/int/float/boolean/null/array/object
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
@@ -67,36 +89,12 @@ Examples:
|
||||
}
|
||||
]
|
||||
|
||||
## info
|
||||
<a id="jc.parsers.yaml.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
info(self, /, *args, **kwargs)
|
||||
```
|
||||
|
||||
## process
|
||||
```python
|
||||
process(proc_data)
|
||||
```
|
||||
|
||||
Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Each dictionary represents a YAML document:
|
||||
|
||||
[
|
||||
{
|
||||
YAML Document converted to a Dictionary
|
||||
See https://pypi.org/project/ruamel.yaml for details
|
||||
}
|
||||
]
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@@ -104,10 +102,14 @@ Main text parsing function
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) output preprocessed JSON if True
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries representing the YAML documents.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
|
||||
|
||||
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
||||
110
docs/parsers/zipinfo.md
Normal file
110
docs/parsers/zipinfo.md
Normal file
@@ -0,0 +1,110 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.zipinfo"></a>
|
||||
|
||||
# jc.parsers.zipinfo
|
||||
|
||||
jc - JSON Convert `zipinfo` command output parser
|
||||
|
||||
Options supported:
|
||||
- none
|
||||
|
||||
Note: The default listing format.
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ zipinfo <archive> | jc --zipinfo
|
||||
|
||||
or
|
||||
|
||||
$ jc zipinfo
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('zipinfo', zipinfo_command_output)
|
||||
|
||||
or
|
||||
|
||||
import jc.parsers.zipinfo
|
||||
result = jc.parsers.zipinfo.parse(zipinfo_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"archive": string,
|
||||
"size": integer,
|
||||
"size_unit": string,
|
||||
"number_entries": integer,
|
||||
"number_files": integer,
|
||||
"bytes_uncompressed": integer,
|
||||
"bytes_compressed": integer,
|
||||
"percent_compressed": float,
|
||||
"files": [
|
||||
{
|
||||
"flags": string,
|
||||
"zipversion": string,
|
||||
"zipunder": string,
|
||||
"filesize": integer,
|
||||
"type": string,
|
||||
"method": string,
|
||||
"date": string,
|
||||
"time": string,
|
||||
"filename": string
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
$ zipinfo log4j-core-2.16.0.jar | jc --zipinfo -p
|
||||
|
||||
[
|
||||
{
|
||||
"archive": "log4j-core-2.16.0.jar",
|
||||
"size": 1789565,
|
||||
"size_unit": "bytes",
|
||||
"number_entries": 1218,
|
||||
"number_files": 1218,
|
||||
"bytes_uncompressed": 3974141,
|
||||
"bytes_compressed": 1515455,
|
||||
"percent_compressed": 61.9,
|
||||
"files": [
|
||||
{
|
||||
"flags": "-rw-r--r--",
|
||||
"zipversion": "2.0",
|
||||
"zipunder": "unx",
|
||||
"filesize": 19810,
|
||||
"type": "bl",
|
||||
"method": "defN",
|
||||
"date": "21-Dec-12",
|
||||
"time": "23:35",
|
||||
"filename": "META-INF/MANIFEST.MF"
|
||||
},
|
||||
...
|
||||
|
||||
<a id="jc.parsers.zipinfo.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 Dictionaries. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin
|
||||
|
||||
Version 1.0 by Matt J (https://github.com/listuser)
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user