From f05e96f9de9f1cfdcb1df9a0a64fdc2e019a20bd Mon Sep 17 00:00:00 2001 From: jrude Date: Thu, 16 May 2024 15:21:52 +0200 Subject: [PATCH 1/2] redaction fix --- domLink.py | 20 +++++++++++--------- requirements.txt | 2 +- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/domLink.py b/domLink.py index 30ea813..11a231d 100644 --- a/domLink.py +++ b/domLink.py @@ -4,13 +4,15 @@ from argparse import ArgumentParser from requests import get import sys +import re import os.path import urllib.request, urllib.parse, urllib.error import logging -__version__ = '0.2' - +__version__ = '0.3' +__mailPattern__ = r"^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$" +__privacyPatterns__ = ['REDACTED FOR PRIVACY', 'Whois Privacy Protection', 'Whois Privacy Service', 'Identity Protection Service'] def set_log_level(args_level): if args_level is None: @@ -88,11 +90,11 @@ def parse_whois(base_url, domain): record = '{}_contact'.format(record) email = content.get(record, {}).get('email_address', '').lower() company = content.get(record, {}).get('company_name', '') - if email and (email != 'redacted for privacy') and ('*' not in email): + if email and re.match(__mailPattern__, email): logging.debug('domain: adding email {}'.format(email)) emails[email] = True - if company and company != 'REDACTED FOR PRIVACY': - logging.debug('domain: adding email {}'.format(email)) + if company and company not in __privacyPatterns__: + logging.debug('domain: adding company {}'.format(email)) companies[company] = True return {'emails': emails, 'companies': companies, 'domains': domains} @@ -110,10 +112,10 @@ def parse_history(base_url, domain): entry = '{}_contact'.format(entry) email = record.get(entry, {}).get('email_address', '').lower() company = record.get(entry, {}).get('company_name', '') - if email and (email != 'redacted for privacy') and ('*' not in email): + if email and re.match(__mailPattern__, email): logging.debug('domain: adding email {}'.format(email)) emails[email] = True - if company and company != 'REDACTED FOR PRIVACY': + if company and company not in __privacyPatterns__: logging.debug('domain: adding email {}'.format(email)) companies[company] = True return {'emails': emails, 'companies': companies, 'domains': domains} @@ -139,7 +141,7 @@ def recursive_search(base_url, search, find, page=1, pages=9999): if company: logging.debug('{}={} adding email {}'.format(search, find, company)) companies[company] = True - if email and (email != 'redacted for privacy') and ('*' not in email): + if email and re.match(__mailPattern__, email): logging.debug('{}={} adding email {}'.format(search, find, email)) emails[email] = True page += 1 @@ -186,7 +188,7 @@ def banner(): print ("Author: Vincent Yiu (@vysecurity)") print ("Contributors: Jan Rude (@whoot); John Bond (@b4ldr)") print ("https://www.github.com/vysec/DomLink") - print ("Version: {}".format(__version__)) + print(("Version: {}".format(__version__))) print ("") def main(): diff --git a/requirements.txt b/requirements.txt index 7d34355..2c24336 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1 @@ -requests==2.25.0 +requests==2.31.0 From cfe27da329f205dd7e2eda763d3a9dc19350368c Mon Sep 17 00:00:00 2001 From: Jan Rude Date: Thu, 16 May 2024 15:34:42 +0200 Subject: [PATCH 2/2] Update domLink.py --- domLink.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/domLink.py b/domLink.py index 11a231d..5140307 100644 --- a/domLink.py +++ b/domLink.py @@ -183,13 +183,13 @@ def query_yes_no(question, default='yes'): def banner(): - print ("") - print ("DomLink Domain Discovery Tool") - print ("Author: Vincent Yiu (@vysecurity)") - print ("Contributors: Jan Rude (@whoot); John Bond (@b4ldr)") - print ("https://www.github.com/vysec/DomLink") - print(("Version: {}".format(__version__))) - print ("") + print("") + print("DomLink Domain Discovery Tool") + print("Author: Vincent Yiu (@vysecurity)") + print("Contributors: Jan Rude (@whoot); John Bond (@b4ldr)") + print("https://www.github.com/vysec/DomLink") + print("Version: {}".format(__version__)) + print("") def main(): banner() @@ -281,4 +281,3 @@ def main(): if __name__ == '__main__': main() -