mirror of
https://github.com/adulau/providence.git
synced 2024-11-21 17:47:04 +00:00
chg: [providence] output JSON
This commit is contained in:
parent
28d5c91f4a
commit
a8ac67cf00
1 changed files with 12 additions and 2 deletions
|
@ -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)
|
||||||
|
|
Loading…
Reference in a new issue