PK!pyxtermjs/__init__.py__version__ = "0.1.0" PK!Ra; ; pyxtermjs/app.py#!/usr/bin/env python3 import argparse from flask import Flask, render_template from flask_socketio import SocketIO import pty import os import subprocess import select app = Flask(__name__, template_folder=".", static_folder=".", static_url_path="") app.config["SECRET_KEY"] = "secret!" app.config["fd"] = None app.config["child_pid"] = None socketio = SocketIO(app) def read_and_forward_pty_output(): max_read_bytes = 1024 * 20 while True: socketio.sleep(0.01) if app.config["fd"]: timeout_sec = 0 (data_ready, _, _) = select.select([app.config["fd"]], [], [], timeout_sec) if data_ready: output = os.read(app.config["fd"], max_read_bytes).decode() socketio.emit("pty-output", {"output": output}, namespace="/pty") @app.route("/") def index(): return render_template("index.html") @socketio.on("pty-input", namespace="/pty") def pty_input(data): """write to the child pty""" if app.config["fd"]: os.write(app.config["fd"], data["input"].encode()) @socketio.on("connect", namespace="/pty") def connect(): """new client connected""" if app.config["child_pid"]: # already started child process, don't start another return # create child process attached to a pty we can read from and write to (child_pid, fd) = pty.fork() if child_pid == 0: # this is the child process fork. # anything printed here will show up in the pty, including the output # of this subprocess subprocess.run(["bash"]) else: # this is the parent process fork. # store child fd and pid app.config["fd"] = fd app.config["child_pid"] = child_pid print("child pid is", child_pid) print( "starting background task to continously read and forward pty " "output to client" ) socketio.start_background_task(target=read_and_forward_pty_output) print("task started") def main(): parser = argparse.ArgumentParser() parser.add_argument("-p", "--port", default=5000) parser.add_argument("--debug", action="store_true") args = parser.parse_args() print(f"serving on http://127.0.0.1:{args.port}") socketio.run(app, debug=args.debug, port=args.port) if __name__ == "__main__": main() PK!Xkpyxtermjs/index.html pyxterm.js pyxterm.js    status: connecting...

built by Chad Smith GitHub

PK!HzY*0*pyxtermjs-0.2.0.dist-info/entry_points.txtN+I/N.,()*(I-* r3PK!++!pyxtermjs-0.2.0.dist-info/LICENSEMIT License Copyright (c) 2018 Chad Smith Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. PK!HX"%X\pyxtermjs-0.2.0.dist-info/WHEEL 1 0 нRZzq#|Puu~*mdBt#M-[Ѭ8$6_C-G^?DPK!Hk vn"pyxtermjs-0.2.0.dist-info/METADATATk0]ōnZ2cPžjlIdcw{%Y GyetFɁ*kȶ]}~r싛k3R2jC^R(,<;atZL.CHYaZm&MU<.۾iMVIx J~>=ڼdORyO*Y%qğ.Jcd @ufDk n_Y&H<;d@foNkd_ ӑ.MR}'߂Q=Z (:͕ Mx2)MSˍBۘ .HMb掋hd qww'΁р\C$]d]6)I(Se`xk3O[:W: 92$.m6q- ԓJ'67ߔjf.f/j msƫ#u*>l%[2޲s1\$_(oeAs<E^lo(D6mOPK!HUH:q pyxtermjs-0.2.0.dist-info/RECORD}Kw0}K<$Eȣ(TpB$Z߻Ǖ|3gЋtiJ(i*tQ% t ^y/z0NZȝF TYG8:nHQP8[49֎K&pςyRмJ4U~|XN, JODm:ڕn;b<ɒ*RN:1#d!PIS-7 DZکi( uy1m5tFP?s,gu&ٶ/?tcpʼL.jݳA|(2\