Giter Club home page Giter Club logo

termtunnel's Introduction

Termtunnel Termtunnel

Termtunnel is a tool that allows you to create a tunnel via multiple hops or fight against intranet isolation in a very simple way. As lrzsz can, termtunnel supports not only file transfer but also network proxy.

Quickstart

You must ensure that the termtunnel binary exists on both the local and remote first.

Please use termtunnel to open any locally terminal application such as ssh, bash, etc.

sh-3.2$ >> termtunnel ssh [email protected]

After running, the terminal output is the same as without the termtunnel prefix, and you can keep your normal usage habits.

sh-3.2$ >> termtunnel ssh [email protected]
root@host:~# echo loulou
loulou
root@host:~# uname -a
Linux 5.10.0-11-amd64 #1 SMP Debian 5.10.92-2 (2022-02-28) x86_64 GNU/Linux

When a tunnel needs to be established, just run command termtunnel -a on that remote host.

In the remote termtunnel console, you are allowed to download and upload files or create socks5 proxy.

For example, you can execute termtunnel ssh [email protected] locally, then start /tmp/termtunnel -a on the ssh host to enter the interactive console, and then you can type upload to upload a local file to remote or create a port forward. supported commands are listed in the REPL Command section.

sh-3.2$ >> termtunnel ssh [email protected]
root@host:~# /tmp/termsocks -a
termtunnel>> help

Install

  • Linux

  • MacOS

    • brew install beordle/tap/termtunnel
  • Windows

    • Provide prebuilt binaries to run. Download

Working principle

As you can imagine, we use the method of tapping the string to upload a message to the remote in terminal, and then get a message back from the remote, and in this way, we get a point-to-point transmission channel.

flowchart LR
    local(temrtunnel local) <--> ssh
    ssh <--> sshd
    sshd <--> bash
    bash <--> remote(termtunnel remote)

Termtunnel use pty to control local application, write data to its stdin, and read data from its stdout. and then the local application stdin and stdout be linked with remote termtunnel.

REPL Command

This documentation may be out of date, please refer to the output of the help command.

  • help:

    • view command help
  • local_listen

    • local_listen [local_host] [local_port] [remote_host] [remote_port]
    • when remote_port==0, the service listen on remote_port will be a socks5.
  • remote_listen

    • remote_listen [remote_host] [remote_port] [local_host] [local_port]
    • when remote_port==0, the service listen on remote_port will be a socks5.
  • download

    • download a file
  • upload

    • upload a file

Build from Source

Windows

Please use MSYS2 to compile under windows.

pacman -Syu libuv libuv-devel cmake make 
pacman -Syu openssh  # optional
cmake .
make

Other platform

cmake .
make

FAQ

  1. Can I make the whole process unattended? To reduce user intervention, you can try to use UNIX expect tool.
  2. How to use it with tmux? Out of the box. Designed with tmux in mind. But because of the implementation of tmux, the speed is very limited. If you want to improve the speed, you need to modify the source code and recompile tmux
  3. My office network can't connect to apt, and yum, etc, can this program help me? Yes, use remote_listen

License

This application is free software; you can redistribute it and/or modify it under the terms of the MIT license. See LICENSE file for details.

termtunnel's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.