1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-06-25 00:37:31 +02:00

remove unnecessary if statement

This commit is contained in:
Kelly Brazil
2019-10-31 07:27:12 -07:00
parent 74dae2905b
commit 41a2a9adac
2 changed files with 147 additions and 3 deletions

147
README.md
View File

@ -63,6 +63,7 @@ jc PARSER [OPTIONS]
### Parsers
- `--arp` enables the `arp` parser
- `--df` enables the `df` parser
- `--dig` enables the `dig` parser
- `--env` enables the `env` parser
- `--free` enables the `free` parser
- `--history` enables the `history` parser
@ -177,6 +178,152 @@ $ df | jc --df -p
...
]
```
### dig
```
$ dig cnn.com www.cnn.com @205.251.194.64 | jc --dig -p
[
{
"id": "28182",
"opcode": "QUERY",
"status": "NOERROR",
"flags": "qr rd ra",
"query_num": "1",
"answer_num": "4",
"authority_num": "0",
"additional_num": "1",
"question": {
"name": "cnn.com.",
"class": "IN",
"type": "A"
},
"answer": [
{
"name": "cnn.com.",
"class": "IN",
"type": "A",
"ttl": "5",
"data": "151.101.193.67"
},
{
"name": "cnn.com.",
"class": "IN",
"type": "A",
"ttl": "5",
"data": "151.101.1.67"
},
{
"name": "cnn.com.",
"class": "IN",
"type": "A",
"ttl": "5",
"data": "151.101.129.67"
},
{
"name": "cnn.com.",
"class": "IN",
"type": "A",
"ttl": "5",
"data": "151.101.65.67"
}
],
"query_time": "45 msec",
"server": "192.168.71.2#53(192.168.71.2)",
"when": "Wed Oct 30 03:11:21 PDT 2019",
"rcvd": "100"
},
{
"id": "23264",
"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": "33 msec",
"server": "205.251.194.64#53(205.251.194.64)",
"when": "Wed Oct 30 03:11:21 PDT 2019",
"rcvd": "212"
}
]
```
```
$ dig -x 1.1.1.1 | jc --dig -p
[
{
"id": "27526",
"opcode": "QUERY",
"status": "NOERROR",
"flags": "qr rd ra",
"query_num": "1",
"answer_num": "1",
"authority_num": "0",
"additional_num": "1",
"question": {
"name": "1.1.1.1.in-addr.arpa.",
"class": "IN",
"type": "PTR"
},
"answer": [
{
"name": "1.1.1.1.IN-ADDR.ARPA.",
"class": "IN",
"type": "PTR",
"ttl": "5",
"data": "one.one.one.one."
}
],
"query_time": "34 msec",
"server": "192.168.71.2#53(192.168.71.2)",
"when": "Wed Oct 30 03:13:48 PDT 2019",
"rcvd": "98"
}
]
```
### env
```
$ env | jc --env -p

View File

@ -241,9 +241,6 @@ def parse(data):
output_entry = {}
for line in cleandata:
if line.find('; <<>> DiG') == 0:
continue
if line.find(';; ->>HEADER<<-') == 0:
output_entry = {}
output_entry.update(parse_header(line))