chg: [providence] allow multiple company names

This commit is contained in:
Alexandre Dulaunoy 2023-01-12 07:27:17 +01:00
parent b0fe17660c
commit 911917e79d
Signed by: adulau
GPG key ID: 09E2CD4944E6CBCD

View file

@ -14,15 +14,16 @@ parser = argparse.ArgumentParser(
) )
parser.add_argument("-v", help="increase output verbosity", action="store_true") parser.add_argument("-v", help="increase output verbosity", action="store_true")
parser.add_argument("-n", "--name", type=str, help="Company name to find") parser.add_argument(
"-n", "--name", type=str, help="Company name to find", action="append"
)
parser.add_argument( parser.add_argument(
"-t", "-t",
"--tld", "--tld",
type=str, type=str,
help="Limit to a specific TLD (if not, all known TLDs are tested)", help="Limit to a specific TLD (if not, all known TLDs are tested)",
action="append" action="append",
) )
#parser.add_argument("","")
args = parser.parse_args() args = parser.parse_args()
@ -65,23 +66,31 @@ else:
results = set() results = set()
if re.search(r' {1,}', args.name):
# replace with - def permutation_name(name_arg=None):
name = args.name if name_arg is None:
reversed_name = " ".join(args.name.split(" ")[::-1]) return False
p = name.replace(" ", "-") if re.search(r' {1,}', name_arg):
results.update(guess_name(name=p, tlds=tlds)) # replace with -
p = reversed_name.replace(" ", "-") name = name_arg
results.update(guess_name(name=p, tlds=tlds)) reversed_name = " ".join(name_arg.split(" ")[::-1])
p = name.replace(" ", "") p = name.replace(" ", "-")
results.update(guess_name(name=p, tlds=tlds)) results.update(guess_name(name=p, tlds=tlds))
p = reversed_name.replace(" ", "") p = reversed_name.replace(" ", "-")
results.update(guess_name(name=p, tlds=tlds)) results.update(guess_name(name=p, tlds=tlds))
# try with removal of word p = name.replace(" ", "")
for word in args.name.split(" "): results.update(guess_name(name=p, tlds=tlds))
results.update(guess_name(name=word, tlds=tlds)) p = reversed_name.replace(" ", "")
else: results.update(guess_name(name=p, tlds=tlds))
results.update(guess_name(name=args.name, tlds=tlds)) # try with removal of word
for word in name_arg.split(" "):
results.update(guess_name(name=word, tlds=tlds))
else:
results.update(guess_name(name=name_arg, tlds=tlds))
for name in args.name:
permutation_name(name_arg=name)
output = {} output = {}
output['results'] = list(results) output['results'] = list(results)