Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rDNS (in-addr.arpa.) support, convert to IPv4 #168

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions winnower.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ def is_fqdn(address):
return False


def rdns_to_ip(address):
return '.'.join(address.replace('.in-addr.arpa.', '').split('.')[::-1])


def winnow(in_file, out_file, enr_file):
config = ConfigParser.SafeConfigParser(allow_no_value=True)
cfg_success = config.read('combine.cfg')
Expand Down Expand Up @@ -167,6 +171,12 @@ def winnow(in_file, out_file, enr_file):
logger.info('Beginning winnowing process')
for each in crop:
(addr, addr_type, direction, source, note, date) = each

# handle rDNS as an IP, we don't know which DNS A rec it was so don't use PTR
if addr.endswith('.in-addr.arpa.'):
addr = rdns_to_ip(addr)
addr_type = 'IPv4'

# this should be refactored into appropriate functions
if addr_type == 'IPv4' and is_ipv4(addr):
#logger.info('Enriching %s' % addr)
Expand Down