mirror of
https://github.com/adulau/providence.git
synced 2024-11-21 17:47:04 +00:00
chg: [providence] allow multiple company names
This commit is contained in:
parent
b0fe17660c
commit
911917e79d
1 changed files with 29 additions and 20 deletions
|
@ -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,10 +66,14 @@ else:
|
||||||
|
|
||||||
results = set()
|
results = set()
|
||||||
|
|
||||||
if re.search(r' {1,}', args.name):
|
|
||||||
|
def permutation_name(name_arg=None):
|
||||||
|
if name_arg is None:
|
||||||
|
return False
|
||||||
|
if re.search(r' {1,}', name_arg):
|
||||||
# replace with -
|
# replace with -
|
||||||
name = args.name
|
name = name_arg
|
||||||
reversed_name = " ".join(args.name.split(" ")[::-1])
|
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(" ", "-")
|
||||||
|
@ -78,10 +83,14 @@ if re.search(r' {1,}', args.name):
|
||||||
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
|
# try with removal of word
|
||||||
for word in args.name.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:
|
||||||
results.update(guess_name(name=args.name, tlds=tlds))
|
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)
|
||||||
|
|
Loading…
Reference in a new issue