Skip to content

dannyphantoom/Terminal_env

Repository files navigation

Terminal Sharing Web App

This application allows you to access your terminal through a web interface from any device, anywhere in the world. The interface is a pure, full-screen terminal with no UI elements, providing an immersive terminal experience. All connected clients share the same terminal session with the host machine, so any changes made are instantly visible to everyone.

Features

  • Access your terminal from any web browser on any device with internet access
  • Full-screen terminal with no UI elements (just like a native terminal)
  • Share your terminal with others through a public URL
  • Synchronized shared terminal: all clients see the same terminal session
  • Changes made on the host machine are visible to all connected clients
  • Changes made by any client are visible to the host and all other clients
  • Multiple devices can connect to the same terminal session simultaneously
  • Persistent tmux session that survives client disconnections
  • Full terminal emulation with color support
  • Responsive design for desktop and mobile devices
  • Support for all terminal-based applications (vim, tmux, etc.)
  • Keyboard shortcuts for terminal management

Requirements

  • Python 3.6+
  • Flask
  • Flask-SocketIO
  • Eventlet (or other async mode for Flask-SocketIO)
  • Pyngrok (for creating tunnels to the public internet)
  • tmux (for shared terminal functionality)

Installation

The start script will automatically install the required packages.

Usage

Shared Terminal (Recommended)

  1. Start the shared terminal server with internet access:

    ./shared_start.sh --ngrok
    

    This will:

    • Create a persistent tmux session on the host machine
    • Start the web server with ngrok tunneling
    • Create a public URL that can be accessed from anywhere
  2. Access the shared terminal on the host machine directly:

    tmux attach-session -t shared_terminal
    
  3. Share the public URL (displayed in the console) with anyone who needs access

  4. All connected clients and the host will see the same terminal session

    • Changes made by the host are visible to all clients
    • Changes made by any client are visible to the host and all other clients

Local Network Only

  1. Start the server for local network access only:

    ./start.sh
    
  2. The server will run on http://0.0.0.0:5000 by default

    • Access this from another device on your network using your computer's IP address
    • For example: http://192.168.1.100:5000
  3. To find your IP address:

    hostname -I
    

Internet Access from Any Device

  1. Start the server with ngrok tunneling enabled:

    ./start.sh --ngrok
    

    or

    ./shared_start.sh --ngrok  # for shared terminal functionality
    
  2. The server will create a public URL that can be accessed from anywhere

    • The URL will be displayed in the console
    • Share this URL with anyone who needs access to your terminal
  3. For better performance and reliability, use an ngrok auth token:

    ./shared_start.sh --ngrok --ngrok-token YOUR_TOKEN
    
    • Get a free auth token by signing up at ngrok.com

Using the Terminal Interface

The web interface is a pure terminal experience with no visible UI elements:

  • The terminal automatically connects and initializes on page load
  • The terminal fills the entire screen for an immersive experience
  • Use keyboard shortcuts to manage your session:
    • Ctrl+Alt+T: Create a new terminal session
    • Ctrl+Alt+D: Disconnect current terminal session
  • The terminal automatically resizes when you resize your browser window

Using tmux Commands in the Shared Session

When using the shared terminal, you can use these tmux commands:

  • Ctrl+b d: Detach from the session (on host machine)
  • Ctrl+b c: Create a new window
  • Ctrl+b n: Go to next window
  • Ctrl+b p: Go to previous window
  • Ctrl+b ": Split horizontally
  • Ctrl+b %: Split vertically

Advanced Options

  • Run in background mode (useful for servers):

    ./start.sh --ngrok --background
    
  • Specify a different port:

    ./start.sh --port 8080
    
  • Use a different ngrok region for better performance:

    ./start.sh --ngrok --ngrok-region eu
    
    • Available regions: us, eu, ap, au, sa, jp, in

Security Considerations

  • When using the ngrok tunnel, your terminal is accessible to anyone who has the URL
  • Consider using an ngrok account with a custom subdomain for consistency
  • For sensitive environments, implement additional authentication layers
  • Be cautious about the commands you run when sharing your terminal

Customization

  • Edit templates/index.html to modify the web interface
  • Edit app.py to change server settings or behavior

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published