mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-06-19 00:17:51 +02:00
simplify answer data logic
This commit is contained in:
@ -1,7 +1,8 @@
|
|||||||
jc changelog
|
jc changelog
|
||||||
|
|
||||||
20210209 v1.14.3
|
202102010 v1.14.3
|
||||||
- Add hciconfig parser tested on linux
|
- Add hciconfig parser tested on linux
|
||||||
|
- Update dig parser to simplify answer data logic
|
||||||
|
|
||||||
20210205 v1.14.2
|
20210205 v1.14.2
|
||||||
- Update dig parser to fix cases where there are spaces in the answer data (e.g. TXT records)
|
- Update dig parser to fix cases where there are spaces in the answer data (e.g. TXT records)
|
||||||
|
@ -333,7 +333,7 @@ import jc.utils
|
|||||||
|
|
||||||
|
|
||||||
class info():
|
class info():
|
||||||
version = '1.4'
|
version = '1.5'
|
||||||
description = 'dig command parser'
|
description = 'dig command parser'
|
||||||
author = 'Kelly Brazil'
|
author = 'Kelly Brazil'
|
||||||
author_email = 'kellyjonbrazil@gmail.com'
|
author_email = 'kellyjonbrazil@gmail.com'
|
||||||
@ -521,12 +521,12 @@ def parse_authority(authority):
|
|||||||
|
|
||||||
def parse_answer(answer):
|
def parse_answer(answer):
|
||||||
# www.cnn.com. 5 IN CNAME turner-tls.map.fastly.net.
|
# www.cnn.com. 5 IN CNAME turner-tls.map.fastly.net.
|
||||||
answer = answer.split()
|
answer = answer.split(maxsplit=4)
|
||||||
answer_name = answer[0]
|
answer_name = answer[0]
|
||||||
answer_class = answer[2]
|
answer_class = answer[2]
|
||||||
answer_type = answer[3]
|
answer_type = answer[3]
|
||||||
answer_ttl = answer[1]
|
answer_ttl = answer[1]
|
||||||
answer_data = ' '.join(answer[4:])
|
answer_data = answer[4]
|
||||||
|
|
||||||
# remove surrounding quotation marks from answer_data if they exist
|
# remove surrounding quotation marks from answer_data if they exist
|
||||||
if answer_data.startswith('"') and answer_data.endswith('"'):
|
if answer_data.startswith('"') and answer_data.endswith('"'):
|
||||||
|
Reference in New Issue
Block a user