chg: [providence] output JSON

This commit is contained in:
Alexandre Dulaunoy 2023-01-11 07:48:11 +01:00
parent 28d5c91f4a
commit a8ac67cf00
Signed by: adulau
GPG key ID: 09E2CD4944E6CBCD

View file

@ -4,6 +4,7 @@ import argparse
from pathlib import Path from pathlib import Path
import os import os
import re import re
import orjson
import requests import requests
@ -20,6 +21,7 @@ parser.add_argument(
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)",
) )
#parser.add_argument("","")
args = parser.parse_args() args = parser.parse_args()
@ -65,15 +67,23 @@ results = set()
if re.search(r' {1,}', args.name): if re.search(r' {1,}', args.name):
# replace with - # replace with -
name = args.name name = args.name
reversed_name = " ".join(args.name.split(" ")[::-1])
p = name.replace(" ", "-") p = name.replace(" ", "-")
results.update(guess_name(name=p, tlds=tlds)) results.update(guess_name(name=p, tlds=tlds))
# combined p = reversed_name.replace(" ", "-")
results.update(guess_name(name=p, tlds=tlds))
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(" ", "")
results.update(guess_name(name=p, tlds=tlds))
# try with removal of word # try with removal of word
for word in args.name.split(" "): for word in args.name.split(" "):
results.update(guess_name(name=word, tlds=tlds)) results.update(guess_name(name=word, tlds=tlds))
else: else:
results.update(guess_name(name=args.name, tlds=tlds)) results.update(guess_name(name=args.name, tlds=tlds))
print(results) output = {}
output['results'] = list(results)
j = orjson.dumps(output).decode()
print(j)