Python pyfiglet.figlet_format() Examples

The following are 25 code examples of pyfiglet.figlet_format(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module pyfiglet , or try the search function .
Example #1
Source File: auth.py    From drive-cli with MIT License 6 votes vote down vote up
def login(remote):
    token = os.path.join(dirpath, 'token.json')
    store = file.Storage(token)
    creds = store.get()
    if not creds or creds.invalid:
        client_id = os.path.join(dirpath, 'oauth.json')
        flow = client.flow_from_clientsecrets(client_id, SCOPES)
        flags = tools.argparser.parse_args(args=[])
        if remote:
            flags.noauth_local_webserver = True
        creds = tools.run_flow(flow, store, flags)
        click.secho(
            "********************** welcome to **********************", bold=True, fg='red')
        result = pyfiglet.figlet_format("Drive - CLI", font="slant")
        click.secho(result, fg='yellow')
        click.secho(
            "********************************************************", bold=True, fg='red') 
Example #2
Source File: figlet.py    From X-tra-Telegram with Apache License 2.0 6 votes vote down vote up
def figlet(event):
    if event.fwd_from:
        return
    CMD_FIG = {"slant": "slant", "3D": "3-d", "5line": "5lineoblique", "alpha": "alphabet", "banner": "banner3-D", "doh": "doh", "iso": "isometric1", "letter": "letters", "allig": "alligator", "dotm": "dotmatrix", "bubble": "bubble", "bulb": "bulbhead", "digi": "digital"}
    input_str = event.pattern_match.group(1)
    if "|" in input_str:
        text, cmd = input_str.split("|", maxsplit=1)
    elif input_str is not None:
        cmd = None
        text = input_str
    else:
        await event.edit("Please add some text to figlet")
        return
    if cmd is not None:
        try:
            font = CMD_FIG[cmd]
        except KeyError:
            await event.edit("Invalid selected font.")
            return
        result = pyfiglet.figlet_format(text, font=font)
    else:
        result = pyfiglet.figlet_format(text)
    await event.respond("‌‌‎`{}`".format(result))
    await event.delete() 
Example #3
Source File: notsobot.py    From Trusty-cogs with MIT License 6 votes vote down vote up
def do_ascii(self, text):
        try:
            i = Image.new("RGB", (2000, 1000))
            img = ImageDraw.Draw(i)
            txt = figlet_format(text, font="starwars")
            img.text((20, 20), figlet_format(text, font="starwars"), fill=(0, 255, 0))
            text_width, text_height = img.textsize(figlet_format(text, font="starwars"))
            imgs = Image.new("RGB", (text_width + 30, text_height))
            ii = ImageDraw.Draw(imgs)
            ii.text((20, 20), figlet_format(text, font="starwars"), fill=(0, 255, 0))
            text_width, text_height = ii.textsize(figlet_format(text, font="starwars"))
            final = BytesIO()
            imgs.save(final, "png")
            file_size = final.tell()
            final.seek(0)
            return final, txt, file_size
        except Exception:
            return False, False 
Example #4
Source File: Fun.py    From NotSoBot with MIT License 6 votes vote down vote up
def do_ascii(self, text):
		try:
			i = PIL.Image.new('RGB', (2000, 1000))
			img = PIL.ImageDraw.Draw(i)
			txt = figlet_format(text, font='starwars')
			img.text((20, 20), figlet_format(text, font='starwars'), fill=(0, 255, 0))
			text_width, text_height = img.textsize(figlet_format(text, font='starwars'))
			imgs = PIL.Image.new('RGB', (text_width + 30, text_height))
			ii = PIL.ImageDraw.Draw(imgs)
			ii.text((20, 20), figlet_format(text, font='starwars'), fill=(0, 255, 0))
			text_width, text_height = ii.textsize(figlet_format(text, font='starwars'))
			final = BytesIO()
			imgs.save(final, 'png')
			final.seek(0)
			return final, txt
		except:
			return False, False 
Example #5
Source File: figlet.py    From BotHub with Apache License 2.0 6 votes vote down vote up
def figlet(event):
    if event.fwd_from:
        return
    CMD_FIG = {"slant": "slant", "3D": "3-d", "5line": "5lineoblique", "alpha": "alphabet", "banner": "banner3-D", "doh": "doh", "iso": "isometric1", "letter": "letters", "allig": "alligator", "dotm": "dotmatrix", "bubble": "bubble", "bulb": "bulbhead", "digi": "digital"}
    input_str = event.pattern_match.group(1)
    if "|" in input_str:
        text, cmd = input_str.split("|", maxsplit=1)
    elif input_str is not None:
        cmd = None
        text = input_str
    else:
        await event.edit("Please add some text to figlet")
        return
    if cmd is not None:
        try:
            font = CMD_FIG[cmd]
        except KeyError:
            await event.edit("Invalid selected font.")
            return
        result = pyfiglet.figlet_format(text, font=font)
    else:
        result = pyfiglet.figlet_format(text)
    await event.respond("‌‌‎`{}`".format(result))
    await event.delete() 
Example #6
Source File: banner.py    From limbo with MIT License 6 votes vote down vote up
def make_banner(query):
    # Slack turns -- into an emdash; un-turn it
    query = query.replace(u"\u2014", u"--")

    ns = ARGPARSE.parse_args(query.split(" "))
    if ns.l:
        return "```{0}```".format(", ".join(FONTS))
    font = ns.font or "standard"

    if font not in FONTS:
        return "Unable to find font {0}".format(font)

    banner = pyfiglet.figlet_format(
        " ".join(ns.bannertext), font=font).rstrip()
    if not banner:
        return

    return "```{0}```".format(banner) 
Example #7
Source File: __init__.py    From butian-src-domains with GNU General Public License v3.0 5 votes vote down vote up
def banner():
    banner_txt = 'butian-src-domains'
    banner_art = pyfiglet.figlet_format('src-domains')
    banner_art += '# src-domains @version: {}'.format(__version__)
    print('{}{}{}'.format(Fore.CYAN, banner_art, Fore.RESET)) 
Example #8
Source File: draw.py    From rainbowstream with MIT License 5 votes vote down vote up
def ascii_art(text):
    """
    Draw the Ascii Art
    """
    fi = figlet_format(text, font='doom')
    print('\n'.join(
        [next(dg['cyc'])(i) for i in fi.split('\n')]
    )) 
Example #9
Source File: defaultFrame.py    From TerminusBrowser with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def __init__(self, welcome=False, test=False):
        self.headerString = 'TerminusBrowser'
        self.footerStringRight = f''
        self.url = 'Welcome Screen'

        if welcome:
            welcomeText = pyfiglet.figlet_format('TerminusBrowser') + '\nRecent Commits:\n'

            if not test:
                r = requests.get('https://api.github.com/repos/wtheisen/TerminusBrowser/commits')
                data = r.json()

                count = 0
                for cData in data:
                    commit = cData['commit']
                    cleanMessage = commit['message'].replace('\r', '').replace('\n\n', '\n')
                    welcomeText += f'\n {commit["author"]["name"]}: {cleanMessage}'

                    if count < 4:
                        count += 1
                    else:
                        break

            self.contents = urwid.Text(welcomeText, 'center')
        else:
            self.contents = urwid.Text('')

        self.contents = urwid.Filler(self.contents)
        urwid.WidgetWrap.__init__(self, self.contents) 
Example #10
Source File: flask_gopher.py    From flask-gopher with GNU General Public License v3.0 5 votes vote down vote up
def figlet(self, text, width=None, font='normal', justify='auto', **kwargs):
        """
        Renders the given text using the pyfiglet engine. See the pyfiglet
        package for more information on available fonts and options. There's
        also a  command line client (pyfiglet) that you can use to test out
        different fonts. There are over 500 of them!

        Options:
            font (str): The figlet font to use, see pyfiglet for choices
            direction (str): auto, left-to-right, right-to-left
            justify (str): auto, left, right, center
        """
        width = width or self.default_width
        try:
            text = figlet_format(text, font, width=width, justify=justify, **kwargs)
        except FigletError:
            # Could be that the character is too large for the width of the
            # screen, or some other figlet rendering error. Fall back to using
            # the bare text that the user supplied.
            pass

        if justify == 'center':
            text = self.center(text, width=width)
        elif justify == 'right':
            text = self.rjust(text, width=width)
        return text 
Example #11
Source File: ccat.py    From ccat with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def exit_cli(self):
        questions = [
            {
                'type': 'confirm',
                'message': 'Do you want to exit?',
                'name': 'exit',
                'default': False,
            }
        ]

        answers = prompt(questions)
        if answers['exit']:
            print(figlet_format('Bye Bye', font='slant'))
            sys.exit() 
Example #12
Source File: ccat.py    From ccat with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def print_title(self, text='Cloud Container Attack Tool', font='slant'):
        print(figlet_format(text, font=font)) 
Example #13
Source File: LARRYCHATTER_CommandPost.py    From LARRYCHATTER with MIT License 5 votes vote down vote up
def print_banner():
    ascii_banner = pyfiglet.figlet_format("LARRYCHATTER")
    print(colored(ascii_banner, 'blue'))
    print("\n")
    print(colored("------------------------ Covert Implant Framework ------------------------", "blue"))
    print("\n")
    print(colored("Created by @UpayanSaha", "blue")) 
Example #14
Source File: ascii_text.py    From unicorn-remote with MIT License 5 votes vote down vote up
def run(params):
    if "text" in params:
        text = params["text"]
    else:
        text = "Hello, World!"

    width,height=unicorn.get_shape()

    figletText = figlet_format(text+'  ', "banner", width=1000) # banner font generates text with heigth 7
    textMatrix = figletText.split("\n")[:width] # width should be 8 on both HAT and pHAT!
    textWidth = len(textMatrix[0]) # the total length of the result from figlet
    global i 
    i = -1

    def step():
        global i
        i = 0 if i>=100*textWidth else i+1 # avoid overflow
        for h in range(height):
            for w in range(width):
                hPos = (i-h) % textWidth
                chr = textMatrix[w][hPos]
                if chr == ' ':
                    unicorn.set_pixel(h, 6-w, 0, 0, 0)
                else:
                    unicorn.set_pixel(h, 6-w, 255, 0, 0)
        unicorn.show()

    while True:
        step()
        sleep(0.1) 
Example #15
Source File: ascii.py    From Squid-Plugins with MIT License 5 votes vote down vote up
def setup(bot):
    if figlet_format is None:
        raise NameError("You need to run `pip3 install pyfiglet`")
    n = Ascii(bot)
    bot.add_cog(n) 
Example #16
Source File: ascii.py    From Squid-Plugins with MIT License 5 votes vote down vote up
def _ascii(self, *, text):
        msg = str(figlet_format(text, font='cybermedium'))
        if msg[0] == " ":
            msg = "." + msg[1:]
        error = figlet_format('LOL, that\'s a bit too long.',
                              font='cybermedium')
        if len(msg) > 2000:
            await self.bot.say(box(error))
        else:
            await self.bot.say(box(msg)) 
Example #17
Source File: asciiart.py    From grinder with GNU General Public License v2.0 5 votes vote down vote up
def print_opener() -> None:
        """
        This function draws a big GRINDER ASCII logo at startup.
        :return: None
        """
        init(strip=not stdout.isatty())
        cprint(figlet_format("GRINDER", font="cosmike"), "blue", attrs=["bold"]) 
Example #18
Source File: Zydra.py    From Zydra with MIT License 5 votes vote down vote up
def banner(self):
        term.clear()
        term.pos(1, 1)
        banner = pyfiglet.figlet_format("ZYDRA", font="epic").replace("\n", "\n\t\t", 7)
        cprint("\r\n\t" + "@" * 61, "blue", end="")
        cprint("\n\t\t" + banner + "\t\tAuthor : Hamed Hosseini", "blue", attrs=['bold'])
        cprint("\t" + "@" * 61 + "\n", "blue") 
Example #19
Source File: fun.py    From Discord-Selfbot with GNU General Public License v3.0 5 votes vote down vote up
def font(self, ctx, *, txt: str):
        """Change font for ascii. All fonts: http://www.figlet.org/examples.html for all fonts."""
        try:
            str(figlet_format('test', font=txt))
        except (FontError, FontNotFound):
            return await ctx.send(self.bot.bot_prefix + 'Invalid font type.')
        write_config_value("optional_config", "ascii_font", txt)
        await ctx.send(self.bot.bot_prefix + 'Successfully set ascii font.') 
Example #20
Source File: fun.py    From Discord-Selfbot with GNU General Public License v3.0 5 votes vote down vote up
def ascii(self, ctx, *, msg):
        """Convert text to ascii art. Ex: [p]ascii stuff [p]help ascii for more info."""
        if ctx.invoked_subcommand is None:
            if msg:
                font = get_config_value("optional_config", "ascii_font")
                msg = str(figlet_format(msg.strip(), font=font))
                if len(msg) > 2000:
                    await ctx.send(self.bot.bot_prefix + 'Message too long, RIP.')
                else:
                    await ctx.message.delete()
                    await ctx.send(self.bot.bot_prefix + '```\n{}\n```'.format(msg))
            else:
                await ctx.send(
                               self.bot.bot_prefix + 'Please input text to convert to ascii art. Ex: ``>ascii stuff``') 
Example #21
Source File: logo.py    From memes with MIT License 5 votes vote down vote up
def print_logo():
    colorama.init()
    print()
    cprint(figlet_format('OPENGENUS', font='basic'), 'yellow')
    cprint(figlet_format('MEMES', font='starwars'), 'green') 
Example #22
Source File: cli_output.py    From Vxscan with Apache License 2.0 5 votes vote down vote up
def banner():
    ascii_banner = pyfiglet.figlet_format("Vxscan")
    print(Bcolors.RED + ascii_banner + Bcolors.ENDC) 
Example #23
Source File: mr.sip.py    From Mr.SIP with GNU General Public License v3.0 4 votes vote down vote up
def main():
    
   # ascii_banner = pyfiglet.figlet_format("Mr.SIP: SIP-Based Audit and Attack Tool")
   # print(ascii_banner + "\033[1m\033[91m ~ By Melih Tas (SN)\n\033[0m") 

   banner = """
 __  __      ____ ___ ____      ____ ___ ____       _                        _ 
|  \/  |_ __/ ___|_ _|  _ \ _  / ___|_ _|  _ \     | |__   __ _ ___  ___  __| |
| |\/| | '__\___ \| || |_) (_) \___ \| || |_) |____| '_ \ / _` / __|/ _ \/ _` |
| |  | | | _ ___) | ||  __/ _   ___) | ||  __/_____| |_) | (_| \__ \  __/ (_| |
|_|  |_|_|(_)____/___|_|   (_) |____/___|_|        |_.__/ \__,_|___/\___|\__,_|
                                                                               
    _             _ _ _                     _      _   _   _             _    
   / \  _   _  __| (_) |_    __ _ _ __   __| |    / \ | |_| |_ __ _  ___| | __
  / _ \| | | |/ _` | | __|  / _` | '_ \ / _` |   / _ \| __| __/ _` |/ __| |/ /
 / ___ \ |_| | (_| | | |_  | (_| | | | | (_| |  / ___ \ |_| || (_| | (__|   < 
/_/   \_\__,_|\__,_|_|\__|  \__,_|_| |_|\__,_| /_/   \_\__|\__\__,_|\___|_|\_\\
                                                                              
 _____           _ 
|_   _|__   ___ | |
  | |/ _ \ / _ \| |
  | | (_) | (_) | |
  |_|\___/ \___/|_|+ \033[1m\033[91m ~ By Melih Tas (SN)\n\033[0m
   """ + "Greetz ~ \033[1m\033[94m Caner \033[1m\033[93m Onur \033[1m\033[95m Nesli \n\033[0m"
                   
   print (banner)
   if options.interface is not None:
      conf.iface = options.interface

   s = time.time()

   if options.network_scanner:
      networkScanner()
   elif options.dos_simulator:
      dosSmilator()
   elif options.sip_enumerator:
      sipEnumerator()

   e = time.time()
   print ("time taken: {}".format(e-s))


# SIP-NES: SIP-based Network Scanner 
Example #24
Source File: logo.py    From memes with MIT License 4 votes vote down vote up
def test_logo():
    colorama.init()
    print()
    cprint(figlet_format('TEST', font='basic'), 'red') 
Example #25
Source File: FindFrontableDomains.py    From FindFrontableDomains with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument('-f', '--file', type=str, required=False)
    parser.add_argument('-t', '--threads', type=int, required=False, default=10)
    parser.add_argument('-d', '--domain', type=str, required=False)
    parser.add_argument('-c', '--check', type=str, required=False)
    args = parser.parse_args()
    threads =  args.threads
    check=args.check
    file = args.file
    domain = args.domain

    from colorama import init
    init(strip=not sys.stdout.isatty()) # strip colors if stdout is redirected
    from termcolor import cprint 
    from pyfiglet import figlet_format

    cprint(figlet_format('Find'))
    cprint(figlet_format('Frontable'))
    cprint(figlet_format('Domains'))


    q = queue.Queue()
    if file:
        with open(file, 'r') as f:
            for d in f:
                d = d.rstrip()
                if d:
                    q.put(d)   
    elif check:
        q.put(check)       
    elif domain:
        subdomains = []
        subdomains = sublist3r.main(domain, threads, savefile=None, ports=None, silent=False, verbose=False, enable_bruteforce=False, engines=None)
        for i in subdomains:
            print(i)
            q.put(i)
    else:
        print("No Input Detected!")
        sys.exit()
    print("---------------------------------------------------------")
    print("Starting search for frontable domains...")
    # spawn a pool of threads and pass them queue instance
    for i in range(threads):
        t = ThreadLookup(q)
        t.setDaemon(True)
        t.start()
    
    q.join()
    print("")
    print("Search complete!")