def updated(self): self.tool_header() echo(f'[ ✓ ] Congratulations! sashay has been updated successfully', fg='vblack', bg='vgreen') echo(f'[ ✓ ] Press enter to continue', fg='vgreen') self.tool_footer()
def tool_footer(self): from quo.color import ColorDepth from quo.progress import formatters, ProgressBar custom_formatters = [ # formatters.Label(), # formatters.Text(" "), formatters.Rainbow(formatters.Bar()), # formatters.Text(" left: "), # formatters.Rainbow(formatters.TimeLeft()) ] color_depth = ColorDepth.eight_bit with ProgressBar(color_depth=color_depth, formatters=custom_formatters) as pb: for i in pb(range(100)): time.sleep(0.01) echo(f" ", hidden=True) container( Box( Window( FormattedTextControl( Text( "<st bg='red'> </st><ye bg='yellow'> </ye><gr bg='green'> </gr><bl bg='blue'> </bl><wh bg='white'> </wh><ma bg='magenta'> </ma><cy bg='cyan'> </cy><aq bg='aquamarine'> </aq><cr bg='crimson'> </cr><kh bg='khaki'> </kh><in bg='indigo'> </in><st bg='red'> </st><ye bg='yellow'> </ye><gr bg='green'> </gr><bl bg='blue'> </bl><wh bg='white'> </wh><ma bg='magenta'> </ma><cy bg='cyan'> </cy>" )))))
def exit(self): self.tool_header() container( Window( FormattedTextControl("See you soon"),style="fg:blue bold bg:white", align="center"), bind=False) quo.echo(f'Geez...where are you going so soon?', fg='black', bg='vred') quo.echo(f'Anyway, hope to see you back soon', bg="vred") self.tool_footer()
def nonet(self): self.tool_header() quo.echo(f"[ * ]", fg="vred", nl=False, bold=True) quo.echo(f" There is no network connectivity", bold=True, fg="cyan") quo.echo(f"[ * ]", fg="vred", nl=False, bold=True) quo.echo(f" Please try again later", fg="cyan", bold=True) self.tool_footer()
def updating(self): quo.echo(f'#############################################', fg='vblack', bg='vcyan') quo.echo(f'//////////////////UPDATING///////////////////', fg='vred', bg='vwhite') quo.echo(f'#############################################', fg='vblack', bg='vcyan')
def about(self,total): self.tool_header() from quo.table import Table data = [ ["Title", "Author", "Contact"], ["sashay", "Gerrishon Sirere", "*****@*****.**"] ] features = [ ["Features"], ["[ + ] Automatic tool installer"], ["[ + ] 370+ tools"], ["[ + ] Requires python 3.6+"] ] quo.echo(Table(data)) quo.echo(f" ", hidden=True) quo.echo(Table(features)) quo.echo(f'[✓] With great power comes great responsibility', fg="blue", bold=True) self.tool_footer()
def installed(self, name): self.tool_header() echo(f"[ + ] ", fg="blue", nl=False) echo(f">", fg=aquamarine, nl=False, bold=True) time.sleep(0.02) echo(f">", fg=khaki, nl=False, bold=True) time.sleep(0.02) echo(f">", fg=gold, nl=False, bold=True) echo(f"[ + ] ", fg="blue", nl=False, bold=True) echo(f"Installed Succefully!", nl=False, bold=True) echo(f"[ + ] ", fg="blue", nl=False) echo(f"{name} has been installed succefully!") self.tool_footer()
def update_error(self): self.tool_header() echo(f"[ x ] sshy can't be updated at this time", fg="cyan") echo(f"[ x ] Please try again later", fg="cyan") self.tool_footer()
def ins_sc(self): self.tool_header() quo.echo(f'[ ✓ ] sashay has been installed successfully', fg='white') quo.echo(f'[ ✓ ] Type sashay or sshy from anywhere in your terminal', fg='yellow') self.tool_footer()
def update(self): self.tool_header() console.bar("UPDATES") quo.echo(f'[ 1 ] Update sashay', fg='vblue') quo.echo(f'[ 0 ] << Go back', fg='vyellow') self.tool_footer()
def tool_footer(self): quo.echo(f" ", hidden=True) quo.echo(f" ", bg="red", nl=False) time.sleep(0.05) quo.echo(f" ", bg="yellow", nl=False) time.sleep(0.05) quo.echo(f" ", bg="green", nl=False) time.sleep(0.05) quo.echo(f" ", bg="blue", nl=False) time.sleep(0.05) quo.echo(f" ", bg="white", nl=False) time.sleep(0.05) quo.echo(f" ", bg="magenta", nl=False) time.sleep(0.05) quo.echo(f" ", bg="cyan", nl=False) time.sleep(0.05) quo.echo(f" ", bg=gold, nl=False) time.sleep(0.05) quo.echo(f" ", bg=aquamarine, nl=False) time.sleep(0.05) quo.echo(f" ", bg=crimson, nl=False) time.sleep(0.05) quo.echo(f" ", bg=khaki, nl=False) time.sleep(0.05) quo.echo(f" ", bg=lime, nl=False) time.sleep(0.05) quo.echo(f" ", bg=silver, nl=False) time.sleep(0.05) quo.echo(f" ", bg=indigo, nl=False) time.sleep(0.05) quo.echo(f" ", bg=maroon, nl=False) time.sleep(0.05) quo.echo(f" ", bg=thistle, nl=False) print('<aquamarine> </aquamarine>', end="") quo.echo(f" ", bg=salmon)
def ins_tnc(self): self.tool_header() quo.echo(f"THE SOFTWARE IS PROVIDED", fg="vblack", bg="vwhite", nl=False) time.sleep(0.25) quo.echo(f" 'AS IS'", fg="vred", bg="vwhite", nl=False) quo.echo(f" WITHOUT WARRANTY OF ANY KIND", fg="vblack", bg="vwhite", nl=False) time.sleep(0.25) quo.echo(f" INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF", fg="vblack", bg="vwhite", nl=False) time.sleep(0.25) quo.echo(f" MERRCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE", fg="vblack", bg="vwhite", italic=True, nl=False) quo.echo(f" AND", fg="vblack", bg="vwhite", nl=False) quo.echo(f" NONINFRINGEMENT.", fg="vblack", bg="vwhite", italic=True, nl=False) time.sleep(0.25) quo.echo(f" IN NO EVENT SHALL I BE LIABLE FOR", fg="vblack", bg="vwhite", nl=False) quo.echo(f" ANY CLAIM, DAMAGES OR OTHER LIABILITY,", fg="vblack", bg="vwhite", nl=True) quo.echo( f" WHETHER IN AN ACTION OF CONTRACT,OR OTHERWISE, ARISING FROM, OUT OF OR", fg="vblack", bg="vwhite", nl=False) time.sleep(0.25) quo.echo( f" IN CONNECTION WITH THIS SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.", fg='vblack', bg="vwhite") time.sleep(0.5) quo.echo(f'Installing this tool means you agree with all terms', fg='vred') self.tool_footer()
def installing(self): quo.echo(f'#############################################', fg='vblack', bg='vcyan') quo.echo(f'/////////////////INSTALLING//////////////////', fg='vred', bg='vwhite') quo.echo(f'#############################################', fg='vblack', bg='vcyan')
def category(self): while True: tool = tools() total = len(tool.category) num = 1 clear() logo.tool_header() echo(f"") for cat in tool.category: echo(f"[", fg="yellow", nl=False, bold=True) echo(f" {num} ", fg="magenta", nl=False, italic=True) echo(f"]", fg="yellow", bold=True, nl=False) echo(f" {tool.category_data[cat]}", fg="vblue", bold=True) num += 1 echo("") logo.back() session = Prompt(bottom_toolbar=Text( ' <b>List of</b> <u>all</u> tools in <style bg="red">categories</style>' ), placeholder=Text( '<gray>(please type something)</gray>')) cmd = session.prompt("$» ") if cmd == "00" or cmd == "back": self.menu() break else: try: if int(cmd) in range(1, int(total) + 1): while True: print(int(cmd) - 1) print(tool.category[int(cmd) - 1]) cnt = 1 clear() logo.tool_header() tmp_cat_tool = [] for i in tool.names: if tool.category[ int(cmd) - 1] in tool.data[i]["category"]: tmp_cat_tool.append(tool.data[i]['name']) echo("[", bold=True, fg="vblue", nl=False) echo(f" {cnt} ", bold=True, fg="green", nl=False) echo(f"]", bold=True, fg="vblue", nl=False) echo(" Install", fg="vyellow", nl=False) echo(f" {tool.data[i]['name']}", fg="cyan", bold=True) cnt += 1 print(f"") logo.back() if tool.category == "information_gathering": print("ddd") session = Prompt( bottom_toolbar=Text( ' <b>List of</b> <u>all</u> tools in <style bg="red">categories</style>' ), placeholder=Text( '<gray>(please type something)</gray>')) tcmd = session.prompt("$» ") if tcmd == "00" or tcmd == "back": break else: try: cat_total = len(tmp_cat_tool) if int(tcmd) in range( 1, int(cat_total) + 1): clear() logo.installing() print(f"<green>Installing ...</green>") tool.install(tmp_cat_tool[int(tcmd) - 1]) else: print( f"<violate>Sorry</violate> <blue>'{tcmd}'</blue> is an <red>invalid</red> input !!" ) time.sleep(1) except ValueError: print( f"<violate>Sorry</violate> <blue>'{tcmd}'</blue> is an <red>invalid</red> input !!" ) time.sleep(1) else: print( f"<violate>Sorry</violate> <blue>'{cmd}'</blue> is an <red>invalid</red> input !!" ) time.sleep(1) except ValueError: print( f"<violate>Sorry</violate> <blue>'{cmd}'</blue> is an <red>invalid</red> input !!" ) time.sleep(1)
def category(self): while True: tool = tools() total = len(tool.category) num = 1 clear() logo.tool_header() echo(f"") for cat in tool.category: echo(f"[", fg="yellow", nl=False, bold=True) echo(f" {num} ", fg="magenta", nl=False, italic=True) echo(f"]", fg="yellow", bold=True, nl=False) echo(f" {tool.category_data[cat]}", fg="vblue", bold=True) num += 1 echo("") logo.back() session = Prompt(bottom_toolbar=Text( ' <b>List of</b> <u>all</u> tools in <style bg="red">categories</style>' ), placeholder=Text( '<gray>(please type something)</gray>')) cmd = session.prompt("") if cmd == "00" or cmd == "back": self.menu() break else: try: if int(cmd) in range(1, int(total) + 1): while True: print(int(cmd) - 1) print(tool.category[int(cmd) - 1]) cnt = 1 clear() logo.tool_header() print(f"") tmp_cat_tool = [] for i in tool.names: if tool.category[ int(cmd) - 1] in tool.data[i]["category"]: tmp_cat_tool.append(tool.data[i]['name']) print( f" {green}[ {violate}{cnt} {green}] {yellow}Install {green}{tool.data[i]['name']}{nc}" ) cnt += 1 print(f"") logo.back() session = Prompt( bottom_toolbar=Text( ' <b>List of</b> <u>all</u> tools in <style bg="red">categories</style>' ), placeholder=Text( '<gray>(please type something)</gray>')) tcmd = session.prompt("$") # tcmd=inputc}@{blue}space {yellow}$ {nc}") if tcmd == "00" or tcmd == "back": break else: try: cat_total = len(tmp_cat_tool) if int(tcmd) in range( 1, int(cat_total) + 1): clear() logo.installing() print(f"{green}Installing ....{nc}") tool.install(tmp_cat_tool[int(tcmd) - 1]) else: print( f"\007{red}Sorry,{violate} '{tcmd}' {blue}: {red}invalid input !!{nc}" ) time.sleep(1) except ValueError: print( f"\007{red}Sorry,{violate} '{tcmd}' {blue}: {red}invalid input !!{nc}" ) time.sleep(1) else: print( f"\007{red}Sorry,{violate} '{cmd}' {blue}: {red}invalid input !!{nc}" ) time.sleep(1) except ValueError: print( f"\007{red}Sorry,{violate} '{cmd}' {blue}: {red}invalid input !!{nc}" ) time.sleep(1)
def installing(self): echo("#############################################")
def install_tools(self): while True: tool = tools() num = 1 total = len(tool.names) clear() logo.install_tools() print(f" ") for tool_name in tool.names: echo(f"[", fg="vyellow", bold=True, nl=False) echo(f" {num} ", fg="vmagenta", italic=True, nl=False) echo(f"]", fg="vyellow", bold=True, nl=False) echo(f" Install ", nl=False) echo(f"{tool_name}", fg=aquamarine, bold=True) num += 1 echo(f"") logo.back() echo(f"sshy", fg="vblue", italic=True, bold=True, nl=False) echo(f">>>", fg="cyan", bold=True, italic=True) #def main(): # history = quo.history.InMemoryHistory() # history.append_string("import os") # history.append_string('print("hello")') # history.append_string('print("world")') session = Prompt(bottom_toolbar=Text( ' <b>List of</b> <u>all</u> <style bg="red">tools</style>'), placeholder=Text( '<gray>(please type something)</gray>')) #history=history, auto_suggest=quo.completion.AutoSuggestFromHistory(), enable_history_search=True) # while True: # try: cmd = session.prompt("» ") #except KeyboardInterrupt: # pass # Ctrl-C pressed. Try again. # else: # break if cmd == "00" or cmd == "back": self.menu() break else: try: if int(cmd) >= 1 and int(cmd) <= int(total): clear() logo.installing() print("<green>Installing...</green>") tool.install(tool.names[int(cmd) - 1]) else: echo(f"Sorry, '{cmd}', is an invalid input !!", fg="black", bg="red") sleep(1) except ValueError: echo(f"Error:", fg="black", bg="vred", nl=False) echo(f" {cmd}", nl=False, fg="yellow") echo(f" is an invalid input!!", fg="red") time.sleep(1)
def update(self): while True: clear() logo.update() echo(f"sshy", fg="vblue", nl=False, italic=True, bold=True) quo.echo(f">>>", fg="cyan", italic=True, bold=True) session = Prompt( bottom_toolbar=Text( ' <b>Check/Download</b> <u>new</u> <style bg="red">updates</style>' ), placeholder=Text( '<style color="#888888">(please type something)</style>')) cmd = session.prompt("") if cmd == "1": system = sys() if system.connection(): clear() logo.updating() if system.sudo != None: if os.path.exists(system.home + "/sashay"): pass else: os.system( system.sudo + " git clone https://github.com/secretum-inc.git " + system.home + "/sashay") if os.path.exists(system.home + "/sashay/install.sshy"): os.system("cd " + system.home + "/sashay;" + system.sudo + " ./install.sshy") if os.path.exists(system.bin + "/sashay") and os.path.exists( system.conf_dir + "/sashay"): clear() logo.updated() cmd = input( f"{blue}sshy{nc}@{blue}space {yellow}$ {nc}" ) else: clear() logo.update_error() cmd = input( f"{blue}sshy{nc}@{blue}space {yellow}$ {nc}" ) else: quo.clear() logo.update_error() cmd = input( f"{blue}sshy@{blue}space {yellow}$ {nc}") else: if os.path.exists(system.home + "/sashay"): pass else: os.system( "git clone https://github.com/secretum-inc/sashay.git " + system.home + "/sashay") if os.path.exists(system.home + "/sashay/install.sshy"): os.system("cd " + system.home + "/sashay;./install.sshy") if os.path.exists(system.bin + "/sashay") and os.path.exists( system.conf_dir + "/sashay"): clear() logo.updated() cmd = input( f"{blue}sshy{nc}@{blue}space {yellow}$ {nc}" ) else: clear() logo.update_error() cmd = input( f"{blue}sshy{nc}@{blue}space {yellow}$ {nc}" ) else: clear() logo.update_error() cmd = input( f"{blue}sshy{nc}@{blue}space {yellow}$ {nc}") else: clear() logo.nonet() tmp = input(f"{blue}sshy{nc}@{blue}space {yellow}$ {nc}") elif cmd == "0" or cmd == "back": self.menu() break else: echo(f"Invalid input !!", fg="vred") time.sleep(1) if cmd == "0" or cmd == "back": self.menu() break else: echo(f"")
import os import sys from quo import clear, echo from src.menu import * if __name__ == "__main__": try: Main.menu() except KeyboardInterrupt: clear() echo("Exitting...", reverse=True) logo.exit()
def not_installed(self, name): self.tool_header() echo(f"[ x ] Sorry, {name} has not been installed!", fg="vred") self.tool_footer()
def not_ins(self): self.tool_header() quo.echo(f"[ x ]", fg=aquamarine, nl=False) quo.echo(f" sashay cannot be installed at the moment") quo.echo(f'[ x ] An error occurred, please try again later') self.tool_footer()
def install_tools(self): while True: tool = tools() num = 1 total = len(tool.names) clear() logo.install_tools() #print(f" ") for tool_name in tool.meta: echo(f"[", fg="vyellow", bold=True, nl=False) echo(f" {num} ", fg="vmagenta", italic=True, nl=False) echo(f"]", fg="vyellow", bold=True, nl=False) echo(f" Install ", nl=False) echo(f"{tool_name}", fg=aquamarine, bold=True) num += 1 echo(f"") logo.back() # echo(f"sshy", fg="vblue", italic=True, bold=True, nl=False) # echo(f">>>", fg="cyan", bold=True, italic=True) session = Prompt(bottom_toolbar=Text( ' <b>List of</b> <u>all</u> <style bg="red">tools</style>'), placeholder=Text( '<gray>(please type something)</gray>')) cmd = session.prompt("» ") if cmd == "00" or cmd == "back": self.menu() break else: try: if int(cmd) >= 1 and int(cmd) <= int(total): clear() logo.installing() print("<green>Installing...</green>") tool.install(tool.names[int(cmd) - 1]) else: echo(f"Sorry, '{cmd}', is an invalid input !!", fg="black", bg="red") sleep(1) except ValueError: echo(f"Error:", fg="black", bg="vred", nl=False) echo(f" {cmd}", nl=False, fg="yellow") echo(f" is an invalid input!!", fg="red") time.sleep(1)
def menu(self,total): self.tool_header() quo.echo(f"[ 1 ]", fg="vyellow", bg="vblack", nl=False) quo.echo(f" ", hidden=True, nl=False) show_all = """𝕊𝕙𝕠𝕨 𝕒𝕝𝕝 𝕥𝕠𝕠𝕝𝕤""" quo.echo(f"{show_all}", bg='vyellow', fg='vblack') time.sleep(0.3) quo.echo(f"[ 2 ]", bg="vyellow", fg="vblack", nl=False) quo.echo(f" ", hidden=True, nl=False) show_a = """𝕊𝕙𝕠𝕨 𝕒𝕝𝕝 𝕔𝕒𝕥𝕖𝕘𝕠𝕣𝕚𝕖𝕤""" quo.echo(f"{show_a}", bg='vblack', fg='vyellow') time.sleep(0.3) quo.echo(f"[ 3 ]", fg="vyellow", bg="vblack", nl=False) quo.echo(f" ", hidden=True, nl=False) update = """𝕌𝕡𝕕𝕒𝕥𝕖 𝕊𝕒𝕤𝕙𝕒𝕪""" quo.echo(f"{update}", fg='vblack', bg='vyellow') time.sleep(0.2) quo.echo(f"[ 4 ]", fg="vblack", bg="vyellow", nl=False) quo.echo(f" ", hidden=True, nl=False) about = """𝔸𝕓𝕠𝕦𝕥 𝕦𝕤""" quo.echo(f"{about}", fg='vyellow', bg='vblack') time.sleep(0.2) quo.echo(f"[ x ]", fg="vyellow", bg="vblack", nl=False) quo.echo(f" ", hidden=True, nl=False) exit_s = """𝔼𝕩𝕚𝕥 𝕊𝕒𝕤𝕙𝕒𝕪""" quo.echo(f"{exit_s}", fg='vblack', bg='vyellow') self.tool_footer()
def tool_footer(self): echo(f" ", hidden=True) echo(f" ", bg="red", nl=False) time.sleep(0.0008) echo(" ", bg="yellow", nl=False) time.sleep(0.0008) echo(" ", bg="green", nl=False) time.sleep(0.0008) echo(f" ", bg="blue", nl=False) time.sleep(0.0008) echo(" ", bg="white", nl=False) time.sleep(0.0008) echo(f" ", bg="magenta", nl=False) time.sleep(0.0008) echo(" ", bg="cyan", nl=False) time.sleep(0.0008) echo(" ", bg=gold, nl=False) time.sleep(0.0008) echo(" ", bg=aquamarine, nl=False) time.sleep(0.0008) echo(" ", bg=crimson, nl=False) time.sleep(0.0008) echo(" ", bg=khaki, nl=False) time.sleep(0.0008) echo(f" ", bg=lime, nl=False) time.sleep(0.0008) echo(f" ", bg=silver, nl=False) time.sleep(0.0008) echo(f" ", bg=indigo, nl=False) time.sleep(0.0008) echo(f" ", bg=maroon, nl=False) time.sleep(0.0008) echo(f" ", bg=thistle, nl=False) time.sleep(0.0008) echo(" ", bg="yellow", nl=False) time.sleep(0.0008) echo(" ", bg="green", nl=False) time.sleep(0.0008) echo(f" ", bg="blue", nl=False) time.sleep(0.0008) echo(" ", bg="white", nl=False) time.sleep(0.0008) echo(f" ", bg="magenta", nl=False) time.sleep(0.0008) echo(" ", bg="cyan")
def update(self): while True: session = Prompt( placeholder=Text("<grey>(please type something)</grey>")) _inp = session.prompt("$» ") clear() logo.update() session = Prompt( bottom_toolbar=Text( ' <b>Check/Download</b> <u>new</u> <style bg="red">updates</style>' ), placeholder=Text( '<style color="#888888">(please type something)</style>')) cmd = session.prompt("$» ") if cmd == "1": system = sys() if system.connection(): clear() logo.updating() if system.sudo != None: if os.path.exists(system.home + "/sashay"): pass else: os.system( system.sudo + " git clone https://github.com/scalabli.git " + system.home + "/sashay") if os.path.exists(system.home + "/sashay/install.sshy"): os.system("cd " + system.home + "/sashay;" + system.sudo + " ./install.sshy") if os.path.exists(system.bin + "/sashay") and os.path.exists( system.conf_dir + "/sashay"): clear() logo.updated() cmd = _inp else: clear() logo.update_error() cmd = _inp else: clear() logo.update_error() cmd = _inp else: if os.path.exists(system.home + "/sashay"): pass else: os.system( "git clone https://github.com/scalabli/sashay.git " + system.home + "/sashay") if os.path.exists(system.home + "/sashay/install.sshy"): os.system("cd " + system.home + "/sashay;./install.sshy") if os.path.exists(system.bin + "/sashay") and os.path.exists( system.conf_dir + "/sashay"): clear() logo.updated() cmd = _inp else: clear() logo.update_error() cmd = _inp else: clear() logo.update_error() cmd = _inp else: clear() logo.nonet() tmp = _inp elif cmd == "0" or cmd == "back": self.menu() break else: echo(f"Invalid input !!", fg="vred") time.sleep(1) if cmd == "0" or cmd == "back": self.menu() break else: echo(f"")