This commit is contained in:
Florian Mounier
2015-10-19 11:51:08 +02:00
parent e789622b7e
commit 856aac2bcb
6 changed files with 19 additions and 37 deletions

View File

@@ -14,7 +14,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
__version__ = '2.0.0-beta5'
__version__ = '2.0.0-beta6'
import os

View File

@@ -1,13 +0,0 @@
#!/usr/bin/env python
from calendar import LocaleHTMLCalendar
from datetime import datetime
import locale
now = datetime.now()
calendar = LocaleHTMLCalendar(locale=locale.getlocale())
calendar_table = calendar.formatmonth(now.year, now.month)
calendar_table = calendar_table.replace('border="0"', 'border="1"')
print('\x1bP;HTML|')
print(calendar_table)
print('\x1bP')

View File

@@ -30,13 +30,14 @@ Butterfly is a xterm compliant terminal built with python and javascript.
{title}Butterfly programs:{reset}
{strong}b : {reset}Alias for {strong}butterfly{reset} executable. Takes a comand in parameter or launch a butterfly server for one shot use (if outside butterfly).
{strong}b cat : {reset}A wrapper around cat allowing to display images as <img> instead of binary.
{strong}b open : {reset}Open a new terminal at specified location.
{strong}b session : {reset}Open or rattach a butterfly session. Multiplexing is supported.
{strong}b colors : {reset}Test the terminal colors (16, 256 and 16777216 colors)
{strong}b hr : {reset}Put a html hr. This is a test for html output.
{strong}b calendar : {reset}Display current month using html. This is also a test for html output.
{strong}b : {reset}Alias for {strong}butterfly{reset} executable. Takes a comand in parameter or launch a butterfly server for one shot use (if outside butterfly).
{strong}b cat : {reset}A wrapper around cat allowing to display images as <img> instead of binary.
{strong}b open : {reset}Open a new terminal at specified location.
{strong}b session : {reset}Open or rattach a butterfly session. Multiplexing is supported.
{strong}b colors : {reset}Test the terminal colors (16, 256 and 16777216 colors)
{strong}b html : {reset}Output in html standard input.
For more butterfly programs check out: https://github.com/paradoxxxzero/butterfly-demos
{title}Styling butterfly:{reset}

View File

@@ -1,4 +0,0 @@
#!/usr/bin/env python
import sys
sys.stdout.write('\x1bP;HTML|<hr />\x1bP')
sys.stdout.flush()

View File

@@ -1,8 +1,18 @@
#!/usr/bin/env python
from butterfly.escapes import html
import argparse
import fileinput
import sys
parser = argparse.ArgumentParser(
description="Butterfly html converter.\n\n"
"Output in html standard input.\n"
"Example: $ echo \"<b>Bold</b>\" | b html",
formatter_class=argparse.RawTextHelpFormatter)
parser.parse_known_args()
with html():
for line in fileinput.input():
sys.stdout.write(line)

View File

@@ -1,12 +0,0 @@
#!/usr/bin/env python
import sys
w = sys.stdout.write
print('Image injection test')
injection = 'R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" onload="alert(\'pwnd\')" /><img src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='
w('\x1bP;IMAGE|image/gif;%s' % injection)
w('\x1bP')
print('HTML script execution test')
w('\x1bP;HTML|<img src="https://imgs.xkcd.com/comics/hack.png" onload="alert(\'pwnd\')" />')
w('\x1bP')