From 543232895aded349c1d8ae86897b252c090db9eb Mon Sep 17 00:00:00 2001 From: Alexandre Dulaunoy Date: Sat, 7 Jan 2023 16:28:37 +0100 Subject: [PATCH] chg: [providence] WiP on guessing names --- bin/providence.py | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/bin/providence.py b/bin/providence.py index a41995a..14743f9 100644 --- a/bin/providence.py +++ b/bin/providence.py @@ -3,6 +3,7 @@ import sys import argparse from pathlib import Path import os +import re import requests @@ -46,10 +47,12 @@ def cache_suffixes(url="https://publicsuffix.org/list/public_suffix_list.dat"): def guess_name(name=None, tlds=None): + guessed_names = set() if name is None: return False for t in tlds: - print(f"{name}.{t}") + guessed_names.add(f"{name}.{t}") + return guessed_names if not args.tld: @@ -57,4 +60,19 @@ if not args.tld: else: tlds = [args.tld] -guess_name(name=args.name, tlds=tlds) +results = set() + +if re.search(r' {1,}', args.name): + # replace with - + name = args.name + p = name.replace(" ", "-") + results.update(guess_name(name=p, tlds=tlds)) + # combined + p = name.replace(" ", "") + results.update(guess_name(name=p, tlds=tlds)) + # try with removal of word + +else: + results.update(guess_name(name=args.name, tlds=tlds)) + +print(results)