1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-08-08 22:36:48 +02:00

use in instead of .find()

This commit is contained in:
Kelly Brazil
2020-04-04 16:46:09 -07:00
parent 302f05cdda
commit fe1a0d1faf

View File

@ -324,7 +324,7 @@ import jc.utils
class info(): class info():
version = '1.1' version = '1.2'
description = 'dig command parser' description = 'dig command parser'
author = 'Kelly Brazil' author = 'Kelly Brazil'
author_email = 'kellyjonbrazil@gmail.com' author_email = 'kellyjonbrazil@gmail.com'
@ -525,11 +525,12 @@ def parse_answer(answer):
'ttl': answer_ttl, 'ttl': answer_ttl,
'data': answer_data} 'data': answer_data}
def parse_axfr(axfr): def parse_axfr(axfr):
#; <<>> DiG 9.11.14-3-Debian <<>> @81.4.108.41 axfr zonetransfer.me +nocookie # ; <<>> DiG 9.11.14-3-Debian <<>> @81.4.108.41 axfr zonetransfer.me +nocookie
#; (1 server found) # ; (1 server found)
#;; global options: +cmd # ;; global options: +cmd
#zonetransfer.me. 7200 IN A 5.196.105.14 # zonetransfer.me. 7200 IN A 5.196.105.14
axfr = axfr.split(maxsplit=4) axfr = axfr.split(maxsplit=4)
axfr_name = axfr[0] axfr_name = axfr[0]
axfr_ttl = axfr[1] axfr_ttl = axfr[1]
@ -575,7 +576,7 @@ def parse(data, raw=False, quiet=False):
output_entry = {} output_entry = {}
for line in cleandata: for line in cleandata:
if line.startswith('; <<>> ') and line.lower().find(' axfr ') != -1: if line.startswith('; <<>> ') and ' axfr ' in line.lower():
question = False question = False
authority = False authority = False
answer = False answer = False
@ -583,7 +584,7 @@ def parse(data, raw=False, quiet=False):
axfr_list = [] axfr_list = []
continue continue
if line.find(';') == -1 and axfr: if ';' not in line and axfr:
axfr_list.append(parse_axfr(line)) axfr_list.append(parse_axfr(line))
output_entry.update({'axfr': axfr_list}) output_entry.update({'axfr': axfr_list})
continue continue
@ -620,7 +621,7 @@ def parse(data, raw=False, quiet=False):
authority_list = [] authority_list = []
continue continue
if line.find(';') == -1 and authority: if ';' not in line and authority:
authority_list.append(parse_authority(line)) authority_list.append(parse_authority(line))
output_entry.update({'authority': authority_list}) output_entry.update({'authority': authority_list})
continue continue
@ -633,7 +634,7 @@ def parse(data, raw=False, quiet=False):
answer_list = [] answer_list = []
continue continue
if line.find(';') == -1 and answer: if ';' not in line and answer:
answer_list.append(parse_answer(line)) answer_list.append(parse_answer(line))
output_entry.update({'answer': answer_list}) output_entry.update({'answer': answer_list})
continue continue