chg: [providence] lower down company names

This commit is contained in:
Alexandre Dulaunoy 2023-01-12 07:35:51 +01:00
parent 911917e79d
commit 33015c844b
Signed by: adulau
GPG key ID: 09E2CD4944E6CBCD

View file

@ -13,7 +13,7 @@ parser = argparse.ArgumentParser(
epilog="More info: https://github.com/adulau/providence", epilog="More info: https://github.com/adulau/providence",
) )
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( parser.add_argument(
"-n", "--name", type=str, help="Company name to find", action="append" "-n", "--name", type=str, help="Company name to find", action="append"
) )
@ -24,6 +24,9 @@ parser.add_argument(
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(
"-dns", help="Do DNS lookup validation", action="store_true", default=False
)
args = parser.parse_args() args = parser.parse_args()
@ -70,8 +73,8 @@ results = set()
def permutation_name(name_arg=None): def permutation_name(name_arg=None):
if name_arg is None: if name_arg is None:
return False return False
name_arg = name_arg.lower()
if re.search(r' {1,}', name_arg): if re.search(r' {1,}', name_arg):
# replace with -
name = name_arg name = name_arg
reversed_name = " ".join(name_arg.split(" ")[::-1]) reversed_name = " ".join(name_arg.split(" ")[::-1])
p = name.replace(" ", "-") p = name.replace(" ", "-")
@ -82,7 +85,6 @@ def permutation_name(name_arg=None):
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
for word in name_arg.split(" "): for word in name_arg.split(" "):
results.update(guess_name(name=word, tlds=tlds)) results.update(guess_name(name=word, tlds=tlds))
else: else:
@ -94,6 +96,6 @@ for name in args.name:
output = {} output = {}
output['results'] = list(results) output['results'] = list(results)
j = orjson.dumps(output).decode() if not args.dns:
j = orjson.dumps(output).decode()
print(j) print(j)