Так то же, наверное, можно, но я сделал через cmd библиотеку, сделал класс:
class Interp(cmd.Cmd):
pattern=str()
Database=False
Pattern=False
Country=False
intro=Fore.GREEN+"""1)Output help, use the command: \"help\".
2)Enter a search template, enter the command \"pattern\" parameters: the name template or the path to the file.
3)Start the program, enter \"start\".
4)View the entered parameters, enter \"info\".
5)Change the setting Database, enter the \"Database\" parameter: Database
6)Change the setting Pattern, enter the \"Pattern\" parameter:Pattern
7)Change the setting Country, enter the \"Country\" parameter:Country
9)Get geo date \"get_geo_info mydatabase.db\""""+Fore.WHITE
prompt='--> '
def do_pattern(self, arg):
self.pattern=""
self.patterns=arg
print(Fore.GREEN,end='',flush=True)
print(f"pattern:{self.pattern}")
print(Fore.WHITE,end='',flush=True)
return False
def do_start(self, arg):
if len(self.pattern)>2:
shodan_find1(self.pattern,1)
print(Fore.GREEN,end='',flush=True)
print("Начат сбор информации")
print(Fore.WHITE,end='',flush=True)
else:
print(Fore.RED,end='',flush=True)
print("""Введенные данные не верны""")
print(Fore.GREEN,end='',flush=True)
print("Шаблон поиска:",self.pattern)
print(Fore.WHITE,end='',flush=True)
return False
def do_get_geo_info(self, arg):
get_geo_html(self.Database,pattern=self.Pattern, country=self.Country)
return False
def do_Pattern(self, arg):
self.Pattern=""
self.Patterns=arg
print(Fore.GREEN,end='',flush=True)
print(f"pattern:{self.Pattern}")
print(Fore.WHITE,end='',flush=True)
return False
def do_Country(self, arg):
Country=arg
print(Country)
return False
def do_Database(self, arg):
self.Database=arg
try:
file=open(self.Database,'r')
except:
print(Fore.RED,end='',flush=True)
print(f"""Базу данных \"{self.Database}\" не удалось найти.""")
print(Fore.WHITE,end='',flush=True)
self.Database=str()
return False
def do_info(self, arg):
print(Fore.GREEN+"Search pattern :",end='',flush=True)
print(Fore.YELLOW,self.pattern)
print(Fore.WHITE,end='',flush=True)
print(Fore.GREEN+"Pattern for get geo info:",end='',flush=True)
print(Fore.YELLOW,self.Pattern)
print(Fore.WHITE,end='',flush=True)
print(Fore.GREEN+"Database:",end='',flush=True)
print(Fore.YELLOW,self.Database)
print(Fore.WHITE,end='',flush=True)
print(Fore.GREEN+"Country:",end='',flush=True)
print(Fore.YELLOW,self.Country)
print(Fore.WHITE,end='',flush=True)
return False
def do_help(self, arg):
print(Fore.GREEN,end='',flush=True)
get_info()
print(Fore.WHITE,end='',flush=True)
return False